repo_name
stringclasses 10
values | file_path
stringlengths 29
222
| content
stringlengths 24
926k
| extention
stringclasses 5
values |
---|---|---|---|
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/strvararg.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/strvararg.h
// Purpose: macros for implementing type-safe vararg passing of strings
// Author: Vaclav Slavik
// Created: 2007-02-19
// Copyright: (c) 2007 REA Elektronik GmbH
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STRVARARG_H_
#define _WX_STRVARARG_H_
#include "wx/platform.h"
#include "wx/cpp.h"
#include "wx/chartype.h"
#include "wx/strconv.h"
#include "wx/buffer.h"
#include "wx/unichar.h"
#if defined(HAVE_TYPE_TRAITS)
#include <type_traits>
#elif defined(HAVE_TR1_TYPE_TRAITS)
#ifdef __VISUALC__
#include <type_traits>
#else
#include <tr1/type_traits>
#endif
#endif
class WXDLLIMPEXP_FWD_BASE wxCStrData;
class WXDLLIMPEXP_FWD_BASE wxString;
// ----------------------------------------------------------------------------
// WX_DEFINE_VARARG_FUNC* macros
// ----------------------------------------------------------------------------
// This macro is used to implement type-safe wrappers for variadic functions
// that accept strings as arguments. This makes it possible to pass char*,
// wchar_t* or even wxString (as opposed to having to use wxString::c_str())
// to e.g. wxPrintf().
//
// This is done by defining a set of N template function taking 1..N arguments
// (currently, N is set to 30 in this header). These functions are just thin
// wrappers around another variadic function ('impl' or 'implUtf8' arguments,
// see below) and the only thing the wrapper does is that it normalizes the
// arguments passed in so that they are of the type expected by variadic
// functions taking string arguments, i.e., char* or wchar_t*, depending on the
// build:
// * char* in the current locale's charset in ANSI build
// * char* with UTF-8 encoding if wxUSE_UNICODE_UTF8 and the app is running
// under an UTF-8 locale
// * wchar_t* if wxUSE_UNICODE_WCHAR or if wxUSE_UNICODE_UTF8 and the current
// locale is not UTF-8
//
// Note that wxFormatString *must* be used for the format parameter of these
// functions, otherwise the implementation won't work correctly. Furthermore,
// it must be passed by value, not reference, because it's modified by the
// vararg templates internally.
//
// Parameters:
// [ there are examples in square brackets showing values of the parameters
// for the wxFprintf() wrapper for fprintf() function with the following
// prototype:
// int wxFprintf(FILE *stream, const wxString& format, ...); ]
//
// rettype Functions' return type [int]
// name Name of the function [fprintf]
// numfixed The number of leading "fixed" (i.e., not variadic)
// arguments of the function (e.g. "stream" and "format"
// arguments of fprintf()); their type is _not_ converted
// using wxArgNormalizer<T>, unlike the rest of
// the function's arguments [2]
// fixed List of types of the leading "fixed" arguments, in
// parenthesis [(FILE*,const wxString&)]
// impl Name of the variadic function that implements 'name' for
// the native strings representation (wchar_t* if
// wxUSE_UNICODE_WCHAR or wxUSE_UNICODE_UTF8 when running under
// non-UTF8 locale, char* in ANSI build) [wxCrt_Fprintf]
// implUtf8 Like 'impl', but for the UTF-8 char* version to be used
// if wxUSE_UNICODE_UTF8 and running under UTF-8 locale
// (ignored otherwise) [fprintf]
//
#define WX_DEFINE_VARARG_FUNC(rettype, name, numfixed, fixed, impl, implUtf8) \
_WX_VARARG_DEFINE_FUNC_N0(rettype, name, impl, implUtf8, numfixed, fixed) \
WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, numfixed, fixed, impl, implUtf8)
// ditto, but without the version with 0 template/vararg arguments
#define WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, \
numfixed, fixed, impl, implUtf8) \
_WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
_WX_VARARG_DEFINE_FUNC, \
rettype, name, impl, implUtf8, numfixed, fixed)
// Like WX_DEFINE_VARARG_FUNC, but for variadic functions that don't return
// a value.
#define WX_DEFINE_VARARG_FUNC_VOID(name, numfixed, fixed, impl, implUtf8) \
_WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed) \
_WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
_WX_VARARG_DEFINE_FUNC_VOID, \
void, name, impl, implUtf8, numfixed, fixed)
// Like WX_DEFINE_VARARG_FUNC_VOID, but instead of wrapping an implementation
// function, does nothing in defined functions' bodies.
//
// Used to implement wxLogXXX functions if wxUSE_LOG=0.
#define WX_DEFINE_VARARG_FUNC_NOP(name, numfixed, fixed) \
_WX_VARARG_DEFINE_FUNC_NOP_N0(name, numfixed, fixed) \
_WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
_WX_VARARG_DEFINE_FUNC_NOP, \
void, name, dummy, dummy, numfixed, fixed)
// Like WX_DEFINE_VARARG_FUNC_CTOR, but for defining template constructors
#define WX_DEFINE_VARARG_FUNC_CTOR(name, numfixed, fixed, impl, implUtf8) \
_WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed) \
_WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
_WX_VARARG_DEFINE_FUNC_CTOR, \
void, name, impl, implUtf8, numfixed, fixed)
// ----------------------------------------------------------------------------
// wxFormatString
// ----------------------------------------------------------------------------
// This class must be used for format string argument of the functions
// defined using WX_DEFINE_VARARG_FUNC_* macros. It converts the string to
// char* or wchar_t* for passing to implementation function efficiently (i.e.
// without keeping the converted string in memory for longer than necessary,
// like c_str()). It also converts format string to the correct form that
// accounts for string changes done by wxArgNormalizer<>
//
// Note that this class can _only_ be used for function arguments!
class WXDLLIMPEXP_BASE wxFormatString
{
public:
wxFormatString(const char *str)
: m_char(wxScopedCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {}
wxFormatString(const wchar_t *str)
: m_wchar(wxScopedWCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {}
wxFormatString(const wxString& str)
: m_str(&str), m_cstr(NULL) {}
wxFormatString(const wxCStrData& str)
: m_str(NULL), m_cstr(&str) {}
wxFormatString(const wxScopedCharBuffer& str)
: m_char(str), m_str(NULL), m_cstr(NULL) {}
wxFormatString(const wxScopedWCharBuffer& str)
: m_wchar(str), m_str(NULL), m_cstr(NULL) {}
// Possible argument types. These are or-combinable for wxASSERT_ARG_TYPE
// convenience. Some of the values are or-combined with another value, this
// expresses "supertypes" for use with wxASSERT_ARG_TYPE masks. For example,
// a char* string is also a pointer and an integer is also a char.
enum ArgumentType
{
Arg_Unused = 0, // not used at all; the value of 0 is chosen to
// conveniently pass wxASSERT_ARG_TYPE's check
Arg_Char = 0x0001, // character as char %c
Arg_Pointer = 0x0002, // %p
Arg_String = 0x0004 | Arg_Pointer, // any form of string (%s and %p too)
Arg_Int = 0x0008 | Arg_Char, // (ints can be used with %c)
#if SIZEOF_INT == SIZEOF_LONG
Arg_LongInt = Arg_Int,
#else
Arg_LongInt = 0x0010,
#endif
#if defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == SIZEOF_LONG
Arg_LongLongInt = Arg_LongInt,
#elif defined(wxLongLong_t)
Arg_LongLongInt = 0x0020,
#endif
Arg_Double = 0x0040,
Arg_LongDouble = 0x0080,
#if defined(wxSIZE_T_IS_UINT)
Arg_Size_t = Arg_Int,
#elif defined(wxSIZE_T_IS_ULONG)
Arg_Size_t = Arg_LongInt,
#elif defined(SIZEOF_LONG_LONG) && SIZEOF_SIZE_T == SIZEOF_LONG_LONG
Arg_Size_t = Arg_LongLongInt,
#else
Arg_Size_t = 0x0100,
#endif
Arg_IntPtr = 0x0200, // %n -- store # of chars written
Arg_ShortIntPtr = 0x0400,
Arg_LongIntPtr = 0x0800,
Arg_Unknown = 0x8000 // unrecognized specifier (likely error)
};
// returns the type of format specifier for n-th variadic argument (this is
// not necessarily n-th format specifier if positional specifiers are used);
// called by wxArgNormalizer<> specializations to get information about
// n-th variadic argument desired representation
ArgumentType GetArgumentType(unsigned n) const;
// returns the value passed to ctor, only converted to wxString, similarly
// to other InputAsXXX() methods
wxString InputAsString() const;
#if !wxUSE_UNICODE_WCHAR
operator const char*() const
{ return const_cast<wxFormatString*>(this)->AsChar(); }
private:
// InputAsChar() returns the value passed to ctor, only converted
// to char, while AsChar() takes the string returned by InputAsChar()
// and does format string conversion on it as well (and similarly for
// ..AsWChar() below)
const char* InputAsChar();
const char* AsChar();
wxScopedCharBuffer m_convertedChar;
#endif // !wxUSE_UNICODE_WCHAR
#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
public:
operator const wchar_t*() const
{ return const_cast<wxFormatString*>(this)->AsWChar(); }
private:
const wchar_t* InputAsWChar();
const wchar_t* AsWChar();
wxScopedWCharBuffer m_convertedWChar;
#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
private:
wxScopedCharBuffer m_char;
wxScopedWCharBuffer m_wchar;
// NB: we can use a pointer here, because wxFormatString is only used
// as function argument, so it has shorter life than the string
// passed to the ctor
const wxString * const m_str;
const wxCStrData * const m_cstr;
wxDECLARE_NO_ASSIGN_CLASS(wxFormatString);
};
// these two helper classes are used to find wxFormatString argument among fixed
// arguments passed to a vararg template
struct wxFormatStringArgument
{
wxFormatStringArgument(const wxFormatString *s = NULL) : m_str(s) {}
const wxFormatString *m_str;
// overriding this operator allows us to reuse _WX_VARARG_JOIN macro
wxFormatStringArgument operator,(const wxFormatStringArgument& a) const
{
wxASSERT_MSG( m_str == NULL || a.m_str == NULL,
"can't have two format strings in vararg function" );
return wxFormatStringArgument(m_str ? m_str : a.m_str);
}
operator const wxFormatString*() const { return m_str; }
};
template<typename T>
struct wxFormatStringArgumentFinder
{
static wxFormatStringArgument find(T)
{
// by default, arguments are not format strings, so return "not found"
return wxFormatStringArgument();
}
};
template<>
struct wxFormatStringArgumentFinder<const wxFormatString&>
{
static wxFormatStringArgument find(const wxFormatString& arg)
{ return wxFormatStringArgument(&arg); }
};
template<>
struct wxFormatStringArgumentFinder<wxFormatString>
: public wxFormatStringArgumentFinder<const wxFormatString&> {};
// avoid passing big objects by value to wxFormatStringArgumentFinder::find()
// (and especially wx[W]CharBuffer with its auto_ptr<> style semantics!):
template<>
struct wxFormatStringArgumentFinder<wxString>
: public wxFormatStringArgumentFinder<const wxString&> {};
template<>
struct wxFormatStringArgumentFinder<wxScopedCharBuffer>
: public wxFormatStringArgumentFinder<const wxScopedCharBuffer&> {};
template<>
struct wxFormatStringArgumentFinder<wxScopedWCharBuffer>
: public wxFormatStringArgumentFinder<const wxScopedWCharBuffer&> {};
template<>
struct wxFormatStringArgumentFinder<wxCharBuffer>
: public wxFormatStringArgumentFinder<const wxCharBuffer&> {};
template<>
struct wxFormatStringArgumentFinder<wxWCharBuffer>
: public wxFormatStringArgumentFinder<const wxWCharBuffer&> {};
// ----------------------------------------------------------------------------
// wxArgNormalizer*<T> converters
// ----------------------------------------------------------------------------
#if wxDEBUG_LEVEL
// Check that the format specifier for index-th argument in 'fmt' has
// the correct type (one of wxFormatString::Arg_XXX or-combination in
// 'expected_mask').
#define wxASSERT_ARG_TYPE(fmt, index, expected_mask) \
wxSTATEMENT_MACRO_BEGIN \
if ( !fmt ) \
break; \
const int argtype = fmt->GetArgumentType(index); \
wxASSERT_MSG( (argtype & (expected_mask)) == argtype, \
"format specifier doesn't match argument type" ); \
wxSTATEMENT_MACRO_END
#else
// Just define it to suppress "unused parameter" warnings for the
// parameters which we don't use otherwise
#define wxASSERT_ARG_TYPE(fmt, index, expected_mask) \
wxUnusedVar(fmt); \
wxUnusedVar(index)
#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL
#if defined(HAVE_TYPE_TRAITS) || defined(HAVE_TR1_TYPE_TRAITS)
// Note: this type is misnamed, so that the error message is easier to
// understand (no error happens for enums, because the IsEnum=true case is
// specialized).
template<bool IsEnum>
struct wxFormatStringSpecifierNonPodType {};
template<>
struct wxFormatStringSpecifierNonPodType<true>
{
enum { value = wxFormatString::Arg_Int };
};
template<typename T>
struct wxFormatStringSpecifier
{
#ifdef HAVE_TYPE_TRAITS
typedef std::is_enum<T> is_enum;
#elif defined HAVE_TR1_TYPE_TRAITS
typedef std::tr1::is_enum<T> is_enum;
#endif
enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
};
#else // !HAVE_(TR1_)TYPE_TRAITS
template<typename T>
struct wxFormatStringSpecifier
{
// We can't detect enums without is_enum, so the only thing we can
// do is to accept unknown types. However, the only acceptable unknown
// types still are enums, which are promoted to ints, so return Arg_Int
// here. This will at least catch passing of non-POD types through ... at
// runtime.
//
// Furthermore, if the compiler doesn't have partial template
// specialization, we didn't cover pointers either.
enum { value = wxFormatString::Arg_Int };
};
#endif // HAVE_TR1_TYPE_TRAITS/!HAVE_TR1_TYPE_TRAITS
template<typename T>
struct wxFormatStringSpecifier<T*>
{
enum { value = wxFormatString::Arg_Pointer };
};
template<typename T>
struct wxFormatStringSpecifier<const T*>
{
enum { value = wxFormatString::Arg_Pointer };
};
#define wxFORMAT_STRING_SPECIFIER(T, arg) \
template<> struct wxFormatStringSpecifier<T> \
{ \
enum { value = arg }; \
};
wxFORMAT_STRING_SPECIFIER(bool, wxFormatString::Arg_Int)
wxFORMAT_STRING_SPECIFIER(int, wxFormatString::Arg_Int)
wxFORMAT_STRING_SPECIFIER(unsigned int, wxFormatString::Arg_Int)
wxFORMAT_STRING_SPECIFIER(short int, wxFormatString::Arg_Int)
wxFORMAT_STRING_SPECIFIER(short unsigned int, wxFormatString::Arg_Int)
wxFORMAT_STRING_SPECIFIER(long int, wxFormatString::Arg_LongInt)
wxFORMAT_STRING_SPECIFIER(long unsigned int, wxFormatString::Arg_LongInt)
#ifdef wxLongLong_t
wxFORMAT_STRING_SPECIFIER(wxLongLong_t, wxFormatString::Arg_LongLongInt)
wxFORMAT_STRING_SPECIFIER(wxULongLong_t, wxFormatString::Arg_LongLongInt)
#endif
wxFORMAT_STRING_SPECIFIER(float, wxFormatString::Arg_Double)
wxFORMAT_STRING_SPECIFIER(double, wxFormatString::Arg_Double)
wxFORMAT_STRING_SPECIFIER(long double, wxFormatString::Arg_LongDouble)
#if wxWCHAR_T_IS_REAL_TYPE
wxFORMAT_STRING_SPECIFIER(wchar_t, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
#endif
#if !wxUSE_UNICODE
wxFORMAT_STRING_SPECIFIER(char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
wxFORMAT_STRING_SPECIFIER(signed char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
wxFORMAT_STRING_SPECIFIER(unsigned char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
#endif
wxFORMAT_STRING_SPECIFIER(char*, wxFormatString::Arg_String)
wxFORMAT_STRING_SPECIFIER(unsigned char*, wxFormatString::Arg_String)
wxFORMAT_STRING_SPECIFIER(signed char*, wxFormatString::Arg_String)
wxFORMAT_STRING_SPECIFIER(const char*, wxFormatString::Arg_String)
wxFORMAT_STRING_SPECIFIER(const unsigned char*, wxFormatString::Arg_String)
wxFORMAT_STRING_SPECIFIER(const signed char*, wxFormatString::Arg_String)
wxFORMAT_STRING_SPECIFIER(wchar_t*, wxFormatString::Arg_String)
wxFORMAT_STRING_SPECIFIER(const wchar_t*, wxFormatString::Arg_String)
wxFORMAT_STRING_SPECIFIER(int*, wxFormatString::Arg_IntPtr | wxFormatString::Arg_Pointer)
wxFORMAT_STRING_SPECIFIER(short int*, wxFormatString::Arg_ShortIntPtr | wxFormatString::Arg_Pointer)
wxFORMAT_STRING_SPECIFIER(long int*, wxFormatString::Arg_LongIntPtr | wxFormatString::Arg_Pointer)
#undef wxFORMAT_STRING_SPECIFIER
// Converts an argument passed to wxPrint etc. into standard form expected,
// by wxXXX functions, e.g. all strings (wxString, char*, wchar_t*) are
// converted into wchar_t* or char* depending on the build.
template<typename T>
struct wxArgNormalizer
{
// Ctor. 'value' is the value passed as variadic argument, 'fmt' is pointer
// to printf-like format string or NULL if the variadic function doesn't
// use format string and 'index' is index of 'value' in variadic arguments
// list (starting at 1)
wxArgNormalizer(T value,
const wxFormatString *fmt, unsigned index)
: m_value(value)
{
wxASSERT_ARG_TYPE( fmt, index, wxFormatStringSpecifier<T>::value );
}
// Returns the value in a form that can be safely passed to real vararg
// functions. In case of strings, this is char* in ANSI build and wchar_t*
// in Unicode build.
T get() const { return m_value; }
T m_value;
};
// normalizer for passing arguments to functions working with wchar_t* (and
// until ANSI build is removed, char* in ANSI build as well - FIXME-UTF8)
// string representation
#if !wxUSE_UTF8_LOCALE_ONLY
template<typename T>
struct wxArgNormalizerWchar : public wxArgNormalizer<T>
{
wxArgNormalizerWchar(T value,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizer<T>(value, fmt, index) {}
};
#endif // !wxUSE_UTF8_LOCALE_ONLY
// normalizer for passing arguments to functions working with UTF-8 encoded
// char* strings
#if wxUSE_UNICODE_UTF8
template<typename T>
struct wxArgNormalizerUtf8 : public wxArgNormalizer<T>
{
wxArgNormalizerUtf8(T value,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizer<T>(value, fmt, index) {}
};
#define wxArgNormalizerNative wxArgNormalizerUtf8
#else // wxUSE_UNICODE_WCHAR
#define wxArgNormalizerNative wxArgNormalizerWchar
#endif // wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_UTF8
// special cases for converting strings:
// base class for wxArgNormalizer<T> specializations that need to do conversion;
// CharType is either wxStringCharType or wchar_t in UTF-8 build when wrapping
// widechar CRT function
template<typename CharType>
struct wxArgNormalizerWithBuffer
{
typedef wxScopedCharTypeBuffer<CharType> CharBuffer;
wxArgNormalizerWithBuffer() {}
wxArgNormalizerWithBuffer(const CharBuffer& buf,
const wxFormatString *fmt,
unsigned index)
: m_value(buf)
{
wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String );
}
const CharType *get() const { return m_value; }
CharBuffer m_value;
};
// string objects:
template<>
struct WXDLLIMPEXP_BASE wxArgNormalizerNative<const wxString&>
{
wxArgNormalizerNative(const wxString& s,
const wxFormatString *fmt,
unsigned index)
: m_value(s)
{
wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String );
}
const wxStringCharType *get() const;
const wxString& m_value;
};
// c_str() values:
template<>
struct WXDLLIMPEXP_BASE wxArgNormalizerNative<const wxCStrData&>
{
wxArgNormalizerNative(const wxCStrData& value,
const wxFormatString *fmt,
unsigned index)
: m_value(value)
{
wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String );
}
const wxStringCharType *get() const;
const wxCStrData& m_value;
};
// wxString/wxCStrData conversion to wchar_t* value
#if wxUSE_UNICODE_UTF8 && !wxUSE_UTF8_LOCALE_ONLY
template<>
struct WXDLLIMPEXP_BASE wxArgNormalizerWchar<const wxString&>
: public wxArgNormalizerWithBuffer<wchar_t>
{
wxArgNormalizerWchar(const wxString& s,
const wxFormatString *fmt, unsigned index);
};
template<>
struct WXDLLIMPEXP_BASE wxArgNormalizerWchar<const wxCStrData&>
: public wxArgNormalizerWithBuffer<wchar_t>
{
wxArgNormalizerWchar(const wxCStrData& s,
const wxFormatString *fmt, unsigned index);
};
#endif // wxUSE_UNICODE_UTF8 && !wxUSE_UTF8_LOCALE_ONLY
// C string pointers of the wrong type (wchar_t* for ANSI or UTF8 build,
// char* for wchar_t Unicode build or UTF8):
#if wxUSE_UNICODE_WCHAR
template<>
struct wxArgNormalizerWchar<const char*>
: public wxArgNormalizerWithBuffer<wchar_t>
{
wxArgNormalizerWchar(const char* s,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {}
};
#elif wxUSE_UNICODE_UTF8
template<>
struct wxArgNormalizerUtf8<const wchar_t*>
: public wxArgNormalizerWithBuffer<char>
{
wxArgNormalizerUtf8(const wchar_t* s,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerWithBuffer<char>(wxConvUTF8.cWC2MB(s), fmt, index) {}
};
template<>
struct wxArgNormalizerUtf8<const char*>
: public wxArgNormalizerWithBuffer<char>
{
wxArgNormalizerUtf8(const char* s,
const wxFormatString *fmt,
unsigned index)
{
wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String );
if ( wxLocaleIsUtf8 )
{
m_value = wxScopedCharBuffer::CreateNonOwned(s);
}
else
{
// convert to widechar string first:
wxScopedWCharBuffer buf(wxConvLibc.cMB2WC(s));
// then to UTF-8:
if ( buf )
m_value = wxConvUTF8.cWC2MB(buf);
}
}
};
// UTF-8 build needs conversion to wchar_t* too:
#if !wxUSE_UTF8_LOCALE_ONLY
template<>
struct wxArgNormalizerWchar<const char*>
: public wxArgNormalizerWithBuffer<wchar_t>
{
wxArgNormalizerWchar(const char* s,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {}
};
#endif // !wxUSE_UTF8_LOCALE_ONLY
#else // ANSI - FIXME-UTF8
template<>
struct wxArgNormalizerWchar<const wchar_t*>
: public wxArgNormalizerWithBuffer<char>
{
wxArgNormalizerWchar(const wchar_t* s,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerWithBuffer<char>(wxConvLibc.cWC2MB(s), fmt, index) {}
};
#endif // wxUSE_UNICODE_WCHAR/wxUSE_UNICODE_UTF8/ANSI
// this macro is used to implement specialization that are exactly same as
// some other specialization, i.e. to "forward" the implementation (e.g. for
// T=wxString and T=const wxString&). Note that the ctor takes BaseT argument,
// not T!
#if wxUSE_UNICODE_UTF8
#if wxUSE_UTF8_LOCALE_ONLY
#define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \
_WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerUtf8, T, BaseT)
#else // possibly non-UTF8 locales
#define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \
_WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerWchar, T, BaseT); \
_WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerUtf8, T, BaseT)
#endif
#else // wxUSE_UNICODE_WCHAR
#define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \
_WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerWchar, T, BaseT)
#endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR
#define _WX_ARG_NORMALIZER_FORWARD_IMPL(Normalizer, T, BaseT) \
template<> \
struct Normalizer<T> : public Normalizer<BaseT> \
{ \
Normalizer(BaseT value, \
const wxFormatString *fmt, unsigned index) \
: Normalizer<BaseT>(value, fmt, index) {} \
}
// non-reference versions of specializations for string objects
WX_ARG_NORMALIZER_FORWARD(wxString, const wxString&);
WX_ARG_NORMALIZER_FORWARD(wxCStrData, const wxCStrData&);
// versions for passing non-const pointers:
WX_ARG_NORMALIZER_FORWARD(char*, const char*);
WX_ARG_NORMALIZER_FORWARD(wchar_t*, const wchar_t*);
// versions for passing wx[W]CharBuffer:
WX_ARG_NORMALIZER_FORWARD(wxScopedCharBuffer, const char*);
WX_ARG_NORMALIZER_FORWARD(const wxScopedCharBuffer&, const char*);
WX_ARG_NORMALIZER_FORWARD(wxScopedWCharBuffer, const wchar_t*);
WX_ARG_NORMALIZER_FORWARD(const wxScopedWCharBuffer&, const wchar_t*);
WX_ARG_NORMALIZER_FORWARD(wxCharBuffer, const char*);
WX_ARG_NORMALIZER_FORWARD(const wxCharBuffer&, const char*);
WX_ARG_NORMALIZER_FORWARD(wxWCharBuffer, const wchar_t*);
WX_ARG_NORMALIZER_FORWARD(const wxWCharBuffer&, const wchar_t*);
// versions for std::[w]string:
#if wxUSE_STD_STRING
#include "wx/stringimpl.h"
#if !wxUSE_UTF8_LOCALE_ONLY
template<>
struct wxArgNormalizerWchar<const std::string&>
: public wxArgNormalizerWchar<const char*>
{
wxArgNormalizerWchar(const std::string& s,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerWchar<const char*>(s.c_str(), fmt, index) {}
};
template<>
struct wxArgNormalizerWchar<const wxStdWideString&>
: public wxArgNormalizerWchar<const wchar_t*>
{
wxArgNormalizerWchar(const wxStdWideString& s,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerWchar<const wchar_t*>(s.c_str(), fmt, index) {}
};
#endif // !wxUSE_UTF8_LOCALE_ONLY
#if wxUSE_UNICODE_UTF8
template<>
struct wxArgNormalizerUtf8<const std::string&>
: public wxArgNormalizerUtf8<const char*>
{
wxArgNormalizerUtf8(const std::string& s,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerUtf8<const char*>(s.c_str(), fmt, index) {}
};
template<>
struct wxArgNormalizerUtf8<const wxStdWideString&>
: public wxArgNormalizerUtf8<const wchar_t*>
{
wxArgNormalizerUtf8(const wxStdWideString& s,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerUtf8<const wchar_t*>(s.c_str(), fmt, index) {}
};
#endif // wxUSE_UNICODE_UTF8
WX_ARG_NORMALIZER_FORWARD(std::string, const std::string&);
WX_ARG_NORMALIZER_FORWARD(wxStdWideString, const wxStdWideString&);
#endif // wxUSE_STD_STRING
// versions for wxUniChar, wxUniCharRef:
// (this is same for UTF-8 and Wchar builds, we just convert to wchar_t)
template<>
struct wxArgNormalizer<const wxUniChar&> : public wxArgNormalizer<wchar_t>
{
wxArgNormalizer(const wxUniChar& s,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizer<wchar_t>(wx_truncate_cast(wchar_t, s.GetValue()), fmt, index) {}
};
// for wchar_t, default handler does the right thing
// char has to be treated differently in Unicode builds: a char argument may
// be used either for a character value (which should be converted into
// wxUniChar) or as an integer value (which should be left as-is). We take
// advantage of the fact that both char and wchar_t are converted into int
// in variadic arguments here.
#if wxUSE_UNICODE
template<typename T>
struct wxArgNormalizerNarrowChar
{
wxArgNormalizerNarrowChar(T value,
const wxFormatString *fmt, unsigned index)
{
wxASSERT_ARG_TYPE( fmt, index,
wxFormatString::Arg_Char | wxFormatString::Arg_Int );
// FIXME-UTF8: which one is better default in absence of fmt string
// (i.e. when used like e.g. Foo("foo", "bar", 'c', NULL)?
if ( !fmt || fmt->GetArgumentType(index) == wxFormatString::Arg_Char )
m_value = wx_truncate_cast(T, wxUniChar(value).GetValue());
else
m_value = value;
}
int get() const { return m_value; }
T m_value;
};
template<>
struct wxArgNormalizer<char> : public wxArgNormalizerNarrowChar<char>
{
wxArgNormalizer(char value,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerNarrowChar<char>(value, fmt, index) {}
};
template<>
struct wxArgNormalizer<unsigned char>
: public wxArgNormalizerNarrowChar<unsigned char>
{
wxArgNormalizer(unsigned char value,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerNarrowChar<unsigned char>(value, fmt, index) {}
};
template<>
struct wxArgNormalizer<signed char>
: public wxArgNormalizerNarrowChar<signed char>
{
wxArgNormalizer(signed char value,
const wxFormatString *fmt, unsigned index)
: wxArgNormalizerNarrowChar<signed char>(value, fmt, index) {}
};
#endif // wxUSE_UNICODE
// convert references:
WX_ARG_NORMALIZER_FORWARD(wxUniChar, const wxUniChar&);
WX_ARG_NORMALIZER_FORWARD(const wxUniCharRef&, const wxUniChar&);
WX_ARG_NORMALIZER_FORWARD(wxUniCharRef, const wxUniChar&);
WX_ARG_NORMALIZER_FORWARD(const wchar_t&, wchar_t);
WX_ARG_NORMALIZER_FORWARD(const char&, char);
WX_ARG_NORMALIZER_FORWARD(const unsigned char&, unsigned char);
WX_ARG_NORMALIZER_FORWARD(const signed char&, signed char);
#undef WX_ARG_NORMALIZER_FORWARD
#undef _WX_ARG_NORMALIZER_FORWARD_IMPL
// NB: Don't #undef wxASSERT_ARG_TYPE here as it's also used in wx/longlong.h.
// ----------------------------------------------------------------------------
// WX_VA_ARG_STRING
// ----------------------------------------------------------------------------
// Replacement for va_arg() for use with strings in functions that accept
// strings normalized by wxArgNormalizer<T>:
struct WXDLLIMPEXP_BASE wxArgNormalizedString
{
wxArgNormalizedString(const void* ptr) : m_ptr(ptr) {}
// returns true if non-NULL string was passed in
bool IsValid() const { return m_ptr != NULL; }
operator bool() const { return IsValid(); }
// extracts the string, returns empty string if NULL was passed in
wxString GetString() const;
operator wxString() const;
private:
const void *m_ptr;
};
#define WX_VA_ARG_STRING(ap) wxArgNormalizedString(va_arg(ap, const void*))
// ----------------------------------------------------------------------------
// implementation of the WX_DEFINE_VARARG_* macros
// ----------------------------------------------------------------------------
// NB: The vararg emulation code is limited to 30 variadic and 4 fixed
// arguments at the moment.
// If you need more variadic arguments, you need to
// 1) increase the value of _WX_VARARG_MAX_ARGS
// 2) add _WX_VARARG_JOIN_* and _WX_VARARG_ITER_* up to the new
// _WX_VARARG_MAX_ARGS value to the lists below
// If you need more fixed arguments, you need to
// 1) increase the value of _WX_VARARG_MAX_FIXED_ARGS
// 2) add _WX_VARARG_FIXED_EXPAND_* and _WX_VARARG_FIXED_UNUSED_EXPAND_*
// macros below
#define _WX_VARARG_MAX_ARGS 30
#define _WX_VARARG_MAX_FIXED_ARGS 4
#define _WX_VARARG_JOIN_1(m) m(1)
#define _WX_VARARG_JOIN_2(m) _WX_VARARG_JOIN_1(m), m(2)
#define _WX_VARARG_JOIN_3(m) _WX_VARARG_JOIN_2(m), m(3)
#define _WX_VARARG_JOIN_4(m) _WX_VARARG_JOIN_3(m), m(4)
#define _WX_VARARG_JOIN_5(m) _WX_VARARG_JOIN_4(m), m(5)
#define _WX_VARARG_JOIN_6(m) _WX_VARARG_JOIN_5(m), m(6)
#define _WX_VARARG_JOIN_7(m) _WX_VARARG_JOIN_6(m), m(7)
#define _WX_VARARG_JOIN_8(m) _WX_VARARG_JOIN_7(m), m(8)
#define _WX_VARARG_JOIN_9(m) _WX_VARARG_JOIN_8(m), m(9)
#define _WX_VARARG_JOIN_10(m) _WX_VARARG_JOIN_9(m), m(10)
#define _WX_VARARG_JOIN_11(m) _WX_VARARG_JOIN_10(m), m(11)
#define _WX_VARARG_JOIN_12(m) _WX_VARARG_JOIN_11(m), m(12)
#define _WX_VARARG_JOIN_13(m) _WX_VARARG_JOIN_12(m), m(13)
#define _WX_VARARG_JOIN_14(m) _WX_VARARG_JOIN_13(m), m(14)
#define _WX_VARARG_JOIN_15(m) _WX_VARARG_JOIN_14(m), m(15)
#define _WX_VARARG_JOIN_16(m) _WX_VARARG_JOIN_15(m), m(16)
#define _WX_VARARG_JOIN_17(m) _WX_VARARG_JOIN_16(m), m(17)
#define _WX_VARARG_JOIN_18(m) _WX_VARARG_JOIN_17(m), m(18)
#define _WX_VARARG_JOIN_19(m) _WX_VARARG_JOIN_18(m), m(19)
#define _WX_VARARG_JOIN_20(m) _WX_VARARG_JOIN_19(m), m(20)
#define _WX_VARARG_JOIN_21(m) _WX_VARARG_JOIN_20(m), m(21)
#define _WX_VARARG_JOIN_22(m) _WX_VARARG_JOIN_21(m), m(22)
#define _WX_VARARG_JOIN_23(m) _WX_VARARG_JOIN_22(m), m(23)
#define _WX_VARARG_JOIN_24(m) _WX_VARARG_JOIN_23(m), m(24)
#define _WX_VARARG_JOIN_25(m) _WX_VARARG_JOIN_24(m), m(25)
#define _WX_VARARG_JOIN_26(m) _WX_VARARG_JOIN_25(m), m(26)
#define _WX_VARARG_JOIN_27(m) _WX_VARARG_JOIN_26(m), m(27)
#define _WX_VARARG_JOIN_28(m) _WX_VARARG_JOIN_27(m), m(28)
#define _WX_VARARG_JOIN_29(m) _WX_VARARG_JOIN_28(m), m(29)
#define _WX_VARARG_JOIN_30(m) _WX_VARARG_JOIN_29(m), m(30)
#define _WX_VARARG_ITER_1(m,a,b,c,d,e,f) m(1,a,b,c,d,e,f)
#define _WX_VARARG_ITER_2(m,a,b,c,d,e,f) _WX_VARARG_ITER_1(m,a,b,c,d,e,f) m(2,a,b,c,d,e,f)
#define _WX_VARARG_ITER_3(m,a,b,c,d,e,f) _WX_VARARG_ITER_2(m,a,b,c,d,e,f) m(3,a,b,c,d,e,f)
#define _WX_VARARG_ITER_4(m,a,b,c,d,e,f) _WX_VARARG_ITER_3(m,a,b,c,d,e,f) m(4,a,b,c,d,e,f)
#define _WX_VARARG_ITER_5(m,a,b,c,d,e,f) _WX_VARARG_ITER_4(m,a,b,c,d,e,f) m(5,a,b,c,d,e,f)
#define _WX_VARARG_ITER_6(m,a,b,c,d,e,f) _WX_VARARG_ITER_5(m,a,b,c,d,e,f) m(6,a,b,c,d,e,f)
#define _WX_VARARG_ITER_7(m,a,b,c,d,e,f) _WX_VARARG_ITER_6(m,a,b,c,d,e,f) m(7,a,b,c,d,e,f)
#define _WX_VARARG_ITER_8(m,a,b,c,d,e,f) _WX_VARARG_ITER_7(m,a,b,c,d,e,f) m(8,a,b,c,d,e,f)
#define _WX_VARARG_ITER_9(m,a,b,c,d,e,f) _WX_VARARG_ITER_8(m,a,b,c,d,e,f) m(9,a,b,c,d,e,f)
#define _WX_VARARG_ITER_10(m,a,b,c,d,e,f) _WX_VARARG_ITER_9(m,a,b,c,d,e,f) m(10,a,b,c,d,e,f)
#define _WX_VARARG_ITER_11(m,a,b,c,d,e,f) _WX_VARARG_ITER_10(m,a,b,c,d,e,f) m(11,a,b,c,d,e,f)
#define _WX_VARARG_ITER_12(m,a,b,c,d,e,f) _WX_VARARG_ITER_11(m,a,b,c,d,e,f) m(12,a,b,c,d,e,f)
#define _WX_VARARG_ITER_13(m,a,b,c,d,e,f) _WX_VARARG_ITER_12(m,a,b,c,d,e,f) m(13,a,b,c,d,e,f)
#define _WX_VARARG_ITER_14(m,a,b,c,d,e,f) _WX_VARARG_ITER_13(m,a,b,c,d,e,f) m(14,a,b,c,d,e,f)
#define _WX_VARARG_ITER_15(m,a,b,c,d,e,f) _WX_VARARG_ITER_14(m,a,b,c,d,e,f) m(15,a,b,c,d,e,f)
#define _WX_VARARG_ITER_16(m,a,b,c,d,e,f) _WX_VARARG_ITER_15(m,a,b,c,d,e,f) m(16,a,b,c,d,e,f)
#define _WX_VARARG_ITER_17(m,a,b,c,d,e,f) _WX_VARARG_ITER_16(m,a,b,c,d,e,f) m(17,a,b,c,d,e,f)
#define _WX_VARARG_ITER_18(m,a,b,c,d,e,f) _WX_VARARG_ITER_17(m,a,b,c,d,e,f) m(18,a,b,c,d,e,f)
#define _WX_VARARG_ITER_19(m,a,b,c,d,e,f) _WX_VARARG_ITER_18(m,a,b,c,d,e,f) m(19,a,b,c,d,e,f)
#define _WX_VARARG_ITER_20(m,a,b,c,d,e,f) _WX_VARARG_ITER_19(m,a,b,c,d,e,f) m(20,a,b,c,d,e,f)
#define _WX_VARARG_ITER_21(m,a,b,c,d,e,f) _WX_VARARG_ITER_20(m,a,b,c,d,e,f) m(21,a,b,c,d,e,f)
#define _WX_VARARG_ITER_22(m,a,b,c,d,e,f) _WX_VARARG_ITER_21(m,a,b,c,d,e,f) m(22,a,b,c,d,e,f)
#define _WX_VARARG_ITER_23(m,a,b,c,d,e,f) _WX_VARARG_ITER_22(m,a,b,c,d,e,f) m(23,a,b,c,d,e,f)
#define _WX_VARARG_ITER_24(m,a,b,c,d,e,f) _WX_VARARG_ITER_23(m,a,b,c,d,e,f) m(24,a,b,c,d,e,f)
#define _WX_VARARG_ITER_25(m,a,b,c,d,e,f) _WX_VARARG_ITER_24(m,a,b,c,d,e,f) m(25,a,b,c,d,e,f)
#define _WX_VARARG_ITER_26(m,a,b,c,d,e,f) _WX_VARARG_ITER_25(m,a,b,c,d,e,f) m(26,a,b,c,d,e,f)
#define _WX_VARARG_ITER_27(m,a,b,c,d,e,f) _WX_VARARG_ITER_26(m,a,b,c,d,e,f) m(27,a,b,c,d,e,f)
#define _WX_VARARG_ITER_28(m,a,b,c,d,e,f) _WX_VARARG_ITER_27(m,a,b,c,d,e,f) m(28,a,b,c,d,e,f)
#define _WX_VARARG_ITER_29(m,a,b,c,d,e,f) _WX_VARARG_ITER_28(m,a,b,c,d,e,f) m(29,a,b,c,d,e,f)
#define _WX_VARARG_ITER_30(m,a,b,c,d,e,f) _WX_VARARG_ITER_29(m,a,b,c,d,e,f) m(30,a,b,c,d,e,f)
#define _WX_VARARG_FIXED_EXPAND_1(t1) \
t1 f1
#define _WX_VARARG_FIXED_EXPAND_2(t1,t2) \
t1 f1, t2 f2
#define _WX_VARARG_FIXED_EXPAND_3(t1,t2,t3) \
t1 f1, t2 f2, t3 f3
#define _WX_VARARG_FIXED_EXPAND_4(t1,t2,t3,t4) \
t1 f1, t2 f2, t3 f3, t4 f4
#define _WX_VARARG_FIXED_UNUSED_EXPAND_1(t1) \
t1 WXUNUSED(f1)
#define _WX_VARARG_FIXED_UNUSED_EXPAND_2(t1,t2) \
t1 WXUNUSED(f1), t2 WXUNUSED(f2)
#define _WX_VARARG_FIXED_UNUSED_EXPAND_3(t1,t2,t3) \
t1 WXUNUSED(f1), t2 WXUNUSED(f2), t3 WXUNUSED(f3)
#define _WX_VARARG_FIXED_UNUSED_EXPAND_4(t1,t2,t3,t4) \
t1 WXUNUSED(f1), t2 WXUNUSED(f2), t3 WXUNUSED(f3), t4 WXUNUSED(f4)
#define _WX_VARARG_FIXED_TYPEDEFS_1(t1) \
typedef t1 TF1
#define _WX_VARARG_FIXED_TYPEDEFS_2(t1,t2) \
_WX_VARARG_FIXED_TYPEDEFS_1(t1); typedef t2 TF2
#define _WX_VARARG_FIXED_TYPEDEFS_3(t1,t2,t3) \
_WX_VARARG_FIXED_TYPEDEFS_2(t1,t2); typedef t3 TF3
#define _WX_VARARG_FIXED_TYPEDEFS_4(t1,t2,t3,t4) \
_WX_VARARG_FIXED_TYPEDEFS_3(t1,t2,t3); typedef t4 TF4
// This macro expands N-items tuple of fixed arguments types into part of
// function's declaration. For example,
// "_WX_VARARG_FIXED_EXPAND(3, (int, char*, int))" expands into
// "int f1, char* f2, int f3".
#define _WX_VARARG_FIXED_EXPAND(N, args) \
_WX_VARARG_FIXED_EXPAND_IMPL(N, args)
#define _WX_VARARG_FIXED_EXPAND_IMPL(N, args) \
_WX_VARARG_FIXED_EXPAND_##N args
// Ditto for unused arguments
#define _WX_VARARG_FIXED_UNUSED_EXPAND(N, args) \
_WX_VARARG_FIXED_UNUSED_EXPAND_IMPL(N, args)
#define _WX_VARARG_FIXED_UNUSED_EXPAND_IMPL(N, args) \
_WX_VARARG_FIXED_UNUSED_EXPAND_##N args
// Declarates typedefs for fixed arguments types; i-th fixed argument types
// will have TFi typedef.
#define _WX_VARARG_FIXED_TYPEDEFS(N, args) \
_WX_VARARG_FIXED_TYPEDEFS_IMPL(N, args)
#define _WX_VARARG_FIXED_TYPEDEFS_IMPL(N, args) \
_WX_VARARG_FIXED_TYPEDEFS_##N args
// This macro calls another macro 'm' passed as second argument 'N' times,
// with its only argument set to 1..N, and concatenates the results using
// comma as separator.
//
// An example:
// #define foo(i) x##i
// // this expands to "x1,x2,x3,x4"
// _WX_VARARG_JOIN(4, foo)
//
//
// N must not be greater than _WX_VARARG_MAX_ARGS (=30).
#define _WX_VARARG_JOIN(N, m) _WX_VARARG_JOIN_IMPL(N, m)
#define _WX_VARARG_JOIN_IMPL(N, m) _WX_VARARG_JOIN_##N(m)
// This macro calls another macro 'm' passed as second argument 'N' times, with
// its first argument set to 1..N and the remaining arguments set to 'a', 'b',
// 'c', 'd', 'e' and 'f'. The results are separated with whitespace in the
// expansion.
//
// An example:
// // this macro expands to:
// // foo(1,a,b,c,d,e,f)
// // foo(2,a,b,c,d,e,f)
// // foo(3,a,b,c,d,e,f)
// _WX_VARARG_ITER(3, foo, a, b, c, d, e, f)
//
// N must not be greater than _WX_VARARG_MAX_ARGS (=30).
#define _WX_VARARG_ITER(N,m,a,b,c,d,e,f) \
_WX_VARARG_ITER_IMPL(N,m,a,b,c,d,e,f)
#define _WX_VARARG_ITER_IMPL(N,m,a,b,c,d,e,f) \
_WX_VARARG_ITER_##N(m,a,b,c,d,e,f)
// Generates code snippet for i-th "variadic" argument in vararg function's
// prototype:
#define _WX_VARARG_ARG(i) T##i a##i
// Like _WX_VARARG_ARG_UNUSED, but outputs argument's type with WXUNUSED:
#define _WX_VARARG_ARG_UNUSED(i) T##i WXUNUSED(a##i)
// Generates code snippet for i-th type in vararg function's template<...>:
#define _WX_VARARG_TEMPL(i) typename T##i
// Generates code snippet for passing i-th argument of vararg function
// wrapper to its implementation, normalizing it in the process:
#define _WX_VARARG_PASS_WCHAR(i) \
wxArgNormalizerWchar<T##i>(a##i, fmt, i).get()
#define _WX_VARARG_PASS_UTF8(i) \
wxArgNormalizerUtf8<T##i>(a##i, fmt, i).get()
// And the same for fixed arguments, _not_ normalizing it:
#define _WX_VARARG_PASS_FIXED(i) f##i
#define _WX_VARARG_FIND_FMT(i) \
(wxFormatStringArgumentFinder<TF##i>::find(f##i))
#define _WX_VARARG_FORMAT_STRING(numfixed, fixed) \
_WX_VARARG_FIXED_TYPEDEFS(numfixed, fixed); \
const wxFormatString *fmt = \
(_WX_VARARG_JOIN(numfixed, _WX_VARARG_FIND_FMT))
#if wxUSE_UNICODE_UTF8
#define _WX_VARARG_DO_CALL_UTF8(return_kw, impl, implUtf8, N, numfixed) \
return_kw implUtf8(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED), \
_WX_VARARG_JOIN(N, _WX_VARARG_PASS_UTF8))
#define _WX_VARARG_DO_CALL0_UTF8(return_kw, impl, implUtf8, numfixed) \
return_kw implUtf8(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED))
#endif // wxUSE_UNICODE_UTF8
#define _WX_VARARG_DO_CALL_WCHAR(return_kw, impl, implUtf8, N, numfixed) \
return_kw impl(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED), \
_WX_VARARG_JOIN(N, _WX_VARARG_PASS_WCHAR))
#define _WX_VARARG_DO_CALL0_WCHAR(return_kw, impl, implUtf8, numfixed) \
return_kw impl(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED))
#if wxUSE_UNICODE_UTF8
#if wxUSE_UTF8_LOCALE_ONLY
#define _WX_VARARG_DO_CALL _WX_VARARG_DO_CALL_UTF8
#define _WX_VARARG_DO_CALL0 _WX_VARARG_DO_CALL0_UTF8
#else // possibly non-UTF8 locales
#define _WX_VARARG_DO_CALL(return_kw, impl, implUtf8, N, numfixed) \
if ( wxLocaleIsUtf8 ) \
_WX_VARARG_DO_CALL_UTF8(return_kw, impl, implUtf8, N, numfixed);\
else \
_WX_VARARG_DO_CALL_WCHAR(return_kw, impl, implUtf8, N, numfixed)
#define _WX_VARARG_DO_CALL0(return_kw, impl, implUtf8, numfixed) \
if ( wxLocaleIsUtf8 ) \
_WX_VARARG_DO_CALL0_UTF8(return_kw, impl, implUtf8, numfixed); \
else \
_WX_VARARG_DO_CALL0_WCHAR(return_kw, impl, implUtf8, numfixed)
#endif // wxUSE_UTF8_LOCALE_ONLY or not
#else // wxUSE_UNICODE_WCHAR or ANSI
#define _WX_VARARG_DO_CALL _WX_VARARG_DO_CALL_WCHAR
#define _WX_VARARG_DO_CALL0 _WX_VARARG_DO_CALL0_WCHAR
#endif // wxUSE_UNICODE_UTF8 / wxUSE_UNICODE_WCHAR
// Macro to be used with _WX_VARARG_ITER in the implementation of
// WX_DEFINE_VARARG_FUNC (see its documentation for the meaning of arguments)
#define _WX_VARARG_DEFINE_FUNC(N, rettype, name, \
impl, implUtf8, numfixed, fixed) \
template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \
_WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
{ \
_WX_VARARG_FORMAT_STRING(numfixed, fixed); \
_WX_VARARG_DO_CALL(return, impl, implUtf8, N, numfixed); \
}
#define _WX_VARARG_DEFINE_FUNC_N0(rettype, name, \
impl, implUtf8, numfixed, fixed) \
inline rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \
{ \
_WX_VARARG_DO_CALL0(return, impl, implUtf8, numfixed); \
}
// Macro to be used with _WX_VARARG_ITER in the implementation of
// WX_DEFINE_VARARG_FUNC_VOID (see its documentation for the meaning of
// arguments; rettype is ignored and is used only to satisfy _WX_VARARG_ITER's
// requirements).
#define _WX_VARARG_DEFINE_FUNC_VOID(N, rettype, name, \
impl, implUtf8, numfixed, fixed) \
template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
void name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \
_WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
{ \
_WX_VARARG_FORMAT_STRING(numfixed, fixed); \
_WX_VARARG_DO_CALL(wxEMPTY_PARAMETER_VALUE, \
impl, implUtf8, N, numfixed); \
}
#define _WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed) \
inline void name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \
{ \
_WX_VARARG_DO_CALL0(wxEMPTY_PARAMETER_VALUE, \
impl, implUtf8, numfixed); \
}
// Macro to be used with _WX_VARARG_ITER in the implementation of
// WX_DEFINE_VARARG_FUNC_CTOR (see its documentation for the meaning of
// arguments; rettype is ignored and is used only to satisfy _WX_VARARG_ITER's
// requirements).
#define _WX_VARARG_DEFINE_FUNC_CTOR(N, rettype, name, \
impl, implUtf8, numfixed, fixed) \
template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \
_WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
{ \
_WX_VARARG_FORMAT_STRING(numfixed, fixed); \
_WX_VARARG_DO_CALL(wxEMPTY_PARAMETER_VALUE, \
impl, implUtf8, N, numfixed); \
}
#define _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed) \
inline name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \
{ \
_WX_VARARG_DO_CALL0(wxEMPTY_PARAMETER_VALUE, \
impl, implUtf8, numfixed); \
}
// Macro to be used with _WX_VARARG_ITER in the implementation of
// WX_DEFINE_VARARG_FUNC_NOP, i.e. empty stub for a disabled vararg function.
// The rettype and impl arguments are ignored.
#define _WX_VARARG_DEFINE_FUNC_NOP(N, rettype, name, \
impl, implUtf8, numfixed, fixed) \
template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed), \
_WX_VARARG_JOIN(N, _WX_VARARG_ARG_UNUSED)) \
{}
#define _WX_VARARG_DEFINE_FUNC_NOP_N0(name, numfixed, fixed) \
inline void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed)) \
{}
#endif // _WX_STRVARARG_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/artprov.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/artprov.h
// Purpose: wxArtProvider class
// Author: Vaclav Slavik
// Modified by:
// Created: 18/03/2002
// Copyright: (c) Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ARTPROV_H_
#define _WX_ARTPROV_H_
#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;
class wxArtProviderModule;
// ----------------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------------
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_ART_ID_FROM_STR(id) (id)
#define wxART_MAKE_ART_ID(id) (#id)
// ----------------------------------------------------------------------------
// Art clients
// ----------------------------------------------------------------------------
#define wxART_TOOLBAR wxART_MAKE_CLIENT_ID(wxART_TOOLBAR)
#define wxART_MENU wxART_MAKE_CLIENT_ID(wxART_MENU)
#define wxART_FRAME_ICON wxART_MAKE_CLIENT_ID(wxART_FRAME_ICON)
#define wxART_CMN_DIALOG wxART_MAKE_CLIENT_ID(wxART_CMN_DIALOG)
#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)
// ----------------------------------------------------------------------------
// Art IDs
// ----------------------------------------------------------------------------
#define wxART_ADD_BOOKMARK wxART_MAKE_ART_ID(wxART_ADD_BOOKMARK)
#define wxART_DEL_BOOKMARK wxART_MAKE_ART_ID(wxART_DEL_BOOKMARK)
#define wxART_HELP_SIDE_PANEL wxART_MAKE_ART_ID(wxART_HELP_SIDE_PANEL)
#define wxART_HELP_SETTINGS wxART_MAKE_ART_ID(wxART_HELP_SETTINGS)
#define wxART_HELP_BOOK wxART_MAKE_ART_ID(wxART_HELP_BOOK)
#define wxART_HELP_FOLDER wxART_MAKE_ART_ID(wxART_HELP_FOLDER)
#define wxART_HELP_PAGE wxART_MAKE_ART_ID(wxART_HELP_PAGE)
#define wxART_GO_BACK wxART_MAKE_ART_ID(wxART_GO_BACK)
#define wxART_GO_FORWARD wxART_MAKE_ART_ID(wxART_GO_FORWARD)
#define wxART_GO_UP wxART_MAKE_ART_ID(wxART_GO_UP)
#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)
#define wxART_PRINT wxART_MAKE_ART_ID(wxART_PRINT)
#define wxART_HELP wxART_MAKE_ART_ID(wxART_HELP)
#define wxART_TIP wxART_MAKE_ART_ID(wxART_TIP)
#define wxART_REPORT_VIEW wxART_MAKE_ART_ID(wxART_REPORT_VIEW)
#define wxART_LIST_VIEW wxART_MAKE_ART_ID(wxART_LIST_VIEW)
#define wxART_NEW_DIR wxART_MAKE_ART_ID(wxART_NEW_DIR)
#define wxART_HARDDISK wxART_MAKE_ART_ID(wxART_HARDDISK)
#define wxART_FLOPPY wxART_MAKE_ART_ID(wxART_FLOPPY)
#define wxART_CDROM wxART_MAKE_ART_ID(wxART_CDROM)
#define wxART_REMOVABLE wxART_MAKE_ART_ID(wxART_REMOVABLE)
#define wxART_FOLDER wxART_MAKE_ART_ID(wxART_FOLDER)
#define wxART_FOLDER_OPEN wxART_MAKE_ART_ID(wxART_FOLDER_OPEN)
#define wxART_GO_DIR_UP wxART_MAKE_ART_ID(wxART_GO_DIR_UP)
#define wxART_EXECUTABLE_FILE wxART_MAKE_ART_ID(wxART_EXECUTABLE_FILE)
#define wxART_NORMAL_FILE wxART_MAKE_ART_ID(wxART_NORMAL_FILE)
#define wxART_TICK_MARK wxART_MAKE_ART_ID(wxART_TICK_MARK)
#define wxART_CROSS_MARK wxART_MAKE_ART_ID(wxART_CROSS_MARK)
#define wxART_ERROR wxART_MAKE_ART_ID(wxART_ERROR)
#define wxART_QUESTION wxART_MAKE_ART_ID(wxART_QUESTION)
#define wxART_WARNING wxART_MAKE_ART_ID(wxART_WARNING)
#define wxART_INFORMATION wxART_MAKE_ART_ID(wxART_INFORMATION)
#define wxART_MISSING_IMAGE wxART_MAKE_ART_ID(wxART_MISSING_IMAGE)
#define wxART_COPY wxART_MAKE_ART_ID(wxART_COPY)
#define wxART_CUT wxART_MAKE_ART_ID(wxART_CUT)
#define wxART_PASTE wxART_MAKE_ART_ID(wxART_PASTE)
#define wxART_DELETE wxART_MAKE_ART_ID(wxART_DELETE)
#define wxART_NEW wxART_MAKE_ART_ID(wxART_NEW)
#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)
#define wxART_FIND_AND_REPLACE wxART_MAKE_ART_ID(wxART_FIND_AND_REPLACE)
#define wxART_FULL_SCREEN wxART_MAKE_ART_ID(wxART_FULL_SCREEN)
#define wxART_EDIT wxART_MAKE_ART_ID(wxART_EDIT)
// ----------------------------------------------------------------------------
// wxArtProvider class
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE 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).
static void Push(wxArtProvider *provider);
// Add new provider to the bottom of providers stack (i.e. the provider
// will be queried as the last one).
static void PushBack(wxArtProvider *provider);
#if WXWIN_COMPATIBILITY_2_8
// use PushBack(), it's the same thing
static wxDEPRECATED( void Insert(wxArtProvider *provider) );
#endif
// Remove latest added provider and delete it.
static bool Pop();
// Remove provider from providers stack but don't delete it.
static bool Remove(wxArtProvider *provider);
// Delete the given provider and remove it from the providers stack.
static bool Delete(wxArtProvider *provider);
// Query the providers for bitmap with given ID and return it. Return
// wxNullBitmap if no provider provides it.
static wxBitmap GetBitmap(const wxArtID& id,
const wxArtClient& client = wxART_OTHER,
const wxSize& size = wxDefaultSize);
// Query the providers for icon with given ID and return it. Return
// wxNullIcon if no provider provides it.
static wxIcon GetIcon(const wxArtID& id,
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);
// Rescale bitmap (used internally if requested size is other than the available).
static void RescaleBitmap(wxBitmap& bmp, const wxSize& sizeNeeded);
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
static void CleanUpProviders();
// Get the default size of an icon for a specific client
virtual wxSize DoGetSizeHint(const wxArtClient& client)
{
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.
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;
}
private:
static void CommonAddingProvider();
static wxIconBundle DoGetIconBundle(const wxArtID& id,
const wxArtClient& client);
private:
// list of providers:
static wxArtProvidersList *sm_providers;
// art resources cache (so that CreateXXX is not called that often):
static wxArtProviderCache *sm_cache;
wxDECLARE_ABSTRACT_CLASS(wxArtProvider);
};
#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_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/encconv.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/encconv.h
// Purpose: wxEncodingConverter class for converting between different
// font encodings
// Author: Vaclav Slavik
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ENCCONV_H_
#define _WX_ENCCONV_H_
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/fontenc.h"
#include "wx/dynarray.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
enum
{
wxCONVERT_STRICT,
wxCONVERT_SUBSTITUTE
};
enum
{
wxPLATFORM_CURRENT = -1,
wxPLATFORM_UNIX = 0,
wxPLATFORM_WINDOWS,
wxPLATFORM_MAC
};
// ----------------------------------------------------------------------------
// types
// ----------------------------------------------------------------------------
WX_DEFINE_ARRAY_INT(wxFontEncoding, wxFontEncodingArray);
//--------------------------------------------------------------------------------
// wxEncodingConverter
// This class is capable of converting strings between any two
// 8bit encodings/charsets. It can also convert from/to Unicode
//--------------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject
{
public:
wxEncodingConverter();
virtual ~wxEncodingConverter() { if (m_Table) delete[] m_Table; }
// Initialize conversion. Both output or input encoding may
// be wxFONTENCODING_UNICODE.
//
// All subsequent calls to Convert() will interpret it's argument
// as a string in input_enc encoding and will output string in
// output_enc encoding.
//
// You must call this method before calling Convert. You may call
// it more than once in order to switch to another conversion
//
// Method affects behaviour of Convert() in case input character
// cannot be converted because it does not exist in output encoding:
// wxCONVERT_STRICT --
// follow behaviour of GNU Recode - just copy unconvertable
// characters to output and don't change them (it's integer
// value will stay the same)
// wxCONVERT_SUBSTITUTE --
// try some (lossy) substitutions - e.g. replace
// unconvertable latin capitals with acute by ordinary
// capitals, replace en-dash or em-dash by '-' etc.
// both modes guarantee that output string will have same length
// as input string
//
// Returns false if given conversion is impossible, true otherwise
// (conversion may be impossible either if you try to convert
// to Unicode with non-Unicode build of wxWidgets or if input
// or output encoding is not supported.)
bool Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method = wxCONVERT_STRICT);
// Convert input string according to settings passed to Init.
// Note that you must call Init before using Convert!
bool Convert(const char* input, char* output) const;
bool Convert(char* str) const { return Convert(str, str); }
wxString Convert(const wxString& input) const;
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); }
// Return equivalent(s) for given font that are used
// under given platform. wxPLATFORM_CURRENT means the plaform
// this binary was compiled for
//
// Examples:
// current platform enc returned value
// -----------------------------------------------------
// unix CP1250 {ISO8859_2}
// unix ISO8859_2 {}
// windows ISO8859_2 {CP1250}
//
// Equivalence is defined in terms of convertibility:
// 2 encodings are equivalent if you can convert text between
// then without losing information (it may - and will - happen
// that you lose special chars like quotation marks or em-dashes
// but you shouldn't lose any diacritics and language-specific
// characters when converting between equivalent encodings).
//
// Convert() method is not limited to converting between
// equivalent encodings, it can convert between arbitrary
// two encodings!
//
// Remember that this function does _NOT_ check for presence of
// fonts in system. It only tells you what are most suitable
// encodings. (It usually returns only one encoding)
//
// Note that argument enc itself may be present in returned array!
// (so that you can -- as a side effect -- detect whether the
// encoding is native for this platform or not)
static wxFontEncodingArray GetPlatformEquivalents(wxFontEncoding enc, int platform = wxPLATFORM_CURRENT);
// Similar to GetPlatformEquivalent, but this one will return ALL
// equivalent encodings, regardless the platform, including itself.
static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc);
// Return true if [any text in] one multibyte encoding can be
// converted to another one losslessly.
//
// Do not call this with wxFONTENCODING_UNICODE, it doesn't make
// sense (always works in one sense and always depends on the text
// to convert in the other)
static bool CanConvert(wxFontEncoding encIn, wxFontEncoding encOut)
{
return GetAllEquivalents(encIn).Index(encOut) != wxNOT_FOUND;
}
private:
wchar_t *m_Table;
bool m_UnicodeInput, m_UnicodeOutput;
bool m_JustCopy;
wxDECLARE_NO_COPY_CLASS(wxEncodingConverter);
};
#endif // _WX_ENCCONV_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/glcanvas.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/glcanvas.h
// Purpose: wxGLCanvas base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GLCANVAS_H_BASE_
#define _WX_GLCANVAS_H_BASE_
#include "wx/defs.h"
#if wxUSE_GLCANVAS
#include "wx/app.h"
#include "wx/palette.h"
#include "wx/window.h"
class WXDLLIMPEXP_FWD_GL wxGLCanvas;
class WXDLLIMPEXP_FWD_GL wxGLContext;
// ----------------------------------------------------------------------------
// Constants for attributes list
// ----------------------------------------------------------------------------
// Notice that not all implementation support options such as stereo, auxiliary
// buffers, alpha channel, and accumulator buffer, use IsDisplaySupported() to
// check for individual attributes support.
enum
{
WX_GL_RGBA = 1, // use true color palette (on if no attrs specified)
WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
WX_GL_DOUBLEBUFFER, // use double buffering (on if no attrs specified)
WX_GL_STEREO, // use stereoscopic display
WX_GL_AUX_BUFFERS, // number of auxiliary buffers
WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
WX_GL_MIN_ALPHA, // use alpha buffer with most bits (> MIN_ALPHA bits)
WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
WX_GL_STENCIL_SIZE, // bits for stencil buffer
WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
WX_GL_MIN_ACCUM_ALPHA, // use alpha buffer with most bits (> MIN_ACCUM_ALPHA bits)
WX_GL_SAMPLE_BUFFERS, // 1 for multisampling support (antialiasing)
WX_GL_SAMPLES, // 4 for 2x2 antialiasing supersampling on most graphics cards
WX_GL_FRAMEBUFFER_SRGB,// capability for sRGB framebuffer
// Context attributes
WX_GL_CORE_PROFILE, // use an OpenGL core profile
WX_GL_MAJOR_VERSION, // major OpenGL version of the core profile
WX_GL_MINOR_VERSION, // minor OpenGL version of the core profile
wx_GL_COMPAT_PROFILE, // use compatible profile (use all versions features)
WX_GL_FORWARD_COMPAT, // forward compatible context. OpenGL >= 3.0
WX_GL_ES2, // ES or ES2 context.
WX_GL_DEBUG, // create a debug context
WX_GL_ROBUST_ACCESS, // robustness.
WX_GL_NO_RESET_NOTIFY, // never deliver notification of reset events
WX_GL_LOSE_ON_RESET, // if graphics reset, all context state is lost
WX_GL_RESET_ISOLATION, // protect other apps or share contexts from reset side-effects
WX_GL_RELEASE_FLUSH, // on context release, flush pending commands
WX_GL_RELEASE_NONE // on context release, pending commands are not flushed
};
#define wxGLCanvasName wxT("GLCanvas")
// ----------------------------------------------------------------------------
// wxGLAttribsBase: OpenGL rendering attributes
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_GL wxGLAttribsBase
{
public:
wxGLAttribsBase() { Reset(); }
// Setters
void AddAttribute(int attribute) { m_GLValues.push_back(attribute); }
// Search for searchVal and combine the next value with combineVal
void AddAttribBits(int searchVal, int combineVal);
// ARB functions necessity
void SetNeedsARB(bool needsARB = true) { m_needsARB = needsARB; }
// Delete contents
void Reset()
{
m_GLValues.clear();
m_needsARB = false;
}
// Accessors
const int* GetGLAttrs() const
{
return (m_GLValues.empty() || !m_GLValues[0]) ? NULL : &*m_GLValues.begin();
}
int GetSize() const { return (int)(m_GLValues.size()); }
// ARB function (e.g. wglCreateContextAttribsARB) is needed
bool NeedsARB() const { return m_needsARB; }
private:
wxVector<int> m_GLValues;
bool m_needsARB;
};
// ----------------------------------------------------------------------------
// wxGLContextAttrs: OpenGL rendering context attributes
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_GL wxGLContextAttrs : public wxGLAttribsBase
{
public:
// Setters, allowing chained calls
wxGLContextAttrs& CoreProfile();
wxGLContextAttrs& MajorVersion(int val);
wxGLContextAttrs& MinorVersion(int val);
wxGLContextAttrs& OGLVersion(int vmayor, int vminor)
{ return MajorVersion(vmayor).MinorVersion(vminor); }
wxGLContextAttrs& CompatibilityProfile();
wxGLContextAttrs& ForwardCompatible();
wxGLContextAttrs& ES2();
wxGLContextAttrs& DebugCtx();
wxGLContextAttrs& Robust();
wxGLContextAttrs& NoResetNotify();
wxGLContextAttrs& LoseOnReset();
wxGLContextAttrs& ResetIsolation();
wxGLContextAttrs& ReleaseFlush(int val = 1); //'int' allows future values
wxGLContextAttrs& PlatformDefaults();
void EndList(); // No more values can be chained
// Currently only used for X11 context creation
bool x11Direct; // X11 direct render
bool renderTypeRGBA;
};
// ----------------------------------------------------------------------------
// wxGLAttributes: canvas configuration
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_GL wxGLAttributes : public wxGLAttribsBase
{
public:
// Setters, allowing chained calls
wxGLAttributes& RGBA();
wxGLAttributes& BufferSize(int val);
wxGLAttributes& Level(int val);
wxGLAttributes& DoubleBuffer();
wxGLAttributes& Stereo();
wxGLAttributes& AuxBuffers(int val);
wxGLAttributes& MinRGBA(int mRed, int mGreen, int mBlue, int mAlpha);
wxGLAttributes& Depth(int val);
wxGLAttributes& Stencil(int val);
wxGLAttributes& MinAcumRGBA(int mRed, int mGreen, int mBlue, int mAlpha);
wxGLAttributes& PlatformDefaults();
wxGLAttributes& Defaults();
wxGLAttributes& SampleBuffers(int val);
wxGLAttributes& Samplers(int val);
wxGLAttributes& FrameBuffersRGB();
void EndList(); // No more values can be chained
// This function is undocumented and can not be chained on purpose!
// To keep backwards compatibility with versions before wx3.1 we add here
// the default values used in those versions for the case of NULL list.
void AddDefaultsForWXBefore31();
};
// ----------------------------------------------------------------------------
// wxGLContextBase: OpenGL rendering context
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_GL wxGLContextBase : public wxObject
{
public:
// The derived class should provide a ctor with this signature:
//
// wxGLContext(wxGLCanvas *win,
// const wxGLContext *other = NULL,
// const wxGLContextAttrs *ctxAttrs = NULL);
// set this context as the current one
virtual bool SetCurrent(const wxGLCanvas& win) const = 0;
bool IsOK() { return m_isOk; }
protected:
bool m_isOk;
};
// ----------------------------------------------------------------------------
// wxGLCanvasBase: window which can be used for OpenGL rendering
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_GL wxGLCanvasBase : public wxWindow
{
public:
// default ctor doesn't initialize the window, use Create() later
wxGLCanvasBase();
virtual ~wxGLCanvasBase();
/*
The derived class should provide a ctor with this signature:
wxGLCanvas(wxWindow *parent,
const wxGLAttributes& dispAttrs,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const wxPalette& palette = wxNullPalette);
*/
// operations
// ----------
// set the given context associated with this window as the current one
bool SetCurrent(const wxGLContext& context) const;
// flush the back buffer (if we have it)
virtual bool SwapBuffers() = 0;
// accessors
// ---------
// check if the given attributes are supported without creating a canvas
static bool IsDisplaySupported(const wxGLAttributes& dispAttrs);
static bool IsDisplaySupported(const int *attribList);
#if wxUSE_PALETTE
const wxPalette *GetPalette() const { return &m_palette; }
#endif // wxUSE_PALETTE
// miscellaneous helper functions
// ------------------------------
// call glcolor() for the colour with the given name, return false if
// colour not found
bool SetColour(const wxString& colour);
// return true if the extension with given name is supported
//
// notice that while this function is implemented for all of GLX, WGL and
// AGL the extensions names are usually not the same for different
// platforms and so the code using it still usually uses conditional
// compilation
static bool IsExtensionSupported(const char *extension);
// Get the wxGLContextAttrs object filled with the context-related values
// of the list of attributes passed at ctor when no wxGLAttributes is used
// as a parameter
wxGLContextAttrs& GetGLCTXAttrs() { return m_GLCTXAttrs; }
// deprecated methods using the implicit wxGLContext
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( wxGLContext* GetContext() const );
wxDEPRECATED( void SetCurrent() );
wxDEPRECATED( void OnSize(wxSizeEvent& event) );
#endif // WXWIN_COMPATIBILITY_2_8
#ifdef __WXUNIVERSAL__
// resolve the conflict with wxWindowUniv::SetCurrent()
virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); }
#endif
protected:
// override this to implement SetColour() in GL_INDEX_MODE
// (currently only implemented in wxX11 and wxMotif ports)
virtual int GetColourIndex(const wxColour& WXUNUSED(col)) { return -1; }
// check if the given extension name is present in the space-separated list
// of extensions supported by the current implementation such as returned
// by glXQueryExtensionsString() or glGetString(GL_EXTENSIONS)
static bool IsExtensionInList(const char *list, const char *extension);
// For the case of "int* attribList" at ctor is != 0
wxGLContextAttrs m_GLCTXAttrs;
// Extract pixel format and context attributes.
// Return false if an unknown attribute is found.
static bool ParseAttribList(const int* attribList,
wxGLAttributes& dispAttrs,
wxGLContextAttrs* ctxAttrs = NULL);
#if wxUSE_PALETTE
// create default palette if we're not using RGBA mode
// (not supported in most ports)
virtual wxPalette CreateDefaultPalette() { return wxNullPalette; }
wxPalette m_palette;
#endif // wxUSE_PALETTE
#if WXWIN_COMPATIBILITY_2_8
wxGLContext *m_glContext;
#endif // WXWIN_COMPATIBILITY_2_8
};
// ----------------------------------------------------------------------------
// wxGLApp: a special wxApp subclass for OpenGL applications which must be used
// to select a visual compatible with the given attributes
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_GL wxGLAppBase : public wxApp
{
public:
wxGLAppBase() : wxApp() { }
// use this in the constructor of the user-derived wxGLApp class to
// determine if an OpenGL rendering context with these attributes
// is available - returns true if so, false if not.
virtual bool InitGLVisual(const int *attribList) = 0;
};
#if defined(__WXMSW__)
#include "wx/msw/glcanvas.h"
#elif defined(__WXMOTIF__) || defined(__WXX11__)
#include "wx/x11/glcanvas.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/glcanvas.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/glcanvas.h"
#elif defined(__WXMAC__)
#include "wx/osx/glcanvas.h"
#elif defined(__WXQT__)
#include "wx/qt/glcanvas.h"
#else
#error "wxGLCanvas not supported in this wxWidgets port"
#endif
// wxMac and wxMSW don't need anything extra in wxGLAppBase, so declare it here
#ifndef wxGL_APP_DEFINED
class WXDLLIMPEXP_GL wxGLApp : public wxGLAppBase
{
public:
wxGLApp() : wxGLAppBase() { }
virtual bool InitGLVisual(const int *attribList) wxOVERRIDE;
private:
wxDECLARE_DYNAMIC_CLASS(wxGLApp);
};
#endif // !wxGL_APP_DEFINED
// ----------------------------------------------------------------------------
// wxGLAPI: an API wrapper that allows the use of 'old' APIs even on OpenGL
// platforms that don't support it natively anymore, if the APIs are available
// it's a mere redirect
// ----------------------------------------------------------------------------
#ifndef wxUSE_OPENGL_EMULATION
#define wxUSE_OPENGL_EMULATION 0
#endif
class WXDLLIMPEXP_GL wxGLAPI : public wxObject
{
public:
wxGLAPI();
~wxGLAPI();
static void glFrustum(GLfloat left, GLfloat right, GLfloat bottom,
GLfloat top, GLfloat zNear, GLfloat zFar);
static void glBegin(GLenum mode);
static void glTexCoord2f(GLfloat s, GLfloat t);
static void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
static void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
static void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
static void glColor3f(GLfloat r, GLfloat g, GLfloat b);
static void glEnd();
};
#endif // wxUSE_GLCANVAS
#endif // _WX_GLCANVAS_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/window.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/window.h
// Purpose: wxWindowBase class - the interface of wxWindow
// Author: Vadim Zeitlin
// Modified by: Ron Lee
// Created: 01/02/97
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WINDOW_H_BASE_
#define _WX_WINDOW_H_BASE_
// ----------------------------------------------------------------------------
// headers which we must include here
// ----------------------------------------------------------------------------
#include "wx/event.h" // the base class
#include "wx/list.h" // defines wxWindowList
#include "wx/cursor.h" // we have member variables of these classes
#include "wx/font.h" // so we can't do without them
#include "wx/colour.h"
#include "wx/region.h"
#include "wx/utils.h"
#include "wx/intl.h"
#include "wx/validate.h" // for wxDefaultValidator (always include it)
#if wxUSE_PALETTE
#include "wx/palette.h"
#endif // wxUSE_PALETTE
#if wxUSE_ACCEL
#include "wx/accel.h"
#endif // wxUSE_ACCEL
#if wxUSE_ACCESSIBILITY
#include "wx/access.h"
#endif
// when building wxUniv/Foo we don't want the code for native menu use to be
// compiled in - it should only be used when building real wxFoo
#ifdef __WXUNIVERSAL__
#define wxUSE_MENUS_NATIVE 0
#else // !__WXUNIVERSAL__
#define wxUSE_MENUS_NATIVE wxUSE_MENUS
#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__
// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxCaret;
class WXDLLIMPEXP_FWD_CORE wxControl;
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxDropTarget;
class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints;
class WXDLLIMPEXP_FWD_CORE wxSizer;
class WXDLLIMPEXP_FWD_CORE wxToolTip;
class WXDLLIMPEXP_FWD_CORE wxWindowBase;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxScrollHelper;
#if wxUSE_ACCESSIBILITY
class WXDLLIMPEXP_FWD_CORE wxAccessible;
#endif
// ----------------------------------------------------------------------------
// helper stuff used by wxWindow
// ----------------------------------------------------------------------------
// struct containing all the visual attributes of a control
struct WXDLLIMPEXP_CORE wxVisualAttributes
{
// the font used for control label/text inside it
wxFont font;
// the foreground colour
wxColour colFg;
// the background colour, may be wxNullColour if the controls background
// colour is not solid
wxColour colBg;
};
// different window variants, on platforms like e.g. mac uses different
// rendering sizes
enum wxWindowVariant
{
wxWINDOW_VARIANT_NORMAL, // Normal size
wxWINDOW_VARIANT_SMALL, // Smaller size (about 25 % smaller than normal)
wxWINDOW_VARIANT_MINI, // Mini size (about 33 % smaller than normal)
wxWINDOW_VARIANT_LARGE, // Large size (about 25 % larger than normal)
wxWINDOW_VARIANT_MAX
};
#if wxUSE_SYSTEM_OPTIONS
#define wxWINDOW_DEFAULT_VARIANT wxT("window-default-variant")
#endif
// valid values for Show/HideWithEffect()
enum wxShowEffect
{
wxSHOW_EFFECT_NONE,
wxSHOW_EFFECT_ROLL_TO_LEFT,
wxSHOW_EFFECT_ROLL_TO_RIGHT,
wxSHOW_EFFECT_ROLL_TO_TOP,
wxSHOW_EFFECT_ROLL_TO_BOTTOM,
wxSHOW_EFFECT_SLIDE_TO_LEFT,
wxSHOW_EFFECT_SLIDE_TO_RIGHT,
wxSHOW_EFFECT_SLIDE_TO_TOP,
wxSHOW_EFFECT_SLIDE_TO_BOTTOM,
wxSHOW_EFFECT_BLEND,
wxSHOW_EFFECT_EXPAND,
wxSHOW_EFFECT_MAX
};
// Values for EnableTouchEvents() mask.
enum
{
wxTOUCH_NONE = 0x0000,
wxTOUCH_VERTICAL_PAN_GESTURE = 0x0001,
wxTOUCH_HORIZONTAL_PAN_GESTURE = 0x0002,
wxTOUCH_PAN_GESTURES = wxTOUCH_VERTICAL_PAN_GESTURE |
wxTOUCH_HORIZONTAL_PAN_GESTURE,
wxTOUCH_ZOOM_GESTURE = 0x0004,
wxTOUCH_ROTATE_GESTURE = 0x0008,
wxTOUCH_PRESS_GESTURES = 0x0010,
wxTOUCH_ALL_GESTURES = 0x001f
};
// flags for SendSizeEvent()
enum
{
wxSEND_EVENT_POST = 1
};
// ----------------------------------------------------------------------------
// (pseudo)template list classes
// ----------------------------------------------------------------------------
WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLIMPEXP_CORE);
// ----------------------------------------------------------------------------
// global variables
// ----------------------------------------------------------------------------
extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxTopLevelWindows;
// declared here for compatibility only, main declaration is in wx/app.h
extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete;
// ----------------------------------------------------------------------------
// wxWindowBase is the base class for all GUI controls/widgets, this is the public
// interface of this class.
//
// Event handler: windows have themselves as their event handlers by default,
// but their event handlers could be set to another object entirely. This
// separation can reduce the amount of derivation required, and allow
// alteration of a window's functionality (e.g. by a resource editor that
// temporarily switches event handlers).
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWindowBase : public wxEvtHandler
{
public:
// creating the window
// -------------------
// default ctor, initializes everything which can be initialized before
// Create()
wxWindowBase() ;
virtual ~wxWindowBase();
// deleting the window
// -------------------
// ask the window to close itself, return true if the event handler
// honoured our request
bool Close( bool force = false );
// the following functions delete the C++ objects (the window itself
// or its children) as well as the GUI windows and normally should
// never be used directly
// delete window unconditionally (dangerous!), returns true if ok
virtual bool Destroy();
// delete all children of this window, returns true if ok
bool DestroyChildren();
// is the window being deleted?
bool IsBeingDeleted() const;
// window attributes
// -----------------
// label is just the same as the title (but for, e.g., buttons it
// makes more sense to speak about labels), title access
// is available from wxTLW classes only (frames, dialogs)
virtual void SetLabel(const wxString& label) = 0;
virtual wxString GetLabel() const = 0;
// the window name is used for resource setting in X, it is not the
// same as the window title/label
virtual void SetName( const wxString &name ) { m_windowName = name; }
virtual wxString GetName() const { return m_windowName; }
// sets the window variant, calls internally DoSetVariant if variant
// has changed
void SetWindowVariant(wxWindowVariant variant);
wxWindowVariant GetWindowVariant() const { return m_windowVariant; }
// get or change the layout direction (LTR or RTL) for this window,
// wxLayout_Default is returned if layout direction is not supported
virtual wxLayoutDirection GetLayoutDirection() const
{ return wxLayout_Default; }
virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir))
{ }
// mirror coordinates for RTL layout if this window uses it and if the
// mirroring is not done automatically like Win32
virtual wxCoord AdjustForLayoutDirection(wxCoord x,
wxCoord width,
wxCoord widthTotal) const;
// window id uniquely identifies the window among its siblings unless
// it is wxID_ANY which means "don't care"
virtual void SetId( wxWindowID winid ) { m_windowId = winid; }
wxWindowID GetId() const { return m_windowId; }
// generate a unique id (or count of them consecutively), returns a
// valid id in the auto-id range or wxID_NONE if failed. If using
// autoid management, it will mark the id as reserved until it is
// used (by assigning it to a wxWindowIDRef) or unreserved.
static wxWindowID NewControlId(int count = 1)
{
return wxIdManager::ReserveId(count);
}
// If an ID generated from NewControlId is not assigned to a wxWindowIDRef,
// it must be unreserved
static void UnreserveControlId(wxWindowID id, int count = 1)
{
wxIdManager::UnreserveId(id, count);
}
// moving/resizing
// ---------------
// set the window size and/or position
void SetSize( int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO )
{ DoSetSize(x, y, width, height, sizeFlags); }
void SetSize( int width, int height )
{ DoSetSize( wxDefaultCoord, wxDefaultCoord, width, height, wxSIZE_USE_EXISTING ); }
void SetSize( const wxSize& size )
{ SetSize( size.x, size.y); }
void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
{ DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); }
void Move(int x, int y, int flags = wxSIZE_USE_EXISTING)
{ DoSetSize(x, y, wxDefaultCoord, wxDefaultCoord, flags); }
void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING)
{ Move(pt.x, pt.y, flags); }
void SetPosition(const wxPoint& pt) { Move(pt); }
// Z-order
virtual void Raise() = 0;
virtual void Lower() = 0;
// client size is the size of area available for subwindows
void SetClientSize( int width, int height )
{ DoSetClientSize(width, height); }
void SetClientSize( const wxSize& size )
{ DoSetClientSize(size.x, size.y); }
void SetClientSize(const wxRect& rect)
{ SetClientSize( rect.width, rect.height ); }
// get the window position (pointers may be NULL): notice that it is in
// client coordinates for child windows and screen coordinates for the
// top level ones, use GetScreenPosition() if you need screen
// coordinates for all kinds of windows
void GetPosition( int *x, int *y ) const { DoGetPosition(x, y); }
wxPoint GetPosition() const
{
int x, y;
DoGetPosition(&x, &y);
return wxPoint(x, y);
}
// get the window position in screen coordinates
void GetScreenPosition(int *x, int *y) const { DoGetScreenPosition(x, y); }
wxPoint GetScreenPosition() const
{
int x, y;
DoGetScreenPosition(&x, &y);
return wxPoint(x, y);
}
// get the window size (pointers may be NULL)
void GetSize( int *w, int *h ) const { DoGetSize(w, h); }
wxSize GetSize() const
{
int w, h;
DoGetSize(& w, & h);
return wxSize(w, h);
}
void GetClientSize( int *w, int *h ) const { DoGetClientSize(w, h); }
wxSize GetClientSize() const
{
int w, h;
DoGetClientSize(&w, &h);
return wxSize(w, h);
}
// get the position and size at once
wxRect GetRect() const
{
int x, y, w, h;
GetPosition(&x, &y);
GetSize(&w, &h);
return wxRect(x, y, w, h);
}
wxRect GetScreenRect() const
{
int x, y, w, h;
GetScreenPosition(&x, &y);
GetSize(&w, &h);
return wxRect(x, y, w, h);
}
// get the origin of the client area of the window relative to the
// window top left corner (the client area may be shifted because of
// the borders, scrollbars, other decorations...)
virtual wxPoint GetClientAreaOrigin() const;
// get the client rectangle in window (i.e. client) coordinates
wxRect GetClientRect() const
{
return wxRect(GetClientAreaOrigin(), GetClientSize());
}
// client<->window size conversion
virtual wxSize ClientToWindowSize(const wxSize& size) const;
virtual wxSize WindowToClientSize(const wxSize& size) const;
// get the size best suited for the window (in fact, minimal
// acceptable size using which it will still look "nice" in
// most situations)
wxSize GetBestSize() const;
void GetBestSize(int *w, int *h) const
{
wxSize s = GetBestSize();
if ( w )
*w = s.x;
if ( h )
*h = s.y;
}
// Determine the best size in the other direction if one of them is
// fixed. This is used with windows that can wrap their contents and
// returns input-independent best size for the others.
int GetBestHeight(int width) const;
int GetBestWidth(int height) const;
void SetScrollHelper( wxScrollHelper *sh ) { m_scrollHelper = sh; }
wxScrollHelper *GetScrollHelper() { return m_scrollHelper; }
// reset the cached best size value so it will be recalculated the
// next time it is needed.
void InvalidateBestSize();
void CacheBestSize(const wxSize& size) const
{ wxConstCast(this, wxWindowBase)->m_bestSizeCache = size; }
// This function will merge the window's best size into the window's
// minimum size, giving priority to the min size components, and
// returns the results.
virtual wxSize GetEffectiveMinSize() const;
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED_MSG("use GetEffectiveMinSize() instead")
wxSize GetBestFittingSize() const;
#endif // WXWIN_COMPATIBILITY_2_8
// A 'Smart' SetSize that will fill in default size values with 'best'
// size. Sets the minsize to what was passed in.
void SetInitialSize(const wxSize& size=wxDefaultSize);
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED_MSG("use SetInitialSize() instead")
void SetBestFittingSize(const wxSize& size=wxDefaultSize);
#endif // WXWIN_COMPATIBILITY_2_8
// the generic centre function - centers the window on parent by`
// default or on screen if it doesn't have parent or
// wxCENTER_ON_SCREEN flag is given
void Centre(int dir = wxBOTH) { DoCentre(dir); }
void Center(int dir = wxBOTH) { DoCentre(dir); }
// centre with respect to the parent window
void CentreOnParent(int dir = wxBOTH) { DoCentre(dir); }
void CenterOnParent(int dir = wxBOTH) { CentreOnParent(dir); }
// set window size to wrap around its children
virtual void Fit();
// set virtual size to satisfy children
virtual void FitInside();
// SetSizeHints is actually for setting the size hints
// for the wxTLW for a Window Manager - hence the name -
// and it is therefore overridden in wxTLW to do that.
// In wxWindow(Base), it has (unfortunately) been abused
// to mean the same as SetMinSize() and SetMaxSize().
virtual void SetSizeHints( int minW, int minH,
int maxW = wxDefaultCoord, int maxH = wxDefaultCoord,
int incW = wxDefaultCoord, int incH = wxDefaultCoord )
{ DoSetSizeHints(minW, minH, maxW, maxH, incW, incH); }
void SetSizeHints( const wxSize& minSize,
const wxSize& maxSize=wxDefaultSize,
const wxSize& incSize=wxDefaultSize)
{ DoSetSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y, incSize.x, incSize.y); }
#if WXWIN_COMPATIBILITY_2_8
// these are useless and do nothing since wxWidgets 2.9
wxDEPRECATED( virtual void SetVirtualSizeHints( int minW, int minH,
int maxW = wxDefaultCoord, int maxH = wxDefaultCoord ) );
wxDEPRECATED( void SetVirtualSizeHints( const wxSize& minSize,
const wxSize& maxSize=wxDefaultSize) );
#endif // WXWIN_COMPATIBILITY_2_8
// Call these to override what GetBestSize() returns. This
// method is only virtual because it is overridden in wxTLW
// as a different API for SetSizeHints().
virtual void SetMinSize(const wxSize& minSize);
virtual void SetMaxSize(const wxSize& maxSize);
// Like Set*Size, but for client, not window, size
virtual void SetMinClientSize(const wxSize& size)
{ SetMinSize(ClientToWindowSize(size)); }
virtual void SetMaxClientSize(const wxSize& size)
{ SetMaxSize(ClientToWindowSize(size)); }
// Override these methods to impose restrictions on min/max size.
// The easier way is to call SetMinSize() and SetMaxSize() which
// will have the same effect. Doing both is non-sense.
virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); }
virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); }
// Like Get*Size, but for client, not window, size
virtual wxSize GetMinClientSize() const
{ return WindowToClientSize(GetMinSize()); }
virtual wxSize GetMaxClientSize() const
{ return WindowToClientSize(GetMaxSize()); }
// Get the min and max values one by one
int GetMinWidth() const { return GetMinSize().x; }
int GetMinHeight() const { return GetMinSize().y; }
int GetMaxWidth() const { return GetMaxSize().x; }
int GetMaxHeight() const { return GetMaxSize().y; }
// Methods for accessing the virtual size of a window. For most
// windows this is just the client area of the window, but for
// some like scrolled windows it is more or less independent of
// the screen window size. You may override the DoXXXVirtual
// methods below for classes where that is the case.
void SetVirtualSize( const wxSize &size ) { DoSetVirtualSize( size.x, size.y ); }
void SetVirtualSize( int x, int y ) { DoSetVirtualSize( x, y ); }
wxSize GetVirtualSize() const { return DoGetVirtualSize(); }
void GetVirtualSize( int *x, int *y ) const
{
wxSize s( DoGetVirtualSize() );
if( x )
*x = s.GetWidth();
if( y )
*y = s.GetHeight();
}
// Override these methods for windows that have a virtual size
// independent of their client size. e.g. the virtual area of a
// wxScrolledWindow.
virtual void DoSetVirtualSize( int x, int y );
virtual wxSize DoGetVirtualSize() const;
// Return the largest of ClientSize and BestSize (as determined
// by a sizer, interior children, or other means)
virtual wxSize GetBestVirtualSize() const
{
wxSize client( GetClientSize() );
wxSize best( GetBestSize() );
return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) );
}
// returns the magnification of the content of this window
// e.g. 2.0 for a window on a retina screen
virtual double GetContentScaleFactor() const;
// return the size of the left/right and top/bottom borders in x and y
// components of the result respectively
virtual wxSize GetWindowBorderSize() const;
// wxSizer and friends use this to give a chance to a component to recalc
// its min size once one of the final size components is known. Override
// this function when that is useful (such as for wxStaticText which can
// stretch over several lines). Parameter availableOtherDir
// tells the item how much more space there is available in the opposite
// direction (-1 if unknown).
virtual bool
InformFirstDirection(int direction, int size, int availableOtherDir);
// sends a size event to the window using its current size -- this has an
// effect of refreshing the window layout
//
// by default the event is sent, i.e. processed immediately, but if flags
// value includes wxSEND_EVENT_POST then it's posted, i.e. only schedule
// for later processing
virtual void SendSizeEvent(int flags = 0);
// this is a safe wrapper for GetParent()->SendSizeEvent(): it checks that
// we have a parent window and it's not in process of being deleted
//
// this is used by controls such as tool/status bars changes to which must
// also result in parent re-layout
void SendSizeEventToParent(int flags = 0);
// this is a more readable synonym for SendSizeEvent(wxSEND_EVENT_POST)
void PostSizeEvent() { SendSizeEvent(wxSEND_EVENT_POST); }
// this is the same as SendSizeEventToParent() but using PostSizeEvent()
void PostSizeEventToParent() { SendSizeEventToParent(wxSEND_EVENT_POST); }
// These functions should be used before repositioning the children of
// this window to reduce flicker or, in MSW case, even avoid display
// corruption in some situations (so they're more than just optimization).
//
// EndRepositioningChildren() should be called if and only if
// BeginRepositioningChildren() returns true. To ensure that this is always
// done automatically, use ChildrenRepositioningGuard class below.
virtual bool BeginRepositioningChildren() { return false; }
virtual void EndRepositioningChildren() { }
// A simple helper which ensures that EndRepositioningChildren() is called
// from its dtor if and only if calling BeginRepositioningChildren() from
// the ctor returned true.
class ChildrenRepositioningGuard
{
public:
// Notice that window can be NULL here, for convenience. In this case
// this class simply doesn't do anything.
explicit ChildrenRepositioningGuard(wxWindowBase* win)
: m_win(win),
m_callEnd(win && win->BeginRepositioningChildren())
{
}
~ChildrenRepositioningGuard()
{
if ( m_callEnd )
m_win->EndRepositioningChildren();
}
private:
wxWindowBase* const m_win;
const bool m_callEnd;
wxDECLARE_NO_COPY_CLASS(ChildrenRepositioningGuard);
};
// window state
// ------------
// returns true if window was shown/hidden, false if the nothing was
// done (window was already shown/hidden)
virtual bool Show( bool show = true );
bool Hide() { return Show(false); }
// show or hide the window with a special effect, not implemented on
// most platforms (where it is the same as Show()/Hide() respectively)
//
// timeout specifies how long the animation should take, in ms, the
// default value of 0 means to use the default (system-dependent) value
virtual bool ShowWithEffect(wxShowEffect WXUNUSED(effect),
unsigned WXUNUSED(timeout) = 0)
{
return Show();
}
virtual bool HideWithEffect(wxShowEffect WXUNUSED(effect),
unsigned WXUNUSED(timeout) = 0)
{
return Hide();
}
// returns true if window was enabled/disabled, false if nothing done
virtual bool Enable( bool enable = true );
bool Disable() { return Enable(false); }
virtual bool IsShown() const { return m_isShown; }
// returns true if the window is really enabled and false otherwise,
// whether because it had been explicitly disabled itself or because
// its parent is currently disabled -- then this method returns false
// whatever is the intrinsic state of this window, use IsThisEnabled(0
// to retrieve it. In other words, this relation always holds:
//
// IsEnabled() == IsThisEnabled() && parent.IsEnabled()
//
bool IsEnabled() const;
// returns the internal window state independently of the parent(s)
// state, i.e. the state in which the window would be if all its
// parents were enabled (use IsEnabled() above to get the effective
// window state)
bool IsThisEnabled() const { return m_isEnabled; }
// returns true if the window is visible, i.e. IsShown() returns true
// if called on it and all its parents up to the first TLW
virtual bool IsShownOnScreen() const;
// get/set window style (setting style won't update the window and so
// is only useful for internal usage)
virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; }
virtual long GetWindowStyleFlag() const { return m_windowStyle; }
// just some (somewhat shorter) synonyms
void SetWindowStyle( long style ) { SetWindowStyleFlag(style); }
long GetWindowStyle() const { return GetWindowStyleFlag(); }
// check if the flag is set
bool HasFlag(int flag) const { return (m_windowStyle & flag) != 0; }
virtual bool IsRetained() const { return HasFlag(wxRETAINED); }
// turn the flag on if it had been turned off before and vice versa,
// return true if the flag is currently turned on
bool ToggleWindowStyle(int flag);
// extra style: the less often used style bits which can't be set with
// SetWindowStyleFlag()
virtual void SetExtraStyle(long exStyle) { m_exStyle = exStyle; }
long GetExtraStyle() const { return m_exStyle; }
bool HasExtraStyle(int exFlag) const { return (m_exStyle & exFlag) != 0; }
#if WXWIN_COMPATIBILITY_2_8
// make the window modal (all other windows unresponsive)
wxDEPRECATED( virtual void MakeModal(bool modal = true) );
#endif
// (primitive) theming support
// ---------------------------
virtual void SetThemeEnabled(bool enableTheme) { m_themeEnabled = enableTheme; }
virtual bool GetThemeEnabled() const { return m_themeEnabled; }
// focus and keyboard handling
// ---------------------------
// set focus to this window
virtual void SetFocus() = 0;
// set focus to this window as the result of a keyboard action
virtual void SetFocusFromKbd() { SetFocus(); }
// return the window which currently has the focus or NULL
static wxWindow *FindFocus();
static wxWindow *DoFindFocus() /* = 0: implement in derived classes */;
// return true if the window has focus (handles composite windows
// correctly - returns true if GetMainWindowOfCompositeControl()
// has focus)
virtual bool HasFocus() const;
// can this window have focus in principle?
//
// the difference between AcceptsFocus[FromKeyboard]() and CanAcceptFocus
// [FromKeyboard]() is that the former functions are meant to be
// overridden in the derived classes to simply return false if the
// control can't have focus, while the latter are meant to be used by
// this class clients and take into account the current window state
virtual bool AcceptsFocus() const { return true; }
// can this window or one of its children accept focus?
//
// usually it's the same as AcceptsFocus() but is overridden for
// container windows
virtual bool AcceptsFocusRecursively() const { return AcceptsFocus(); }
// can this window be given focus by keyboard navigation? if not, the
// only way to give it focus (provided it accepts it at all) is to
// click it
virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); }
// Can this window be focused right now, in its current state? This
// shouldn't be called at all if AcceptsFocus() returns false.
//
// It is a convenient helper for the various functions using it below
// but also a hook allowing to override the default logic for some rare
// cases (currently just wxRadioBox in wxMSW) when it's inappropriate.
virtual bool CanBeFocused() const { return IsShown() && IsEnabled(); }
// can this window itself have focus?
bool IsFocusable() const { return AcceptsFocus() && CanBeFocused(); }
// can this window have focus right now?
//
// if this method returns true, it means that calling SetFocus() will
// put focus either to this window or one of its children, if you need
// to know whether this window accepts focus itself, use IsFocusable()
bool CanAcceptFocus() const
{ return AcceptsFocusRecursively() && CanBeFocused(); }
// can this window be assigned focus from keyboard right now?
bool CanAcceptFocusFromKeyboard() const
{ return AcceptsFocusFromKeyboard() && CanBeFocused(); }
// call this when the return value of AcceptsFocus() changes
virtual void SetCanFocus(bool WXUNUSED(canFocus)) { }
// navigates inside this window
bool NavigateIn(int flags = wxNavigationKeyEvent::IsForward)
{ return DoNavigateIn(flags); }
// navigates in the specified direction from this window, this is
// equivalent to GetParent()->NavigateIn()
bool Navigate(int flags = wxNavigationKeyEvent::IsForward)
{ return m_parent && ((wxWindowBase *)m_parent)->DoNavigateIn(flags); }
// this function will generate the appropriate call to Navigate() if the
// key event is one normally used for keyboard navigation and return true
// in this case
bool HandleAsNavigationKey(const wxKeyEvent& event);
// move this window just before/after the specified one in tab order
// (the other window must be our sibling!)
void MoveBeforeInTabOrder(wxWindow *win)
{ DoMoveInTabOrder(win, OrderBefore); }
void MoveAfterInTabOrder(wxWindow *win)
{ DoMoveInTabOrder(win, OrderAfter); }
// parent/children relations
// -------------------------
// get the list of children
const wxWindowList& GetChildren() const { return m_children; }
wxWindowList& GetChildren() { return m_children; }
// needed just for extended runtime
const wxWindowList& GetWindowChildren() const { return GetChildren() ; }
// get the window before/after this one in the parents children list,
// returns NULL if this is the first/last window
wxWindow *GetPrevSibling() const { return DoGetSibling(OrderBefore); }
wxWindow *GetNextSibling() const { return DoGetSibling(OrderAfter); }
// get the parent or the parent of the parent
wxWindow *GetParent() const { return m_parent; }
inline wxWindow *GetGrandParent() const;
// is this window a top level one?
virtual bool IsTopLevel() const;
// is this window a child or grand child of this one (inside the same
// TLW)?
bool IsDescendant(wxWindowBase* win) const;
// it doesn't really change parent, use Reparent() instead
void SetParent( wxWindowBase *parent );
// change the real parent of this window, return true if the parent
// was changed, false otherwise (error or newParent == oldParent)
virtual bool Reparent( wxWindowBase *newParent );
// implementation mostly
virtual void AddChild( wxWindowBase *child );
virtual void RemoveChild( wxWindowBase *child );
// returns true if the child is in the client area of the window, i.e. is
// not scrollbar, toolbar etc.
virtual bool IsClientAreaChild(const wxWindow *WXUNUSED(child)) const
{ return true; }
// looking for windows
// -------------------
// find window among the descendants of this one either by id or by
// name (return NULL if not found)
wxWindow *FindWindow(long winid) const;
wxWindow *FindWindow(const wxString& name) const;
// Find a window among any window (all return NULL if not found)
static wxWindow *FindWindowById( long winid, const wxWindow *parent = NULL );
static wxWindow *FindWindowByName( const wxString& name,
const wxWindow *parent = NULL );
static wxWindow *FindWindowByLabel( const wxString& label,
const wxWindow *parent = NULL );
// event handler stuff
// -------------------
// get the current event handler
wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
// replace the event handler (allows to completely subclass the
// window)
void SetEventHandler( wxEvtHandler *handler );
// push/pop event handler: allows to chain a custom event handler to
// already existing ones
void PushEventHandler( wxEvtHandler *handler );
wxEvtHandler *PopEventHandler( bool deleteHandler = false );
// find the given handler in the event handler chain and remove (but
// not delete) it from the event handler chain, return true if it was
// found and false otherwise (this also results in an assert failure so
// this function should only be called when the handler is supposed to
// be there)
bool RemoveEventHandler(wxEvtHandler *handler);
// Process an event by calling GetEventHandler()->ProcessEvent(): this
// is a straightforward replacement for ProcessEvent() itself which
// shouldn't be used directly with windows as it doesn't take into
// account any event handlers associated with the window
bool ProcessWindowEvent(wxEvent& event)
{ return GetEventHandler()->ProcessEvent(event); }
// Call GetEventHandler()->ProcessEventLocally(): this should be used
// instead of calling ProcessEventLocally() directly on the window
// itself as this wouldn't take any pushed event handlers into account
// correctly
bool ProcessWindowEventLocally(wxEvent& event)
{ return GetEventHandler()->ProcessEventLocally(event); }
// Process an event by calling GetEventHandler()->ProcessEvent() and
// handling any exceptions thrown by event handlers. It's mostly useful
// when processing wx events when called from C code (e.g. in GTK+
// callback) when the exception wouldn't correctly propagate to
// wxEventLoop.
bool HandleWindowEvent(wxEvent& event) const;
// disable wxEvtHandler double-linked list mechanism:
virtual void SetNextHandler(wxEvtHandler *handler) wxOVERRIDE;
virtual void SetPreviousHandler(wxEvtHandler *handler) wxOVERRIDE;
protected:
// NOTE: we change the access specifier of the following wxEvtHandler functions
// so that the user won't be able to call them directly.
// Calling wxWindow::ProcessEvent in fact only works when there are NO
// event handlers pushed on the window.
// To ensure correct operation, instead of wxWindow::ProcessEvent
// you must always call wxWindow::GetEventHandler()->ProcessEvent()
// or HandleWindowEvent().
// The same holds for all other wxEvtHandler functions.
using wxEvtHandler::ProcessEvent;
using wxEvtHandler::ProcessEventLocally;
#if wxUSE_THREADS
using wxEvtHandler::ProcessThreadEvent;
#endif
using wxEvtHandler::SafelyProcessEvent;
using wxEvtHandler::ProcessPendingEvents;
using wxEvtHandler::AddPendingEvent;
using wxEvtHandler::QueueEvent;
public:
// validators
// ----------
#if wxUSE_VALIDATORS
// a window may have an associated validator which is used to control
// user input
virtual void SetValidator( const wxValidator &validator );
virtual wxValidator *GetValidator() { return m_windowValidator; }
#endif // wxUSE_VALIDATORS
// dialog oriented functions
// -------------------------
// validate the correctness of input, return true if ok
virtual bool Validate();
// transfer data between internal and GUI representations
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
virtual void InitDialog();
#if wxUSE_ACCEL
// accelerators
// ------------
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel )
{ m_acceleratorTable = accel; }
wxAcceleratorTable *GetAcceleratorTable()
{ return &m_acceleratorTable; }
#endif // wxUSE_ACCEL
#if wxUSE_HOTKEY
// hot keys (system wide accelerators)
// -----------------------------------
virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode);
virtual bool UnregisterHotKey(int hotkeyId);
#endif // wxUSE_HOTKEY
// translation between different units
// -----------------------------------
// DPI-independent pixels, or DIPs, are pixel values for the standard
// 96 DPI display, they are scaled to take the current resolution into
// account (i.e. multiplied by the same factor as returned by
// GetContentScaleFactor()) if necessary for the current platform.
//
// Currently the conversion factor is the same for all windows but this
// will change with the monitor-specific resolution support in the
// future, so prefer using the non-static member functions.
//
// Similarly, currently in practice the factor is the same in both
// horizontal and vertical directions, but this could, in principle,
// change too, so prefer using the overloads taking wxPoint or wxSize.
static wxSize FromDIP(const wxSize& sz, const wxWindowBase* w);
static wxPoint FromDIP(const wxPoint& pt, const wxWindowBase* w)
{
const wxSize sz = FromDIP(wxSize(pt.x, pt.y), w);
return wxPoint(sz.x, sz.y);
}
static int FromDIP(int d, const wxWindowBase* w)
{
return FromDIP(wxSize(d, 0), w).x;
}
wxSize FromDIP(const wxSize& sz) const { return FromDIP(sz, this); }
wxPoint FromDIP(const wxPoint& pt) const { return FromDIP(pt, this); }
int FromDIP(int d) const { return FromDIP(d, this); }
static wxSize ToDIP(const wxSize& sz, const wxWindowBase* w);
static wxPoint ToDIP(const wxPoint& pt, const wxWindowBase* w)
{
const wxSize sz = ToDIP(wxSize(pt.x, pt.y), w);
return wxPoint(sz.x, sz.y);
}
static int ToDIP(int d, const wxWindowBase* w)
{
return ToDIP(wxSize(d, 0), w).x;
}
wxSize ToDIP(const wxSize& sz) const { return ToDIP(sz, this); }
wxPoint ToDIP(const wxPoint& pt) const { return ToDIP(pt, this); }
int ToDIP(int d) const { return ToDIP(d, this); }
// Dialog units are based on the size of the current font.
wxPoint ConvertPixelsToDialog( const wxPoint& pt ) const;
wxPoint ConvertDialogToPixels( const wxPoint& pt ) const;
wxSize ConvertPixelsToDialog( const wxSize& sz ) const
{
wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y)));
return wxSize(pt.x, pt.y);
}
wxSize ConvertDialogToPixels( const wxSize& sz ) const
{
wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y)));
return wxSize(pt.x, pt.y);
}
// mouse functions
// ---------------
// move the mouse to the specified position
virtual void WarpPointer(int x, int y) = 0;
// start or end mouse capture, these functions maintain the stack of
// windows having captured the mouse and after calling ReleaseMouse()
// the mouse is not released but returns to the window which had had
// captured it previously (if any)
void CaptureMouse();
void ReleaseMouse();
// get the window which currently captures the mouse or NULL
static wxWindow *GetCapture();
// does this window have the capture?
virtual bool HasCapture() const
{ return (wxWindow *)this == GetCapture(); }
// enable the specified touch events for this window, return false if
// the requested events are not supported
virtual bool EnableTouchEvents(int WXUNUSED(eventsMask))
{
return false;
}
// painting the window
// -------------------
// mark the specified rectangle (or the whole window) as "dirty" so it
// will be repainted
virtual void Refresh( bool eraseBackground = true,
const wxRect *rect = (const wxRect *) NULL ) = 0;
// a less awkward wrapper for Refresh
void RefreshRect(const wxRect& rect, bool eraseBackground = true)
{
Refresh(eraseBackground, &rect);
}
// repaint all invalid areas of the window immediately
virtual void Update() { }
// clear the window background
virtual void ClearBackground();
// freeze the window: don't redraw it until it is thawed
void Freeze();
// thaw the window: redraw it after it had been frozen
void Thaw();
// return true if window had been frozen and not unthawed yet
bool IsFrozen() const { return m_freezeCount != 0; }
// adjust DC for drawing on this window
virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { }
// enable or disable double buffering
virtual void SetDoubleBuffered(bool WXUNUSED(on)) { }
// return true if the window contents is double buffered by the system
virtual bool IsDoubleBuffered() const { return false; }
// the update region of the window contains the areas which must be
// repainted by the program
const wxRegion& GetUpdateRegion() const { return m_updateRegion; }
wxRegion& GetUpdateRegion() { return m_updateRegion; }
// get the update rectangle region bounding box in client coords
wxRect GetUpdateClientRect() const;
// these functions verify whether the given point/rectangle belongs to
// (or at least intersects with) the update region
virtual bool DoIsExposed( int x, int y ) const;
virtual bool DoIsExposed( int x, int y, int w, int h ) const;
bool IsExposed( int x, int y ) const
{ return DoIsExposed(x, y); }
bool IsExposed( int x, int y, int w, int h ) const
{ return DoIsExposed(x, y, w, h); }
bool IsExposed( const wxPoint& pt ) const
{ return DoIsExposed(pt.x, pt.y); }
bool IsExposed( const wxRect& rect ) const
{ return DoIsExposed(rect.x, rect.y, rect.width, rect.height); }
// colours, fonts and cursors
// --------------------------
// get the default attributes for the controls of this class: we
// provide a virtual function which can be used to query the default
// attributes of an existing control and a static function which can
// be used even when no existing object of the given class is
// available, but which won't return any styles specific to this
// particular control, of course (e.g. "Ok" button might have
// different -- bold for example -- font)
virtual wxVisualAttributes GetDefaultAttributes() const
{
return GetClassDefaultAttributes(GetWindowVariant());
}
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// set/retrieve the window colours (system defaults are used by
// default): SetXXX() functions return true if colour was changed,
// SetDefaultXXX() reset the "m_inheritXXX" flag after setting the
// value to prevent it from being inherited by our children
virtual bool SetBackgroundColour(const wxColour& colour);
void SetOwnBackgroundColour(const wxColour& colour)
{
if ( SetBackgroundColour(colour) )
m_inheritBgCol = false;
}
wxColour GetBackgroundColour() const;
bool InheritsBackgroundColour() const
{
return m_inheritBgCol;
}
bool UseBgCol() const
{
return m_hasBgCol;
}
bool UseBackgroundColour() const
{
return UseBgCol();
}
virtual bool SetForegroundColour(const wxColour& colour);
void SetOwnForegroundColour(const wxColour& colour)
{
if ( SetForegroundColour(colour) )
m_inheritFgCol = false;
}
wxColour GetForegroundColour() const;
bool UseForegroundColour() const
{
return m_hasFgCol;
}
bool InheritsForegroundColour() const
{
return m_inheritFgCol;
}
// Set/get the background style.
virtual bool SetBackgroundStyle(wxBackgroundStyle style);
wxBackgroundStyle GetBackgroundStyle() const
{ return m_backgroundStyle; }
// returns true if the control has "transparent" areas such as a
// wxStaticText and wxCheckBox and the background should be adapted
// from a parent window
virtual bool HasTransparentBackground() { return false; }
// Returns true if background transparency is supported for this
// window, i.e. if calling SetBackgroundStyle(wxBG_STYLE_TRANSPARENT)
// has a chance of succeeding. If reason argument is non-NULL, returns a
// user-readable explanation of why it isn't supported if the return
// value is false.
virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const;
// set/retrieve the font for the window (SetFont() returns true if the
// font really changed)
virtual bool SetFont(const wxFont& font) = 0;
void SetOwnFont(const wxFont& font)
{
if ( SetFont(font) )
m_inheritFont = false;
}
wxFont GetFont() const;
// set/retrieve the cursor for this window (SetCursor() returns true
// if the cursor was really changed)
virtual bool SetCursor( const wxCursor &cursor );
const wxCursor& GetCursor() const { return m_cursor; }
#if wxUSE_CARET
// associate a caret with the window
void SetCaret(wxCaret *caret);
// get the current caret (may be NULL)
wxCaret *GetCaret() const { return m_caret; }
#endif // wxUSE_CARET
// get the (average) character size for the current font
virtual int GetCharHeight() const = 0;
virtual int GetCharWidth() const = 0;
// get the width/height/... of the text using current or specified
// font
void GetTextExtent(const wxString& string,
int *x, int *y,
int *descent = NULL,
int *externalLeading = NULL,
const wxFont *font = NULL) const
{
DoGetTextExtent(string, x, y, descent, externalLeading, font);
}
wxSize GetTextExtent(const wxString& string) const
{
wxCoord w, h;
GetTextExtent(string, &w, &h);
return wxSize(w, h);
}
// client <-> screen coords
// ------------------------
// translate to/from screen/client coordinates (pointers may be NULL)
void ClientToScreen( int *x, int *y ) const
{ DoClientToScreen(x, y); }
void ScreenToClient( int *x, int *y ) const
{ DoScreenToClient(x, y); }
// wxPoint interface to do the same thing
wxPoint ClientToScreen(const wxPoint& pt) const
{
int x = pt.x, y = pt.y;
DoClientToScreen(&x, &y);
return wxPoint(x, y);
}
wxPoint ScreenToClient(const wxPoint& pt) const
{
int x = pt.x, y = pt.y;
DoScreenToClient(&x, &y);
return wxPoint(x, y);
}
// test where the given (in client coords) point lies
wxHitTest HitTest(wxCoord x, wxCoord y) const
{ return DoHitTest(x, y); }
wxHitTest HitTest(const wxPoint& pt) const
{ return DoHitTest(pt.x, pt.y); }
// misc
// ----
// get the window border style from the given flags: this is different from
// simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to
// translate wxBORDER_DEFAULT to something reasonable
wxBorder GetBorder(long flags) const;
// get border for the flags of this window
wxBorder GetBorder() const { return GetBorder(GetWindowStyleFlag()); }
// send wxUpdateUIEvents to this window, and children if recurse is true
virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
// do the window-specific processing after processing the update event
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ;
#if wxUSE_MENUS
// show popup menu at the given position, generate events for the items
// selected in it
bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition)
{ return PopupMenu(menu, pos.x, pos.y); }
bool PopupMenu(wxMenu *menu, int x, int y);
// simply return the id of the selected item or wxID_NONE without
// generating any events
int GetPopupMenuSelectionFromUser(wxMenu& menu,
const wxPoint& pos = wxDefaultPosition)
{ return DoGetPopupMenuSelectionFromUser(menu, pos.x, pos.y); }
int GetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y)
{ return DoGetPopupMenuSelectionFromUser(menu, x, y); }
#endif // wxUSE_MENUS
// override this method to return true for controls having multiple pages
virtual bool HasMultiplePages() const { return false; }
// scrollbars
// ----------
// can the window have the scrollbar in this orientation?
virtual bool CanScroll(int orient) const;
// does the window have the scrollbar in this orientation?
bool HasScrollbar(int orient) const;
// configure the window scrollbars
virtual void SetScrollbar( int orient,
int pos,
int thumbvisible,
int range,
bool refresh = true ) = 0;
virtual void SetScrollPos( int orient, int pos, bool refresh = true ) = 0;
virtual int GetScrollPos( int orient ) const = 0;
virtual int GetScrollThumb( int orient ) const = 0;
virtual int GetScrollRange( int orient ) const = 0;
// scroll window to the specified position
virtual void ScrollWindow( int dx, int dy,
const wxRect* rect = NULL ) = 0;
// scrolls window by line/page: note that not all controls support this
//
// return true if the position changed, false otherwise
virtual bool ScrollLines(int WXUNUSED(lines)) { return false; }
virtual bool ScrollPages(int WXUNUSED(pages)) { return false; }
// convenient wrappers for ScrollLines/Pages
bool LineUp() { return ScrollLines(-1); }
bool LineDown() { return ScrollLines(1); }
bool PageUp() { return ScrollPages(-1); }
bool PageDown() { return ScrollPages(1); }
// call this to always show one or both scrollbars, even if the window
// is big enough to not require them
virtual void AlwaysShowScrollbars(bool WXUNUSED(horz) = true,
bool WXUNUSED(vert) = true)
{
}
// return true if AlwaysShowScrollbars() had been called before for the
// corresponding orientation
virtual bool IsScrollbarAlwaysShown(int WXUNUSED(orient)) const
{
return false;
}
// context-sensitive help
// ----------------------
// these are the convenience functions wrapping wxHelpProvider methods
#if wxUSE_HELP
// associate this help text with this window
void SetHelpText(const wxString& text);
#if WXWIN_COMPATIBILITY_2_8
// Associate this help text with all windows with the same id as this one.
// Don't use this, do wxHelpProvider::Get()->AddHelp(id, text);
wxDEPRECATED( void SetHelpTextForId(const wxString& text) );
#endif // WXWIN_COMPATIBILITY_2_8
// get the help string associated with the given position in this window
//
// notice that pt may be invalid if event origin is keyboard or unknown
// and this method should return the global window help text then
virtual wxString GetHelpTextAtPoint(const wxPoint& pt,
wxHelpEvent::Origin origin) const;
// returns the position-independent help text
wxString GetHelpText() const
{
return GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Unknown);
}
#else // !wxUSE_HELP
// silently ignore SetHelpText() calls
void SetHelpText(const wxString& WXUNUSED(text)) { }
void SetHelpTextForId(const wxString& WXUNUSED(text)) { }
#endif // wxUSE_HELP
// tooltips
// --------
#if wxUSE_TOOLTIPS
// the easiest way to set a tooltip for a window is to use this method
void SetToolTip( const wxString &tip ) { DoSetToolTipText(tip); }
// attach a tooltip to the window, pointer can be NULL to remove
// existing tooltip
void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); }
// more readable synonym for SetToolTip(NULL)
void UnsetToolTip() { SetToolTip(NULL); }
// get the associated tooltip or NULL if none
wxToolTip* GetToolTip() const { return m_tooltip; }
wxString GetToolTipText() const;
// Use the same tool tip as the given one (which can be NULL to indicate
// that no tooltip should be used) for this window. This is currently only
// used by wxCompositeWindow::DoSetToolTip() implementation and is not part
// of the public wx API.
//
// Returns true if tip was valid and we copied it or false if it was NULL
// and we reset our own tooltip too.
bool CopyToolTip(wxToolTip *tip);
#else // !wxUSE_TOOLTIPS
// make it much easier to compile apps in an environment
// that doesn't support tooltips
void SetToolTip(const wxString & WXUNUSED(tip)) { }
void UnsetToolTip() { }
#endif // wxUSE_TOOLTIPS/!wxUSE_TOOLTIPS
// drag and drop
// -------------
#if wxUSE_DRAG_AND_DROP
// set/retrieve the drop target associated with this window (may be
// NULL; it's owned by the window and will be deleted by it)
virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0;
virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; }
// Accept files for dragging
virtual void DragAcceptFiles(bool accept)
#ifdef __WXMSW__
// it does have common implementation but not for MSW which has its own
// native version of it
= 0
#endif // __WXMSW__
;
#endif // wxUSE_DRAG_AND_DROP
// constraints and sizers
// ----------------------
#if wxUSE_CONSTRAINTS
// set the constraints for this window or retrieve them (may be NULL)
void SetConstraints( wxLayoutConstraints *constraints );
wxLayoutConstraints *GetConstraints() const { return m_constraints; }
// implementation only
void UnsetConstraints(wxLayoutConstraints *c);
wxWindowList *GetConstraintsInvolvedIn() const
{ return m_constraintsInvolvedIn; }
void AddConstraintReference(wxWindowBase *otherWin);
void RemoveConstraintReference(wxWindowBase *otherWin);
void DeleteRelatedConstraints();
void ResetConstraints();
// these methods may be overridden for special layout algorithms
virtual void SetConstraintSizes(bool recurse = true);
virtual bool LayoutPhase1(int *noChanges);
virtual bool LayoutPhase2(int *noChanges);
virtual bool DoPhase(int phase);
// these methods are virtual but normally won't be overridden
virtual void SetSizeConstraint(int x, int y, int w, int h);
virtual void MoveConstraint(int x, int y);
virtual void GetSizeConstraint(int *w, int *h) const ;
virtual void GetClientSizeConstraint(int *w, int *h) const ;
virtual void GetPositionConstraint(int *x, int *y) const ;
#endif // wxUSE_CONSTRAINTS
// when using constraints or sizers, it makes sense to update
// children positions automatically whenever the window is resized
// - this is done if autoLayout is on
void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; }
bool GetAutoLayout() const { return m_autoLayout; }
// lay out the window and its children
virtual bool Layout();
// sizers
void SetSizer(wxSizer *sizer, bool deleteOld = true );
void SetSizerAndFit( wxSizer *sizer, bool deleteOld = true );
wxSizer *GetSizer() const { return m_windowSizer; }
// Track if this window is a member of a sizer
void SetContainingSizer(wxSizer* sizer);
wxSizer *GetContainingSizer() const { return m_containingSizer; }
// accessibility
// ----------------------
#if wxUSE_ACCESSIBILITY
// Override to create a specific accessible object.
virtual wxAccessible* CreateAccessible() { return NULL; }
// Sets the accessible object.
void SetAccessible(wxAccessible* accessible) ;
// Returns the accessible object.
wxAccessible* GetAccessible() { return m_accessible; }
// Returns the accessible object, calling CreateAccessible if necessary.
// May return NULL, in which case system-provide accessible is used.
wxAccessible* GetOrCreateAccessible() ;
#endif
// Set window transparency if the platform supports it
virtual bool SetTransparent(wxByte WXUNUSED(alpha)) { return false; }
virtual bool CanSetTransparent() { return false; }
// implementation
// --------------
// event handlers
void OnSysColourChanged( wxSysColourChangedEvent& event );
void OnInitDialog( wxInitDialogEvent &event );
void OnMiddleClick( wxMouseEvent& event );
#if wxUSE_HELP
void OnHelp(wxHelpEvent& event);
#endif // wxUSE_HELP
// virtual function for implementing internal idle
// behaviour
virtual void OnInternalIdle();
// Send idle event to window and all subwindows
// Returns true if more idle time is requested.
virtual bool SendIdleEvents(wxIdleEvent& event);
// get the handle of the window for the underlying window system: this
// is only used for wxWin itself or for user code which wants to call
// platform-specific APIs
virtual WXWidget GetHandle() const = 0;
// associate the window with a new native handle
virtual void AssociateHandle(WXWidget WXUNUSED(handle)) { }
// dissociate the current native handle from the window
virtual void DissociateHandle() { }
#if wxUSE_PALETTE
// Store the palette used by DCs in wxWindow so that the dcs can share
// a palette. And we can respond to palette messages.
wxPalette GetPalette() const { return m_palette; }
// When palette is changed tell the DC to set the system palette to the
// new one.
void SetPalette(const wxPalette& pal);
// return true if we have a specific palette
bool HasCustomPalette() const { return m_hasCustomPalette; }
// return the first parent window with a custom palette or NULL
wxWindow *GetAncestorWithCustomPalette() const;
#endif // wxUSE_PALETTE
// inherit the parents visual attributes if they had been explicitly set
// by the user (i.e. we don't inherit default attributes) and if we don't
// have our own explicitly set
virtual void InheritAttributes();
// returns false from here if this window doesn't want to inherit the
// parents colours even if InheritAttributes() would normally do it
//
// this just provides a simple way to customize InheritAttributes()
// behaviour in the most common case
virtual bool ShouldInheritColours() const { return false; }
// returns true if the window can be positioned outside of parent's client
// area (normal windows can't, but e.g. menubar or statusbar can):
virtual bool CanBeOutsideClientArea() const { return false; }
// returns true if the platform should explicitly apply a theme border. Currently
// used only by Windows
virtual bool CanApplyThemeBorder() const { return true; }
// returns the main window of composite control; this is the window
// that FindFocus returns if the focus is in one of composite control's
// windows
virtual wxWindow *GetMainWindowOfCompositeControl()
{ return (wxWindow*)this; }
enum NavigationKind
{
Navigation_Tab,
Navigation_Accel
};
// If this function returns true, keyboard events of the given kind can't
// escape from it. A typical example of such "navigation domain" is a top
// level window because pressing TAB in one of them must not transfer focus
// to a different top level window. But it's not limited to them, e.g. MDI
// children frames are not top level windows (and their IsTopLevel()
// returns false) but still are self-contained navigation domains for the
// purposes of TAB navigation -- but not for the accelerators.
virtual bool IsTopNavigationDomain(NavigationKind WXUNUSED(kind)) const
{
return false;
}
protected:
// helper for the derived class Create() methods: the first overload, with
// validator parameter, should be used for child windows while the second
// one is used for top level ones
bool CreateBase(wxWindowBase *parent,
wxWindowID winid,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPanelNameStr);
bool CreateBase(wxWindowBase *parent,
wxWindowID winid,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name);
// event handling specific to wxWindow
virtual bool TryBefore(wxEvent& event) wxOVERRIDE;
virtual bool TryAfter(wxEvent& event) wxOVERRIDE;
enum WindowOrder
{
OrderBefore, // insert before the given window
OrderAfter // insert after the given window
};
// common part of GetPrev/NextSibling()
wxWindow *DoGetSibling(WindowOrder order) const;
// common part of MoveBefore/AfterInTabOrder()
virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move);
// implementation of Navigate() and NavigateIn()
virtual bool DoNavigateIn(int flags);
#if wxUSE_CONSTRAINTS
// satisfy the constraints for the windows but don't set the window sizes
void SatisfyConstraints();
#endif // wxUSE_CONSTRAINTS
// Send the wxWindowDestroyEvent if not done yet and sets m_isBeingDeleted
// to true
void SendDestroyEvent();
// this method should be implemented to use operating system specific code
// to really enable/disable the widget, it will only be called when we
// really need to enable/disable window and so no additional checks on the
// widgets state are necessary
virtual void DoEnable(bool WXUNUSED(enable)) { }
// the window id - a number which uniquely identifies a window among
// its siblings unless it is wxID_ANY
wxWindowIDRef m_windowId;
// the parent window of this window (or NULL) and the list of the children
// of this window
wxWindow *m_parent;
wxWindowList m_children;
// the minimal allowed size for the window (no minimal size if variable(s)
// contain(s) wxDefaultCoord)
int m_minWidth,
m_minHeight,
m_maxWidth,
m_maxHeight;
// event handler for this window: usually is just 'this' but may be
// changed with SetEventHandler()
wxEvtHandler *m_eventHandler;
#if wxUSE_VALIDATORS
// associated validator or NULL if none
wxValidator *m_windowValidator;
#endif // wxUSE_VALIDATORS
#if wxUSE_DRAG_AND_DROP
wxDropTarget *m_dropTarget;
#endif // wxUSE_DRAG_AND_DROP
// visual window attributes
wxCursor m_cursor;
wxFont m_font; // see m_hasFont
wxColour m_backgroundColour, // m_hasBgCol
m_foregroundColour; // m_hasFgCol
#if wxUSE_CARET
wxCaret *m_caret;
#endif // wxUSE_CARET
// the region which should be repainted in response to paint event
wxRegion m_updateRegion;
#if wxUSE_ACCEL
// the accelerator table for the window which translates key strokes into
// command events
wxAcceleratorTable m_acceleratorTable;
#endif // wxUSE_ACCEL
// the tooltip for this window (may be NULL)
#if wxUSE_TOOLTIPS
wxToolTip *m_tooltip;
#endif // wxUSE_TOOLTIPS
// constraints and sizers
#if wxUSE_CONSTRAINTS
// the constraints for this window or NULL
wxLayoutConstraints *m_constraints;
// constraints this window is involved in
wxWindowList *m_constraintsInvolvedIn;
#endif // wxUSE_CONSTRAINTS
// this window's sizer
wxSizer *m_windowSizer;
// The sizer this window is a member of, if any
wxSizer *m_containingSizer;
// Layout() window automatically when its size changes?
bool m_autoLayout:1;
// window state
bool m_isShown:1;
bool m_isEnabled:1;
bool m_isBeingDeleted:1;
// was the window colours/font explicitly changed by user?
bool m_hasBgCol:1;
bool m_hasFgCol:1;
bool m_hasFont:1;
// and should it be inherited by children?
bool m_inheritBgCol:1;
bool m_inheritFgCol:1;
bool m_inheritFont:1;
// window attributes
long m_windowStyle,
m_exStyle;
wxString m_windowName;
bool m_themeEnabled;
wxBackgroundStyle m_backgroundStyle;
#if wxUSE_PALETTE
wxPalette m_palette;
bool m_hasCustomPalette;
#endif // wxUSE_PALETTE
#if wxUSE_ACCESSIBILITY
wxAccessible* m_accessible;
#endif
// Virtual size (scrolling)
wxSize m_virtualSize;
wxScrollHelper *m_scrollHelper;
wxWindowVariant m_windowVariant ;
// override this to change the default (i.e. used when no style is
// specified) border for the window class
virtual wxBorder GetDefaultBorder() const;
// this allows you to implement standard control borders without
// repeating the code in different classes that are not derived from
// wxControl
virtual wxBorder GetDefaultBorderForControl() const { return wxBORDER_THEME; }
// Get the default size for the new window if no explicit size given. TLWs
// have their own default size so this is just for non top-level windows.
static int WidthDefault(int w) { return w == wxDefaultCoord ? 20 : w; }
static int HeightDefault(int h) { return h == wxDefaultCoord ? 20 : h; }
// Used to save the results of DoGetBestSize so it doesn't need to be
// recalculated each time the value is needed.
wxSize m_bestSizeCache;
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED_MSG("use SetInitialSize() instead.")
void SetBestSize(const wxSize& size);
wxDEPRECATED_MSG("use SetInitialSize() instead.")
virtual void SetInitialBestSize(const wxSize& size);
#endif // WXWIN_COMPATIBILITY_2_8
// more pure virtual functions
// ---------------------------
// NB: we must have DoSomething() function when Something() is an overloaded
// method: indeed, we can't just have "virtual Something()" in case when
// the function is overloaded because then we'd have to make virtual all
// the variants (otherwise only the virtual function may be called on a
// pointer to derived class according to C++ rules) which is, in
// general, absolutely not needed. So instead we implement all
// overloaded Something()s in terms of DoSomething() which will be the
// only one to be virtual.
// text extent
virtual void DoGetTextExtent(const wxString& string,
int *x, int *y,
int *descent = NULL,
int *externalLeading = NULL,
const wxFont *font = NULL) const = 0;
// coordinates translation
virtual void DoClientToScreen( int *x, int *y ) const = 0;
virtual void DoScreenToClient( int *x, int *y ) const = 0;
virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const;
// capture/release the mouse, used by Capture/ReleaseMouse()
virtual void DoCaptureMouse() = 0;
virtual void DoReleaseMouse() = 0;
// retrieve the position/size of the window
virtual void DoGetPosition(int *x, int *y) const = 0;
virtual void DoGetScreenPosition(int *x, int *y) const;
virtual void DoGetSize(int *width, int *height) const = 0;
virtual void DoGetClientSize(int *width, int *height) const = 0;
// get the size which best suits the window: for a control, it would be
// the minimal size which doesn't truncate the control, for a panel - the
// same size as it would have after a call to Fit()
virtual wxSize DoGetBestSize() const;
// this method can be overridden instead of DoGetBestSize() if it computes
// the best size of the client area of the window only, excluding borders
// (GetBorderSize() will be used to add them)
virtual wxSize DoGetBestClientSize() const { return wxDefaultSize; }
// These two methods can be overridden to implement intelligent
// width-for-height and/or height-for-width best size determination for the
// window. By default the fixed best size is used.
virtual int DoGetBestClientHeight(int WXUNUSED(width)) const
{ return wxDefaultCoord; }
virtual int DoGetBestClientWidth(int WXUNUSED(height)) const
{ return wxDefaultCoord; }
// this is the virtual function to be overridden in any derived class which
// wants to change how SetSize() or Move() works - it is called by all
// versions of these functions in the base class
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO) = 0;
// same as DoSetSize() for the client size
virtual void DoSetClientSize(int width, int height) = 0;
virtual void DoSetSizeHints( int minW, int minH,
int maxW, int maxH,
int incW, int incH );
// return the total size of the window borders, i.e. the sum of the widths
// of the left and the right border in the x component of the returned size
// and the sum of the heights of the top and bottom borders in the y one
//
// NB: this is currently only implemented properly for wxMSW, wxGTK and
// wxUniv and doesn't behave correctly in the presence of scrollbars in
// the other ports
virtual wxSize DoGetBorderSize() const;
// move the window to the specified location and resize it: this is called
// from both DoSetSize() and DoSetClientSize() and would usually just
// reposition this window except for composite controls which will want to
// arrange themselves inside the given rectangle
//
// Important note: the coordinates passed to this method are in parent's
// *window* coordinates and not parent's client coordinates (as the values
// passed to DoSetSize and returned by DoGetPosition are)!
virtual void DoMoveWindow(int x, int y, int width, int height) = 0;
// centre the window in the specified direction on parent, note that
// wxCENTRE_ON_SCREEN shouldn't be specified here, it only makes sense for
// TLWs
virtual void DoCentre(int dir);
#if wxUSE_TOOLTIPS
virtual void DoSetToolTipText( const wxString &tip );
virtual void DoSetToolTip( wxToolTip *tip );
#endif // wxUSE_TOOLTIPS
#if wxUSE_MENUS
virtual bool DoPopupMenu(wxMenu *menu, int x, int y) = 0;
#endif // wxUSE_MENUS
// Makes an adjustment to the window position to make it relative to the
// parents client area, e.g. if the parent is a frame with a toolbar, its
// (0, 0) is just below the toolbar
virtual void AdjustForParentClientOrigin(int& x, int& y,
int sizeFlags = 0) const;
// implements the window variants
virtual void DoSetWindowVariant( wxWindowVariant variant ) ;
// really freeze/thaw the window (should have port-specific implementation)
virtual void DoFreeze() { }
virtual void DoThaw() { }
// Must be called when mouse capture is lost to send
// wxMouseCaptureLostEvent to windows on capture stack.
static void NotifyCaptureLost();
private:
// recursively call our own and our children DoEnable() when the
// enabled/disabled status changed because a parent window had been
// enabled/disabled
void NotifyWindowOnEnableChange(bool enabled);
#if wxUSE_MENUS
// temporary event handlers used by GetPopupMenuSelectionFromUser()
void InternalOnPopupMenu(wxCommandEvent& event);
void InternalOnPopupMenuUpdate(wxUpdateUIEvent& event);
// implementation of the public GetPopupMenuSelectionFromUser() method
int DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y);
#endif // wxUSE_MENUS
// layout the window children when its size changes unless this was
// explicitly disabled with SetAutoLayout(false)
void InternalOnSize(wxSizeEvent& event);
// base for dialog unit conversion, i.e. average character size
wxSize GetDlgUnitBase() const;
// number of Freeze() calls minus the number of Thaw() calls: we're frozen
// (i.e. not being updated) if it is positive
unsigned int m_freezeCount;
wxDECLARE_ABSTRACT_CLASS(wxWindowBase);
wxDECLARE_NO_COPY_CLASS(wxWindowBase);
wxDECLARE_EVENT_TABLE();
};
#if WXWIN_COMPATIBILITY_2_8
// Inlines for some deprecated methods
inline wxSize wxWindowBase::GetBestFittingSize() const
{
return GetEffectiveMinSize();
}
inline void wxWindowBase::SetBestFittingSize(const wxSize& size)
{
SetInitialSize(size);
}
inline void wxWindowBase::SetBestSize(const wxSize& size)
{
SetInitialSize(size);
}
inline void wxWindowBase::SetInitialBestSize(const wxSize& size)
{
SetInitialSize(size);
}
#endif // WXWIN_COMPATIBILITY_2_8
// ----------------------------------------------------------------------------
// now include the declaration of wxWindow class
// ----------------------------------------------------------------------------
// include the declaration of the platform-specific class
#if defined(__WXMSW__)
#ifdef __WXUNIVERSAL__
#define wxWindowNative wxWindowMSW
#else // !wxUniv
#define wxWindowMSW wxWindow
#endif // wxUniv/!wxUniv
#include "wx/msw/window.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/window.h"
#elif defined(__WXGTK20__)
#ifdef __WXUNIVERSAL__
#define wxWindowNative wxWindowGTK
#else // !wxUniv
#define wxWindowGTK wxWindow
#endif // wxUniv
#include "wx/gtk/window.h"
#ifdef __WXGTK3__
#define wxHAVE_DPI_INDEPENDENT_PIXELS
#endif
#elif defined(__WXGTK__)
#ifdef __WXUNIVERSAL__
#define wxWindowNative wxWindowGTK
#else // !wxUniv
#define wxWindowGTK wxWindow
#endif // wxUniv
#include "wx/gtk1/window.h"
#elif defined(__WXX11__)
#ifdef __WXUNIVERSAL__
#define wxWindowNative wxWindowX11
#else // !wxUniv
#define wxWindowX11 wxWindow
#endif // wxUniv
#include "wx/x11/window.h"
#elif defined(__WXDFB__)
#define wxWindowNative wxWindowDFB
#include "wx/dfb/window.h"
#elif defined(__WXMAC__)
#ifdef __WXUNIVERSAL__
#define wxWindowNative wxWindowMac
#else // !wxUniv
#define wxWindowMac wxWindow
#endif // wxUniv
#include "wx/osx/window.h"
#define wxHAVE_DPI_INDEPENDENT_PIXELS
#elif defined(__WXQT__)
#ifdef __WXUNIVERSAL__
#define wxWindowNative wxWindowQt
#else // !wxUniv
#define wxWindowQt wxWindow
#endif // wxUniv
#include "wx/qt/window.h"
#endif
// for wxUniversal, we now derive the real wxWindow from wxWindow<platform>,
// for the native ports we already have defined it above
#if defined(__WXUNIVERSAL__)
#ifndef wxWindowNative
#error "wxWindowNative must be defined above!"
#endif
#include "wx/univ/window.h"
#endif // wxUniv
// ----------------------------------------------------------------------------
// inline functions which couldn't be declared in the class body because of
// forward dependencies
// ----------------------------------------------------------------------------
inline wxWindow *wxWindowBase::GetGrandParent() const
{
return m_parent ? m_parent->GetParent() : NULL;
}
#ifdef wxHAVE_DPI_INDEPENDENT_PIXELS
// FromDIP() and ToDIP() become trivial in this case, so make them inline to
// avoid any overhead.
/* static */
inline wxSize
wxWindowBase::FromDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w))
{
return sz;
}
/* static */
inline wxSize
wxWindowBase::ToDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w))
{
return sz;
}
#endif // wxHAVE_DPI_INDEPENDENT_PIXELS
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------
// Find the wxWindow at the current mouse position, also returning the mouse
// position.
extern WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPointer(wxPoint& pt);
// Get the current mouse position.
extern WXDLLIMPEXP_CORE wxPoint wxGetMousePosition();
// get the currently active window of this application or NULL
extern WXDLLIMPEXP_CORE wxWindow *wxGetActiveWindow();
// get the (first) top level parent window
WXDLLIMPEXP_CORE wxWindow* wxGetTopLevelParent(wxWindow *win);
#if wxUSE_ACCESSIBILITY
// ----------------------------------------------------------------------------
// accessible object for windows
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWindowAccessible: public wxAccessible
{
public:
wxWindowAccessible(wxWindow* win): wxAccessible(win) { if (win) win->SetAccessible(this); }
virtual ~wxWindowAccessible() {}
// Overridables
// Can return either a child object, or an integer
// representing the child element, starting from 1.
virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject) wxOVERRIDE;
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
virtual wxAccStatus GetLocation(wxRect& rect, int elementId) wxOVERRIDE;
// Navigates from fromId to toId/toObject.
virtual wxAccStatus Navigate(wxNavDir navDir, int fromId,
int* toId, wxAccessible** toObject) wxOVERRIDE;
// Gets the name of the specified object.
virtual wxAccStatus GetName(int childId, wxString* name) wxOVERRIDE;
// Gets the number of children.
virtual wxAccStatus GetChildCount(int* childCount) wxOVERRIDE;
// Gets the specified child (starting from 1).
// If *child is NULL and return value is wxACC_OK,
// this means that the child is a simple element and
// not an accessible object.
virtual wxAccStatus GetChild(int childId, wxAccessible** child) wxOVERRIDE;
// Gets the parent, or NULL.
virtual wxAccStatus GetParent(wxAccessible** parent) wxOVERRIDE;
// Performs the default action. childId is 0 (the action for this object)
// or > 0 (the action for a child).
// Return wxACC_NOT_SUPPORTED if there is no default action for this
// window (e.g. an edit control).
virtual wxAccStatus DoDefaultAction(int childId) wxOVERRIDE;
// Gets the default action for this object (0) or > 0 (the action for a child).
// Return wxACC_OK even if there is no action. actionName is the action, or the empty
// string if there is no action.
// The retrieved string describes the action that is performed on an object,
// not what the object does as a result. For example, a toolbar button that prints
// a document has a default action of "Press" rather than "Prints the current document."
virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName) wxOVERRIDE;
// Returns the description for this object or a child.
virtual wxAccStatus GetDescription(int childId, wxString* description) wxOVERRIDE;
// Returns help text for this object or a child, similar to tooltip text.
virtual wxAccStatus GetHelpText(int childId, wxString* helpText) wxOVERRIDE;
// Returns the keyboard shortcut for this object or child.
// Return e.g. ALT+K
virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut) wxOVERRIDE;
// Returns a role constant.
virtual wxAccStatus GetRole(int childId, wxAccRole* role) wxOVERRIDE;
// Returns a state constant.
virtual wxAccStatus GetState(int childId, long* state) wxOVERRIDE;
// Returns a localized string representing the value for the object
// or child.
virtual wxAccStatus GetValue(int childId, wxString* strValue) wxOVERRIDE;
// Selects the object or child.
virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags) wxOVERRIDE;
// Gets the window with the keyboard focus.
// If childId is 0 and child is NULL, no object in
// this subhierarchy has the focus.
// If this object has the focus, child should be 'this'.
virtual wxAccStatus GetFocus(int* childId, wxAccessible** child) wxOVERRIDE;
#if wxUSE_VARIANT
// Gets a variant representing the selected children
// of this object.
// Acceptable values:
// - a null variant (IsNull() returns true)
// - a list variant (GetType() == wxT("list")
// - an integer representing the selected child element,
// or 0 if this object is selected (GetType() == wxT("long")
// - a "void*" pointer to a wxAccessible child object
virtual wxAccStatus GetSelections(wxVariant* selections) wxOVERRIDE;
#endif // wxUSE_VARIANT
};
#endif // wxUSE_ACCESSIBILITY
#endif // _WX_WINDOW_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/appprogress.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/appprogress.h
// Purpose: wxAppProgressIndicator interface.
// Author: Chaobin Zhang <[email protected]>
// Created: 2014-09-05
// Copyright: (c) 2014 wxWidgets development team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_APPPROG_H_
#define _WX_APPPROG_H_
#include "wx/defs.h"
class WXDLLIMPEXP_CORE wxAppProgressIndicatorBase
{
public:
wxAppProgressIndicatorBase() {}
virtual ~wxAppProgressIndicatorBase() {}
virtual bool IsAvailable() const = 0;
virtual void SetValue(int value) = 0;
virtual void SetRange(int range) = 0;
virtual void Pulse() = 0;
virtual void Reset() = 0;
private:
wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicatorBase);
};
#if defined(__WXMSW__) && wxUSE_TASKBARBUTTON
#include "wx/msw/appprogress.h"
#elif defined(__WXOSX_COCOA__)
#include "wx/osx/appprogress.h"
#else
class wxAppProgressIndicator : public wxAppProgressIndicatorBase
{
public:
wxAppProgressIndicator(wxWindow* WXUNUSED(parent) = NULL,
int WXUNUSED(maxValue) = 100)
{
}
virtual bool IsAvailable() const wxOVERRIDE { return false; }
virtual void SetValue(int WXUNUSED(value)) wxOVERRIDE { }
virtual void SetRange(int WXUNUSED(range)) wxOVERRIDE { }
virtual void Pulse() wxOVERRIDE { }
virtual void Reset() wxOVERRIDE { }
};
#endif
#endif // _WX_APPPROG_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/busyinfo.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/busyinfo.h
// Purpose: Information window (when app is busy)
// Author: Vaclav Slavik
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __BUSYINFO_H_BASE__
#define __BUSYINFO_H_BASE__
#include "wx/defs.h"
#if wxUSE_BUSYINFO
#include "wx/colour.h"
#include "wx/icon.h"
class WXDLLIMPEXP_FWD_CORE wxWindow;
// This class is used to pass all the various parameters to wxBusyInfo ctor.
// According to the usual naming conventions (see wxAboutDialogInfo,
// wxFontInfo, ...) it would be called wxBusyInfoInfo, but this would have been
// rather strange, so we call it wxBusyInfoFlags instead.
//
// Methods are mostly self-explanatory except for the difference between "Text"
// and "Label": the former can contain markup, while the latter is just plain
// string which is not parsed in any way.
class wxBusyInfoFlags
{
public:
wxBusyInfoFlags()
{
m_parent = NULL;
m_alpha = wxALPHA_OPAQUE;
}
wxBusyInfoFlags& Parent(wxWindow* parent)
{ m_parent = parent; return *this; }
wxBusyInfoFlags& Icon(const wxIcon& icon)
{ m_icon = icon; return *this; }
wxBusyInfoFlags& Title(const wxString& title)
{ m_title = title; return *this; }
wxBusyInfoFlags& Text(const wxString& text)
{ m_text = text; return *this; }
wxBusyInfoFlags& Label(const wxString& label)
{ m_label = label; return *this; }
wxBusyInfoFlags& Foreground(const wxColour& foreground)
{ m_foreground = foreground; return *this; }
wxBusyInfoFlags& Background(const wxColour& background)
{ m_background = background; return *this; }
wxBusyInfoFlags& Transparency(wxByte alpha)
{ m_alpha = alpha; return *this; }
private:
wxWindow* m_parent;
wxIcon m_icon;
wxString m_title,
m_text,
m_label;
wxColour m_foreground,
m_background;
wxByte m_alpha;
friend class wxBusyInfo;
};
#include "wx/generic/busyinfo.h"
#endif // wxUSE_BUSYINFO
#endif // __BUSYINFO_H_BASE__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/selstore.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/selstore.h
// Purpose: wxSelectionStore stores selected items in a control
// Author: Vadim Zeitlin
// Modified by:
// Created: 08.06.03 (extracted from src/generic/listctrl.cpp)
// Copyright: (c) 2000-2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SELSTORE_H_
#define _WX_SELSTORE_H_
#include "wx/dynarray.h"
// ----------------------------------------------------------------------------
// wxSelectedIndices is just a sorted array of indices
// ----------------------------------------------------------------------------
inline int CMPFUNC_CONV wxUIntCmp(unsigned n1, unsigned n2)
{
return (int)(n1 - n2);
}
WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(unsigned, wxUIntCmp, wxSelectedIndices);
// ----------------------------------------------------------------------------
// wxSelectionStore is used to store the selected items in the virtual
// controls, i.e. it is well suited for storing even when the control contains
// a huge (practically infinite) number of items.
//
// Of course, internally it still has to store the selected items somehow (as
// an array currently) but the advantage is that it can handle the selection
// of all items (common operation) efficiently and that it could be made even
// smarter in the future (e.g. store the selections as an array of ranges +
// individual items) without changing its API.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSelectionStore
{
public:
wxSelectionStore() : m_itemsSel(wxUIntCmp) { Init(); }
// set the total number of items we handle
void SetItemCount(unsigned count);
// special case of SetItemCount(0)
void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; }
// must be called when new items are inserted/added
void OnItemsInserted(unsigned item, unsigned numItems);
// must be called when an items is deleted
void OnItemDelete(unsigned item);
// more efficient version for notifying the selection about deleting
// several items at once, return true if any of them were selected
bool OnItemsDeleted(unsigned item, unsigned numItems);
// select one item, use SelectRange() insted if possible!
//
// returns true if the items selection really changed
bool SelectItem(unsigned item, bool select = true);
// select the range of items (inclusive)
//
// return true and fill the itemsChanged array with the indices of items
// which have changed state if "few" of them did, otherwise return false
// (meaning that too many items changed state to bother counting them
// individually)
bool SelectRange(unsigned itemFrom, unsigned itemTo,
bool select = true,
wxArrayInt *itemsChanged = NULL);
// return true if the given item is selected
bool IsSelected(unsigned item) const;
// return true if no items are currently selected
bool IsEmpty() const
{
return m_defaultState ? m_itemsSel.size() == m_count
: m_itemsSel.empty();
}
// return the total number of selected items
unsigned GetSelectedCount() const
{
return m_defaultState ? m_count - m_itemsSel.GetCount()
: m_itemsSel.GetCount();
}
// type of a "cookie" used to preserve the iteration state, this is an
// opaque type, don't rely on its current representation
typedef size_t IterationState;
// constant representing absence of selection and hence end of iteration
static const unsigned NO_SELECTION;
// get the first selected item in index order, return NO_SELECTION if none
unsigned GetFirstSelectedItem(IterationState& cookie) const;
// get the next selected item, return NO_SELECTION if no more
unsigned GetNextSelectedItem(IterationState& cookie) const;
private:
// (re)init
void Init() { m_count = 0; m_defaultState = false; }
// the total number of items we handle
unsigned m_count;
// the default state: normally, false (i.e. off) but maybe set to true if
// there are more selected items than non selected ones - this allows to
// handle selection of all items efficiently
bool m_defaultState;
// the array of items whose selection state is different from default
wxSelectedIndices m_itemsSel;
wxDECLARE_NO_COPY_CLASS(wxSelectionStore);
};
#endif // _WX_SELSTORE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/docmdi.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/docmdi.h
// Purpose: Frame classes for MDI document/view applications
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) 1997 Julian Smart
// (c) 2010 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DOCMDI_H_
#define _WX_DOCMDI_H_
#include "wx/defs.h"
#if wxUSE_MDI_ARCHITECTURE
#include "wx/docview.h"
#include "wx/mdi.h"
// 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
{
public:
wxDocMDIParentFrame() : wxDocMDIParentFrameBase() { }
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)
{
}
private:
wxDECLARE_CLASS(wxDocMDIParentFrame);
wxDECLARE_NO_COPY_CLASS(wxDocMDIParentFrame);
};
// ----------------------------------------------------------------------------
// An MDI document child frame
// ----------------------------------------------------------------------------
typedef
wxDocChildFrameAny<wxMDIChildFrame, wxMDIParentFrame> wxDocMDIChildFrameBase;
class WXDLLIMPEXP_CORE wxDocMDIChildFrame : public wxDocMDIChildFrameBase
{
public:
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)
{
}
private:
wxDECLARE_CLASS(wxDocMDIChildFrame);
wxDECLARE_NO_COPY_CLASS(wxDocMDIChildFrame);
};
#endif // wxUSE_MDI_ARCHITECTURE
#endif // _WX_DOCMDI_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/overlay.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/overlay.h
// Purpose: wxOverlay class
// Author: Stefan Csomor
// Modified by:
// Created: 2006-10-20
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_OVERLAY_H_
#define _WX_OVERLAY_H_
#include "wx/defs.h"
#if defined(__WXDFB__)
#define wxHAS_NATIVE_OVERLAY 1
#elif defined(__WXOSX__) && wxOSX_USE_COCOA
#define wxHAS_NATIVE_OVERLAY 1
#else
// don't define wxHAS_NATIVE_OVERLAY
#endif
// ----------------------------------------------------------------------------
// creates an overlay over an existing window, allowing for manipulations like
// rubberbanding etc. This API is not stable yet, not to be used outside wx
// internal code
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxOverlayImpl;
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_CORE wxOverlay
{
public:
wxOverlay();
~wxOverlay();
// clears the overlay without restoring the former state
// to be done eg when the window content has been changed and repainted
void Reset();
// returns (port-specific) implementation of the overlay
wxOverlayImpl *GetImpl() { return m_impl; }
private:
friend class WXDLLIMPEXP_FWD_CORE wxDCOverlay;
// returns true if it has been setup
bool IsOk();
void Init(wxDC* dc, int x , int y , int width , int height);
void BeginDrawing(wxDC* dc);
void EndDrawing(wxDC* dc);
void Clear(wxDC* dc);
wxOverlayImpl* m_impl;
bool m_inDrawing;
wxDECLARE_NO_COPY_CLASS(wxOverlay);
};
class WXDLLIMPEXP_CORE wxDCOverlay
{
public:
// connects this overlay to the corresponding drawing dc, if the overlay is
// not initialized yet this call will do so
wxDCOverlay(wxOverlay &overlay, wxDC *dc, int x , int y , int width , int height);
// convenience wrapper that behaves the same using the entire area of the dc
wxDCOverlay(wxOverlay &overlay, wxDC *dc);
// removes the connection between the overlay and the dc
virtual ~wxDCOverlay();
// clears the layer, restoring the state at the last init
void Clear();
private:
void Init(wxDC *dc, int x , int y , int width , int height);
wxOverlay& m_overlay;
wxDC* m_dc;
wxDECLARE_NO_COPY_CLASS(wxDCOverlay);
};
#endif // _WX_OVERLAY_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/dc.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/dc.h
// Purpose: wxDC class
// Author: Vadim Zeitlin
// Modified by:
// Created: 05/25/99
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DC_H_BASE_
#define _WX_DC_H_BASE_
// ----------------------------------------------------------------------------
// headers which we must include here
// ----------------------------------------------------------------------------
#include "wx/object.h" // the base class
#include "wx/intl.h" // for wxLayoutDirection
#include "wx/colour.h" // we have member variables of these classes
#include "wx/font.h" // so we can't do without them
#include "wx/bitmap.h" // for wxNullBitmap
#include "wx/brush.h"
#include "wx/pen.h"
#include "wx/palette.h"
#include "wx/dynarray.h"
#include "wx/math.h"
#include "wx/image.h"
#include "wx/region.h"
#include "wx/affinematrix2d.h"
#define wxUSE_NEW_DC 1
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxClientDC;
class WXDLLIMPEXP_FWD_CORE wxPaintDC;
class WXDLLIMPEXP_FWD_CORE wxWindowDC;
class WXDLLIMPEXP_FWD_CORE wxScreenDC;
class WXDLLIMPEXP_FWD_CORE wxMemoryDC;
class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
class WXDLLIMPEXP_FWD_CORE wxPrintData;
class WXDLLIMPEXP_FWD_CORE wxWindow;
#if wxUSE_GRAPHICS_CONTEXT
class WXDLLIMPEXP_FWD_CORE wxGraphicsContext;
#endif
// Logical ops
enum wxRasterOperationMode
{
wxCLEAR, // 0
wxXOR, // src XOR dst
wxINVERT, // NOT dst
wxOR_REVERSE, // src OR (NOT dst)
wxAND_REVERSE, // src AND (NOT dst)
wxCOPY, // src
wxAND, // src AND dst
wxAND_INVERT, // (NOT src) AND dst
wxNO_OP, // dst
wxNOR, // (NOT src) AND (NOT dst)
wxEQUIV, // (NOT src) XOR dst
wxSRC_INVERT, // (NOT src)
wxOR_INVERT, // (NOT src) OR dst
wxNAND, // (NOT src) OR (NOT dst)
wxOR, // src OR dst
wxSET // 1
#if WXWIN_COMPATIBILITY_2_8
,wxROP_BLACK = wxCLEAR,
wxBLIT_BLACKNESS = wxCLEAR,
wxROP_XORPEN = wxXOR,
wxBLIT_SRCINVERT = wxXOR,
wxROP_NOT = wxINVERT,
wxBLIT_DSTINVERT = wxINVERT,
wxROP_MERGEPENNOT = wxOR_REVERSE,
wxBLIT_00DD0228 = wxOR_REVERSE,
wxROP_MASKPENNOT = wxAND_REVERSE,
wxBLIT_SRCERASE = wxAND_REVERSE,
wxROP_COPYPEN = wxCOPY,
wxBLIT_SRCCOPY = wxCOPY,
wxROP_MASKPEN = wxAND,
wxBLIT_SRCAND = wxAND,
wxROP_MASKNOTPEN = wxAND_INVERT,
wxBLIT_00220326 = wxAND_INVERT,
wxROP_NOP = wxNO_OP,
wxBLIT_00AA0029 = wxNO_OP,
wxROP_NOTMERGEPEN = wxNOR,
wxBLIT_NOTSRCERASE = wxNOR,
wxROP_NOTXORPEN = wxEQUIV,
wxBLIT_00990066 = wxEQUIV,
wxROP_NOTCOPYPEN = wxSRC_INVERT,
wxBLIT_NOTSCRCOPY = wxSRC_INVERT,
wxROP_MERGENOTPEN = wxOR_INVERT,
wxBLIT_MERGEPAINT = wxOR_INVERT,
wxROP_NOTMASKPEN = wxNAND,
wxBLIT_007700E6 = wxNAND,
wxROP_MERGEPEN = wxOR,
wxBLIT_SRCPAINT = wxOR,
wxROP_WHITE = wxSET,
wxBLIT_WHITENESS = wxSET
#endif //WXWIN_COMPATIBILITY_2_8
};
// Flood styles
enum wxFloodFillStyle
{
wxFLOOD_SURFACE = 1,
wxFLOOD_BORDER
};
// Mapping modes
enum wxMappingMode
{
wxMM_TEXT = 1,
wxMM_METRIC,
wxMM_LOMETRIC,
wxMM_TWIPS,
wxMM_POINTS
};
// Description of text characteristics.
struct wxFontMetrics
{
wxFontMetrics()
{
height =
ascent =
descent =
internalLeading =
externalLeading =
averageWidth = 0;
}
int height, // Total character height.
ascent, // Part of the height above the baseline.
descent, // Part of the height below the baseline.
internalLeading, // Intra-line spacing.
externalLeading, // Inter-line spacing.
averageWidth; // Average font width, a.k.a. "x-width".
};
#if WXWIN_COMPATIBILITY_2_8
//-----------------------------------------------------------------------------
// wxDrawObject helper class
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDrawObject
{
public:
wxDEPRECATED_CONSTRUCTOR(wxDrawObject)()
: m_isBBoxValid(false)
, m_minX(0), m_minY(0), m_maxX(0), m_maxY(0)
{ }
virtual ~wxDrawObject() { }
virtual void Draw(wxDC&) const { }
virtual void CalcBoundingBox(wxCoord x, wxCoord y)
{
if ( m_isBBoxValid )
{
if ( x < m_minX ) m_minX = x;
if ( y < m_minY ) m_minY = y;
if ( x > m_maxX ) m_maxX = x;
if ( y > m_maxY ) m_maxY = y;
}
else
{
m_isBBoxValid = true;
m_minX = x;
m_minY = y;
m_maxX = x;
m_maxY = y;
}
}
void ResetBoundingBox()
{
m_isBBoxValid = false;
m_minX = m_maxX = m_minY = m_maxY = 0;
}
// Get the final bounding box of the PostScript or Metafile picture.
wxCoord MinX() const { return m_minX; }
wxCoord MaxX() const { return m_maxX; }
wxCoord MinY() const { return m_minY; }
wxCoord MaxY() const { return m_maxY; }
//to define the type of object for derived objects
virtual int GetType()=0;
protected:
//for boundingbox calculation
bool m_isBBoxValid:1;
//for boundingbox calculation
wxCoord m_minX, m_minY, m_maxX, m_maxY;
};
#endif // WXWIN_COMPATIBILITY_2_8
//-----------------------------------------------------------------------------
// wxDCFactory
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxDCImpl;
class WXDLLIMPEXP_CORE wxDCFactory
{
public:
wxDCFactory() {}
virtual ~wxDCFactory() {}
virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) = 0;
virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) = 0;
virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) = 0;
virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) = 0;
virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) = 0;
virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) = 0;
virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) = 0;
#if wxUSE_PRINTING_ARCHITECTURE
virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) = 0;
#endif
static void Set(wxDCFactory *factory);
static wxDCFactory *Get();
private:
static wxDCFactory *m_factory;
};
//-----------------------------------------------------------------------------
// wxNativeDCFactory
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNativeDCFactory: public wxDCFactory
{
public:
wxNativeDCFactory() {}
virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) wxOVERRIDE;
virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) wxOVERRIDE;
virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) wxOVERRIDE;
virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) wxOVERRIDE;
virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) wxOVERRIDE;
virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) wxOVERRIDE;
virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) wxOVERRIDE;
#if wxUSE_PRINTING_ARCHITECTURE
virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) wxOVERRIDE;
#endif
};
//-----------------------------------------------------------------------------
// wxDCImpl
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDCImpl: public wxObject
{
public:
wxDCImpl( wxDC *owner );
virtual ~wxDCImpl();
wxDC *GetOwner() const { return m_owner; }
wxWindow* GetWindow() const { return m_window; }
virtual bool IsOk() const { return m_ok; }
// query capabilities
virtual bool CanDrawBitmap() const = 0;
virtual bool CanGetTextExtent() const = 0;
// get Cairo context
virtual void* GetCairoContext() const
{
return NULL;
}
virtual void* GetHandle() const { return NULL; }
// query dimension, colour deps, resolution
virtual void DoGetSize(int *width, int *height) const = 0;
void GetSize(int *width, int *height) const
{
DoGetSize(width, height);
return ;
}
wxSize GetSize() const
{
int w, h;
DoGetSize(&w, &h);
return wxSize(w, h);
}
virtual void DoGetSizeMM(int* width, int* height) const = 0;
virtual int GetDepth() const = 0;
virtual wxSize GetPPI() const = 0;
// Right-To-Left (RTL) modes
virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) { }
virtual wxLayoutDirection GetLayoutDirection() const { return wxLayout_Default; }
// page and document
virtual bool StartDoc(const wxString& WXUNUSED(message)) { return true; }
virtual void EndDoc() { }
virtual void StartPage() { }
virtual void EndPage() { }
// flushing the content of this dc immediately eg onto screen
virtual void Flush() { }
// bounding box
virtual void CalcBoundingBox(wxCoord x, wxCoord y)
{
// Bounding box is internally stored in device units.
x = LogicalToDeviceX(x);
y = LogicalToDeviceY(y);
if ( m_isBBoxValid )
{
if ( x < m_minX ) m_minX = x;
if ( y < m_minY ) m_minY = y;
if ( x > m_maxX ) m_maxX = x;
if ( y > m_maxY ) m_maxY = y;
}
else
{
m_isBBoxValid = true;
m_minX = x;
m_minY = y;
m_maxX = x;
m_maxY = y;
}
}
void ResetBoundingBox()
{
m_isBBoxValid = false;
m_minX = m_maxX = m_minY = m_maxY = 0;
}
// Get bounding box in logical units.
wxCoord MinX() const { return m_isBBoxValid ? DeviceToLogicalX(m_minX) : 0; }
wxCoord MaxX() const { return m_isBBoxValid ? DeviceToLogicalX(m_maxX) : 0; }
wxCoord MinY() const { return m_isBBoxValid ? DeviceToLogicalY(m_minY) : 0; }
wxCoord MaxY() const { return m_isBBoxValid ? DeviceToLogicalY(m_maxY) : 0; }
// setters and getters
virtual void SetFont(const wxFont& font) = 0;
virtual const wxFont& GetFont() const { return m_font; }
virtual void SetPen(const wxPen& pen) = 0;
virtual const wxPen& GetPen() const { return m_pen; }
virtual void SetBrush(const wxBrush& brush) = 0;
virtual const wxBrush& GetBrush() const { return m_brush; }
virtual void SetBackground(const wxBrush& brush) = 0;
virtual const wxBrush& GetBackground() const { return m_backgroundBrush; }
virtual void SetBackgroundMode(int mode) = 0;
virtual int GetBackgroundMode() const { return m_backgroundMode; }
virtual void SetTextForeground(const wxColour& colour)
{ m_textForegroundColour = colour; }
virtual const wxColour& GetTextForeground() const
{ return m_textForegroundColour; }
virtual void SetTextBackground(const wxColour& colour)
{ m_textBackgroundColour = colour; }
virtual const wxColour& GetTextBackground() const
{ return m_textBackgroundColour; }
#if wxUSE_PALETTE
virtual void SetPalette(const wxPalette& palette) = 0;
#endif // wxUSE_PALETTE
// inherit the DC attributes (font and colours) from the given window
//
// this is called automatically when a window, client or paint DC is
// created
virtual void InheritAttributes(wxWindow *win);
// logical functions
virtual void SetLogicalFunction(wxRasterOperationMode function) = 0;
virtual wxRasterOperationMode GetLogicalFunction() const
{ return m_logicalFunction; }
// text measurement
virtual wxCoord GetCharHeight() const = 0;
virtual wxCoord GetCharWidth() const = 0;
// The derived classes should really override DoGetFontMetrics() to return
// the correct values in the future but for now provide a default
// implementation in terms of DoGetTextExtent() to avoid breaking the
// compilation of all other ports as wxMSW is the only one to implement it.
virtual void DoGetFontMetrics(int *height,
int *ascent,
int *descent,
int *internalLeading,
int *externalLeading,
int *averageWidth) const;
virtual void DoGetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent = NULL,
wxCoord *externalLeading = NULL,
const wxFont *theFont = NULL) const = 0;
virtual void GetMultiLineTextExtent(const wxString& string,
wxCoord *width,
wxCoord *height,
wxCoord *heightLine = NULL,
const wxFont *font = NULL) const;
virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
// clearing
virtual void Clear() = 0;
// clipping
// Note that this pure virtual method has an implementation that updates
// the values returned by DoGetClippingBox() and so can be called from the
// derived class overridden version if it makes sense (i.e. if the clipping
// box coordinates are not already updated in some other way).
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
wxCoord w, wxCoord h) = 0;
// NB: this function works with device coordinates, not the logical ones!
virtual void DoSetDeviceClippingRegion(const wxRegion& region) = 0;
// Method used to implement wxDC::GetClippingBox().
//
// Default implementation returns values stored in m_clip[XY][12] member
// variables, so this method doesn't need to be overridden if they're kept
// up to date.
virtual bool DoGetClippingRect(wxRect& rect) const;
#if WXWIN_COMPATIBILITY_3_0
// This method is kept for backwards compatibility but shouldn't be used
// nor overridden in the new code, implement DoGetClippingRect() above
// instead.
wxDEPRECATED_BUT_USED_INTERNALLY(
virtual void DoGetClippingBox(wxCoord *x, wxCoord *y,
wxCoord *w, wxCoord *h) const
);
#endif // WXWIN_COMPATIBILITY_3_0
virtual void DestroyClippingRegion() { ResetClipping(); }
// coordinates conversions and transforms
virtual wxCoord DeviceToLogicalX(wxCoord x) const;
virtual wxCoord DeviceToLogicalY(wxCoord y) const;
virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
virtual wxCoord LogicalToDeviceX(wxCoord x) const;
virtual wxCoord LogicalToDeviceY(wxCoord y) const;
virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
virtual wxCoord LogicalToDeviceYRel(wxCoord y) const;
virtual void SetMapMode(wxMappingMode mode);
virtual wxMappingMode GetMapMode() const { return m_mappingMode; }
virtual void SetUserScale(double x, double y);
virtual void GetUserScale(double *x, double *y) const
{
if ( x ) *x = m_userScaleX;
if ( y ) *y = m_userScaleY;
}
virtual void SetLogicalScale(double x, double y);
virtual void GetLogicalScale(double *x, double *y) const
{
if ( x ) *x = m_logicalScaleX;
if ( y ) *y = m_logicalScaleY;
}
virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const
{
if ( x ) *x = m_logicalOriginX;
if ( y ) *y = m_logicalOriginY;
}
virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const
{
if ( x ) *x = m_deviceOriginX;
if ( y ) *y = m_deviceOriginY;
}
#if wxUSE_DC_TRANSFORM_MATRIX
// Transform matrix support is not available in most ports right now
// (currently only wxMSW provides it) so do nothing in these methods by
// default.
virtual bool CanUseTransformMatrix() const
{ return false; }
virtual bool SetTransformMatrix(const wxAffineMatrix2D& WXUNUSED(matrix))
{ return false; }
virtual wxAffineMatrix2D GetTransformMatrix() const
{ return wxAffineMatrix2D(); }
virtual void ResetTransformMatrix()
{ }
#endif // wxUSE_DC_TRANSFORM_MATRIX
virtual void SetDeviceLocalOrigin( wxCoord x, wxCoord y );
virtual void ComputeScaleAndOrigin();
// this needs to overidden if the axis is inverted
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
virtual double GetContentScaleFactor() const { return m_contentScaleFactor; }
#ifdef __WXMSW__
// Native Windows functions using the underlying HDC don't honour GDI+
// transformations which may be applied to it. Using this function we can
// transform the coordinates manually before passing them to such functions
// (as in e.g. wxRendererMSW code). It doesn't do anything if this is not a
// wxGCDC.
virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const
{
return r;
}
#endif // __WXMSW__
// ---------------------------------------------------------
// the actual drawing API
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
wxFloodFillStyle style = wxFLOOD_SURFACE) = 0;
virtual void DoGradientFillLinear(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
wxDirection nDirection = wxEAST);
virtual void DoGradientFillConcentric(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
const wxPoint& circleCenter);
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0;
virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0;
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0;
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc) = 0;
virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
wxCoord width, wxCoord height);
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
double sa, double ea) = 0;
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0;
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
wxCoord width, wxCoord height,
double radius) = 0;
virtual void DoDrawEllipse(wxCoord x, wxCoord y,
wxCoord width, wxCoord height) = 0;
virtual void DoCrossHair(wxCoord x, wxCoord y) = 0;
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0;
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
bool useMask = false) = 0;
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0;
virtual void DoDrawRotatedText(const wxString& text,
wxCoord x, wxCoord y, double angle) = 0;
virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY,
bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord,
wxCoord ysrcMask = wxDefaultCoord) = 0;
virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
wxCoord dstWidth, wxCoord dstHeight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxCoord srcWidth, wxCoord srcHeight,
wxRasterOperationMode rop = wxCOPY,
bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord,
wxCoord ysrcMask = wxDefaultCoord);
virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const
{ return wxNullBitmap; }
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset ) = 0;
virtual void DrawLines(const wxPointList *list,
wxCoord xoffset, wxCoord yoffset );
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) = 0;
virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle);
void DrawPolygon(const wxPointList *list,
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle );
#if wxUSE_SPLINES
void DrawSpline(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord x3, wxCoord y3);
void DrawSpline(int n, const wxPoint points[]);
void DrawSpline(const wxPointList *points) { DoDrawSpline(points); }
virtual void DoDrawSpline(const wxPointList *points);
#endif
// ---------------------------------------------------------
// wxMemoryDC Impl API
virtual void DoSelect(const wxBitmap& WXUNUSED(bmp))
{ }
virtual const wxBitmap& GetSelectedBitmap() const
{ return wxNullBitmap; }
virtual wxBitmap& GetSelectedBitmap()
{ return wxNullBitmap; }
// ---------------------------------------------------------
// wxPrinterDC Impl API
virtual wxRect GetPaperRect() const
{ int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); }
virtual int GetResolution() const
{ return -1; }
#if wxUSE_GRAPHICS_CONTEXT
virtual wxGraphicsContext* GetGraphicsContext() const
{ return NULL; }
virtual void SetGraphicsContext( wxGraphicsContext* WXUNUSED(ctx) )
{}
#endif
private:
wxDC *m_owner;
protected:
// This method exists for backwards compatibility only (while it's not
// documented, there are derived classes using it outside wxWidgets
// itself), don't use it in any new code and just call wxDCImpl version of
// DestroyClippingRegion() to reset the clipping information instead.
void ResetClipping()
{
m_clipping = false;
m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0;
}
// returns adjustment factor for converting wxFont "point size"; in wx
// it is point size on screen and needs to be multiplied by this value
// for rendering on higher-resolution DCs such as printer ones
static float GetFontPointSizeAdjustment(float dpi);
// Return the number of pixels per mm in the horizontal and vertical
// directions, respectively.
//
// If the physical size of the DC is not known, or doesn't make sense, as
// for a SVG DC, for example, a fixed value corresponding to the standard
// DPI is used.
double GetMMToPXx() const;
double GetMMToPXy() const;
// window on which the DC draws or NULL
wxWindow *m_window;
// flags
bool m_colour:1;
bool m_ok:1;
bool m_clipping:1;
bool m_isInteractive:1;
bool m_isBBoxValid:1;
// coordinate system variables
wxCoord m_logicalOriginX, m_logicalOriginY;
wxCoord m_deviceOriginX, m_deviceOriginY; // Usually 0,0, can be change by user
wxCoord m_deviceLocalOriginX, m_deviceLocalOriginY; // non-zero if native top-left corner
// is not at 0,0. This was the case under
// Mac's GrafPorts (coordinate system
// used toplevel window's origin) and
// e.g. for Postscript, where the native
// origin in the bottom left corner.
double m_logicalScaleX, m_logicalScaleY;
double m_userScaleX, m_userScaleY;
double m_scaleX, m_scaleY; // calculated from logical scale and user scale
int m_signX, m_signY; // Used by SetAxisOrientation() to invert the axes
double m_contentScaleFactor; // used by high resolution displays (retina)
// Pixel per mm in horizontal and vertical directions.
//
// These variables are computed on demand by GetMMToPX[xy]() functions,
// don't access them directly other than for assigning to them.
mutable double m_mm_to_pix_x,
m_mm_to_pix_y;
// bounding and clipping boxes
wxCoord m_minX, m_minY, m_maxX, m_maxY; // Bounding box is stored in device units.
wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2; // Clipping box is stored in logical units.
wxRasterOperationMode m_logicalFunction;
int m_backgroundMode;
wxMappingMode m_mappingMode;
wxPen m_pen;
wxBrush m_brush;
wxBrush m_backgroundBrush;
wxColour m_textForegroundColour;
wxColour m_textBackgroundColour;
wxFont m_font;
#if wxUSE_PALETTE
wxPalette m_palette;
bool m_hasCustomPalette;
#endif // wxUSE_PALETTE
private:
// Return the full DC area in logical coordinates.
wxRect GetLogicalArea() const;
wxDECLARE_ABSTRACT_CLASS(wxDCImpl);
};
class WXDLLIMPEXP_CORE wxDC : public wxObject
{
public:
// copy attributes (font, colours and writing direction) from another DC
void CopyAttributes(const wxDC& dc);
virtual ~wxDC() { delete m_pimpl; }
wxDCImpl *GetImpl()
{ return m_pimpl; }
const wxDCImpl *GetImpl() const
{ return m_pimpl; }
wxWindow *GetWindow() const
{ return m_pimpl->GetWindow(); }
void *GetHandle() const
{ return m_pimpl->GetHandle(); }
bool IsOk() const
{ return m_pimpl && m_pimpl->IsOk(); }
// query capabilities
bool CanDrawBitmap() const
{ return m_pimpl->CanDrawBitmap(); }
bool CanGetTextExtent() const
{ return m_pimpl->CanGetTextExtent(); }
// query dimension, colour deps, resolution
void GetSize(int *width, int *height) const
{ m_pimpl->DoGetSize(width, height); }
wxSize GetSize() const
{ return m_pimpl->GetSize(); }
void GetSizeMM(int* width, int* height) const
{ m_pimpl->DoGetSizeMM(width, height); }
wxSize GetSizeMM() const
{
int w, h;
m_pimpl->DoGetSizeMM(&w, &h);
return wxSize(w, h);
}
int GetDepth() const
{ return m_pimpl->GetDepth(); }
wxSize GetPPI() const
{ return m_pimpl->GetPPI(); }
virtual int GetResolution() const
{ return m_pimpl->GetResolution(); }
double GetContentScaleFactor() const
{ return m_pimpl->GetContentScaleFactor(); }
// Right-To-Left (RTL) modes
void SetLayoutDirection(wxLayoutDirection dir)
{ m_pimpl->SetLayoutDirection( dir ); }
wxLayoutDirection GetLayoutDirection() const
{ return m_pimpl->GetLayoutDirection(); }
// page and document
bool StartDoc(const wxString& message)
{ return m_pimpl->StartDoc(message); }
void EndDoc()
{ m_pimpl->EndDoc(); }
void StartPage()
{ m_pimpl->StartPage(); }
void EndPage()
{ m_pimpl->EndPage(); }
// bounding box
void CalcBoundingBox(wxCoord x, wxCoord y)
{ m_pimpl->CalcBoundingBox(x,y); }
void ResetBoundingBox()
{ m_pimpl->ResetBoundingBox(); }
wxCoord MinX() const
{ return m_pimpl->MinX(); }
wxCoord MaxX() const
{ return m_pimpl->MaxX(); }
wxCoord MinY() const
{ return m_pimpl->MinY(); }
wxCoord MaxY() const
{ return m_pimpl->MaxY(); }
// setters and getters
void SetFont(const wxFont& font)
{ m_pimpl->SetFont( font ); }
const wxFont& GetFont() const
{ return m_pimpl->GetFont(); }
void SetPen(const wxPen& pen)
{ m_pimpl->SetPen( pen ); }
const wxPen& GetPen() const
{ return m_pimpl->GetPen(); }
void SetBrush(const wxBrush& brush)
{ m_pimpl->SetBrush( brush ); }
const wxBrush& GetBrush() const
{ return m_pimpl->GetBrush(); }
void SetBackground(const wxBrush& brush)
{ m_pimpl->SetBackground( brush ); }
const wxBrush& GetBackground() const
{ return m_pimpl->GetBackground(); }
void SetBackgroundMode(int mode)
{ m_pimpl->SetBackgroundMode( mode ); }
int GetBackgroundMode() const
{ return m_pimpl->GetBackgroundMode(); }
void SetTextForeground(const wxColour& colour)
{ m_pimpl->SetTextForeground(colour); }
const wxColour& GetTextForeground() const
{ return m_pimpl->GetTextForeground(); }
void SetTextBackground(const wxColour& colour)
{ m_pimpl->SetTextBackground(colour); }
const wxColour& GetTextBackground() const
{ return m_pimpl->GetTextBackground(); }
#if wxUSE_PALETTE
void SetPalette(const wxPalette& palette)
{ m_pimpl->SetPalette(palette); }
#endif // wxUSE_PALETTE
// logical functions
void SetLogicalFunction(wxRasterOperationMode function)
{ m_pimpl->SetLogicalFunction(function); }
wxRasterOperationMode GetLogicalFunction() const
{ return m_pimpl->GetLogicalFunction(); }
// text measurement
wxCoord GetCharHeight() const
{ return m_pimpl->GetCharHeight(); }
wxCoord GetCharWidth() const
{ return m_pimpl->GetCharWidth(); }
wxFontMetrics GetFontMetrics() const
{
wxFontMetrics fm;
m_pimpl->DoGetFontMetrics(&fm.height, &fm.ascent, &fm.descent,
&fm.internalLeading, &fm.externalLeading,
&fm.averageWidth);
return fm;
}
void GetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent = NULL,
wxCoord *externalLeading = NULL,
const wxFont *theFont = NULL) const
{ m_pimpl->DoGetTextExtent(string, x, y, descent, externalLeading, theFont); }
wxSize GetTextExtent(const wxString& string) const
{
wxCoord w, h;
m_pimpl->DoGetTextExtent(string, &w, &h);
return wxSize(w, h);
}
void GetMultiLineTextExtent(const wxString& string,
wxCoord *width,
wxCoord *height,
wxCoord *heightLine = NULL,
const wxFont *font = NULL) const
{ m_pimpl->GetMultiLineTextExtent( string, width, height, heightLine, font ); }
wxSize GetMultiLineTextExtent(const wxString& string) const
{
wxCoord w, h;
m_pimpl->GetMultiLineTextExtent(string, &w, &h);
return wxSize(w, h);
}
bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
{ return m_pimpl->DoGetPartialTextExtents(text, widths); }
// clearing
void Clear()
{ m_pimpl->Clear(); }
// clipping
void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{ m_pimpl->DoSetClippingRegion(x, y, width, height); }
void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
{ m_pimpl->DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); }
void SetClippingRegion(const wxRect& rect)
{ m_pimpl->DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); }
// unlike the functions above, the coordinates of the region used in this
// one are in device coordinates, not the logical ones
void SetDeviceClippingRegion(const wxRegion& region)
{ m_pimpl->DoSetDeviceClippingRegion(region); }
// this function is deprecated because its name is confusing: you may
// expect it to work with logical coordinates but, in fact, it does exactly
// the same thing as SetDeviceClippingRegion()
//
// please review the code using it and either replace it with calls to
// SetDeviceClippingRegion() or correct it if it was [wrongly] passing
// logical coordinates to this function
wxDEPRECATED_INLINE(void SetClippingRegion(const wxRegion& region),
SetDeviceClippingRegion(region); )
void DestroyClippingRegion()
{ m_pimpl->DestroyClippingRegion(); }
bool GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
{
wxRect r;
const bool clipping = m_pimpl->DoGetClippingRect(r);
if ( x )
*x = r.x;
if ( y )
*y = r.y;
if ( w )
*w = r.width;
if ( h )
*h = r.height;
return clipping;
}
bool GetClippingBox(wxRect& rect) const
{ return m_pimpl->DoGetClippingRect(rect); }
// coordinates conversions and transforms
wxCoord DeviceToLogicalX(wxCoord x) const
{ return m_pimpl->DeviceToLogicalX(x); }
wxCoord DeviceToLogicalY(wxCoord y) const
{ return m_pimpl->DeviceToLogicalY(y); }
wxCoord DeviceToLogicalXRel(wxCoord x) const
{ return m_pimpl->DeviceToLogicalXRel(x); }
wxCoord DeviceToLogicalYRel(wxCoord y) const
{ return m_pimpl->DeviceToLogicalYRel(y); }
wxCoord LogicalToDeviceX(wxCoord x) const
{ return m_pimpl->LogicalToDeviceX(x); }
wxCoord LogicalToDeviceY(wxCoord y) const
{ return m_pimpl->LogicalToDeviceY(y); }
wxCoord LogicalToDeviceXRel(wxCoord x) const
{ return m_pimpl->LogicalToDeviceXRel(x); }
wxCoord LogicalToDeviceYRel(wxCoord y) const
{ return m_pimpl->LogicalToDeviceYRel(y); }
void SetMapMode(wxMappingMode mode)
{ m_pimpl->SetMapMode(mode); }
wxMappingMode GetMapMode() const
{ return m_pimpl->GetMapMode(); }
void SetUserScale(double x, double y)
{ m_pimpl->SetUserScale(x,y); }
void GetUserScale(double *x, double *y) const
{ m_pimpl->GetUserScale( x, y ); }
void SetLogicalScale(double x, double y)
{ m_pimpl->SetLogicalScale( x, y ); }
void GetLogicalScale(double *x, double *y) const
{ m_pimpl->GetLogicalScale( x, y ); }
void SetLogicalOrigin(wxCoord x, wxCoord y)
{ m_pimpl->SetLogicalOrigin(x,y); }
void GetLogicalOrigin(wxCoord *x, wxCoord *y) const
{ m_pimpl->DoGetLogicalOrigin(x, y); }
wxPoint GetLogicalOrigin() const
{ wxCoord x, y; m_pimpl->DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); }
void SetDeviceOrigin(wxCoord x, wxCoord y)
{ m_pimpl->SetDeviceOrigin( x, y); }
void GetDeviceOrigin(wxCoord *x, wxCoord *y) const
{ m_pimpl->DoGetDeviceOrigin(x, y); }
wxPoint GetDeviceOrigin() const
{ wxCoord x, y; m_pimpl->DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); }
void SetAxisOrientation(bool xLeftRight, bool yBottomUp)
{ m_pimpl->SetAxisOrientation(xLeftRight, yBottomUp); }
#if wxUSE_DC_TRANSFORM_MATRIX
bool CanUseTransformMatrix() const
{ return m_pimpl->CanUseTransformMatrix(); }
bool SetTransformMatrix(const wxAffineMatrix2D &matrix)
{ return m_pimpl->SetTransformMatrix(matrix); }
wxAffineMatrix2D GetTransformMatrix() const
{ return m_pimpl->GetTransformMatrix(); }
void ResetTransformMatrix()
{ m_pimpl->ResetTransformMatrix(); }
#endif // wxUSE_DC_TRANSFORM_MATRIX
// mostly internal
void SetDeviceLocalOrigin( wxCoord x, wxCoord y )
{ m_pimpl->SetDeviceLocalOrigin( x, y ); }
// -----------------------------------------------
// the actual drawing API
bool FloodFill(wxCoord x, wxCoord y, const wxColour& col,
wxFloodFillStyle style = wxFLOOD_SURFACE)
{ return m_pimpl->DoFloodFill(x, y, col, style); }
bool FloodFill(const wxPoint& pt, const wxColour& col,
wxFloodFillStyle style = wxFLOOD_SURFACE)
{ return m_pimpl->DoFloodFill(pt.x, pt.y, col, style); }
// fill the area specified by rect with a radial gradient, starting from
// initialColour in the centre of the cercle and fading to destColour.
void GradientFillConcentric(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour)
{ m_pimpl->DoGradientFillConcentric( rect, initialColour, destColour,
wxPoint(rect.GetWidth() / 2,
rect.GetHeight() / 2)); }
void GradientFillConcentric(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
const wxPoint& circleCenter)
{ m_pimpl->DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); }
// fill the area specified by rect with a linear gradient
void GradientFillLinear(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
wxDirection nDirection = wxEAST)
{ m_pimpl->DoGradientFillLinear(rect, initialColour, destColour, nDirection); }
bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const
{ return m_pimpl->DoGetPixel(x, y, col); }
bool GetPixel(const wxPoint& pt, wxColour *col) const
{ return m_pimpl->DoGetPixel(pt.x, pt.y, col); }
void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{ m_pimpl->DoDrawLine(x1, y1, x2, y2); }
void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
{ m_pimpl->DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); }
void CrossHair(wxCoord x, wxCoord y)
{ m_pimpl->DoCrossHair(x, y); }
void CrossHair(const wxPoint& pt)
{ m_pimpl->DoCrossHair(pt.x, pt.y); }
void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc)
{ m_pimpl->DoDrawArc(x1, y1, x2, y2, xc, yc); }
void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
{ m_pimpl->DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); }
void DrawCheckMark(wxCoord x, wxCoord y,
wxCoord width, wxCoord height)
{ m_pimpl->DoDrawCheckMark(x, y, width, height); }
void DrawCheckMark(const wxRect& rect)
{ m_pimpl->DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); }
void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
double sa, double ea)
{ m_pimpl->DoDrawEllipticArc(x, y, w, h, sa, ea); }
void DrawEllipticArc(const wxPoint& pt, const wxSize& sz,
double sa, double ea)
{ m_pimpl->DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); }
void DrawPoint(wxCoord x, wxCoord y)
{ m_pimpl->DoDrawPoint(x, y); }
void DrawPoint(const wxPoint& pt)
{ m_pimpl->DoDrawPoint(pt.x, pt.y); }
void DrawLines(int n, const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0)
{ m_pimpl->DoDrawLines(n, points, xoffset, yoffset); }
void DrawLines(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0)
{ m_pimpl->DrawLines( list, xoffset, yoffset ); }
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( void DrawLines(const wxList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0) );
#endif // WXWIN_COMPATIBILITY_2_8
void DrawPolygon(int n, const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
void DrawPolygon(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); }
void DrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); }
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( void DrawPolygon(const wxList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) );
#endif // WXWIN_COMPATIBILITY_2_8
void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{ m_pimpl->DoDrawRectangle(x, y, width, height); }
void DrawRectangle(const wxPoint& pt, const wxSize& sz)
{ m_pimpl->DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); }
void DrawRectangle(const wxRect& rect)
{ m_pimpl->DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); }
void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height,
double radius)
{ m_pimpl->DoDrawRoundedRectangle(x, y, width, height, radius); }
void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz,
double radius)
{ m_pimpl->DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); }
void DrawRoundedRectangle(const wxRect& r, double radius)
{ m_pimpl->DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); }
void DrawCircle(wxCoord x, wxCoord y, wxCoord radius)
{ m_pimpl->DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); }
void DrawCircle(const wxPoint& pt, wxCoord radius)
{ m_pimpl->DoDrawEllipse(pt.x - radius, pt.y - radius, 2*radius, 2*radius); }
void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{ m_pimpl->DoDrawEllipse(x, y, width, height); }
void DrawEllipse(const wxPoint& pt, const wxSize& sz)
{ m_pimpl->DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); }
void DrawEllipse(const wxRect& rect)
{ m_pimpl->DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); }
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
{ m_pimpl->DoDrawIcon(icon, x, y); }
void DrawIcon(const wxIcon& icon, const wxPoint& pt)
{ m_pimpl->DoDrawIcon(icon, pt.x, pt.y); }
void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
bool useMask = false)
{ m_pimpl->DoDrawBitmap(bmp, x, y, useMask); }
void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt,
bool useMask = false)
{ m_pimpl->DoDrawBitmap(bmp, pt.x, pt.y, useMask); }
void DrawText(const wxString& text, wxCoord x, wxCoord y)
{ m_pimpl->DoDrawText(text, x, y); }
void DrawText(const wxString& text, const wxPoint& pt)
{ m_pimpl->DoDrawText(text, pt.x, pt.y); }
void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
{ m_pimpl->DoDrawRotatedText(text, x, y, angle); }
void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle)
{ m_pimpl->DoDrawRotatedText(text, pt.x, pt.y, angle); }
// this version puts both optional bitmap and the text into the given
// rectangle and aligns is as specified by alignment parameter; it also
// will emphasize the character with the given index if it is != -1 and
// return the bounding rectangle if required
void DrawLabel(const wxString& text,
const wxBitmap& image,
const wxRect& rect,
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
int indexAccel = -1,
wxRect *rectBounding = NULL);
void DrawLabel(const wxString& text, const wxRect& rect,
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
int indexAccel = -1)
{ DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); }
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord)
{
return m_pimpl->DoBlit(xdest, ydest, width, height,
source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask);
}
bool Blit(const wxPoint& destPt, const wxSize& sz,
wxDC *source, const wxPoint& srcPt,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
const wxPoint& srcPtMask = wxDefaultPosition)
{
return m_pimpl->DoBlit(destPt.x, destPt.y, sz.x, sz.y,
source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y);
}
bool StretchBlit(wxCoord dstX, wxCoord dstY,
wxCoord dstWidth, wxCoord dstHeight,
wxDC *source,
wxCoord srcX, wxCoord srcY,
wxCoord srcWidth, wxCoord srcHeight,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
wxCoord srcMaskX = wxDefaultCoord, wxCoord srcMaskY = wxDefaultCoord)
{
return m_pimpl->DoStretchBlit(dstX, dstY, dstWidth, dstHeight,
source, srcX, srcY, srcWidth, srcHeight, rop, useMask, srcMaskX, srcMaskY);
}
bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize,
wxDC *source, const wxPoint& srcPt, const wxSize& srcSize,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
const wxPoint& srcMaskPt = wxDefaultPosition)
{
return m_pimpl->DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y,
source, srcPt.x, srcPt.y, srcSize.x, srcSize.y, rop, useMask, srcMaskPt.x, srcMaskPt.y);
}
wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const
{
return m_pimpl->DoGetAsBitmap(subrect);
}
#if wxUSE_SPLINES
void DrawSpline(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord x3, wxCoord y3)
{ m_pimpl->DrawSpline(x1,y1,x2,y2,x3,y3); }
void DrawSpline(int n, const wxPoint points[])
{ m_pimpl->DrawSpline(n,points); }
void DrawSpline(const wxPointList *points)
{ m_pimpl->DrawSpline(points); }
#endif // wxUSE_SPLINES
#if WXWIN_COMPATIBILITY_2_8
// for compatibility with the old code when wxCoord was long everywhere
wxDEPRECATED( void GetTextExtent(const wxString& string,
long *x, long *y,
long *descent = NULL,
long *externalLeading = NULL,
const wxFont *theFont = NULL) const );
wxDEPRECATED( void GetLogicalOrigin(long *x, long *y) const );
wxDEPRECATED( void GetDeviceOrigin(long *x, long *y) const );
wxDEPRECATED( void GetClippingBox(long *x, long *y, long *w, long *h) const );
wxDEPRECATED( void DrawObject(wxDrawObject* drawobject) );
#endif // WXWIN_COMPATIBILITY_2_8
#ifdef __WXMSW__
// GetHDC() is the simplest way to retrieve an HDC From a wxDC but only
// works if this wxDC is GDI-based and fails for GDI+ contexts (and
// anything else without HDC, e.g. wxPostScriptDC)
WXHDC GetHDC() const;
// don't use these methods manually, use GetTempHDC() instead
virtual WXHDC AcquireHDC() { return GetHDC(); }
virtual void ReleaseHDC(WXHDC WXUNUSED(hdc)) { }
// helper class holding the result of GetTempHDC() with std::auto_ptr<>-like
// semantics, i.e. it is moved when copied
class TempHDC
{
public:
TempHDC(wxDC& dc)
: m_dc(dc),
m_hdc(dc.AcquireHDC())
{
}
TempHDC(const TempHDC& thdc)
: m_dc(thdc.m_dc),
m_hdc(thdc.m_hdc)
{
const_cast<TempHDC&>(thdc).m_hdc = 0;
}
~TempHDC()
{
if ( m_hdc )
m_dc.ReleaseHDC(m_hdc);
}
WXHDC GetHDC() const { return m_hdc; }
private:
wxDC& m_dc;
WXHDC m_hdc;
wxDECLARE_NO_ASSIGN_CLASS(TempHDC);
};
// GetTempHDC() also works for wxGCDC (but still not for wxPostScriptDC &c)
TempHDC GetTempHDC() { return TempHDC(*this); }
#endif // __WXMSW__
#if wxUSE_GRAPHICS_CONTEXT
virtual wxGraphicsContext* GetGraphicsContext() const
{
return m_pimpl->GetGraphicsContext();
}
virtual void SetGraphicsContext( wxGraphicsContext* ctx )
{
m_pimpl->SetGraphicsContext(ctx);
}
#endif
protected:
// ctor takes ownership of the pointer
wxDC(wxDCImpl *pimpl) : m_pimpl(pimpl) { }
wxDCImpl * const m_pimpl;
private:
wxDECLARE_ABSTRACT_CLASS(wxDC);
wxDECLARE_NO_COPY_CLASS(wxDC);
};
// ----------------------------------------------------------------------------
// helper class: you can use it to temporarily change the DC text colour and
// restore it automatically when the object goes out of scope
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDCTextColourChanger
{
public:
wxDCTextColourChanger(wxDC& dc) : m_dc(dc), m_colFgOld() { }
wxDCTextColourChanger(wxDC& dc, const wxColour& col) : m_dc(dc)
{
Set(col);
}
~wxDCTextColourChanger()
{
if ( m_colFgOld.IsOk() )
m_dc.SetTextForeground(m_colFgOld);
}
void Set(const wxColour& col)
{
if ( !m_colFgOld.IsOk() )
m_colFgOld = m_dc.GetTextForeground();
m_dc.SetTextForeground(col);
}
private:
wxDC& m_dc;
wxColour m_colFgOld;
wxDECLARE_NO_COPY_CLASS(wxDCTextColourChanger);
};
// ----------------------------------------------------------------------------
// helper class: you can use it to temporarily change the DC pen and
// restore it automatically when the object goes out of scope
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDCPenChanger
{
public:
wxDCPenChanger(wxDC& dc, const wxPen& pen) : m_dc(dc), m_penOld(dc.GetPen())
{
m_dc.SetPen(pen);
}
~wxDCPenChanger()
{
if ( m_penOld.IsOk() )
m_dc.SetPen(m_penOld);
}
private:
wxDC& m_dc;
wxPen m_penOld;
wxDECLARE_NO_COPY_CLASS(wxDCPenChanger);
};
// ----------------------------------------------------------------------------
// helper class: you can use it to temporarily change the DC brush and
// restore it automatically when the object goes out of scope
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDCBrushChanger
{
public:
wxDCBrushChanger(wxDC& dc, const wxBrush& brush) : m_dc(dc), m_brushOld(dc.GetBrush())
{
m_dc.SetBrush(brush);
}
~wxDCBrushChanger()
{
if ( m_brushOld.IsOk() )
m_dc.SetBrush(m_brushOld);
}
private:
wxDC& m_dc;
wxBrush m_brushOld;
wxDECLARE_NO_COPY_CLASS(wxDCBrushChanger);
};
// ----------------------------------------------------------------------------
// another small helper class: sets the clipping region in its ctor and
// destroys it in the dtor
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDCClipper
{
public:
wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc)
{
Init(r.GetBox());
}
wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc)
{
Init(r);
}
wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc)
{
Init(wxRect(x, y, w, h));
}
~wxDCClipper()
{
m_dc.DestroyClippingRegion();
if ( m_restoreOld )
m_dc.SetClippingRegion(m_oldClipRect);
}
private:
// Common part of all ctors.
void Init(const wxRect& r)
{
m_restoreOld = m_dc.GetClippingBox(m_oldClipRect);
m_dc.SetClippingRegion(r);
}
wxDC& m_dc;
wxRect m_oldClipRect;
bool m_restoreOld;
wxDECLARE_NO_COPY_CLASS(wxDCClipper);
};
// ----------------------------------------------------------------------------
// helper class: you can use it to temporarily change the DC font and
// restore it automatically when the object goes out of scope
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDCFontChanger
{
public:
wxDCFontChanger(wxDC& dc)
: m_dc(dc), m_fontOld()
{
}
wxDCFontChanger(wxDC& dc, const wxFont& font)
: m_dc(dc), m_fontOld(dc.GetFont())
{
m_dc.SetFont(font);
}
void Set(const wxFont& font)
{
if ( !m_fontOld.IsOk() )
m_fontOld = m_dc.GetFont();
m_dc.SetFont(font);
}
~wxDCFontChanger()
{
if ( m_fontOld.IsOk() )
m_dc.SetFont(m_fontOld);
}
private:
wxDC& m_dc;
wxFont m_fontOld;
wxDECLARE_NO_COPY_CLASS(wxDCFontChanger);
};
#endif // _WX_DC_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/mousemanager.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/mousemanager.h
// Purpose: wxMouseEventsManager class declaration
// Author: Vadim Zeitlin
// Created: 2009-04-20
// Copyright: (c) 2009 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MOUSEMANAGER_H_
#define _WX_MOUSEMANAGER_H_
#include "wx/event.h"
// ----------------------------------------------------------------------------
// wxMouseEventsManager
// ----------------------------------------------------------------------------
/*
This class handles mouse events and synthesizes high-level notifications
such as clicks and drag events from low level mouse button presses and
mouse movement events. It is useful because handling the mouse events is
less obvious than might seem at a first glance: for example, clicks on an
object should only be generated if the mouse was both pressed and released
over it and not just released (so it requires storing the previous state)
and dragging shouldn't start before the mouse moves away far enough.
This class encapsulates all these dull details for controls containing
multiple items which can be identified by a positive integer index and you
just need to implement its pure virtual functions to use it.
*/
class WXDLLIMPEXP_CORE wxMouseEventsManager : public wxEvtHandler
{
public:
// a mouse event manager is always associated with a window and must be
// deleted by the window when it is destroyed so if it is created using the
// default ctor Create() must be called later
wxMouseEventsManager() { Init(); }
wxMouseEventsManager(wxWindow *win) { Init(); Create(win); }
bool Create(wxWindow *win);
virtual ~wxMouseEventsManager();
protected:
// called to find the item at the given position: return wxNOT_FOUND (-1)
// if there is no item here
virtual int MouseHitTest(const wxPoint& pos) = 0;
// called when the user clicked (i.e. pressed and released mouse over the
// same item), should normally generate a notification about this click and
// return true if it was handled or false otherwise, determining whether
// the original mouse event is skipped or not
virtual bool MouseClicked(int item) = 0;
// called to start dragging the given item, should generate the appropriate
// BEGIN_DRAG event and return false if dragging this item was forbidden
virtual bool MouseDragBegin(int item, const wxPoint& pos) = 0;
// called while the item is being dragged, should normally update the
// feedback on screen (usually using wxOverlay)
virtual void MouseDragging(int item, const wxPoint& pos) = 0;
// called when the mouse is released after dragging the item
virtual void MouseDragEnd(int item, const wxPoint& pos) = 0;
// called when mouse capture is lost while dragging the item, should remove
// the visual feedback drawn by MouseDragging()
virtual void MouseDragCancelled(int item) = 0;
// you don't need to override those but you will want to do if it your
// control renders pressed items differently
// called when the item is becomes pressed, can be used to change its
// appearance
virtual void MouseClickBegin(int WXUNUSED(item)) { }
// called if the mouse capture was lost while the item was pressed, can be
// used to restore the default item appearance if it was changed in
// MouseClickBegin()
virtual void MouseClickCancelled(int WXUNUSED(item)) { }
private:
/*
Here is a small diagram explaining the switches between different
states:
/---------->NORMAL<--------------- Drag end
/ / / | event
/ / | | ^
/ / | | |
Click / N | | mouse | mouse up
event / | | down |
| / | | DRAGGING
| / | | ^
Y|/ N \ v |Y
+-------------+ +--------+ N +-----------+
|On same item?| |On item?| -----------|Begin drag?|
+-------------+ +--------+ / +-----------+
^ | / ^
| | / |
\ mouse | / mouse moved |
\ up v v far enough /
\--------PRESSED-------------------/
There are also transitions from PRESSED and DRAGGING to NORMAL in case
the mouse capture is lost or Escape key is pressed which are not shown.
*/
enum State
{
State_Normal, // initial, default state
State_Pressed, // mouse was pressed over an item
State_Dragging // the item is being dragged
};
// common part of both ctors
void Init();
// various event handlers
void OnCaptureLost(wxMouseCaptureLostEvent& event);
void OnLeftDown(wxMouseEvent& event);
void OnLeftUp(wxMouseEvent& event);
void OnMove(wxMouseEvent& event);
// the associated window, never NULL except between the calls to the
// default ctor and Create()
wxWindow *m_win;
// the current state
State m_state;
// the details of the operation currently in progress, only valid if
// m_state is not normal
// the item being pressed or dragged (always valid, i.e. != wxNOT_FOUND if
// m_state != State_Normal)
int m_item;
// the position of the last mouse event of interest: either mouse press in
// State_Pressed or last movement event in State_Dragging
wxPoint m_posLast;
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxMouseEventsManager);
};
#endif // _WX_MOUSEMANAGER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/wx.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/wx.h
// Purpose: wxWidgets central header including the most often used ones
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WX_H_
#define _WX_WX_H_
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/dynarray.h"
#include "wx/list.h"
#include "wx/hash.h"
#include "wx/string.h"
#include "wx/hashmap.h"
#include "wx/arrstr.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/event.h"
#include "wx/app.h"
#include "wx/utils.h"
#include "wx/stream.h"
#include "wx/memory.h"
#include "wx/math.h"
#include "wx/stopwatch.h"
#include "wx/timer.h"
#include "wx/module.h"
#include "wx/wxcrt.h"
#include "wx/wxcrtvararg.h"
#if wxUSE_GUI
#include "wx/window.h"
#include "wx/containr.h"
#include "wx/panel.h"
#include "wx/toplevel.h"
#include "wx/frame.h"
#include "wx/gdicmn.h"
#include "wx/gdiobj.h"
#include "wx/region.h"
#include "wx/bitmap.h"
#include "wx/image.h"
#include "wx/colour.h"
#include "wx/font.h"
#include "wx/dc.h"
#include "wx/dcclient.h"
#include "wx/dcmemory.h"
#include "wx/dcprint.h"
#include "wx/dcscreen.h"
#include "wx/button.h"
#include "wx/menuitem.h"
#include "wx/menu.h"
#include "wx/pen.h"
#include "wx/brush.h"
#include "wx/palette.h"
#include "wx/icon.h"
#include "wx/cursor.h"
#include "wx/dialog.h"
#include "wx/settings.h"
#include "wx/msgdlg.h"
#include "wx/dataobj.h"
#include "wx/control.h"
#include "wx/ctrlsub.h"
#include "wx/bmpbuttn.h"
#include "wx/checkbox.h"
#include "wx/checklst.h"
#include "wx/choice.h"
#include "wx/scrolbar.h"
#include "wx/stattext.h"
#include "wx/statbmp.h"
#include "wx/statbox.h"
#include "wx/listbox.h"
#include "wx/radiobox.h"
#include "wx/radiobut.h"
#include "wx/textctrl.h"
#include "wx/slider.h"
#include "wx/gauge.h"
#include "wx/scrolwin.h"
#include "wx/dirdlg.h"
#include "wx/toolbar.h"
#include "wx/combobox.h"
#include "wx/layout.h"
#include "wx/sizer.h"
#include "wx/statusbr.h"
#include "wx/choicdlg.h"
#include "wx/textdlg.h"
#include "wx/filedlg.h"
// this one is included by exactly one file (mdi.cpp) during wx build so even
// although we keep it here for the library users, don't include it to avoid
// bloating the PCH and (worse) rebuilding the entire library when it changes
// when building the library itself
#ifndef WXBUILDING
#include "wx/mdi.h"
#endif
// always include, even if !wxUSE_VALIDATORS because we need wxDefaultValidator
#include "wx/validate.h"
#if wxUSE_VALIDATORS
#include "wx/valtext.h"
#endif // wxUSE_VALIDATORS
#endif // wxUSE_GUI
#endif // _WX_WX_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/msgdlg.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/msgdlg.h
// Purpose: common header and base class for wxMessageDialog
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSGDLG_H_BASE_
#define _WX_MSGDLG_H_BASE_
#include "wx/defs.h"
#if wxUSE_MSGDLG
#include "wx/dialog.h"
#include "wx/stockitem.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxMessageBoxCaptionStr[];
// ----------------------------------------------------------------------------
// wxMessageDialogBase: base class defining wxMessageDialog interface
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMessageDialogBase : public wxDialog
{
public:
// helper class for SetXXXLabels() methods: it makes it possible to pass
// either a stock id (wxID_CLOSE) or a string ("&Close") to them
class ButtonLabel
{
public:
// ctors are not explicit, objects of this class can be implicitly
// constructed from either stock ids or strings
ButtonLabel(int stockId)
: m_stockId(stockId)
{
wxASSERT_MSG( wxIsStockID(stockId), "invalid stock id" );
}
ButtonLabel(const wxString& label)
: m_label(label), m_stockId(wxID_NONE)
{
}
ButtonLabel(const char *label)
: m_label(label), m_stockId(wxID_NONE)
{
}
ButtonLabel(const wchar_t *label)
: m_label(label), m_stockId(wxID_NONE)
{
}
ButtonLabel(const wxCStrData& label)
: m_label(label), m_stockId(wxID_NONE)
{
}
// default copy ctor and dtor are ok
// get the string label, whether it was originally specified directly
// or as a stock id -- this is only useful for platforms without native
// stock items id support
wxString GetAsString() const
{
return m_stockId == wxID_NONE
? m_label
: wxGetStockLabel(m_stockId, wxSTOCK_FOR_BUTTON);
}
// return the stock id or wxID_NONE if this is not a stock label
int GetStockId() const { return m_stockId; }
private:
// the label if explicitly given or empty if this is a stock item
const wxString m_label;
// the stock item id or wxID_NONE if m_label should be used
const int m_stockId;
};
// ctors
wxMessageDialogBase() { m_dialogStyle = 0; }
wxMessageDialogBase(wxWindow *parent,
const wxString& message,
const wxString& caption,
long style)
: m_message(message),
m_caption(caption)
{
m_parent = GetParentForModalDialog(parent, style);
SetMessageDialogStyle(style);
}
// virtual dtor for the base class
virtual ~wxMessageDialogBase() { }
wxString GetCaption() const { return m_caption; }
// Title and caption are the same thing, GetCaption() mostly exists just
// for compatibility.
virtual void SetTitle(const wxString& title) wxOVERRIDE { m_caption = title; }
virtual wxString GetTitle() const wxOVERRIDE { return m_caption; }
virtual void SetMessage(const wxString& message)
{
m_message = message;
}
wxString GetMessage() const { return m_message; }
void SetExtendedMessage(const wxString& extendedMessage)
{
m_extendedMessage = extendedMessage;
}
wxString GetExtendedMessage() const { return m_extendedMessage; }
// change the dialog style flag
void SetMessageDialogStyle(long style)
{
wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || !(style & wxYES_NO),
"wxYES and wxNO may only be used together" );
wxASSERT_MSG( !(style & wxYES) || !(style & wxOK),
"wxOK and wxYES/wxNO can't be used together" );
// It is common to specify just the icon, without wxOK, in the existing
// code, especially one written by Windows programmers as MB_OK is 0
// and so they're used to omitting wxOK. Don't complain about it but
// just add wxOK implicitly for compatibility.
if ( !(style & wxYES) && !(style & wxOK) )
style |= wxOK;
wxASSERT_MSG( (style & wxID_OK) != wxID_OK,
"wxMessageBox: Did you mean wxOK (and not wxID_OK)?" );
wxASSERT_MSG( !(style & wxNO_DEFAULT) || (style & wxNO),
"wxNO_DEFAULT is invalid without wxNO" );
wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || (style & wxCANCEL),
"wxCANCEL_DEFAULT is invalid without wxCANCEL" );
wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || !(style & wxNO_DEFAULT),
"only one default button can be specified" );
m_dialogStyle = style;
}
long GetMessageDialogStyle() const { return m_dialogStyle; }
// customization of the message box buttons
virtual bool SetYesNoLabels(const ButtonLabel& yes,const ButtonLabel& no)
{
DoSetCustomLabel(m_yes, yes);
DoSetCustomLabel(m_no, no);
return true;
}
virtual bool SetYesNoCancelLabels(const ButtonLabel& yes,
const ButtonLabel& no,
const ButtonLabel& cancel)
{
DoSetCustomLabel(m_yes, yes);
DoSetCustomLabel(m_no, no);
DoSetCustomLabel(m_cancel, cancel);
return true;
}
virtual bool SetOKLabel(const ButtonLabel& ok)
{
DoSetCustomLabel(m_ok, ok);
return true;
}
virtual bool SetOKCancelLabels(const ButtonLabel& ok,
const ButtonLabel& cancel)
{
DoSetCustomLabel(m_ok, ok);
DoSetCustomLabel(m_cancel, cancel);
return true;
}
virtual bool SetHelpLabel(const ButtonLabel& help)
{
DoSetCustomLabel(m_help, help);
return true;
}
// test if any custom labels were set
bool HasCustomLabels() const
{
return !(m_ok.empty() && m_cancel.empty() && m_help.empty() &&
m_yes.empty() && m_no.empty());
}
// these functions return the label to be used for the button which is
// either a custom label explicitly set by the user or the default label,
// i.e. they always return a valid string
wxString GetYesLabel() const
{ return m_yes.empty() ? GetDefaultYesLabel() : m_yes; }
wxString GetNoLabel() const
{ return m_no.empty() ? GetDefaultNoLabel() : m_no; }
wxString GetOKLabel() const
{ return m_ok.empty() ? GetDefaultOKLabel() : m_ok; }
wxString GetCancelLabel() const
{ return m_cancel.empty() ? GetDefaultCancelLabel() : m_cancel; }
wxString GetHelpLabel() const
{ return m_help.empty() ? GetDefaultHelpLabel() : m_help; }
// based on message dialog style, returns exactly one of: wxICON_NONE,
// wxICON_ERROR, wxICON_WARNING, wxICON_QUESTION, wxICON_INFORMATION,
// wxICON_AUTH_NEEDED
virtual long GetEffectiveIcon() const
{
if ( m_dialogStyle & wxICON_NONE )
return wxICON_NONE;
else if ( m_dialogStyle & wxICON_ERROR )
return wxICON_ERROR;
else if ( m_dialogStyle & wxICON_WARNING )
return wxICON_WARNING;
else if ( m_dialogStyle & wxICON_QUESTION )
return wxICON_QUESTION;
else if ( m_dialogStyle & wxICON_INFORMATION )
return wxICON_INFORMATION;
else if ( m_dialogStyle & wxYES )
return wxICON_QUESTION;
else
return wxICON_INFORMATION;
}
protected:
// for the platforms not supporting separate main and extended messages
// this function should be used to combine both of them in a single string
wxString GetFullMessage() const
{
wxString msg = m_message;
if ( !m_extendedMessage.empty() )
msg << "\n\n" << m_extendedMessage;
return msg;
}
wxString m_message,
m_extendedMessage,
m_caption;
long m_dialogStyle;
// this function is called by our public SetXXXLabels() and should assign
// the value to var with possibly some transformation (e.g. Cocoa version
// currently uses this to remove any accelerators from the button strings
// while GTK+ one handles stock items specifically here)
virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label)
{
var = label.GetAsString();
}
// these functions return the custom label or empty string and should be
// used only in specific circumstances such as creating the buttons with
// these labels (in which case it makes sense to only use a custom label if
// it was really given and fall back on stock label otherwise), use the
// Get{Yes,No,OK,Cancel}Label() methods above otherwise
const wxString& GetCustomYesLabel() const { return m_yes; }
const wxString& GetCustomNoLabel() const { return m_no; }
const wxString& GetCustomOKLabel() const { return m_ok; }
const wxString& GetCustomHelpLabel() const { return m_help; }
const wxString& GetCustomCancelLabel() const { return m_cancel; }
private:
// these functions may be overridden to provide different defaults for the
// default button labels (this is used by wxGTK)
virtual wxString GetDefaultYesLabel() const { return wxGetTranslation("Yes"); }
virtual wxString GetDefaultNoLabel() const { return wxGetTranslation("No"); }
virtual wxString GetDefaultOKLabel() const { return wxGetTranslation("OK"); }
virtual wxString GetDefaultCancelLabel() const { return wxGetTranslation("Cancel"); }
virtual wxString GetDefaultHelpLabel() const { return wxGetTranslation("Help"); }
// labels for the buttons, initially empty meaning that the defaults should
// be used, use GetYes/No/OK/CancelLabel() to access them
wxString m_yes,
m_no,
m_ok,
m_cancel,
m_help;
wxDECLARE_NO_COPY_CLASS(wxMessageDialogBase);
};
#include "wx/generic/msgdlgg.h"
#if defined(__WX_COMPILING_MSGDLGG_CPP__) || \
defined(__WXUNIVERSAL__) || defined(__WXGPE__) || \
(defined(__WXGTK__) && !defined(__WXGTK20__))
#define wxMessageDialog wxGenericMessageDialog
#elif defined(__WXMSW__)
#include "wx/msw/msgdlg.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/msgdlg.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/msgdlg.h"
#elif defined(__WXMAC__)
#include "wx/osx/msgdlg.h"
#elif defined(__WXQT__)
#include "wx/qt/msgdlg.h"
#endif
// ----------------------------------------------------------------------------
// wxMessageBox: the simplest way to use wxMessageDialog
// ----------------------------------------------------------------------------
int WXDLLIMPEXP_CORE wxMessageBox(const wxString& message,
const wxString& caption = wxMessageBoxCaptionStr,
long style = wxOK | wxCENTRE,
wxWindow *parent = NULL,
int x = wxDefaultCoord, int y = wxDefaultCoord);
#endif // wxUSE_MSGDLG
#endif // _WX_MSGDLG_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/tls.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/tls.h
// Purpose: Implementation of thread local storage
// Author: Vadim Zeitlin
// Created: 2008-08-08
// Copyright: (c) 2008 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TLS_H_
#define _WX_TLS_H_
#include "wx/defs.h"
// ----------------------------------------------------------------------------
// check for compiler support of thread-specific variables
// ----------------------------------------------------------------------------
// when not using threads at all, there is no need for thread-specific
// values to be really thread-specific
#if !wxUSE_THREADS
#define wxHAS_COMPILER_TLS
#define wxTHREAD_SPECIFIC_DECL
// otherwise try to find the compiler-specific way to handle TLS unless
// explicitly disabled by setting wxUSE_COMPILER_TLS to 0 (it is 1 by default).
#elif wxUSE_COMPILER_TLS
// __thread keyword is not supported correctly by MinGW, at least in some
// configurations, see http://sourceforge.net/support/tracker.php?aid=2837047
// and when in doubt we prefer to not use it at all.
#if defined(HAVE___THREAD_KEYWORD) && !defined(__MINGW32__)
#define wxHAS_COMPILER_TLS
#define wxTHREAD_SPECIFIC_DECL __thread
// MSVC has its own version which might be supported by some other Windows
// compilers, to be tested
#elif defined(__VISUALC__)
#define wxHAS_COMPILER_TLS
#define wxTHREAD_SPECIFIC_DECL __declspec(thread)
#endif // compilers
#endif // wxUSE_COMPILER_TLS
// ----------------------------------------------------------------------------
// define wxTLS_TYPE()
// ----------------------------------------------------------------------------
#ifdef wxHAS_COMPILER_TLS
#define wxTLS_TYPE(T) wxTHREAD_SPECIFIC_DECL T
#define wxTLS_TYPE_REF(T) T&
#define wxTLS_PTR(var) (&(var))
#define wxTLS_VALUE(var) (var)
#else // !wxHAS_COMPILER_TLS
extern "C"
{
typedef void (*wxTlsDestructorFunction)(void*);
}
#if defined(__WINDOWS__)
#include "wx/msw/tls.h"
#elif defined(__UNIX__)
#include "wx/unix/tls.h"
#else
// TODO: we could emulate TLS for such platforms...
#error Neither compiler nor OS support thread-specific variables.
#endif
#include <stdlib.h> // for calloc()
// wxTlsValue<T> represents a thread-specific value of type T but, unlike
// with native compiler thread-specific variables, it behaves like a
// (never NULL) pointer to T and so needs to be dereferenced before use
//
// Note: T must be a POD!
//
// Note: On Unix, thread-specific T value is freed when the thread exits.
// On Windows, thread-specific values are freed later, when given
// wxTlsValue<T> is destroyed. The only exception to this is the
// value for the main thread, which is always freed when
// wxTlsValue<T> is destroyed.
template <typename T>
class wxTlsValue
{
public:
typedef T ValueType;
// ctor doesn't do anything, the object is created on first access
wxTlsValue() : m_key(free) {}
// dtor is only called in the main thread context and so is not enough
// to free memory allocated by us for the other threads, we use
// destructor function when using Pthreads for this (which is not
// called for the main thread as it doesn't call pthread_exit() but
// just to be safe we also reset the key anyhow)
~wxTlsValue()
{
if ( m_key.Get() )
m_key.Set(NULL); // this deletes the value
}
// access the object creating it on demand
ValueType *Get()
{
void *value = m_key.Get();
if ( !value )
{
// ValueType must be POD to be used in wxHAS_COMPILER_TLS case
// anyhow (at least gcc doesn't accept non-POD values being
// declared with __thread) so initialize it as a POD too
value = calloc(1, sizeof(ValueType));
if ( !m_key.Set(value) )
{
free(value);
// this will probably result in a crash in the caller but
// it's arguably better to crash immediately instead of
// slowly dying from out-of-memory errors which would
// happen as the next access to this object would allocate
// another ValueType instance and so on forever
value = NULL;
}
}
return static_cast<ValueType *>(value);
}
// pointer-like accessors
ValueType *operator->() { return Get(); }
ValueType& operator*() { return *Get(); }
private:
wxTlsKey m_key;
wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxTlsValue, T);
};
#define wxTLS_TYPE(T) wxTlsValue<T>
#define wxTLS_TYPE_REF(T) wxTLS_TYPE(T)&
#define wxTLS_PTR(var) ((var).Get())
#define wxTLS_VALUE(var) (*(var))
#endif // wxHAS_COMPILER_TLS/!wxHAS_COMPILER_TLS
#endif // _WX_TLS_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/stockitem.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/stockitem.h
// Purpose: stock items helpers (privateh header)
// Author: Vaclav Slavik
// Modified by:
// Created: 2004-08-15
// Copyright: (c) Vaclav Slavik, 2004
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STOCKITEM_H_
#define _WX_STOCKITEM_H_
#include "wx/defs.h"
#include "wx/chartype.h"
#include "wx/string.h"
#include "wx/accel.h"
// ----------------------------------------------------------------------------
// Helper functions for stock items handling:
// ----------------------------------------------------------------------------
// Returns true if the ID is in the list of recognized stock actions
WXDLLIMPEXP_CORE bool wxIsStockID(wxWindowID id);
// Returns true of the label is empty or label of a stock button with
// given ID
WXDLLIMPEXP_CORE bool wxIsStockLabel(wxWindowID id, const wxString& label);
enum wxStockLabelQueryFlag
{
wxSTOCK_NOFLAGS = 0,
wxSTOCK_WITH_MNEMONIC = 1,
wxSTOCK_WITH_ACCELERATOR = 2,
// by default, stock items text is returned with ellipsis, if appropriate,
// this flag allows to avoid having it
wxSTOCK_WITHOUT_ELLIPSIS = 4,
// return label for button, not menu item: buttons should always use
// mnemonics and never use ellipsis
wxSTOCK_FOR_BUTTON = wxSTOCK_WITHOUT_ELLIPSIS | wxSTOCK_WITH_MNEMONIC
};
// Returns label that should be used for given stock UI element (e.g. "&OK"
// for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character
// is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator
// for given ID is concatenated to the label using \t as separator
WXDLLIMPEXP_CORE wxString wxGetStockLabel(wxWindowID id,
long flags = wxSTOCK_WITH_MNEMONIC);
#if wxUSE_ACCEL
// Returns the accelerator that should be used for given stock UI element
// (e.g. "Ctrl+x" for wxSTOCK_EXIT)
WXDLLIMPEXP_CORE wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id);
#endif
// wxStockHelpStringClient conceptually works like wxArtClient: it gives a hint to
// wxGetStockHelpString() about the context where the help string is to be used
enum wxStockHelpStringClient
{
wxSTOCK_MENU // help string to use for menu items
};
// Returns an help string for the given stock UI element and for the given "context".
WXDLLIMPEXP_CORE wxString wxGetStockHelpString(wxWindowID id,
wxStockHelpStringClient client = wxSTOCK_MENU);
#ifdef __WXGTK20__
// Translates stock ID to GTK+'s stock item string identifier:
WXDLLIMPEXP_CORE const char *wxGetStockGtkID(wxWindowID id);
#endif
#endif // _WX_STOCKITEM_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/windowid.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/windowid.h
// Purpose: wxWindowID class - a class for managing window ids
// Author: Brian Vanderburg II
// Created: 2007-09-21
// Copyright: (c) 2007 Brian Vanderburg II
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WINDOWID_H_
#define _WX_WINDOWID_H_
// NB: do not include defs.h as we are included from it
typedef int wxWindowID;
// ----------------------------------------------------------------------------
// wxWindowIDRef: reference counted id value
// ----------------------------------------------------------------------------
// A wxWindowIDRef object wraps an id value and marks it as (un)used as
// necessary. All ids returned from wxWindow::NewControlId() should be assigned
// to an instance of this class to ensure that the id is marked as being in
// use.
//
// This class is always defined but it is trivial if wxUSE_AUTOID_MANAGEMENT is
// off.
class WXDLLIMPEXP_CORE wxWindowIDRef
{
public:
// default ctor
wxWindowIDRef()
{
m_id = wxID_NONE;
}
// ctor taking id values
wxWindowIDRef(int id)
{
Init(id);
}
wxWindowIDRef(long id)
{
Init(wxWindowID(id));
}
wxWindowIDRef(const wxWindowIDRef& id)
{
Init(id.m_id);
}
// dtor
~wxWindowIDRef()
{
Assign(wxID_NONE);
}
// assignment
wxWindowIDRef& operator=(int id)
{
Assign(id);
return *this;
}
wxWindowIDRef& operator=(long id)
{
Assign(wxWindowID(id));
return *this;
}
wxWindowIDRef& operator=(const wxWindowIDRef& id)
{
if (&id != this)
Assign(id.m_id);
return *this;
}
// access to the stored id value
wxWindowID GetValue() const
{
return m_id;
}
operator wxWindowID() const
{
return m_id;
}
private:
#if wxUSE_AUTOID_MANAGEMENT
// common part of all ctors: call Assign() for our new id
void Init(wxWindowID id)
{
// m_id must be initialized before calling Assign()
m_id = wxID_NONE;
Assign(id);
}
// increase reference count of id, decrease the one of m_id
void Assign(wxWindowID id);
#else // !wxUSE_AUTOID_MANAGEMENT
// trivial stubs for the functions above
void Init(wxWindowID id)
{
m_id = id;
}
void Assign(wxWindowID id)
{
m_id = id;
}
#endif // wxUSE_AUTOID_MANAGEMENT/!wxUSE_AUTOID_MANAGEMENT
wxWindowID m_id;
};
// comparison operators
inline bool operator==(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs)
{
return lhs.GetValue() == rhs.GetValue();
}
inline bool operator==(const wxWindowIDRef& lhs, int rhs)
{
return lhs.GetValue() == rhs;
}
inline bool operator==(const wxWindowIDRef& lhs, long rhs)
{
return lhs.GetValue() == rhs;
}
inline bool operator==(int lhs, const wxWindowIDRef& rhs)
{
return rhs == lhs;
}
inline bool operator==(long lhs, const wxWindowIDRef& rhs)
{
return rhs == lhs;
}
inline bool operator!=(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs)
{
return !(lhs == rhs);
}
inline bool operator!=(const wxWindowIDRef& lhs, int rhs)
{
return !(lhs == rhs);
}
inline bool operator!=(const wxWindowIDRef& lhs, long rhs)
{
return !(lhs == rhs);
}
inline bool operator!=(int lhs, const wxWindowIDRef& rhs)
{
return !(lhs == rhs);
}
inline bool operator!=(long lhs, const wxWindowIDRef& rhs)
{
return !(lhs == rhs);
}
// ----------------------------------------------------------------------------
// wxIdManager
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxIdManager
{
public:
// This returns an id value and not an wxWindowIDRef. The returned value
// should be assigned a.s.a.p to a wxWindowIDRef. The IDs are marked as
// reserved so that another call to ReserveId before assigning the id to a
// wxWindowIDRef will not use the same ID
static wxWindowID ReserveId(int count = 1);
// This will release an unused reserved ID. This should only be called
// if the ID returned by ReserveId was NOT assigned to a wxWindowIDRef
// for some purpose, maybe an early return from a function
static void UnreserveId(wxWindowID id, int count = 1);
};
#endif // _WX_WINDOWID_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/xtitypes.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/xtitypes.h
// Purpose: enum, set, basic types support
// Author: Stefan Csomor
// Modified by: Francesco Montorsi
// Created: 27/07/03
// Copyright: (c) 1997 Julian Smart
// (c) 2003 Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _XTITYPES_H_
#define _XTITYPES_H_
#include "wx/defs.h"
#if wxUSE_EXTENDED_RTTI
#include "wx/string.h"
#include "wx/hashmap.h"
#include "wx/arrstr.h"
#include "wx/flags.h"
#include "wx/intl.h"
#include "wx/log.h"
#include <typeinfo>
class WXDLLIMPEXP_BASE wxClassInfo;
// ----------------------------------------------------------------------------
// Enum Support
//
// In the header files XTI requires no change from pure c++ code, however in the
// implementation, an enum needs to be enumerated e.g.:
//
// wxBEGIN_ENUM( wxFlavor )
// wxENUM_MEMBER( Vanilla )
// wxENUM_MEMBER( Chocolate )
// wxENUM_MEMBER( Strawberry )
// wxEND_ENUM( wxFlavor )
// ----------------------------------------------------------------------------
struct WXDLLIMPEXP_BASE wxEnumMemberData
{
const wxChar* m_name;
int m_value;
};
class WXDLLIMPEXP_BASE wxEnumData
{
public:
wxEnumData( wxEnumMemberData* data );
// returns true if the member has been found and sets the int value
// pointed to accordingly (if ptr != null )
// if not found returns false, value left unchanged
bool HasEnumMemberValue( const wxChar *name, int *value = NULL ) const;
// returns the value of the member, if not found in debug mode an
// assert is issued, in release 0 is returned
int GetEnumMemberValue(const wxChar *name ) const;
// returns the name of the enum member having the passed in value
// returns an empty string if not found
const wxChar *GetEnumMemberName(int value) const;
// returns the number of members in this enum
int GetEnumCount() const { return m_count; }
// returns the value of the nth member
int GetEnumMemberValueByIndex( int n ) const;
// returns the value of the nth member
const wxChar *GetEnumMemberNameByIndex( int n ) const;
private:
wxEnumMemberData *m_members;
int m_count;
};
#define wxBEGIN_ENUM( e ) \
wxEnumMemberData s_enumDataMembers##e[] = {
#define wxENUM_MEMBER( v ) { wxT(#v), v },
#define wxEND_ENUM( e ) \
{ NULL, 0 } }; \
wxEnumData s_enumData##e( s_enumDataMembers##e ); \
wxEnumData *wxGetEnumData(e) { return &s_enumData##e; } \
template<> void wxStringReadValue(const wxString& s, e &data ) \
{ data = (e) s_enumData##e.GetEnumMemberValue(s.c_str()); } \
template<> void wxStringWriteValue(wxString &s, const e &data ) \
{ s = s_enumData##e.GetEnumMemberName((int)data); } \
void FromLong##e( long data, wxAny& result ) \
{ result = wxAny((e)data); } \
void ToLong##e( const wxAny& data, long &result ) \
{ result = (long) (data).As(static_cast<e*>(NULL)); } \
\
wxTO_STRING_IMP( e ) \
wxFROM_STRING_IMP( e ) \
wxEnumTypeInfo s_typeInfo##e(wxT_ENUM, &s_enumData##e, \
&wxTO_STRING( e ), &wxFROM_STRING( e ), &ToLong##e, \
&FromLong##e, typeid(e).name() );
// ----------------------------------------------------------------------------
// Set Support
//
// in the header :
//
// enum wxFlavor
// {
// Vanilla,
// Chocolate,
// Strawberry,
// };
//
// typedef wxBitset<wxFlavor> wxCoupe;
//
// in the implementation file :
//
// wxBEGIN_ENUM( wxFlavor )
// wxENUM_MEMBER( Vanilla )
// wxENUM_MEMBER( Chocolate )
// wxENUM_MEMBER( Strawberry )
// wxEND_ENUM( wxFlavor )
//
// wxIMPLEMENT_SET_STREAMING( wxCoupe, wxFlavor )
//
// implementation note: no partial specialization for streaming, but a delegation
// to a different class
//
// ----------------------------------------------------------------------------
void WXDLLIMPEXP_BASE wxSetStringToArray( const wxString &s, wxArrayString &array );
template<typename e>
void wxSetFromString(const wxString &s, wxBitset<e> &data )
{
wxEnumData* edata = wxGetEnumData((e) 0);
data.reset();
wxArrayString array;
wxSetStringToArray( s, array );
wxString flag;
for ( int i = 0; i < array.Count(); ++i )
{
flag = array[i];
int ivalue;
if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) )
{
data.set( (e) ivalue );
}
}
}
template<typename e>
void wxSetToString( wxString &s, const wxBitset<e> &data )
{
wxEnumData* edata = wxGetEnumData((e) 0);
int count = edata->GetEnumCount();
int i;
s.Clear();
for ( i = 0; i < count; i++ )
{
e value = (e) edata->GetEnumMemberValueByIndex(i);
if ( data.test( value ) )
{
// this could also be done by the templated calls
if ( !s.empty() )
s += wxT("|");
s += edata->GetEnumMemberNameByIndex(i);
}
}
}
#define wxIMPLEMENT_SET_STREAMING(SetName,e) \
template<> void wxStringReadValue(const wxString &s, wxBitset<e> &data ) \
{ wxSetFromString( s, data ); } \
template<> void wxStringWriteValue( wxString &s, const wxBitset<e> &data ) \
{ wxSetToString( s, data ); } \
void FromLong##SetName( long data, wxAny& result ) \
{ result = wxAny(SetName((unsigned long)data)); } \
void ToLong##SetName( const wxAny& data, long &result ) \
{ result = (long) (data).As(static_cast<SetName*>(NULL)).to_ulong(); } \
wxTO_STRING_IMP( SetName ) \
wxFROM_STRING_IMP( SetName ) \
wxEnumTypeInfo s_typeInfo##SetName(wxT_SET, &s_enumData##e, \
&wxTO_STRING( SetName ), &wxFROM_STRING( SetName ), \
&ToLong##SetName, &FromLong##SetName, typeid(SetName).name() );
template<typename e>
void wxFlagsFromString(const wxString &s, e &data )
{
wxEnumData* edata = wxGetEnumData((e*) 0);
data.m_data = 0;
wxArrayString array;
wxSetStringToArray( s, array );
wxString flag;
for ( size_t i = 0; i < array.Count(); ++i )
{
flag = array[i];
int ivalue;
if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) )
{
data.m_data |= ivalue;
}
}
}
template<typename e>
void wxFlagsToString( wxString &s, const e& data )
{
wxEnumData* edata = wxGetEnumData((e*) 0);
int count = edata->GetEnumCount();
int i;
s.Clear();
long dataValue = data.m_data;
for ( i = 0; i < count; i++ )
{
int value = edata->GetEnumMemberValueByIndex(i);
// make this to allow for multi-bit constants to work
if ( value && ( dataValue & value ) == value )
{
// clear the flags we just set
dataValue &= ~value;
// this could also be done by the templated calls
if ( !s.empty() )
s +=wxT("|");
s += edata->GetEnumMemberNameByIndex(i);
}
}
}
#define wxBEGIN_FLAGS( e ) \
wxEnumMemberData s_enumDataMembers##e[] = {
#define wxFLAGS_MEMBER( v ) { wxT(#v), static_cast<int>(v) },
#define wxEND_FLAGS( e ) \
{ NULL, 0 } }; \
wxEnumData s_enumData##e( s_enumDataMembers##e ); \
wxEnumData *wxGetEnumData(e*) { return &s_enumData##e; } \
template<> void wxStringReadValue(const wxString &s, e &data ) \
{ wxFlagsFromString<e>( s, data ); } \
template<> void wxStringWriteValue( wxString &s, const e& data ) \
{ wxFlagsToString<e>( s, data ); } \
void FromLong##e( long data, wxAny& result ) \
{ result = wxAny(e(data)); } \
void ToLong##e( const wxAny& data, long &result ) \
{ result = (long) (data).As(static_cast<e*>(NULL)).m_data; } \
wxTO_STRING_IMP( e ) \
wxFROM_STRING_IMP( e ) \
wxEnumTypeInfo s_typeInfo##e(wxT_SET, &s_enumData##e, \
&wxTO_STRING( e ), &wxFROM_STRING( e ), &ToLong##e, \
&FromLong##e, typeid(e).name() );
// ----------------------------------------------------------------------------
// Type Information
// ----------------------------------------------------------------------------
// All data exposed by the RTTI is characterized using the following classes.
// The first characterization is done by wxTypeKind. All enums up to and including
// wxT_CUSTOM represent so called simple types. These cannot be divided any further.
// They can be converted to and from wxStrings, that's all.
// Other wxTypeKinds can instead be splitted recursively into smaller parts until
// the simple types are reached.
enum wxTypeKind
{
wxT_VOID = 0, // unknown type
wxT_BOOL,
wxT_CHAR,
wxT_UCHAR,
wxT_INT,
wxT_UINT,
wxT_LONG,
wxT_ULONG,
wxT_LONGLONG,
wxT_ULONGLONG,
wxT_FLOAT,
wxT_DOUBLE,
wxT_STRING, // must be wxString
wxT_SET, // must be wxBitset<> template
wxT_ENUM,
wxT_CUSTOM, // user defined type (e.g. wxPoint)
wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM,
wxT_OBJECT_PTR, // object reference
wxT_OBJECT, // embedded object
wxT_COLLECTION, // collection
wxT_DELEGATE, // for connecting against an event source
wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging
};
class WXDLLIMPEXP_BASE wxAny;
class WXDLLIMPEXP_BASE wxTypeInfo;
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo*, wxTypeInfoMap, class WXDLLIMPEXP_BASE );
class WXDLLIMPEXP_BASE wxTypeInfo
{
public:
typedef void (*wxVariant2StringFnc)( const wxAny& data, wxString &result );
typedef void (*wxString2VariantFnc)( const wxString& data, wxAny &result );
wxTypeInfo(wxTypeKind kind,
wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL,
const wxString &name = wxEmptyString):
m_toString(to), m_fromString(from), m_kind(kind), m_name(name)
{
Register();
}
#if 0 // wxUSE_UNICODE
wxTypeInfo(wxTypeKind kind,
wxVariant2StringFnc to, wxString2VariantFnc from,
const char *name):
m_toString(to), m_fromString(from), m_kind(kind),
m_name(wxString::FromAscii(name))
{
Register();
}
#endif
virtual ~wxTypeInfo()
{
Unregister();
}
// return the kind of this type (wxT_... constants)
wxTypeKind GetKind() const { return m_kind; }
// returns the unique name of this type
const wxString& GetTypeName() const { return m_name; }
// is this type a delegate type
bool IsDelegateType() const { return m_kind == wxT_DELEGATE; }
// is this type a custom type
bool IsCustomType() const { return m_kind == wxT_CUSTOM; }
// is this type an object type
bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR; }
// can the content of this type be converted to and from strings ?
bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL; }
// convert a wxAny holding data of this type into a string
void ConvertToString( const wxAny& data, wxString &result ) const
{
if ( m_toString )
(*m_toString)( data, result );
else
wxLogError( wxGetTranslation(wxT("String conversions not supported")) );
}
// convert a string into a wxAny holding the corresponding data in this type
void ConvertFromString( const wxString& data, wxAny &result ) const
{
if( m_fromString )
(*m_fromString)( data, result );
else
wxLogError( wxGetTranslation(wxT("String conversions not supported")) );
}
// statics:
// looks for the corresponding type, will return NULL if not found
static wxTypeInfo *FindType( const wxString& typeName );
private:
void Register();
void Unregister();
wxVariant2StringFnc m_toString;
wxString2VariantFnc m_fromString;
wxTypeKind m_kind;
wxString m_name;
// the static list of all types we know about
static wxTypeInfoMap* ms_typeTable;
};
class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo
{
public:
wxBuiltInTypeInfo( wxTypeKind kind, wxVariant2StringFnc to = NULL,
wxString2VariantFnc from = NULL,
const wxString &name = wxEmptyString ) :
wxTypeInfo( kind, to, from, name )
{ wxASSERT_MSG( GetKind() < wxT_SET, wxT("Illegal Kind for Base Type") ); }
};
class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo
{
public:
wxCustomTypeInfo( const wxString &name, wxVariant2StringFnc to,
wxString2VariantFnc from ) :
wxTypeInfo( wxT_CUSTOM, to, from, name )
{}
};
class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo
{
public:
typedef void (*converterToLong_t)( const wxAny& data, long &result );
typedef void (*converterFromLong_t)( long data, wxAny &result );
wxEnumTypeInfo( wxTypeKind kind, wxEnumData* enumInfo, wxVariant2StringFnc to,
wxString2VariantFnc from, converterToLong_t toLong,
converterFromLong_t fromLong, const wxString &name ) :
wxTypeInfo( kind, to, from, name ), m_toLong( toLong ), m_fromLong( fromLong )
{
wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET,
wxT("Illegal Kind for Enum Type"));
m_enumInfo = enumInfo;
}
const wxEnumData* GetEnumData() const { return m_enumInfo; }
// convert a wxAny holding data of this type into a long
void ConvertToLong( const wxAny& data, long &result ) const
{
if( m_toLong )
(*m_toLong)( data, result );
else
wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) );
}
// convert a long into a wxAny holding the corresponding data in this type
void ConvertFromLong( long data, wxAny &result ) const
{
if( m_fromLong )
(*m_fromLong)( data, result );
else
wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) );
}
private:
converterToLong_t m_toLong;
converterFromLong_t m_fromLong;
wxEnumData *m_enumInfo; // Kind == wxT_ENUM or Kind == wxT_SET
};
class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo
{
public:
wxClassTypeInfo( wxTypeKind kind, wxClassInfo* classInfo,
wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL,
const wxString &name = wxEmptyString);
const wxClassInfo *GetClassInfo() const { return m_classInfo; }
private:
wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL
};
class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo
{
public:
wxCollectionTypeInfo( const wxString &elementName, wxVariant2StringFnc to,
wxString2VariantFnc from , const wxString &name) :
wxTypeInfo( wxT_COLLECTION, to, from, name )
{ m_elementTypeName = elementName; m_elementType = NULL; }
const wxTypeInfo* GetElementType() const
{
if ( m_elementType == NULL )
m_elementType = wxTypeInfo::FindType( m_elementTypeName );
return m_elementType;
}
private:
mutable wxTypeInfo * m_elementType;
wxString m_elementTypeName;
};
class WXDLLIMPEXP_BASE wxEventSourceTypeInfo : public wxTypeInfo
{
public:
wxEventSourceTypeInfo( int eventType, wxClassInfo* eventClass,
wxVariant2StringFnc to = NULL,
wxString2VariantFnc from = NULL );
wxEventSourceTypeInfo( int eventType, int lastEventType, wxClassInfo* eventClass,
wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL );
int GetEventType() const { return m_eventType; }
int GetLastEventType() const { return m_lastEventType; }
const wxClassInfo* GetEventClass() const { return m_eventClass; }
private:
const wxClassInfo *m_eventClass; // (extended will merge into classinfo)
int m_eventType;
int m_lastEventType;
};
template<typename T> const wxTypeInfo* wxGetTypeInfo( T * )
{ return wxTypeInfo::FindType(typeid(T).name()); }
// this macro is for usage with custom, non-object derived classes and structs,
// wxPoint is such a custom type
#if wxUSE_FUNC_TEMPLATE_POINTER
#define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \
wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), &toString, &fromString);
#else
#define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \
void ToString##e( const wxAny& data, wxString &result ) \
{ toString(data, result); } \
void FromString##e( const wxString& data, wxAny &result ) \
{ fromString(data, result); } \
wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), \
&ToString##e, &FromString##e);
#endif
#define wxCOLLECTION_TYPE_INFO( element, collection ) \
wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name(), \
NULL, NULL, typeid(collection).name() );
// sometimes a compiler invents specializations that are nowhere called,
// use this macro to satisfy the refs, currently we don't have to play
// tricks, but if we will have to according to the compiler, we will use
// that macro for that
#define wxILLEGAL_TYPE_SPECIALIZATION( a )
#endif // wxUSE_EXTENDED_RTTI
#endif // _XTITYPES_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/arrstr.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/arrstr.h
// Purpose: wxArrayString class
// Author: Mattia Barbon and Vadim Zeitlin
// Modified by:
// Created: 07/07/03
// Copyright: (c) 2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ARRSTR_H
#define _WX_ARRSTR_H
#include "wx/defs.h"
#include "wx/string.h"
#include "wx/dynarray.h"
#if wxUSE_STD_CONTAINERS_COMPATIBLY
#include <vector>
#endif
// 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(const wxString& s1, const wxString& s2)
{
return s1.Cmp(s2);
}
inline int wxCMPFUNC_CONV wxStringSortDescending(const wxString& s1, const wxString& s2)
{
return wxStringSortAscending(s2, s1);
}
// This comparison function ignores case when comparing strings differing not
// in case only, i.e. this ensures that "Aa" comes before "AB", unlike with
// wxStringSortAscending().
inline int wxCMPFUNC_CONV
wxDictionaryStringSortAscending(const wxString& s1, const wxString& s2)
{
const int cmp = s1.CmpNoCase(s2);
return cmp ? cmp : s1.Cmp(s2);
}
inline int wxCMPFUNC_CONV
wxDictionaryStringSortDescending(const wxString& s1, const wxString& s2)
{
return wxDictionaryStringSortAscending(s2, s1);
}
#if wxUSE_STD_CONTAINERS
typedef int (wxCMPFUNC_CONV *CMPFUNCwxString)(wxString*, wxString*);
WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase,
wxARRAY_DUMMY_BASE, WXDLLIMPEXP_BASE);
class WXDLLIMPEXP_BASE wxArrayString : public wxArrayStringBase
{
public:
// type of function used by wxArrayString::Sort()
typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first,
const wxString& second);
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 wxString* a);
int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const;
void Sort(bool reverseOrder = false);
void Sort(CompareFunction function);
void Sort(CMPFUNCwxString function) { wxArrayStringBase::Sort(function); }
size_t Add(const wxString& string, size_t copies = 1)
{
wxArrayStringBase::Add(string, copies);
return size() - copies;
}
};
// Unlike all the other sorted arrays, this one uses a comparison function
// taking objects by reference rather than value, so define a special functor
// wrapping it.
class wxSortedArrayString_SortFunction
{
public:
typedef int (wxCMPFUNC_CONV *CMPFUNC)(const wxString&, const wxString&);
explicit wxSortedArrayString_SortFunction(CMPFUNC f) : m_f(f) { }
bool operator()(const wxString& s1, const wxString& s2)
{ return m_f(s1, s2) < 0; }
private:
CMPFUNC m_f;
};
typedef wxBaseSortedArray<wxString, wxSortedArrayString_SortFunction>
wxSortedArrayStringBase;
class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase
{
public:
wxSortedArrayString() : wxSortedArrayStringBase(wxStringSortAscending)
{ }
wxSortedArrayString(const wxSortedArrayString& array)
: wxSortedArrayStringBase(array)
{ }
wxSortedArrayString(const wxArrayString& src)
: wxSortedArrayStringBase(wxStringSortAscending)
{
reserve(src.size());
for ( size_t n = 0; n < src.size(); n++ )
Add(src[n]);
}
explicit wxSortedArrayString(wxArrayString::CompareFunction compareFunction)
: wxSortedArrayStringBase(compareFunction)
{ }
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" );
}
};
#else // if !wxUSE_STD_CONTAINERS
#include "wx/beforestd.h"
#include <iterator>
#include "wx/afterstd.h"
class WXDLLIMPEXP_BASE wxArrayString
{
public:
// type of function used by wxArrayString::Sort()
typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first,
const wxString& second);
// type of function used by wxArrayString::Sort(), for compatibility with
// wxArray
typedef int (wxCMPFUNC_CONV *CompareFunction2)(wxString* first,
wxString* second);
// constructors and destructor
// default ctor
wxArrayString() { Init(false); }
// if autoSort is true, the array is always sorted (in alphabetical order)
//
// 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.
explicit 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);
// wxString string array ctor
wxArrayString(size_t sz, const wxString* a);
// copy ctor
wxArrayString(const wxArrayString& array);
// assignment operator
wxArrayString& operator=(const wxArrayString& src);
// not virtual, this class should not be derived from
~wxArrayString();
// memory management
// empties the list, but doesn't release memory
void Empty();
// empties the list and releases memory
void Clear();
// preallocates memory for given number of items
void Alloc(size_t nCount);
// minimizes the memory usage (by freeing all extra memory)
void Shrink();
// simple accessors
// number of elements in the array
size_t GetCount() const { return m_nCount; }
// is it empty?
bool IsEmpty() const { return m_nCount == 0; }
// number of elements in the array (GetCount is preferred API)
size_t Count() const { return m_nCount; }
// items access (range checking is done in debug version)
// get item at position uiIndex
wxString& Item(size_t nIndex)
{
wxASSERT_MSG( nIndex < m_nCount,
wxT("wxArrayString: index out of bounds") );
return 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); }
// get last item
wxString& Last()
{
wxASSERT_MSG( !IsEmpty(),
wxT("wxArrayString: index out of bounds") );
return Item(GetCount() - 1);
}
const wxString& Last() const { return const_cast<wxArrayString*>(this)->Last(); }
// 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;
// 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);
// add new element at given position
void Insert(const wxString& str, size_t uiIndex, size_t nInsert = 1);
// expand the array to have count elements
void SetCount(size_t count);
// remove first item matching this value
void Remove(const wxString& sz);
// remove item by index
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
void Sort(CompareFunction compareFunction);
void Sort(CompareFunction2 compareFunction);
// comparison
// compare two arrays case sensitively
bool operator==(const wxArrayString& a) const;
// compare two arrays case sensitively
bool operator!=(const wxArrayString& a) const { return !(*this == a); }
// STL-like interface
typedef wxString value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef int difference_type;
typedef size_t size_type;
// TODO: this code duplicates the one in dynarray.h
class reverse_iterator
{
typedef wxString value_type;
typedef value_type* pointer;
typedef value_type& reference;
typedef reverse_iterator itor;
friend itor operator+(int o, const itor& it);
friend itor operator+(const itor& it, int o);
friend itor operator-(const itor& it, int o);
friend difference_type operator -(const itor& i1, const itor& i2);
public:
pointer m_ptr;
reverse_iterator() : m_ptr(NULL) { }
explicit 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; }
itor& operator++() { --m_ptr; return *this; }
const itor operator++(int)
{ const reverse_iterator tmp = *this; --m_ptr; return tmp; }
itor& operator--() { ++m_ptr; return *this; }
const itor operator--(int) { const itor tmp = *this; ++m_ptr; return tmp; }
bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }
bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }
};
class const_reverse_iterator
{
typedef wxString value_type;
typedef const value_type* pointer;
typedef const value_type& reference;
typedef const_reverse_iterator itor;
friend itor operator+(int o, const itor& it);
friend itor operator+(const itor& it, int o);
friend itor operator-(const itor& it, int o);
friend difference_type operator -(const itor& i1, const itor& i2);
public:
pointer m_ptr;
const_reverse_iterator() : m_ptr(NULL) { }
explicit 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; }
pointer operator->() const { return m_ptr; }
itor& operator++() { --m_ptr; return *this; }
const itor operator++(int)
{ const itor tmp = *this; --m_ptr; return tmp; }
itor& operator--() { ++m_ptr; return *this; }
const itor operator--(int) { const itor tmp = *this; ++m_ptr; return tmp; }
bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }
bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }
};
wxArrayString(const_iterator first, const_iterator last)
{ Init(false); assign(first, last); }
wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); }
template <class Iterator>
void assign(Iterator first, Iterator last)
{
clear();
reserve(std::distance(first, last));
for(; first != last; ++first)
push_back(*first);
}
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; }
size_type capacity() const { return m_nSize; }
void clear() { Clear(); }
bool empty() const { return IsEmpty(); }
iterator end() { return begin() + GetCount(); }
const_iterator end() const { return begin() + GetCount(); }
iterator erase(iterator first, iterator last)
{
size_t idx = first - begin();
RemoveAt(idx, last - first);
return begin() + idx;
}
iterator erase(iterator it) { return erase(it, it + 1); }
reference front() { return *begin(); }
const_reference front() const { return *begin(); }
void insert(iterator it, size_type n, const_reference v)
{ Insert(v, it - begin(), n); }
iterator insert(iterator it, const_reference v = value_type())
{ size_t idx = it - begin(); Insert(v, idx); return begin() + idx; }
void insert(iterator it, const_iterator first, const_iterator last);
size_type max_size() const { return INT_MAX; }
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); }
reverse_iterator rend() { return reverse_iterator(begin() - 1); }
const_reverse_iterator rend() const
{ return const_reverse_iterator(begin() - 1); }
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
void Copy(const wxArrayString& src); // copies the contents of another array
CompareFunction m_compareFunction; // set only from wxSortedArrayString
private:
// Allocate the new buffer big enough to hold m_nCount + nIncrement items and
// return the pointer to the old buffer, which must be deleted by the caller
// (if the old buffer is big enough, just return NULL).
wxString *Grow(size_t nIncrement);
size_t m_nSize, // current size of the array
m_nCount; // current number of elements
wxString *m_pItems; // pointer to data
bool m_autoSort; // if true, keep the array always sorted
};
class WXDLLIMPEXP_BASE wxSortedArrayString : public wxArrayString
{
public:
wxSortedArrayString() : wxArrayString(true)
{ }
wxSortedArrayString(const wxArrayString& array) : wxArrayString(true)
{ Copy(array); }
explicit wxSortedArrayString(CompareFunction compareFunction)
: wxArrayString(true)
{ m_compareFunction = compareFunction; }
};
#endif // !wxUSE_STD_CONTAINERS
// this class provides a temporary wxString* from a
// wxArrayString
class WXDLLIMPEXP_BASE wxCArrayString
{
public:
wxCArrayString( const wxArrayString& array )
: m_array( array ), m_strings( NULL )
{ }
~wxCArrayString() { delete[] m_strings; }
size_t GetCount() const { return m_array.GetCount(); }
wxString* GetStrings()
{
if( m_strings ) return m_strings;
const size_t count = m_array.GetCount();
m_strings = new wxString[count];
for( size_t i = 0; i < count; ++i )
m_strings[i] = m_array[i];
return m_strings;
}
wxString* Release()
{
wxString *r = GetStrings();
m_strings = NULL;
return r;
}
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 occurring 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;
}
#if wxUSE_STD_CONTAINERS_COMPATIBLY
// construct an adapter from a vector of strings
wxArrayStringsAdapter(const std::vector<wxString>& strings)
: m_type(wxSTRING_POINTER), m_size(strings.size())
{
m_data.ptr = m_size == 0 ? NULL : &strings[0];
}
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY
// 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
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/htmllbox.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/htmllbox.h
// Purpose: wxHtmlListBox is a listbox whose items are wxHtmlCells
// Author: Vadim Zeitlin
// Modified by:
// Created: 31.05.03
// Copyright: (c) 2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HTMLLBOX_H_
#define _WX_HTMLLBOX_H_
#include "wx/vlbox.h" // base class
#include "wx/html/htmlwin.h"
#include "wx/ctrlsub.h"
#if wxUSE_FILESYSTEM
#include "wx/filesys.h"
#endif // wxUSE_FILESYSTEM
class WXDLLIMPEXP_FWD_HTML wxHtmlCell;
class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser;
class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxCache;
class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxStyle;
extern WXDLLIMPEXP_DATA_HTML(const char) wxHtmlListBoxNameStr[];
extern WXDLLIMPEXP_DATA_HTML(const char) wxSimpleHtmlListBoxNameStr[];
// ----------------------------------------------------------------------------
// wxHtmlListBox
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_HTML wxHtmlListBox : public wxVListBox,
public wxHtmlWindowInterface,
public wxHtmlWindowMouseHelper
{
wxDECLARE_ABSTRACT_CLASS(wxHtmlListBox);
public:
// constructors and such
// ---------------------
// default constructor, you must call Create() later
wxHtmlListBox();
// normal constructor which calls Create() internally
wxHtmlListBox(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxHtmlListBoxNameStr);
// really creates the control and sets the initial number of items in it
// (which may be changed later with SetItemCount())
//
// the only special style which may be specified here is wxLB_MULTIPLE
//
// returns true on success or false if the control couldn't be created
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxHtmlListBoxNameStr);
// destructor cleans up whatever resources we use
virtual ~wxHtmlListBox();
// override some base class virtuals
virtual void RefreshRow(size_t line) wxOVERRIDE;
virtual void RefreshRows(size_t from, size_t to) wxOVERRIDE;
virtual void RefreshAll() wxOVERRIDE;
virtual void SetItemCount(size_t count) wxOVERRIDE;
#if wxUSE_FILESYSTEM
// retrieve the file system used by the wxHtmlWinParser: if you use
// relative paths in your HTML, you should use its ChangePathTo() method
wxFileSystem& GetFileSystem() { return m_filesystem; }
const wxFileSystem& GetFileSystem() const { return m_filesystem; }
#endif // wxUSE_FILESYSTEM
virtual void OnInternalIdle() wxOVERRIDE;
protected:
// this method must be implemented in the derived class and should return
// the body (i.e. without <html>) of the HTML for the given item
virtual wxString OnGetItem(size_t n) const = 0;
// this function may be overridden to decorate HTML returned by OnGetItem()
virtual wxString OnGetItemMarkup(size_t n) const;
// this method allows to customize the selection appearance: it may be used
// to specify the colour of the text which normally has the given colour
// colFg when it is inside the selection
//
// by default, the original colour is not used at all and all text has the
// same (default for this system) colour inside selection
virtual wxColour GetSelectedTextColour(const wxColour& colFg) const;
// this is the same as GetSelectedTextColour() but allows to customize the
// background colour -- this is even more rarely used as you can change it
// globally using SetSelectionBackground()
virtual wxColour GetSelectedTextBgColour(const wxColour& colBg) const;
// we implement both of these functions in terms of OnGetItem(), they are
// not supposed to be overridden by our descendants
virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE;
virtual wxCoord OnMeasureItem(size_t n) const wxOVERRIDE;
// override this one to draw custom background for selected items correctly
virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE;
// this method may be overridden to handle clicking on a link in the
// listbox (by default, clicks on links are simply ignored)
virtual void OnLinkClicked(size_t n, const wxHtmlLinkInfo& link);
// event handlers
void OnSize(wxSizeEvent& event);
void OnMouseMove(wxMouseEvent& event);
void OnLeftDown(wxMouseEvent& event);
// common part of all ctors
void Init();
// ensure that the given item is cached
void CacheItem(size_t n) const;
private:
// wxHtmlWindowInterface methods:
virtual void SetHTMLWindowTitle(const wxString& title) wxOVERRIDE;
virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) wxOVERRIDE;
virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
const wxString& url,
wxString *redirect) const wxOVERRIDE;
virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
const wxPoint& pos) const wxOVERRIDE;
virtual wxWindow* GetHTMLWindow() wxOVERRIDE;
virtual wxColour GetHTMLBackgroundColour() const wxOVERRIDE;
virtual void SetHTMLBackgroundColour(const wxColour& clr) wxOVERRIDE;
virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) wxOVERRIDE;
virtual void SetHTMLStatusText(const wxString& text) wxOVERRIDE;
virtual wxCursor GetHTMLCursor(HTMLCursor type) const wxOVERRIDE;
// returns index of item that contains given HTML cell
size_t GetItemForCell(const wxHtmlCell *cell) const;
// Create the cell for the given item, caller is responsible for freeing it.
wxHtmlCell* CreateCellForItem(size_t n) const;
// return physical coordinates of root wxHtmlCell of n-th item
wxPoint GetRootCellCoords(size_t n) const;
// Converts physical coordinates stored in @a pos into coordinates
// relative to the root cell of the item under mouse cursor, if any. If no
// cell is found under the cursor, returns false. Otherwise stores the new
// coordinates back into @a pos and pointer to the cell under cursor into
// @a cell and returns true.
bool PhysicalCoordsToCell(wxPoint& pos, wxHtmlCell*& cell) const;
// The opposite of PhysicalCoordsToCell: converts coordinates relative to
// given cell to physical coordinates in the window
wxPoint CellCoordsToPhysical(const wxPoint& pos, wxHtmlCell *cell) const;
private:
// this class caches the pre-parsed HTML to speed up display
wxHtmlListBoxCache *m_cache;
// HTML parser we use
wxHtmlWinParser *m_htmlParser;
#if wxUSE_FILESYSTEM
// file system used by m_htmlParser
wxFileSystem m_filesystem;
#endif // wxUSE_FILESYSTEM
// rendering style for the parser which allows us to customize our colours
wxHtmlListBoxStyle *m_htmlRendStyle;
// it calls our GetSelectedTextColour() and GetSelectedTextBgColour()
friend class wxHtmlListBoxStyle;
friend class wxHtmlListBoxWinInterface;
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxHtmlListBox);
};
// ----------------------------------------------------------------------------
// wxSimpleHtmlListBox
// ----------------------------------------------------------------------------
#define wxHLB_DEFAULT_STYLE wxBORDER_SUNKEN
#define wxHLB_MULTIPLE wxLB_MULTIPLE
class WXDLLIMPEXP_HTML wxSimpleHtmlListBox :
public wxWindowWithItems<wxHtmlListBox, wxItemContainer>
{
wxDECLARE_ABSTRACT_CLASS(wxSimpleHtmlListBox);
public:
// wxListbox-compatible constructors
// ---------------------------------
wxSimpleHtmlListBox() { }
wxSimpleHtmlListBox(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = wxHLB_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSimpleHtmlListBoxNameStr)
{
Create(parent, id, pos, size, n, choices, style, validator, name);
}
wxSimpleHtmlListBox(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = wxHLB_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSimpleHtmlListBoxNameStr)
{
Create(parent, id, pos, size, choices, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = wxHLB_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSimpleHtmlListBoxNameStr);
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = wxHLB_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSimpleHtmlListBoxNameStr);
virtual ~wxSimpleHtmlListBox();
// these must be overloaded otherwise the compiler will complain
// about wxItemContainerImmutable::[G|S]etSelection being pure virtuals...
void SetSelection(int n) wxOVERRIDE
{ wxVListBox::SetSelection(n); }
int GetSelection() const wxOVERRIDE
{ return wxVListBox::GetSelection(); }
// accessing strings
// -----------------
virtual unsigned int GetCount() const wxOVERRIDE
{ return m_items.GetCount(); }
virtual wxString GetString(unsigned int n) const wxOVERRIDE;
// override default unoptimized wxItemContainer::GetStrings() function
wxArrayString GetStrings() const
{ return m_items; }
virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE;
// resolve ambiguity between wxItemContainer and wxVListBox versions
void Clear() wxOVERRIDE;
protected:
virtual int DoInsertItems(const wxArrayStringsAdapter & items,
unsigned int pos,
void **clientData, wxClientDataType type) wxOVERRIDE;
virtual void DoSetItemClientData(unsigned int n, void *clientData) wxOVERRIDE
{ m_HTMLclientData[n] = clientData; }
virtual void *DoGetItemClientData(unsigned int n) const wxOVERRIDE
{ return m_HTMLclientData[n]; }
// wxItemContainer methods
virtual void DoClear() wxOVERRIDE;
virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE;
// calls wxHtmlListBox::SetItemCount() and RefreshAll()
void UpdateCount();
// override these functions just to change their visibility: users of
// wxSimpleHtmlListBox shouldn't be allowed to call them directly!
virtual void SetItemCount(size_t count) wxOVERRIDE
{ wxHtmlListBox::SetItemCount(count); }
virtual void SetRowCount(size_t count)
{ wxHtmlListBox::SetRowCount(count); }
virtual wxString OnGetItem(size_t n) const wxOVERRIDE
{ return m_items[n]; }
virtual void InitEvent(wxCommandEvent& event, int n) wxOVERRIDE
{
// we're not a virtual control and we can include the string
// of the item which was clicked:
event.SetString(m_items[n]);
wxVListBox::InitEvent(event, n);
}
wxArrayString m_items;
wxArrayPtrVoid m_HTMLclientData;
// Note: For the benefit of old compilers (like gcc-2.8) this should
// not be named m_clientdata as that clashes with the name of an
// anonymous struct member in wxEvtHandler, which we derive from.
wxDECLARE_NO_COPY_CLASS(wxSimpleHtmlListBox);
};
#endif // _WX_HTMLLBOX_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/datstrm.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/datstrm.h
// Purpose: Data stream classes
// Author: Guilhem Lavaux
// Modified by: Mickael Gilabert
// Created: 28/06/1998
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DATSTREAM_H_
#define _WX_DATSTREAM_H_
#include "wx/stream.h"
#include "wx/longlong.h"
#include "wx/convauto.h"
#if wxUSE_STREAMS
// Common wxDataInputStream and wxDataOutputStream parameters.
class WXDLLIMPEXP_BASE wxDataStreamBase
{
public:
void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
// By default we use extended precision (80 bit) format for both float and
// doubles. Call this function to switch to alternative representation in
// which IEEE 754 single precision (32 bits) is used for floats and double
// precision (64 bits) is used for doubles.
void UseBasicPrecisions()
{
#if wxUSE_APPLE_IEEE
m_useExtendedPrecision = false;
#endif // wxUSE_APPLE_IEEE
}
// UseExtendedPrecision() is not very useful as it corresponds to the
// default value, only call it in your code if you want the compilation
// fail with the error when using wxWidgets library compiled without
// extended precision support.
#if wxUSE_APPLE_IEEE
void UseExtendedPrecision()
{
m_useExtendedPrecision = true;
}
#endif // wxUSE_APPLE_IEEE
#if wxUSE_UNICODE
void SetConv( const wxMBConv &conv );
wxMBConv *GetConv() const { return m_conv; }
#endif
protected:
// Ctor and dtor are both protected, this class is never used directly but
// only by its derived classes.
wxDataStreamBase(const wxMBConv& conv);
~wxDataStreamBase();
bool m_be_order;
#if wxUSE_APPLE_IEEE
bool m_useExtendedPrecision;
#endif // wxUSE_APPLE_IEEE
#if wxUSE_UNICODE
wxMBConv *m_conv;
#endif
wxDECLARE_NO_COPY_CLASS(wxDataStreamBase);
};
class WXDLLIMPEXP_BASE wxDataInputStream : public wxDataStreamBase
{
public:
wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvUTF8);
bool IsOk() { return m_input->IsOk(); }
#if wxHAS_INT64
wxUint64 Read64();
#endif
#if wxUSE_LONGLONG
wxLongLong ReadLL();
#endif
wxUint32 Read32();
wxUint16 Read16();
wxUint8 Read8();
double ReadDouble();
float ReadFloat();
wxString ReadString();
#if wxHAS_INT64
void Read64(wxUint64 *buffer, size_t size);
void Read64(wxInt64 *buffer, size_t size);
#endif
#if defined(wxLongLong_t) && wxUSE_LONGLONG
void Read64(wxULongLong *buffer, size_t size);
void Read64(wxLongLong *buffer, size_t size);
#endif
#if wxUSE_LONGLONG
void ReadLL(wxULongLong *buffer, size_t size);
void ReadLL(wxLongLong *buffer, size_t size);
#endif
void Read32(wxUint32 *buffer, size_t size);
void Read16(wxUint16 *buffer, size_t size);
void Read8(wxUint8 *buffer, size_t size);
void ReadDouble(double *buffer, size_t size);
void ReadFloat(float *buffer, size_t size);
wxDataInputStream& operator>>(wxString& s);
wxDataInputStream& operator>>(wxInt8& c);
wxDataInputStream& operator>>(wxInt16& i);
wxDataInputStream& operator>>(wxInt32& i);
wxDataInputStream& operator>>(wxUint8& c);
wxDataInputStream& operator>>(wxUint16& i);
wxDataInputStream& operator>>(wxUint32& i);
#if wxHAS_INT64
wxDataInputStream& operator>>(wxUint64& i);
wxDataInputStream& operator>>(wxInt64& i);
#endif
#if defined(wxLongLong_t) && wxUSE_LONGLONG
wxDataInputStream& operator>>(wxULongLong& i);
wxDataInputStream& operator>>(wxLongLong& i);
#endif
wxDataInputStream& operator>>(double& d);
wxDataInputStream& operator>>(float& f);
protected:
wxInputStream *m_input;
wxDECLARE_NO_COPY_CLASS(wxDataInputStream);
};
class WXDLLIMPEXP_BASE wxDataOutputStream : public wxDataStreamBase
{
public:
wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvUTF8);
bool IsOk() { return m_output->IsOk(); }
#if wxHAS_INT64
void Write64(wxUint64 i);
void Write64(wxInt64 i);
#endif
#if wxUSE_LONGLONG
void WriteLL(const wxLongLong &ll);
void WriteLL(const wxULongLong &ll);
#endif
void Write32(wxUint32 i);
void Write16(wxUint16 i);
void Write8(wxUint8 i);
void WriteDouble(double d);
void WriteFloat(float f);
void WriteString(const wxString& string);
#if wxHAS_INT64
void Write64(const wxUint64 *buffer, size_t size);
void Write64(const wxInt64 *buffer, size_t size);
#endif
#if defined(wxLongLong_t) && wxUSE_LONGLONG
void Write64(const wxULongLong *buffer, size_t size);
void Write64(const wxLongLong *buffer, size_t size);
#endif
#if wxUSE_LONGLONG
void WriteLL(const wxULongLong *buffer, size_t size);
void WriteLL(const wxLongLong *buffer, size_t size);
#endif
void Write32(const wxUint32 *buffer, size_t size);
void Write16(const wxUint16 *buffer, size_t size);
void Write8(const wxUint8 *buffer, size_t size);
void WriteDouble(const double *buffer, size_t size);
void WriteFloat(const float *buffer, size_t size);
wxDataOutputStream& operator<<(const wxString& string);
wxDataOutputStream& operator<<(wxInt8 c);
wxDataOutputStream& operator<<(wxInt16 i);
wxDataOutputStream& operator<<(wxInt32 i);
wxDataOutputStream& operator<<(wxUint8 c);
wxDataOutputStream& operator<<(wxUint16 i);
wxDataOutputStream& operator<<(wxUint32 i);
#if wxHAS_INT64
wxDataOutputStream& operator<<(wxUint64 i);
wxDataOutputStream& operator<<(wxInt64 i);
#endif
#if defined(wxLongLong_t) && wxUSE_LONGLONG
wxDataOutputStream& operator<<(const wxULongLong &i);
wxDataOutputStream& operator<<(const wxLongLong &i);
#endif
wxDataOutputStream& operator<<(double d);
wxDataOutputStream& operator<<(float f);
protected:
wxOutputStream *m_output;
wxDECLARE_NO_COPY_CLASS(wxDataOutputStream);
};
#endif
// wxUSE_STREAMS
#endif
// _WX_DATSTREAM_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/clrpicker.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/clrpicker.h
// Purpose: wxColourPickerCtrl base header
// Author: Francesco Montorsi (based on Vadim Zeitlin's code)
// Modified by:
// Created: 14/4/2006
// Copyright: (c) Vadim Zeitlin, Francesco Montorsi
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CLRPICKER_H_BASE_
#define _WX_CLRPICKER_H_BASE_
#include "wx/defs.h"
#if wxUSE_COLOURPICKERCTRL
#include "wx/pickerbase.h"
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)
// ----------------------------------------------------------------------------
// wxColourPickerWidgetBase: a generic abstract interface which must be
// implemented by controls used by wxColourPickerCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxColourPickerWidgetBase
{
public:
wxColourPickerWidgetBase() { m_colour = *wxBLACK; }
virtual ~wxColourPickerWidgetBase() {}
wxColour GetColour() const
{ return m_colour; }
virtual void SetColour(const wxColour &col)
{ m_colour = col; UpdateColour(); }
virtual void SetColour(const wxString &col)
{ m_colour.Set(col); UpdateColour(); }
protected:
virtual void UpdateColour() = 0;
// the current colour (may be invalid if none)
wxColour m_colour;
};
// Styles which must be supported by all controls implementing wxColourPickerWidgetBase
// NB: these styles must be defined to carefully-chosen values to
// avoid conflicts with wxButton's styles
// show the colour in HTML form (#AABBCC) as colour button label
// (instead of no label at all)
// NOTE: this style is supported just by wxColourButtonGeneric and
// thus is not exposed in wxColourPickerCtrl
#define wxCLRP_SHOW_LABEL 0x0008
#define wxCLRP_SHOW_ALPHA 0x0010
// map platform-dependent controls which implement the wxColourPickerWidgetBase
// under the name "wxColourPickerWidget".
// NOTE: wxColourPickerCtrl allocates a wxColourPickerWidget and relies on the
// fact that all classes being mapped as wxColourPickerWidget have the
// 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__)
#include "wx/gtk/clrpicker.h"
#define wxColourPickerWidget wxColourButton
#elif defined(__WXQT__) && !defined(__WXUNIVERSAL__)
#include "wx/qt/clrpicker.h"
#else
#include "wx/generic/clrpickerg.h"
#define wxColourPickerWidget wxGenericColourButton
#endif
// ----------------------------------------------------------------------------
// wxColourPickerCtrl: platform-independent class which embeds a
// platform-dependent wxColourPickerWidget and, if wxCLRP_USE_TEXTCTRL style is
// used, a textctrl next to it.
// ----------------------------------------------------------------------------
#define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
#define wxCLRP_DEFAULT_STYLE 0
class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase
{
public:
wxColourPickerCtrl() {}
virtual ~wxColourPickerCtrl() {}
wxColourPickerCtrl(wxWindow *parent, wxWindowID id,
const wxColour& col = *wxBLACK, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerCtrlNameStr)
{ Create(parent, id, col, pos, size, style, validator, name); }
bool Create(wxWindow *parent, wxWindowID id,
const wxColour& col = *wxBLACK,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerCtrlNameStr);
public: // public API
// get the colour chosen
wxColour GetColour() const
{ return ((wxColourPickerWidget *)m_picker)->GetColour(); }
// set currently displayed color
void SetColour(const wxColour& col);
// set colour using RGB(r,g,b) syntax or considering given text as a colour name;
// returns true if the given text was successfully recognized.
bool SetColour(const wxString& text);
public: // internal functions
// update the button colour to match the text control contents
void UpdatePickerFromTextCtrl() wxOVERRIDE;
// update the text control to match the button's colour
void UpdateTextCtrlFromPicker() wxOVERRIDE;
// event handler for our picker
void OnColourChange(wxColourPickerEvent &);
protected:
virtual long GetPickerStyle(long style) const wxOVERRIDE
{ return (style & (wxCLRP_SHOW_LABEL | wxCLRP_SHOW_ALPHA)); }
private:
wxDECLARE_DYNAMIC_CLASS(wxColourPickerCtrl);
};
// ----------------------------------------------------------------------------
// wxColourPickerEvent: used by wxColourPickerCtrl only
// ----------------------------------------------------------------------------
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLOURPICKER_CHANGED, wxColourPickerEvent );
class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent
{
public:
wxColourPickerEvent() {}
wxColourPickerEvent(wxObject *generator, int id, const wxColour &col)
: wxCommandEvent(wxEVT_COLOURPICKER_CHANGED, id),
m_colour(col)
{
SetEventObject(generator);
}
wxColour GetColour() const { return m_colour; }
void SetColour(const wxColour &c) { m_colour = c; }
// default copy ctor, assignment operator and dtor are ok
virtual wxEvent *Clone() const wxOVERRIDE { return new wxColourPickerEvent(*this); }
private:
wxColour m_colour;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxColourPickerEvent);
};
// ----------------------------------------------------------------------------
// event types and macros
// ----------------------------------------------------------------------------
typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&);
#define wxColourPickerEventHandler(func) \
wxEVENT_HANDLER_CAST(wxColourPickerEventFunction, func)
#define EVT_COLOURPICKER_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn))
// old wxEVT_COMMAND_* constant
#define wxEVT_COMMAND_COLOURPICKER_CHANGED wxEVT_COLOURPICKER_CHANGED
#endif // wxUSE_COLOURPICKERCTRL
#endif // _WX_CLRPICKER_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/dialup.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/dialup.h
// Purpose: Network related wxWidgets classes and functions
// Author: Vadim Zeitlin
// Modified by:
// Created: 07.07.99
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DIALUP_H
#define _WX_DIALUP_H
#if wxUSE_DIALUP_MANAGER
#include "wx/event.h"
// ----------------------------------------------------------------------------
// misc
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_BASE wxArrayString;
#define WXDIALUP_MANAGER_DEFAULT_BEACONHOST wxT("www.yahoo.com")
// ----------------------------------------------------------------------------
// A class which groups functions dealing with connecting to the network from a
// workstation using dial-up access to the net. There is at most one instance
// of this class in the program accessed via GetDialUpManager().
// ----------------------------------------------------------------------------
/* TODO
*
* 1. more configurability for Unix: i.e. how to initiate the connection, how
* to check for online status, &c.
* 2. a function to enumerate all connections (ISPs) and show a dialog in
* Dial() allowing to choose between them if no ISP given
* 3. add an async version of dialing functions which notify the caller about
* the progress (or may be even start another thread to monitor it)
* 4. the static creation/accessor functions are not MT-safe - but is this
* really crucial? I think we may suppose they're always called from the
* main thread?
*/
class WXDLLIMPEXP_CORE wxDialUpManager
{
public:
// this function should create and return the object of the
// platform-specific class derived from wxDialUpManager. It's implemented
// in the platform-specific source files.
static wxDialUpManager *Create();
// could the dialup manager be initialized correctly? If this function
// returns false, no other functions will work neither, so it's a good idea
// to call this function and check its result before calling any other
// wxDialUpManager methods
virtual bool IsOk() const = 0;
// virtual dtor for any base class
virtual ~wxDialUpManager() { }
// operations
// ----------
// fills the array with the names of all possible values for the first
// parameter to Dial() on this machine and returns their number (may be 0)
virtual size_t GetISPNames(wxArrayString& names) const = 0;
// dial the given ISP, use username and password to authentificate
//
// if no nameOfISP is given, the function will select the default one
//
// if no username/password are given, the function will try to do without
// them, but will ask the user if really needed
//
// if async parameter is false, the function waits until the end of dialing
// and returns true upon successful completion.
// if async is true, the function only initiates the connection and returns
// immediately - the result is reported via events (an event is sent
// anyhow, but if dialing failed it will be a DISCONNECTED one)
virtual bool Dial(const wxString& nameOfISP = wxEmptyString,
const wxString& username = wxEmptyString,
const wxString& password = wxEmptyString,
bool async = true) = 0;
// returns true if (async) dialing is in progress
virtual bool IsDialing() const = 0;
// cancel dialing the number initiated with Dial(async = true)
// NB: this won't result in DISCONNECTED event being sent
virtual bool CancelDialing() = 0;
// hang up the currently active dial up connection
virtual bool HangUp() = 0;
// online status
// -------------
// returns true if the computer has a permanent network connection (i.e. is
// on a LAN) and so there is no need to use Dial() function to go online
//
// NB: this functions tries to guess the result and it is not always
// guaranteed to be correct, so it's better to ask user for
// confirmation or give him a possibility to override it
virtual bool IsAlwaysOnline() const = 0;
// returns true if the computer is connected to the network: under Windows,
// this just means that a RAS connection exists, under Unix we check that
// the "well-known host" (as specified by SetWellKnownHost) is reachable
virtual bool IsOnline() const = 0;
// sometimes the built-in logic for determining the online status may fail,
// so, in general, the user should be allowed to override it. This function
// allows to forcefully set the online status - whatever our internal
// algorithm may think about it.
virtual void SetOnlineStatus(bool isOnline = true) = 0;
// set misc wxDialUpManager options
// --------------------------------
// enable automatical checks for the connection status and sending of
// wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval
// parameter is only for Unix where we do the check manually: under
// Windows, the notification about the change of connection status is
// instantenous.
//
// Returns false if couldn't set up automatic check for online status.
virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60) = 0;
// disable automatic check for connection status change - notice that the
// wxEVT_DIALUP_XXX events won't be sent any more neither.
virtual void DisableAutoCheckOnlineStatus() = 0;
// additional Unix-only configuration
// ----------------------------------
// under Unix, the value of well-known host is used to check whether we're
// connected to the internet. It's unused under Windows, but this function
// is always safe to call. The default value is www.yahoo.com.
virtual void SetWellKnownHost(const wxString& hostname,
int portno = 80) = 0;
// Sets the commands to start up the network and to hang up again. Used by
// the Unix implementations only.
virtual void
SetConnectCommand(const wxString& commandDial = wxT("/usr/bin/pon"),
const wxString& commandHangup = wxT("/usr/bin/poff")) = 0;
};
// ----------------------------------------------------------------------------
// 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 );
// the event class for the dialup events
class WXDLLIMPEXP_CORE wxDialUpEvent : public wxEvent
{
public:
wxDialUpEvent(bool isConnected, bool isOwnEvent) : wxEvent(isOwnEvent)
{
SetEventType(isConnected ? wxEVT_DIALUP_CONNECTED
: wxEVT_DIALUP_DISCONNECTED);
}
// is this a CONNECTED or DISCONNECTED event?
bool IsConnectedEvent() const
{ return GetEventType() == wxEVT_DIALUP_CONNECTED; }
// does this event come from wxDialUpManager::Dial() or from some external
// process (i.e. does it result from our own attempt to establish the
// connection)?
bool IsOwnEvent() const { return m_id != 0; }
// implement the base class pure virtual
virtual wxEvent *Clone() const wxOVERRIDE { return new wxDialUpEvent(*this); }
private:
wxDECLARE_NO_ASSIGN_CLASS(wxDialUpEvent);
};
// the type of dialup event handler function
typedef void (wxEvtHandler::*wxDialUpEventFunction)(wxDialUpEvent&);
#define wxDialUpEventHandler(func) \
wxEVENT_HANDLER_CAST(wxDialUpEventFunction, func)
// macros to catch dialup events
#define EVT_DIALUP_CONNECTED(func) \
wx__DECLARE_EVT0(wxEVT_DIALUP_CONNECTED, wxDialUpEventHandler(func))
#define EVT_DIALUP_DISCONNECTED(func) \
wx__DECLARE_EVT0(wxEVT_DIALUP_DISCONNECTED, wxDialUpEventHandler(func))
#endif // wxUSE_DIALUP_MANAGER
#endif // _WX_DIALUP_H
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/dcbuffer.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/dcbuffer.h
// Purpose: wxBufferedDC class
// Author: Ron Lee <[email protected]>
// Modified by: Vadim Zeitlin (refactored, added bg preservation)
// Created: 16/03/02
// Copyright: (c) Ron Lee
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCBUFFER_H_
#define _WX_DCBUFFER_H_
#include "wx/dcmemory.h"
#include "wx/dcclient.h"
#include "wx/window.h"
// Split platforms into two groups - those which have well-working
// double-buffering by default, and those which do not.
#if defined(__WXMAC__) || defined(__WXGTK20__) || defined(__WXDFB__) || defined(__WXQT__)
#define wxALWAYS_NATIVE_DOUBLE_BUFFER 1
#else
#define wxALWAYS_NATIVE_DOUBLE_BUFFER 0
#endif
// ----------------------------------------------------------------------------
// Double buffering helper.
// ----------------------------------------------------------------------------
// Assumes the buffer bitmap covers the entire scrolled window,
// and prepares the window DC accordingly
#define wxBUFFER_VIRTUAL_AREA 0x01
// Assumes the buffer bitmap only covers the client area;
// 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
{
public:
// Default ctor, must subsequently call Init for two stage construction.
wxBufferedDC()
: m_dc(NULL),
m_buffer(NULL),
m_style(0)
{
}
// Construct a wxBufferedDC using a user supplied buffer.
wxBufferedDC(wxDC *dc,
wxBitmap& buffer = wxNullBitmap,
int style = wxBUFFER_CLIENT_AREA)
: m_dc(NULL), m_buffer(NULL)
{
Init(dc, buffer, style);
}
// Construct a wxBufferedDC with an internal buffer of 'area'
// (where area is usually something like the size of the window
// being buffered)
wxBufferedDC(wxDC *dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA)
: m_dc(NULL), m_buffer(NULL)
{
Init(dc, area, style);
}
// The usually desired action in the dtor is to blit the buffer.
virtual ~wxBufferedDC()
{
if ( m_dc )
UnMask();
}
// These reimplement the actions of the ctors for two stage creation
void Init(wxDC *dc,
wxBitmap& buffer = wxNullBitmap,
int style = wxBUFFER_CLIENT_AREA)
{
InitCommon(dc, style);
m_buffer = &buffer;
UseBuffer();
}
void Init(wxDC *dc, const wxSize &area, int style = wxBUFFER_CLIENT_AREA)
{
InitCommon(dc, style);
UseBuffer(area.x, area.y);
}
// Blits the buffer to the dc, and detaches the dc from the buffer (so it
// can be effectively used once only).
//
// 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();
// Set and get the style
void SetStyle(int style) { m_style = style; }
int GetStyle() const { return m_style & ~wxBUFFER_USES_SHARED_BUFFER; }
private:
// common part of Init()s
void InitCommon(wxDC *dc, int style)
{
wxASSERT_MSG( !m_dc, wxT("wxBufferedDC already initialised") );
m_dc = dc;
m_style = style;
}
// check that the bitmap is valid and use it
void UseBuffer(wxCoord w = -1, wxCoord h = -1);
// the underlying DC to which we copy everything drawn on this one in
// UnMask()
//
// NB: Without the existence of a wxNullDC, this must be a pointer, else it
// could probably be a reference.
wxDC *m_dc;
// the buffer (selected in this DC), initially invalid
wxBitmap *m_buffer;
// the buffering style
int m_style;
wxSize m_area;
wxDECLARE_DYNAMIC_CLASS(wxBufferedDC);
wxDECLARE_NO_COPY_CLASS(wxBufferedDC);
};
// ----------------------------------------------------------------------------
// Double buffered PaintDC.
// ----------------------------------------------------------------------------
// Creates a double buffered wxPaintDC, optionally allowing the
// user to specify their own buffer to use.
class WXDLLIMPEXP_CORE wxBufferedPaintDC : public wxBufferedDC
{
public:
// If no bitmap is supplied by the user, a temporary one will be created.
wxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA)
: m_paintdc(window)
{
// If we're buffering the virtual window, scale the paint DC as well
if (style & wxBUFFER_VIRTUAL_AREA)
window->PrepareDC( m_paintdc );
if( buffer.IsOk() )
Init(&m_paintdc, buffer, style);
else
Init(&m_paintdc, GetBufferedSize(window, style), style);
}
// If no bitmap is supplied by the user, a temporary one will be created.
wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA)
: m_paintdc(window)
{
// If we're using the virtual window, scale the paint DC as well
if (style & wxBUFFER_VIRTUAL_AREA)
window->PrepareDC( m_paintdc );
Init(&m_paintdc, GetBufferedSize(window, style), style);
}
// default copy ctor ok.
virtual ~wxBufferedPaintDC()
{
// We must UnMask here, else by the time the base class
// does it, the PaintDC will have already been destroyed.
UnMask();
}
protected:
// return the size needed by the buffer: this depends on whether we're
// buffering just the currently shown part or the total (scrolled) window
static wxSize GetBufferedSize(wxWindow *window, int style)
{
return style & wxBUFFER_VIRTUAL_AREA ? window->GetVirtualSize()
: window->GetClientSize();
}
private:
wxPaintDC m_paintdc;
wxDECLARE_ABSTRACT_CLASS(wxBufferedPaintDC);
wxDECLARE_NO_COPY_CLASS(wxBufferedPaintDC);
};
//
// wxAutoBufferedPaintDC is a wxPaintDC in toolkits which have double-
// buffering by default. Otherwise it is a wxBufferedPaintDC. Thus,
// you can only expect it work with a simple constructor that
// accepts single wxWindow* argument.
//
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
#define wxAutoBufferedPaintDCBase wxPaintDC
#else
#define wxAutoBufferedPaintDCBase wxBufferedPaintDC
#endif
class WXDLLIMPEXP_CORE 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."
);
}
virtual ~wxAutoBufferedPaintDC() { }
private:
wxDECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC);
};
// Check if the window is natively double buffered and will return a wxPaintDC
// if it is, a wxBufferedPaintDC otherwise. It is the caller's responsibility
// to delete the wxDC pointer when finished with it.
inline wxDC* wxAutoBufferedPaintDCFactory(wxWindow* window)
{
if ( window->IsDoubleBuffered() )
return new wxPaintDC(window);
else
return new wxBufferedPaintDC(window);
}
#endif // _WX_DCBUFFER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/uiaction.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/uiaction.h
// Purpose: wxUIActionSimulator interface
// Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin
// Created: 2010-03-06
// Copyright: (c) 2010 Kevin Ollivier
// (c) 2010 Steven Lamerton
// (c) 2010-2016 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UIACTIONSIMULATOR_H_
#define _WX_UIACTIONSIMULATOR_H_
#include "wx/defs.h"
#if wxUSE_UIACTIONSIMULATOR
#include "wx/mousestate.h" // for wxMOUSE_BTN_XXX constants
class WXDLLIMPEXP_CORE wxUIActionSimulator
{
public:
wxUIActionSimulator();
~wxUIActionSimulator();
// Mouse simulation
// ----------------
// Low level methods
bool MouseMove(long x, long y);
bool MouseMove(const wxPoint& point) { return MouseMove(point.x, point.y); }
bool MouseDown(int button = wxMOUSE_BTN_LEFT);
bool MouseUp(int button = wxMOUSE_BTN_LEFT);
// Higher level interface, use it if possible instead
bool MouseClick(int button = wxMOUSE_BTN_LEFT);
bool MouseDblClick(int button = wxMOUSE_BTN_LEFT);
bool MouseDragDrop(long x1, long y1, long x2, long y2,
int button = wxMOUSE_BTN_LEFT);
bool MouseDragDrop(const wxPoint& p1, const wxPoint& p2,
int button = wxMOUSE_BTN_LEFT)
{ return MouseDragDrop(p1.x, p1.y, p2.x, p2.y, button); }
// Keyboard simulation
// -------------------
// Low level methods for generating key presses and releases
bool KeyDown(int keycode, int modifiers = wxMOD_NONE)
{ return Key(keycode, modifiers, true); }
bool KeyUp(int keycode, int modifiers = wxMOD_NONE)
{ return Key(keycode, modifiers, false); }
// Higher level methods for generating both the key press and release for a
// single key or for all characters in the ASCII string "text" which can currently
// contain letters, digits and characters for the definition of numbers [+-., ].
bool Char(int keycode, int modifiers = wxMOD_NONE);
bool Text(const char *text);
// Select the item with the given text in the currently focused control.
bool Select(const wxString& text);
private:
// This is the common part of Key{Down,Up}() methods: while we keep them
// separate at public API level for consistency with Mouse{Down,Up}(), at
// implementation level it makes more sense to have them in a single
// function.
//
// It calls DoModifiers() to simulate pressing the modifier keys if
// necessary and then DoKey() for the key itself.
bool Key(int keycode, int modifiers, bool isDown);
// Call DoKey() for all modifier keys whose bits are set in the parameter.
void SimulateModifiers(int modifier, bool isDown);
// This pointer is allocated in the ctor and points to the
// platform-specific implementation.
class wxUIActionSimulatorImpl* const m_impl;
wxDECLARE_NO_COPY_CLASS(wxUIActionSimulator);
};
#endif // wxUSE_UIACTIONSIMULATOR
#endif // _WX_UIACTIONSIMULATOR_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/socket.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/socket.h
// Purpose: Socket handling classes
// Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia
// Modified by:
// Created: April 1997
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SOCKET_H_
#define _WX_SOCKET_H_
#include "wx/defs.h"
#if wxUSE_SOCKETS
// ---------------------------------------------------------------------------
// wxSocket headers
// ---------------------------------------------------------------------------
#include "wx/event.h"
#include "wx/sckaddr.h"
#include "wx/list.h"
class wxSocketImpl;
// ------------------------------------------------------------------------
// Types and constants
// ------------------------------------------------------------------------
// Define the type of native sockets.
#if defined(__WINDOWS__)
// Although socket descriptors are still 32 bit values, even under Win64,
// the socket type is 64 bit there.
typedef wxUIntPtr wxSOCKET_T;
#else
typedef int wxSOCKET_T;
#endif
// Types of different socket notifications or events.
//
// NB: the values here should be consecutive and start with 0 as they are
// used to construct the wxSOCKET_XXX_FLAG bit mask values below
enum wxSocketNotify
{
wxSOCKET_INPUT,
wxSOCKET_OUTPUT,
wxSOCKET_CONNECTION,
wxSOCKET_LOST
};
enum
{
wxSOCKET_INPUT_FLAG = 1 << wxSOCKET_INPUT,
wxSOCKET_OUTPUT_FLAG = 1 << wxSOCKET_OUTPUT,
wxSOCKET_CONNECTION_FLAG = 1 << wxSOCKET_CONNECTION,
wxSOCKET_LOST_FLAG = 1 << wxSOCKET_LOST
};
// this is a combination of the bit masks defined above
typedef int wxSocketEventFlags;
enum wxSocketError
{
wxSOCKET_NOERROR = 0,
wxSOCKET_INVOP,
wxSOCKET_IOERR,
wxSOCKET_INVADDR,
wxSOCKET_INVSOCK,
wxSOCKET_NOHOST,
wxSOCKET_INVPORT,
wxSOCKET_WOULDBLOCK,
wxSOCKET_TIMEDOUT,
wxSOCKET_MEMERR,
wxSOCKET_OPTERR
};
// socket options/flags bit masks
enum
{
wxSOCKET_NONE = 0x0000,
wxSOCKET_NOWAIT_READ = 0x0001,
wxSOCKET_NOWAIT_WRITE = 0x0002,
wxSOCKET_NOWAIT = wxSOCKET_NOWAIT_READ | wxSOCKET_NOWAIT_WRITE,
wxSOCKET_WAITALL_READ = 0x0004,
wxSOCKET_WAITALL_WRITE = 0x0008,
wxSOCKET_WAITALL = wxSOCKET_WAITALL_READ | wxSOCKET_WAITALL_WRITE,
wxSOCKET_BLOCK = 0x0010,
wxSOCKET_REUSEADDR = 0x0020,
wxSOCKET_BROADCAST = 0x0040,
wxSOCKET_NOBIND = 0x0080
};
typedef int wxSocketFlags;
// socket kind values (badly defined, don't use)
enum wxSocketType
{
wxSOCKET_UNINIT,
wxSOCKET_CLIENT,
wxSOCKET_SERVER,
wxSOCKET_BASE,
wxSOCKET_DATAGRAM
};
// event
class WXDLLIMPEXP_FWD_NET wxSocketEvent;
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_NET, wxEVT_SOCKET, wxSocketEvent);
// --------------------------------------------------------------------------
// wxSocketBase
// --------------------------------------------------------------------------
class WXDLLIMPEXP_NET wxSocketBase : public wxObject
{
public:
// Public interface
// ----------------
// ctors and dtors
wxSocketBase();
wxSocketBase(wxSocketFlags flags, wxSocketType type);
virtual ~wxSocketBase();
void Init();
bool Destroy();
// state
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_impl != NULL; }
bool Error() const { return LastError() != wxSOCKET_NOERROR; }
bool IsClosed() const { return m_closed; }
bool IsConnected() const { return m_connected; }
bool IsData() { return WaitForRead(0, 0); }
bool IsDisconnected() const { return !IsConnected(); }
wxUint32 LastCount() const { return m_lcount; }
wxUint32 LastReadCount() const { return m_lcount_read; }
wxUint32 LastWriteCount() const { return m_lcount_write; }
wxSocketError LastError() const;
void SaveState();
void RestoreState();
// addresses
virtual bool GetLocal(wxSockAddress& addr_man) const;
virtual bool GetPeer(wxSockAddress& addr_man) const;
virtual bool SetLocal(const wxIPV4address& local);
// base IO
virtual bool Close();
void ShutdownOutput();
wxSocketBase& Discard();
wxSocketBase& Peek(void* buffer, wxUint32 nbytes);
wxSocketBase& Read(void* buffer, wxUint32 nbytes);
wxSocketBase& ReadMsg(void *buffer, wxUint32 nbytes);
wxSocketBase& Unread(const void *buffer, wxUint32 nbytes);
wxSocketBase& Write(const void *buffer, wxUint32 nbytes);
wxSocketBase& WriteMsg(const void *buffer, wxUint32 nbytes);
// all Wait() functions wait until their condition is satisfied or the
// timeout expires; if seconds == -1 (default) then m_timeout value is used
//
// it is also possible to call InterruptWait() to cancel any current Wait()
// wait for anything at all to happen with this socket
bool Wait(long seconds = -1, long milliseconds = 0);
// wait until we can read from or write to the socket without blocking
// (notice that this does not mean that the operation will succeed but only
// that it will return immediately)
bool WaitForRead(long seconds = -1, long milliseconds = 0);
bool WaitForWrite(long seconds = -1, long milliseconds = 0);
// wait until the connection is terminated
bool WaitForLost(long seconds = -1, long milliseconds = 0);
void InterruptWait() { m_interrupt = true; }
wxSocketFlags GetFlags() const { return m_flags; }
void SetFlags(wxSocketFlags flags);
virtual void SetTimeout(long seconds);
long GetTimeout() const { return m_timeout; }
bool GetOption(int level, int optname, void *optval, int *optlen);
bool SetOption(int level, int optname, const void *optval, int optlen);
wxUint32 GetLastIOSize() const { return m_lcount; }
wxUint32 GetLastIOReadSize() const { return m_lcount_read; }
wxUint32 GetLastIOWriteSize() const { return m_lcount_write; }
// event handling
void *GetClientData() const { return m_clientData; }
void SetClientData(void *data) { m_clientData = data; }
void SetEventHandler(wxEvtHandler& handler, int id = wxID_ANY);
void SetNotify(wxSocketEventFlags flags);
void Notify(bool notify);
// Get the underlying socket descriptor.
wxSOCKET_T GetSocket() const;
// initialize/shutdown the sockets (done automatically so there is no need
// to call these functions usually)
//
// should always be called from the main thread only so one of the cases
// where they should indeed be called explicitly is when the first wxSocket
// object in the application is created in a different thread
static bool Initialize();
static void Shutdown();
// check if wxSocket had been already initialized
//
// notice that this function should be only called from the main thread as
// otherwise it is inherently unsafe because Initialize/Shutdown() may be
// called concurrently with it in the main thread
static bool IsInitialized();
// Implementation from now on
// --------------------------
// do not use, should be private (called from wxSocketImpl only)
void OnRequest(wxSocketNotify notify);
// do not use, not documented nor supported
bool IsNoWait() const { return ((m_flags & wxSOCKET_NOWAIT) != 0); }
wxSocketType GetType() const { return m_type; }
// Helper returning wxSOCKET_NONE if non-blocking sockets can be used, i.e.
// the socket is being created in the main thread and the event loop is
// running, or wxSOCKET_BLOCK otherwise.
//
// This is an internal function used only by wxWidgets itself, user code
// should decide if it wants blocking sockets or not and use the
// appropriate style instead of using it (but wxWidgets has to do it like
// this for compatibility with the original network classes behaviour).
static int GetBlockingFlagIfNeeded();
private:
friend class wxSocketClient;
friend class wxSocketServer;
friend class wxDatagramSocket;
// low level IO
wxUint32 DoRead(void* buffer, wxUint32 nbytes);
wxUint32 DoWrite(const void *buffer, wxUint32 nbytes);
// wait until the given flags are set for this socket or the given timeout
// (or m_timeout) expires
//
// notice that wxSOCKET_LOST_FLAG is always taken into account and the
// function returns -1 if the connection was lost; otherwise it returns
// true if any of the events specified by flags argument happened or false
// if the timeout expired
int DoWait(long timeout, wxSocketEventFlags flags);
// a helper calling DoWait() using the same convention as the public
// WaitForXXX() functions use, i.e. use our timeout if seconds == -1 or the
// specified timeout otherwise
int DoWait(long seconds, long milliseconds, wxSocketEventFlags flags);
// another helper calling DoWait() using our m_timeout
int DoWaitWithTimeout(wxSocketEventFlags flags)
{
return DoWait(m_timeout*1000, flags);
}
// pushback buffer
void Pushback(const void *buffer, wxUint32 size);
wxUint32 GetPushback(void *buffer, wxUint32 size, bool peek);
// store the given error as the LastError()
void SetError(wxSocketError error);
private:
// socket
wxSocketImpl *m_impl; // port-specific implementation
wxSocketType m_type; // wxSocket type
// state
wxSocketFlags m_flags; // wxSocket flags
bool m_connected; // connected?
bool m_establishing; // establishing connection?
bool m_reading; // busy reading?
bool m_writing; // busy writing?
bool m_closed; // was the other end closed?
wxUint32 m_lcount; // last IO transaction size
wxUint32 m_lcount_read; // last IO transaction size of Read() direction.
wxUint32 m_lcount_write; // last IO transaction size of Write() direction.
unsigned long m_timeout; // IO timeout value in seconds
// (TODO: remove, wxSocketImpl has it too)
wxList m_states; // stack of states (TODO: remove!)
bool m_interrupt; // interrupt ongoing wait operations?
bool m_beingDeleted; // marked for delayed deletion?
wxIPV4address m_localAddress; // bind to local address?
// pushback buffer
void *m_unread; // pushback buffer
wxUint32 m_unrd_size; // pushback buffer size
wxUint32 m_unrd_cur; // pushback pointer (index into buffer)
// events
int m_id; // socket id
wxEvtHandler *m_handler; // event handler
void *m_clientData; // client data for events
bool m_notify; // notify events to users?
wxSocketEventFlags m_eventmask; // which events to notify?
wxSocketEventFlags m_eventsgot; // collects events received in OnRequest()
friend class wxSocketReadGuard;
friend class wxSocketWriteGuard;
wxDECLARE_CLASS(wxSocketBase);
wxDECLARE_NO_COPY_CLASS(wxSocketBase);
};
// --------------------------------------------------------------------------
// wxSocketServer
// --------------------------------------------------------------------------
class WXDLLIMPEXP_NET wxSocketServer : public wxSocketBase
{
public:
wxSocketServer(const wxSockAddress& addr,
wxSocketFlags flags = wxSOCKET_NONE);
wxSocketBase* Accept(bool wait = true);
bool AcceptWith(wxSocketBase& socket, bool wait = true);
bool WaitForAccept(long seconds = -1, long milliseconds = 0);
wxDECLARE_CLASS(wxSocketServer);
wxDECLARE_NO_COPY_CLASS(wxSocketServer);
};
// --------------------------------------------------------------------------
// wxSocketClient
// --------------------------------------------------------------------------
class WXDLLIMPEXP_NET wxSocketClient : public wxSocketBase
{
public:
wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE);
virtual bool Connect(const wxSockAddress& addr, bool wait = true);
bool Connect(const wxSockAddress& addr,
const wxSockAddress& local,
bool wait = true);
bool WaitOnConnect(long seconds = -1, long milliseconds = 0);
// Sets initial socket buffer sizes using the SO_SNDBUF and SO_RCVBUF
// options before calling connect (either one can be -1 to leave it
// unchanged)
void SetInitialSocketBuffers(int recv, int send)
{
m_initialRecvBufferSize = recv;
m_initialSendBufferSize = send;
}
private:
virtual bool DoConnect(const wxSockAddress& addr,
const wxSockAddress* local,
bool wait = true);
// buffer sizes, -1 if unset and defaults should be used
int m_initialRecvBufferSize;
int m_initialSendBufferSize;
wxDECLARE_CLASS(wxSocketClient);
wxDECLARE_NO_COPY_CLASS(wxSocketClient);
};
// --------------------------------------------------------------------------
// wxDatagramSocket
// --------------------------------------------------------------------------
// WARNING: still in alpha stage
class WXDLLIMPEXP_NET wxDatagramSocket : public wxSocketBase
{
public:
wxDatagramSocket(const wxSockAddress& addr,
wxSocketFlags flags = wxSOCKET_NONE);
wxDatagramSocket& RecvFrom(wxSockAddress& addr,
void *buf,
wxUint32 nBytes);
wxDatagramSocket& SendTo(const wxSockAddress& addr,
const void* buf,
wxUint32 nBytes);
/* TODO:
bool Connect(wxSockAddress& addr);
*/
private:
wxDECLARE_CLASS(wxDatagramSocket);
wxDECLARE_NO_COPY_CLASS(wxDatagramSocket);
};
// --------------------------------------------------------------------------
// wxSocketEvent
// --------------------------------------------------------------------------
class WXDLLIMPEXP_NET wxSocketEvent : public wxEvent
{
public:
wxSocketEvent(int id = 0)
: wxEvent(id, wxEVT_SOCKET)
{
}
wxSocketNotify GetSocketEvent() const { return m_event; }
wxSocketBase *GetSocket() const
{ return (wxSocketBase *) GetEventObject(); }
void *GetClientData() const { return m_clientData; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxSocketEvent(*this); }
virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_SOCKET; }
public:
wxSocketNotify m_event;
void *m_clientData;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSocketEvent);
};
typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&);
#define wxSocketEventHandler(func) \
wxEVENT_HANDLER_CAST(wxSocketEventFunction, func)
#define EVT_SOCKET(id, func) \
wx__DECLARE_EVT1(wxEVT_SOCKET, id, wxSocketEventHandler(func))
#endif // wxUSE_SOCKETS
#endif // _WX_SOCKET_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/xtihandler.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/xtihandler.h
// Purpose: XTI handlers
// Author: Stefan Csomor
// Modified by: Francesco Montorsi
// Created: 27/07/03
// Copyright: (c) 1997 Julian Smart
// (c) 2003 Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _XTIHANDLER_H_
#define _XTIHANDLER_H_
#include "wx/defs.h"
#if wxUSE_EXTENDED_RTTI
#include "wx/xti.h"
// copied from event.h which cannot be included at this place
class WXDLLIMPEXP_FWD_BASE wxEvent;
#ifdef __VISUALC__
#define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
#else
#define wxMSVC_FWD_MULTIPLE_BASES
#endif
class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler;
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
typedef wxEventFunction wxObjectEventFunction;
// ----------------------------------------------------------------------------
// Handler Info
//
// this describes an event sink
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxHandlerInfo
{
friend class WXDLLIMPEXP_BASE wxDynamicClassInfo;
public:
wxHandlerInfo(wxHandlerInfo* &iter,
wxClassInfo* itsClass,
const wxString& name,
wxObjectEventFunction address,
const wxClassInfo* eventClassInfo) :
m_eventFunction(address),
m_name(name),
m_eventClassInfo(eventClassInfo),
m_itsClass(itsClass)
{
Insert(iter);
}
~wxHandlerInfo()
{ Remove(); }
// return the name of this handler
const wxString& GetName() const { return m_name; }
// return the class info of the event
const wxClassInfo *GetEventClassInfo() const { return m_eventClassInfo; }
// get the handler function pointer
wxObjectEventFunction GetEventFunction() const { return m_eventFunction; }
// returns NULL if this is the last handler of this class
wxHandlerInfo* GetNext() const { return m_next; }
// return the class this property is declared in
const wxClassInfo* GetDeclaringClass() const { return m_itsClass; }
private:
// inserts this handler at the end of the linked chain which begins
// with "iter" handler.
void Insert(wxHandlerInfo* &iter);
// removes this handler from the linked chain of the m_itsClass handlers.
void Remove();
wxObjectEventFunction m_eventFunction;
wxString m_name;
const wxClassInfo* m_eventClassInfo;
wxHandlerInfo* m_next;
wxClassInfo* m_itsClass;
};
#define wxHANDLER(name,eventClassType) \
static wxHandlerInfo _handlerInfo##name( first, class_t::GetClassInfoStatic(), \
wxT(#name), (wxObjectEventFunction) (wxEventFunction) &name, \
wxCLASSINFO( eventClassType ) );
#define wxBEGIN_HANDLERS_TABLE(theClass) \
wxHandlerInfo *theClass::GetHandlersStatic() \
{ \
typedef theClass class_t; \
static wxHandlerInfo* first = NULL;
#define wxEND_HANDLERS_TABLE() \
return first; }
#define wxEMPTY_HANDLERS_TABLE(theClass) \
wxBEGIN_HANDLERS_TABLE(theClass) \
wxEND_HANDLERS_TABLE()
#endif // wxUSE_EXTENDED_RTTI
#endif // _XTIHANDLER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/url.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/url.h
// Purpose: URL parser
// Author: Guilhem Lavaux
// Modified by: Ryan Norton
// Created: 20/07/1997
// Copyright: (c) 1997, 1998 Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_URL_H
#define _WX_URL_H
#include "wx/defs.h"
#if wxUSE_URL
#include "wx/uri.h"
#include "wx/protocol/protocol.h"
#if wxUSE_PROTOCOL_HTTP
#include "wx/protocol/http.h"
#endif
enum wxURLError {
wxURL_NOERR = 0,
wxURL_SNTXERR,
wxURL_NOPROTO,
wxURL_NOHOST,
wxURL_NOPATH,
wxURL_CONNERR,
wxURL_PROTOERR
};
#if wxUSE_URL_NATIVE
class WXDLLIMPEXP_FWD_NET wxURL;
class WXDLLIMPEXP_NET wxURLNativeImp : public wxObject
{
public:
virtual ~wxURLNativeImp() { }
virtual wxInputStream *GetInputStream(wxURL *owner) = 0;
};
#endif // wxUSE_URL_NATIVE
class WXDLLIMPEXP_NET wxURL : public wxURI
{
public:
wxURL(const wxString& sUrl = wxEmptyString);
wxURL(const wxURI& uri);
wxURL(const wxURL& url);
virtual ~wxURL();
wxURL& operator = (const wxString& url);
wxURL& operator = (const wxURI& uri);
wxURL& operator = (const wxURL& url);
wxProtocol& GetProtocol() { return *m_protocol; }
wxURLError GetError() const { return m_error; }
wxString GetURL() const { return m_url; }
wxURLError SetURL(const wxString &url)
{ *this = url; return m_error; }
bool IsOk() const
{ return m_error == wxURL_NOERR; }
wxInputStream *GetInputStream();
#if wxUSE_PROTOCOL_HTTP
static void SetDefaultProxy(const wxString& url_proxy);
void SetProxy(const wxString& url_proxy);
#endif // wxUSE_PROTOCOL_HTTP
protected:
static wxProtoInfo *ms_protocols;
#if wxUSE_PROTOCOL_HTTP
static wxHTTP *ms_proxyDefault;
static bool ms_useDefaultProxy;
wxHTTP *m_proxy;
bool m_useProxy;
#endif // wxUSE_PROTOCOL_HTTP
#if wxUSE_URL_NATIVE
friend class wxURLNativeImp;
// pointer to a native URL implementation object
wxURLNativeImp *m_nativeImp;
// Creates on the heap and returns a native
// implementation object for the current platform.
static wxURLNativeImp *CreateNativeImpObject();
#endif // wxUSE_URL_NATIVE
wxProtoInfo *m_protoinfo;
wxProtocol *m_protocol;
wxURLError m_error;
wxString m_url;
void Init(const wxString&);
bool ParseURL();
void CleanData();
void Free();
bool FetchProtocol();
friend class wxProtoInfo;
friend class wxURLModule;
private:
wxDECLARE_DYNAMIC_CLASS(wxURL);
};
#endif // wxUSE_URL
#endif // _WX_URL_H
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/notebook.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/notebook.h
// Purpose: wxNotebook interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 01.02.01
// Copyright: (c) 1996-2000 Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_NOTEBOOK_H_BASE_
#define _WX_NOTEBOOK_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_NOTEBOOK
#include "wx/bookctrl.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// wxNotebook hit results, use wxBK_HITTEST so other book controls can share them
// if wxUSE_NOTEBOOK is disabled
enum
{
wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE,
wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON,
wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL,
wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM,
wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE
};
// wxNotebook flags
// use common book wxBK_* flags for describing alignment
#define wxNB_DEFAULT wxBK_DEFAULT
#define wxNB_TOP wxBK_TOP
#define wxNB_BOTTOM wxBK_BOTTOM
#define wxNB_LEFT wxBK_LEFT
#define wxNB_RIGHT wxBK_RIGHT
#define wxNB_FIXEDWIDTH 0x0100
#define wxNB_MULTILINE 0x0200
#define wxNB_NOPAGETHEME 0x0400
typedef wxWindow wxNotebookPage; // so far, any window can be a page
extern WXDLLIMPEXP_DATA_CORE(const char) wxNotebookNameStr[];
#if wxUSE_EXTENDED_RTTI
// ----------------------------------------------------------------------------
// XTI accessor
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxNotebookPageInfo : public wxObject
{
public:
wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; }
virtual ~wxNotebookPageInfo() { }
bool Create(wxNotebookPage *page,
const wxString& text,
bool selected,
int imageId)
{
m_page = page;
m_text = text;
m_selected = selected;
m_imageId = imageId;
return true;
}
wxNotebookPage* GetPage() const { return m_page; }
wxString GetText() const { return m_text; }
bool GetSelected() const { return m_selected; }
int GetImageId() const { return m_imageId; }
private:
wxNotebookPage *m_page;
wxString m_text;
bool m_selected;
int m_imageId;
wxDECLARE_DYNAMIC_CLASS(wxNotebookPageInfo);
};
WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList );
#endif
// ----------------------------------------------------------------------------
// wxNotebookBase: define wxNotebook interface
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNotebookBase : public wxBookCtrlBase
{
public:
// ctors
// -----
wxNotebookBase() { }
// wxNotebook-specific additions to wxBookCtrlBase interface
// ---------------------------------------------------------
// get the number of rows for a control with wxNB_MULTILINE style (not all
// versions support it - they will always return 1 then)
virtual int GetRowCount() const { return 1; }
// set the padding between tabs (in pixels)
virtual void SetPadding(const wxSize& padding) = 0;
// set the size of the tabs for wxNB_FIXEDWIDTH controls
virtual void SetTabSize(const wxSize& sz) = 0;
// implement some base class functions
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE;
// On platforms that support it, get the theme page background colour, else invalid colour
virtual wxColour GetThemeBackgroundColour() const { return wxNullColour; }
// send wxEVT_NOTEBOOK_PAGE_CHANGING/ED events
// returns false if the change to nPage is vetoed by the program
bool SendPageChangingEvent(int nPage);
// sends the event about page change from old to new (or GetSelection() if
// new is wxNOT_FOUND)
void SendPageChangedEvent(int nPageOld, int nPageNew = wxNOT_FOUND);
#if wxUSE_EXTENDED_RTTI
// XTI accessors
virtual void AddPageInfo( wxNotebookPageInfo* info );
virtual const wxNotebookPageInfoList& GetPageInfos() const;
#endif
protected:
#if wxUSE_EXTENDED_RTTI
wxNotebookPageInfoList m_pageInfos;
#endif
wxDECLARE_NO_COPY_CLASS(wxNotebookBase);
};
// ----------------------------------------------------------------------------
// notebook event class and related stuff
// ----------------------------------------------------------------------------
// wxNotebookEvent is obsolete and defined for compatibility only (notice that
// we use #define and not typedef to also keep compatibility with the existing
// code which forward declares it)
#define wxNotebookEvent wxBookCtrlEvent
typedef wxBookCtrlEventFunction wxNotebookEventFunction;
#define wxNotebookEventHandler(func) wxBookCtrlEventHandler(func)
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEvent );
#define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \
wx__DECLARE_EVT1(wxEVT_NOTEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
#define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \
wx__DECLARE_EVT1(wxEVT_NOTEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
// ----------------------------------------------------------------------------
// wxNotebook class itself
// ----------------------------------------------------------------------------
#if defined(__WXUNIVERSAL__)
#include "wx/univ/notebook.h"
#elif defined(__WXMSW__)
#include "wx/msw/notebook.h"
#elif defined(__WXMOTIF__)
#include "wx/generic/notebook.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/notebook.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/notebook.h"
#elif defined(__WXMAC__)
#include "wx/osx/notebook.h"
#elif defined(__WXQT__)
#include "wx/qt/notebook.h"
#endif
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wxEVT_NOTEBOOK_PAGE_CHANGED
#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING wxEVT_NOTEBOOK_PAGE_CHANGING
#endif // wxUSE_NOTEBOOK
#endif
// _WX_NOTEBOOK_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/msgout.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/msgout.h
// Purpose: wxMessageOutput class. Shows a message to the user
// Author: Mattia Barbon
// Modified by:
// Created: 17.07.02
// Copyright: (c) Mattia Barbon
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSGOUT_H_
#define _WX_MSGOUT_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#include "wx/chartype.h"
#include "wx/strvararg.h"
// ----------------------------------------------------------------------------
// wxMessageOutput is a class abstracting formatted output target, i.e.
// something you can printf() to
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMessageOutput
{
public:
virtual ~wxMessageOutput() { }
// gets the current wxMessageOutput object (may be NULL during
// initialization or shutdown)
static wxMessageOutput* Get();
// sets the global wxMessageOutput instance; returns the previous one
static wxMessageOutput* Set(wxMessageOutput* msgout);
// show a message to the user
// void Printf(const wxString& format, ...) = 0;
WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&),
DoPrintfWchar, DoPrintfUtf8)
// called by DoPrintf() to output formatted string but can also be called
// directly if no formatting is needed
virtual void Output(const wxString& str) = 0;
protected:
#if !wxUSE_UTF8_LOCALE_ONLY
void DoPrintfWchar(const wxChar *format, ...);
#endif
#if wxUSE_UNICODE_UTF8
void DoPrintfUtf8(const char *format, ...);
#endif
private:
static wxMessageOutput* ms_msgOut;
};
// ----------------------------------------------------------------------------
// helper mix-in for output targets that can use difference encodings
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMessageOutputWithConv
{
protected:
explicit wxMessageOutputWithConv(const wxMBConv& conv)
: m_conv(conv.Clone())
{
}
~wxMessageOutputWithConv()
{
delete m_conv;
}
// return the string with "\n" appended if it doesn't already terminate
// with it (in which case it's returned unchanged)
wxString AppendLineFeedIfNeeded(const wxString& str);
// Prepare the given string for output by appending a new line to it, if
// necessary, and converting it to a narrow string using our conversion
// object.
wxCharBuffer PrepareForOutput(const wxString& str);
const wxMBConv* const m_conv;
};
// ----------------------------------------------------------------------------
// implementation which sends output to stderr or specified file
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput,
protected wxMessageOutputWithConv
{
public:
wxMessageOutputStderr(FILE *fp = stderr,
const wxMBConv &conv = wxConvWhateverWorks);
virtual void Output(const wxString& str) wxOVERRIDE;
protected:
FILE *m_fp;
wxDECLARE_NO_COPY_CLASS(wxMessageOutputStderr);
};
// ----------------------------------------------------------------------------
// implementation showing the message to the user in "best" possible way:
// uses stderr or message box if available according to the flag given to ctor.
// ----------------------------------------------------------------------------
enum wxMessageOutputFlags
{
wxMSGOUT_PREFER_STDERR = 0, // use stderr if available (this is the default)
wxMSGOUT_PREFER_MSGBOX = 1 // always use message box if available
};
class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutputStderr
{
public:
wxMessageOutputBest(wxMessageOutputFlags flags = wxMSGOUT_PREFER_STDERR)
: m_flags(flags) { }
virtual void Output(const wxString& str) wxOVERRIDE;
private:
wxMessageOutputFlags m_flags;
};
// ----------------------------------------------------------------------------
// implementation which shows output in a message box
// ----------------------------------------------------------------------------
#if wxUSE_GUI && wxUSE_MSGDLG
class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput
{
public:
wxMessageOutputMessageBox() { }
virtual void Output(const wxString& str) wxOVERRIDE;
};
#endif // wxUSE_GUI && wxUSE_MSGDLG
// ----------------------------------------------------------------------------
// implementation using the native way of outputting debug messages
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutputStderr
{
public:
wxMessageOutputDebug() { }
virtual void Output(const wxString& str) wxOVERRIDE;
};
// ----------------------------------------------------------------------------
// implementation using wxLog (mainly for backwards compatibility)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput
{
public:
wxMessageOutputLog() { }
virtual void Output(const wxString& str) wxOVERRIDE;
};
#endif // _WX_MSGOUT_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/imagtga.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/imagtga.h
// Purpose: wxImage TGA handler
// Author: Seth Jackson
// Copyright: (c) 2005 Seth Jackson
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_IMAGTGA_H_
#define _WX_IMAGTGA_H_
#include "wx/image.h"
//-----------------------------------------------------------------------------
// wxTGAHandler
//-----------------------------------------------------------------------------
#if wxUSE_TGA
class WXDLLIMPEXP_CORE wxTGAHandler : public wxImageHandler
{
public:
wxTGAHandler()
{
m_name = wxT("TGA file");
m_extension = wxT("tga");
m_altExtensions.Add(wxT("tpic"));
m_type = wxBITMAP_TYPE_TGA;
m_mime = wxT("image/tga");
}
#if wxUSE_STREAMS
virtual bool LoadFile(wxImage* image, wxInputStream& stream,
bool verbose = true, int index = -1) wxOVERRIDE;
virtual bool SaveFile(wxImage* image, wxOutputStream& stream,
bool verbose = true) wxOVERRIDE;
protected:
virtual bool DoCanRead(wxInputStream& stream) wxOVERRIDE;
#endif // wxUSE_STREAMS
wxDECLARE_DYNAMIC_CLASS(wxTGAHandler);
};
#endif // wxUSE_TGA
#endif // _WX_IMAGTGA_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/sckaddr.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/sckaddr.h
// Purpose: Network address classes
// Author: Guilhem Lavaux
// Modified by: Vadim Zeitlin to switch to wxSockAddressImpl implementation
// Created: 26/04/1997
// Copyright: (c) 1997, 1998 Guilhem Lavaux
// (c) 2008, 2009 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SCKADDR_H_
#define _WX_SCKADDR_H_
#include "wx/defs.h"
#if wxUSE_SOCKETS
#include "wx/string.h"
class wxSockAddressImpl;
// forward declare it instead of including the system headers defining it which
// can bring in <windows.h> under Windows which we don't want to include from
// public wx headers
struct sockaddr;
// Any socket address kind
class WXDLLIMPEXP_NET wxSockAddress : public wxObject
{
public:
enum Family
{
NONE,
IPV4,
IPV6,
UNIX
};
wxSockAddress();
wxSockAddress(const wxSockAddress& other);
virtual ~wxSockAddress();
wxSockAddress& operator=(const wxSockAddress& other);
virtual void Clear();
virtual Family Type() = 0;
// accessors for the low level address represented by this object
const sockaddr *GetAddressData() const;
int GetAddressDataLen() const;
// we need to be able to create copies of the addresses polymorphically
// (i.e. without knowing the exact address class)
virtual wxSockAddress *Clone() const = 0;
// implementation only, don't use
const wxSockAddressImpl& GetAddress() const { return *m_impl; }
void SetAddress(const wxSockAddressImpl& address);
protected:
wxSockAddressImpl *m_impl;
private:
void Init();
wxDECLARE_ABSTRACT_CLASS(wxSockAddress);
};
// An IP address (either IPv4 or IPv6)
class WXDLLIMPEXP_NET wxIPaddress : public wxSockAddress
{
public:
wxIPaddress() : wxSockAddress() { }
wxIPaddress(const wxIPaddress& other)
: wxSockAddress(other),
m_origHostname(other.m_origHostname)
{
}
bool operator==(const wxIPaddress& addr) const;
bool Hostname(const wxString& name);
bool Service(const wxString& name);
bool Service(unsigned short port);
bool LocalHost();
virtual bool IsLocalHost() const = 0;
bool AnyAddress();
virtual wxString IPAddress() const = 0;
wxString Hostname() const;
unsigned short Service() const;
wxString OrigHostname() const { return m_origHostname; }
protected:
// get m_impl initialized to the right family if it hadn't been done yet
wxSockAddressImpl& GetImpl();
const wxSockAddressImpl& GetImpl() const
{
return const_cast<wxIPaddress *>(this)->GetImpl();
}
// host name originally passed to Hostname()
wxString m_origHostname;
private:
// create the wxSockAddressImpl object of the correct family if it's
// currently uninitialized
virtual void DoInitImpl() = 0;
wxDECLARE_ABSTRACT_CLASS(wxIPaddress);
};
// An IPv4 address
class WXDLLIMPEXP_NET wxIPV4address : public wxIPaddress
{
public:
wxIPV4address() : wxIPaddress() { }
wxIPV4address(const wxIPV4address& other) : wxIPaddress(other) { }
// implement wxSockAddress pure virtuals:
virtual Family Type() wxOVERRIDE { return IPV4; }
virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV4address(*this); }
// implement wxIPaddress pure virtuals:
virtual bool IsLocalHost() const wxOVERRIDE;
virtual wxString IPAddress() const wxOVERRIDE;
// IPv4-specific methods:
bool Hostname(unsigned long addr);
// make base class methods hidden by our overload visible
using wxIPaddress::Hostname;
bool BroadcastAddress();
private:
virtual void DoInitImpl() wxOVERRIDE;
wxDECLARE_DYNAMIC_CLASS(wxIPV4address);
};
#if wxUSE_IPV6
// An IPv6 address
class WXDLLIMPEXP_NET wxIPV6address : public wxIPaddress
{
public:
wxIPV6address() : wxIPaddress() { }
wxIPV6address(const wxIPV6address& other) : wxIPaddress(other) { }
// implement wxSockAddress pure virtuals:
virtual Family Type() wxOVERRIDE { return IPV6; }
virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV6address(*this); }
// implement wxIPaddress pure virtuals:
virtual bool IsLocalHost() const wxOVERRIDE;
virtual wxString IPAddress() const wxOVERRIDE;
// IPv6-specific methods:
bool Hostname(unsigned char addr[16]);
using wxIPaddress::Hostname;
private:
virtual void DoInitImpl() wxOVERRIDE;
wxDECLARE_DYNAMIC_CLASS(wxIPV6address);
};
#endif // wxUSE_IPV6
// Unix domain sockets are only available under, well, Unix
#if defined(__UNIX__) && !defined(__WINDOWS__) && !defined(__WINE__)
#define wxHAS_UNIX_DOMAIN_SOCKETS
#endif
#ifdef wxHAS_UNIX_DOMAIN_SOCKETS
// A Unix domain socket address
class WXDLLIMPEXP_NET wxUNIXaddress : public wxSockAddress
{
public:
wxUNIXaddress() : wxSockAddress() { }
wxUNIXaddress(const wxUNIXaddress& other) : wxSockAddress(other) { }
void Filename(const wxString& name);
wxString Filename() const;
virtual Family Type() wxOVERRIDE { return UNIX; }
virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxUNIXaddress(*this); }
private:
wxSockAddressImpl& GetUNIX();
const wxSockAddressImpl& GetUNIX() const
{
return const_cast<wxUNIXaddress *>(this)->GetUNIX();
}
wxDECLARE_DYNAMIC_CLASS(wxUNIXaddress);
};
#endif // wxHAS_UNIX_DOMAIN_SOCKETS
#endif // wxUSE_SOCKETS
#endif // _WX_SCKADDR_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/helpbase.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/helpbase.h
// Purpose: Help system base classes
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HELPBASEH__
#define _WX_HELPBASEH__
#include "wx/defs.h"
#if wxUSE_HELP
#include "wx/object.h"
#include "wx/string.h"
#include "wx/gdicmn.h"
#include "wx/frame.h"
// Flags for SetViewer
#define wxHELP_NETSCAPE 1
// Search modes:
enum wxHelpSearchMode
{
wxHELP_SEARCH_INDEX,
wxHELP_SEARCH_ALL
};
// Defines the API for help controllers
class WXDLLIMPEXP_CORE wxHelpControllerBase: public wxObject
{
public:
inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; }
inline ~wxHelpControllerBase() {}
// Must call this to set the filename and server name.
// server is only required when implementing TCP/IP-based
// help controllers.
virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return false; }
virtual bool Initialize(const wxString& WXUNUSED(file)) { return false; }
// Set viewer: only relevant to some kinds of controller
virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = wxEmptyString) = 0;
// Displays the contents
virtual bool DisplayContents(void) = 0;
// Display the given section
virtual bool DisplaySection(int sectionNo) = 0;
// Display the section using a context id
virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return false; }
// Display the text in a popup, if possible
virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return false; }
// By default, uses KeywordSection to display a topic. Implementations
// may override this for more specific behaviour.
virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); }
virtual bool DisplayBlock(long blockNo) = 0;
virtual bool KeywordSearch(const wxString& k,
wxHelpSearchMode mode = wxHELP_SEARCH_ALL) = 0;
/// Allows one to override the default settings for the help frame.
virtual void SetFrameParameters(const wxString& WXUNUSED(title),
const wxSize& WXUNUSED(size),
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
bool WXUNUSED(newFrameEachTime) = false)
{
// does nothing by default
}
/// Obtains the latest settings used by the help frame and the help
/// frame.
virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
wxPoint *WXUNUSED(pos) = NULL,
bool *WXUNUSED(newFrameEachTime) = NULL)
{
return NULL; // does nothing by default
}
virtual bool Quit() = 0;
virtual void OnQuit() {}
/// Set the window that can optionally be used for the help window's parent.
virtual void SetParentWindow(wxWindow* win) { m_parentWindow = win; }
/// Get the window that can optionally be used for the help window's parent.
virtual wxWindow* GetParentWindow() const { return m_parentWindow; }
protected:
wxWindow* m_parentWindow;
private:
wxDECLARE_CLASS(wxHelpControllerBase);
};
#endif // wxUSE_HELP
#endif
// _WX_HELPBASEH__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/statline.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/statline.h
// Purpose: wxStaticLine class interface
// Author: Vadim Zeitlin
// Created: 28.06.99
// Copyright: (c) 1999 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATLINE_H_BASE_
#define _WX_STATLINE_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// this defines wxUSE_STATLINE
#include "wx/defs.h"
#if wxUSE_STATLINE
// the base class declaration
#include "wx/control.h"
// ----------------------------------------------------------------------------
// global variables
// ----------------------------------------------------------------------------
// the default name for objects of class wxStaticLine
extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticLineNameStr[];
// ----------------------------------------------------------------------------
// wxStaticLine - a line in a dialog
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxStaticLineBase : public wxControl
{
public:
// constructor
wxStaticLineBase() { }
// is the line vertical?
bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; }
// get the default size for the "lesser" dimension of the static line
static int GetDefaultSize() { return 2; }
// overridden base class virtuals
virtual bool AcceptsFocus() const wxOVERRIDE { return false; }
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
// set the right size for the right dimension
wxSize AdjustSize(const wxSize& size) const
{
wxSize sizeReal(size);
if ( IsVertical() )
{
if ( size.x == wxDefaultCoord )
sizeReal.x = GetDefaultSize();
}
else
{
if ( size.y == wxDefaultCoord )
sizeReal.y = GetDefaultSize();
}
return sizeReal;
}
virtual wxSize DoGetBestSize() const wxOVERRIDE
{
return AdjustSize(wxDefaultSize);
}
wxDECLARE_NO_COPY_CLASS(wxStaticLineBase);
};
// ----------------------------------------------------------------------------
// now include the actual class declaration
// ----------------------------------------------------------------------------
#if defined(__WXUNIVERSAL__)
#include "wx/univ/statline.h"
#elif defined(__WXMSW__)
#include "wx/msw/statline.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/statline.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/statline.h"
#elif defined(__WXMAC__)
#include "wx/osx/statline.h"
#elif defined(__WXQT__)
#include "wx/qt/statline.h"
#else // use generic implementation for all other platforms
#include "wx/generic/statline.h"
#endif
#endif // wxUSE_STATLINE
#endif // _WX_STATLINE_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/persist.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/persist.h
// Purpose: common classes for persistence support
// Author: Vadim Zeitlin
// Created: 2009-01-18
// Copyright: (c) 2009 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PERSIST_H_
#define _WX_PERSIST_H_
#include "wx/string.h"
#include "wx/hashmap.h"
#include "wx/confbase.h"
class wxPersistentObject;
WX_DECLARE_VOIDPTR_HASH_MAP(wxPersistentObject *, wxPersistentObjectsMap);
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------
/*
We do _not_ declare this function as doing this would force us to specialize
it for the user classes deriving from the standard persistent classes.
However we do define overloads of wxCreatePersistentObject() for all the wx
classes which means that template wxPersistentObject::Restore() picks up the
right overload to use provided that the header defining the correct overload
is included before calling it. And a compilation error happens if this is
not done.
template <class T>
wxPersistentObject *wxCreatePersistentObject(T *obj);
*/
// ----------------------------------------------------------------------------
// wxPersistenceManager: global aspects of persistent windows
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPersistenceManager
{
public:
// Call this method to specify a non-default persistence manager to use.
// This function should usually be called very early to affect creation of
// all persistent controls and the object passed to it must have a lifetime
// long enough to be still alive when the persistent controls are destroyed
// and need it to save their state so typically this would be a global or a
// wxApp member.
static void Set(wxPersistenceManager& manager);
// accessor to the unique persistence manager object
static wxPersistenceManager& Get();
// trivial but virtual dtor
virtual ~wxPersistenceManager();
// globally disable restoring or saving the persistent properties (both are
// enabled by default)
void DisableSaving() { m_doSave = false; }
void DisableRestoring() { m_doRestore = false; }
// register an object with the manager: when using the first overload,
// wxCreatePersistentObject() must be specialized for this object class;
// with the second one the persistent adapter is created by the caller
//
// the object shouldn't be already registered with us
template <class T>
wxPersistentObject *Register(T *obj)
{
return Register(obj, wxCreatePersistentObject(obj));
}
wxPersistentObject *Register(void *obj, wxPersistentObject *po);
// check if the object is registered and return the associated
// wxPersistentObject if it is or NULL otherwise
wxPersistentObject *Find(void *obj) const;
// unregister the object, this is called by wxPersistentObject itself so
// there is usually no need to do it explicitly
//
// deletes the associated wxPersistentObject
void Unregister(void *obj);
// save/restore the state of an object
//
// these methods do nothing if DisableSaving/Restoring() was called
//
// Restore() returns true if the object state was really restored
void Save(void *obj);
bool Restore(void *obj);
// combines both Save() and Unregister() calls
void SaveAndUnregister(void *obj)
{
Save(obj);
Unregister(obj);
}
// combines both Register() and Restore() calls
template <class T>
bool RegisterAndRestore(T *obj)
{
return Register(obj) && Restore(obj);
}
bool RegisterAndRestore(void *obj, wxPersistentObject *po)
{
return Register(obj, po) && Restore(obj);
}
// methods used by the persistent objects to save and restore the data
//
// currently these methods simply use wxConfig::Get() but they may be
// overridden in the derived class (once we allow creating custom
// persistent managers)
#define wxPERSIST_DECLARE_SAVE_RESTORE_FOR(Type) \
virtual bool SaveValue(const wxPersistentObject& who, \
const wxString& name, \
Type value); \
\
virtual bool \
RestoreValue(const wxPersistentObject& who, \
const wxString& name, \
Type *value)
wxPERSIST_DECLARE_SAVE_RESTORE_FOR(bool);
wxPERSIST_DECLARE_SAVE_RESTORE_FOR(int);
wxPERSIST_DECLARE_SAVE_RESTORE_FOR(long);
wxPERSIST_DECLARE_SAVE_RESTORE_FOR(wxString);
#undef wxPERSIST_DECLARE_SAVE_RESTORE_FOR
protected:
// ctor is private, use Get()
wxPersistenceManager()
{
m_doSave =
m_doRestore = true;
}
// Return the config object to use, by default just the global one but a
// different one could be used by the derived class if needed.
virtual wxConfigBase *GetConfig() const { return wxConfigBase::Get(); }
// Return the path to use for saving the setting with the given name for
// the specified object (notice that the name is the name of the setting,
// not the name of the object itself which can be retrieved with GetName()).
virtual wxString GetKey(const wxPersistentObject& who,
const wxString& name) const;
private:
// map with the registered objects as keys and associated
// wxPersistentObjects as values
wxPersistentObjectsMap m_persistentObjects;
// true if we should restore/save the settings (it doesn't make much sense
// to use this class when both of them are false but setting one of them to
// false may make sense in some situations)
bool m_doSave,
m_doRestore;
wxDECLARE_NO_COPY_CLASS(wxPersistenceManager);
};
// ----------------------------------------------------------------------------
// wxPersistentObject: ABC for anything persistent
// ----------------------------------------------------------------------------
class wxPersistentObject
{
public:
// ctor associates us with the object whose options we save/restore
wxPersistentObject(void *obj) : m_obj(obj) { }
// trivial but virtual dtor
virtual ~wxPersistentObject() { }
// methods used by wxPersistenceManager
// ------------------------------------
// save/restore the corresponding objects settings
//
// these methods shouldn't be used directly as they don't respect the
// global wxPersistenceManager::DisableSaving/Restoring() settings, use
// wxPersistenceManager methods with the same name instead
virtual void Save() const = 0;
virtual bool Restore() = 0;
// get the kind of the objects we correspond to, e.g. "Frame"
virtual wxString GetKind() const = 0;
// get the name of the object we correspond to, e.g. "Main"
virtual wxString GetName() const = 0;
// return the associated object
void *GetObject() const { return m_obj; }
protected:
// wrappers for wxPersistenceManager methods which don't require passing
// "this" as the first parameter all the time
template <typename T>
bool SaveValue(const wxString& name, T value) const
{
return wxPersistenceManager::Get().SaveValue(*this, name, value);
}
template <typename T>
bool RestoreValue(const wxString& name, T *value)
{
return wxPersistenceManager::Get().RestoreValue(*this, name, value);
}
private:
void * const m_obj;
wxDECLARE_NO_COPY_CLASS(wxPersistentObject);
};
// Helper function calling RegisterAndRestore() on the global persistence
// manager object.
template <typename T>
inline bool wxPersistentRegisterAndRestore(T *obj)
{
wxPersistentObject * const pers = wxCreatePersistentObject(obj);
return wxPersistenceManager::Get().RegisterAndRestore(obj, pers);
}
// A helper function which also sets the name for the (wxWindow-derived) object
// before registering and restoring it.
template <typename T>
inline bool wxPersistentRegisterAndRestore(T *obj, const wxString& name)
{
obj->SetName(name);
return wxPersistentRegisterAndRestore(obj);
}
#endif // _WX_PERSIST_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/fmappriv.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/fmappriv.h
// Purpose: private wxFontMapper stuff, not to be used by the library users
// Author: Vadim Zeitlin
// Modified by:
// Created: 21.06.2003 (extracted from common/fontmap.cpp)
// Copyright: (c) 1999-2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FMAPPRIV_H_
#define _WX_FMAPPRIV_H_
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// a special pseudo encoding which means "don't ask me about this charset
// any more" -- we need it to avoid driving the user crazy with asking him
// time after time about the same charset which he [presumably] doesn't
// have the fonts for
enum { wxFONTENCODING_UNKNOWN = -2 };
// the config paths we use
#if wxUSE_CONFIG
#define FONTMAPPER_ROOT_PATH wxT("/wxWindows/FontMapper")
#define FONTMAPPER_CHARSET_PATH wxT("Charsets")
#define FONTMAPPER_CHARSET_ALIAS_PATH wxT("Aliases")
#endif // wxUSE_CONFIG
// ----------------------------------------------------------------------------
// wxFontMapperPathChanger: change the config path during our lifetime
// ----------------------------------------------------------------------------
#if wxUSE_CONFIG && wxUSE_FILECONFIG
class wxFontMapperPathChanger
{
public:
wxFontMapperPathChanger(wxFontMapperBase *fontMapper, const wxString& path)
{
m_fontMapper = fontMapper;
m_ok = m_fontMapper->ChangePath(path, &m_pathOld);
}
bool IsOk() const { return m_ok; }
~wxFontMapperPathChanger()
{
if ( IsOk() )
m_fontMapper->RestorePath(m_pathOld);
}
private:
// the fontmapper object we're working with
wxFontMapperBase *m_fontMapper;
// the old path to be restored if m_ok
wxString m_pathOld;
// have we changed the path successfully?
bool m_ok;
wxDECLARE_NO_COPY_CLASS(wxFontMapperPathChanger);
};
#endif // wxUSE_CONFIG
#endif // _WX_FMAPPRIV_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/typeinfo.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/typeinfo.h
// Purpose: wxTypeId implementation
// Author: Jaakko Salli
// Created: 2009-11-19
// Copyright: (c) wxWidgets Team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TYPEINFO_H_
#define _WX_TYPEINFO_H_
//
// This file defines wxTypeId macro that should be used internally in
// wxWidgets instead of typeid(), for compatibility with builds that do
// not implement C++ RTTI. Also, type defining macros in this file are
// intended for internal use only at this time and may change in future
// versions.
//
// The reason why we need this simple RTTI system in addition to the older
// wxObject-based one is that the latter does not work in template
// classes.
//
#include "wx/defs.h"
#ifndef wxNO_RTTI
//
// Let's trust that Visual C++ versions 9.0 and later implement C++
// RTTI well enough, so we can use it and work around harmless memory
// leaks reported by the static run-time libraries.
//
#if wxCHECK_VISUALC_VERSION(9)
#define wxTRUST_CPP_RTTI 1
#else
#define wxTRUST_CPP_RTTI 0
#endif
#include <typeinfo>
#include <string.h>
#define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC)
#define WX_DECLARE_TYPEINFO_INLINE(CLS)
#define WX_DECLARE_TYPEINFO(CLS)
#define WX_DEFINE_TYPEINFO(CLS)
#define WX_DECLARE_ABSTRACT_TYPEINFO(CLS)
#if wxTRUST_CPP_RTTI
#define wxTypeId typeid
#else /* !wxTRUST_CPP_RTTI */
//
// For improved type-safety, let's make the check using class name
// comparison. Most modern compilers already do this, but we cannot
// rely on all supported compilers to work this well. However, in
// cases where we'd know that typeid() would be flawless (as such),
// wxTypeId could of course simply be defined as typeid.
//
class wxTypeIdentifier
{
public:
wxTypeIdentifier(const char* className)
{
m_className = className;
}
bool operator==(const wxTypeIdentifier& other) const
{
return strcmp(m_className, other.m_className) == 0;
}
bool operator!=(const wxTypeIdentifier& other) const
{
return !(*this == other);
}
private:
const char* m_className;
};
#define wxTypeId(OBJ) wxTypeIdentifier(typeid(OBJ).name())
#endif /* wxTRUST_CPP_RTTI/!wxTRUST_CPP_RTTI */
#else // if !wxNO_RTTI
#define wxTRUST_CPP_RTTI 0
//
// When C++ RTTI is not available, we will have to make the type comparison
// using pointer to a dummy static member function. This will fail if
// declared type is used across DLL boundaries, although using
// WX_DECLARE_TYPEINFO() and WX_DEFINE_TYPEINFO() pair instead of
// WX_DECLARE_TYPEINFO_INLINE() should fix this. However, that approach is
// usually not possible when type info needs to be declared for a template
// class.
//
typedef void (*wxTypeIdentifier)();
// Use this macro to declare type info with specified static function
// IDENTFUNC used as type identifier. Usually you should only use
// WX_DECLARE_TYPEINFO() or WX_DECLARE_TYPEINFO_INLINE() however.
#define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC) \
public: \
virtual wxTypeIdentifier GetWxTypeId() const \
{ \
return reinterpret_cast<wxTypeIdentifier> \
(&IDENTFUNC); \
}
// Use this macro to declare type info with externally specified
// type identifier, defined with WX_DEFINE_TYPEINFO().
#define WX_DECLARE_TYPEINFO(CLS) \
private: \
static CLS sm_wxClassInfo(); \
_WX_DECLARE_TYPEINFO_CUSTOM(CLS, sm_wxClassInfo)
// Use this macro to implement type identifier function required by
// WX_DECLARE_TYPEINFO().
// NOTE: CLS is required to have default ctor. If it doesn't
// already, you should provide a private dummy one.
#define WX_DEFINE_TYPEINFO(CLS) \
CLS CLS::sm_wxClassInfo() { return CLS(); }
// Use this macro to declare type info fully inline in class.
// NOTE: CLS is required to have default ctor. If it doesn't
// already, you should provide a private dummy one.
#define WX_DECLARE_TYPEINFO_INLINE(CLS) \
private: \
static CLS sm_wxClassInfo() { return CLS(); } \
_WX_DECLARE_TYPEINFO_CUSTOM(CLS, sm_wxClassInfo)
#define wxTypeId(OBJ) (OBJ).GetWxTypeId()
// Because abstract classes cannot be instantiated, we use
// this macro to define pure virtual type interface for them.
#define WX_DECLARE_ABSTRACT_TYPEINFO(CLS) \
public: \
virtual wxTypeIdentifier GetWxTypeId() const = 0;
#endif // wxNO_RTTI/!wxNO_RTTI
#endif // _WX_TYPEINFO_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/dvrenderers.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/dvrenderers.h
// Purpose: Declare all wxDataViewCtrl classes
// Author: Robert Roebling, Vadim Zeitlin
// Created: 2009-11-08 (extracted from wx/dataview.h)
// Copyright: (c) 2006 Robert Roebling
// (c) 2009 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DVRENDERERS_H_
#define _WX_DVRENDERERS_H_
/*
Note about the structure of various headers: they're organized in a more
complicated way than usual because of the various dependencies which are
different for different ports. In any case the only public header, i.e. the
one which can be included directly is wx/dataview.h. It, in turn, includes
this one to define all the renderer classes.
We define the base wxDataViewRendererBase class first and then include a
port-dependent wx/xxx/dvrenderer.h which defines wxDataViewRenderer itself.
After this we can define wxDataViewRendererCustomBase (and maybe in the
future base classes for other renderers if the need arises, i.e. if there
is any non-trivial code or API which it makes sense to keep in common code)
and include wx/xxx/dvrenderers.h (notice the plural) which defines all the
rest of the renderer classes.
*/
class WXDLLIMPEXP_FWD_CORE wxDataViewCustomRenderer;
// ----------------------------------------------------------------------------
// wxDataViewIconText: helper class used by wxDataViewIconTextRenderer
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewIconText : public wxObject
{
public:
wxDataViewIconText( const wxString &text = wxEmptyString,
const wxIcon& icon = wxNullIcon )
: m_text(text),
m_icon(icon)
{ }
wxDataViewIconText( const wxDataViewIconText &other )
: wxObject(),
m_text(other.m_text),
m_icon(other.m_icon)
{ }
void SetText( const wxString &text ) { m_text = text; }
wxString GetText() const { return m_text; }
void SetIcon( const wxIcon &icon ) { m_icon = icon; }
const wxIcon &GetIcon() const { return m_icon; }
bool IsSameAs(const wxDataViewIconText& other) const
{
return m_text == other.m_text && m_icon.IsSameAs(other.m_icon);
}
bool operator==(const wxDataViewIconText& other) const
{
return IsSameAs(other);
}
bool operator!=(const wxDataViewIconText& other) const
{
return !IsSameAs(other);
}
private:
wxString m_text;
wxIcon m_icon;
wxDECLARE_DYNAMIC_CLASS(wxDataViewIconText);
};
DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_CORE)
// ----------------------------------------------------------------------------
// wxDataViewCheckIconText: value class used by wxDataViewCheckIconTextRenderer
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewCheckIconText : public wxDataViewIconText
{
public:
wxDataViewCheckIconText(const wxString& text = wxString(),
const wxIcon& icon = wxNullIcon,
wxCheckBoxState checkedState = wxCHK_UNDETERMINED)
: wxDataViewIconText(text, icon),
m_checkedState(checkedState)
{
}
wxCheckBoxState GetCheckedState() const { return m_checkedState; }
void SetCheckedState(wxCheckBoxState state) { m_checkedState = state; }
private:
wxCheckBoxState m_checkedState;
wxDECLARE_DYNAMIC_CLASS(wxDataViewCheckIconText);
};
DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewCheckIconText, WXDLLIMPEXP_CORE)
// ----------------------------------------------------------------------------
// wxDataViewRendererBase
// ----------------------------------------------------------------------------
enum wxDataViewCellMode
{
wxDATAVIEW_CELL_INERT,
wxDATAVIEW_CELL_ACTIVATABLE,
wxDATAVIEW_CELL_EDITABLE
};
enum wxDataViewCellRenderState
{
wxDATAVIEW_CELL_SELECTED = 1,
wxDATAVIEW_CELL_PRELIT = 2,
wxDATAVIEW_CELL_INSENSITIVE = 4,
wxDATAVIEW_CELL_FOCUSED = 8
};
// helper for fine-tuning rendering of values depending on row's state
class WXDLLIMPEXP_CORE wxDataViewValueAdjuster
{
public:
virtual ~wxDataViewValueAdjuster() {}
// changes the value to have appearance suitable for highlighted rows
virtual wxVariant MakeHighlighted(const wxVariant& value) const { return value; }
};
class WXDLLIMPEXP_CORE wxDataViewRendererBase: public wxObject
{
public:
wxDataViewRendererBase( const wxString &varianttype,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int alignment = wxDVR_DEFAULT_ALIGNMENT );
virtual ~wxDataViewRendererBase();
virtual bool Validate( wxVariant& WXUNUSED(value) )
{ return true; }
void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; }
wxDataViewColumn* GetOwner() const { return m_owner; }
// renderer value and attributes: SetValue() and SetAttr() are called
// before a cell is rendered using this renderer
virtual bool SetValue(const wxVariant& value) = 0;
virtual bool GetValue(wxVariant& value) const = 0;
#if wxUSE_ACCESSIBILITY
virtual wxString GetAccessibleDescription() const = 0;
#endif // wxUSE_ACCESSIBILITY
wxString GetVariantType() const { return m_variantType; }
// Prepare for rendering the value of the corresponding item in the given
// column taken from the provided non-null model.
//
// Notice that the column must be the same as GetOwner()->GetModelColumn(),
// it is only passed to this method because the existing code already has
// it and should probably be removed in the future.
//
// Return true if this cell is non-empty or false otherwise (and also if
// the model returned a value of the wrong, i.e. different from our
// GetVariantType(), type, in which case a debug error is also logged).
bool PrepareForItem(const wxDataViewModel *model,
const wxDataViewItem& item,
unsigned column);
// renderer properties:
virtual void SetMode( wxDataViewCellMode mode ) = 0;
virtual wxDataViewCellMode GetMode() const = 0;
// NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
// rather an "int"; that's because for rendering cells it's allowed
// to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
virtual void SetAlignment( int align ) = 0;
virtual int GetAlignment() const = 0;
// enable or disable (if called with wxELLIPSIZE_NONE) replacing parts of
// the item text (hence this only makes sense for renderers showing
// text...) with ellipsis in order to make it fit the column width
virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) = 0;
void DisableEllipsize() { EnableEllipsize(wxELLIPSIZE_NONE); }
virtual wxEllipsizeMode GetEllipsizeMode() const = 0;
// in-place editing
virtual bool HasEditorCtrl() const
{ return false; }
virtual wxWindow* CreateEditorCtrl(wxWindow * WXUNUSED(parent),
wxRect WXUNUSED(labelRect),
const wxVariant& WXUNUSED(value))
{ return NULL; }
virtual bool GetValueFromEditorCtrl(wxWindow * WXUNUSED(editor),
wxVariant& WXUNUSED(value))
{ return false; }
virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect );
virtual void CancelEditing();
virtual bool FinishEditing();
wxWindow *GetEditorCtrl() const { return m_editorCtrl; }
virtual bool IsCustomRenderer() const { return false; }
// Implementation only from now on.
// Return the alignment of this renderer if it's specified (i.e. has value
// different from the default wxDVR_DEFAULT_ALIGNMENT) or the alignment of
// the column it is used for otherwise.
//
// Unlike GetAlignment(), this always returns a valid combination of
// wxALIGN_XXX flags (although possibly wxALIGN_NOT) and never returns
// wxDVR_DEFAULT_ALIGNMENT.
int GetEffectiveAlignment() const;
// Like GetEffectiveAlignment(), but returns wxDVR_DEFAULT_ALIGNMENT if
// the owner isn't set and GetAlignment() is default.
int GetEffectiveAlignmentIfKnown() const;
// Send wxEVT_DATAVIEW_ITEM_EDITING_STARTED event.
void NotifyEditingStarted(const wxDataViewItem& item);
// Sets the transformer for fine-tuning rendering of values depending on row's state
void SetValueAdjuster(wxDataViewValueAdjuster *transformer)
{ delete m_valueAdjuster; m_valueAdjuster = transformer; }
protected:
// These methods are called from PrepareForItem() and should do whatever is
// needed for the current platform to ensure that the item is rendered
// using the given attributes and enabled/disabled state.
virtual void SetAttr(const wxDataViewItemAttr& attr) = 0;
virtual void SetEnabled(bool enabled) = 0;
// Return whether the currently rendered item is on a highlighted row
// (typically selection with dark background). For internal use only.
virtual bool IsHighlighted() const = 0;
// Helper of PrepareForItem() also used in StartEditing(): returns the
// value checking that its type matches our GetVariantType().
wxVariant CheckedGetValue(const wxDataViewModel* model,
const wxDataViewItem& item,
unsigned column) const;
// Validates the given value (if it is non-null) and sends (in any case)
// ITEM_EDITING_DONE event and, finally, updates the model with the value
// (f it is valid, of course) if the event wasn't vetoed.
bool DoHandleEditingDone(wxVariant* value);
wxString m_variantType;
wxDataViewColumn *m_owner;
wxWeakRef<wxWindow> m_editorCtrl;
wxDataViewItem m_item; // Item being currently edited, if valid.
wxDataViewValueAdjuster *m_valueAdjuster;
// internal utility, may be used anywhere the window associated with the
// renderer is required
wxDataViewCtrl* GetView() const;
private:
// Called from {Called,Finish}Editing() and dtor to cleanup m_editorCtrl
void DestroyEditControl();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase);
};
// include the real wxDataViewRenderer declaration for the native ports
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
// in the generic implementation there is no real wxDataViewRenderer, all
// renderers are custom so it's the same as wxDataViewCustomRenderer and
// wxDataViewCustomRendererBase derives from wxDataViewRendererBase directly
//
// this is a rather ugly hack but unfortunately it just doesn't seem to be
// possible to have the same class hierarchy in all ports and avoid
// duplicating the entire wxDataViewCustomRendererBase in the generic
// wxDataViewRenderer class (well, we could use a mix-in but this would
// make classes hierarchy non linear and arguably even more complex)
#define wxDataViewCustomRendererRealBase wxDataViewRendererBase
#else
#if defined(__WXGTK20__)
#include "wx/gtk/dvrenderer.h"
#elif defined(__WXMAC__)
#include "wx/osx/dvrenderer.h"
#elif defined(__WXQT__)
#include "wx/qt/dvrenderer.h"
#else
#error "unknown native wxDataViewCtrl implementation"
#endif
#define wxDataViewCustomRendererRealBase wxDataViewRenderer
#endif
// ----------------------------------------------------------------------------
// wxDataViewCustomRendererBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewCustomRendererBase
: public wxDataViewCustomRendererRealBase
{
public:
// Constructor must specify the usual renderer parameters which we simply
// pass to the base class
wxDataViewCustomRendererBase(const wxString& varianttype = "string",
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT)
: wxDataViewCustomRendererRealBase(varianttype, mode, align)
{
}
// Render the item using the current value (returned by GetValue()).
virtual bool Render(wxRect cell, wxDC *dc, int state) = 0;
// Return the size of the item appropriate to its current value.
virtual wxSize GetSize() const = 0;
// Define virtual function which are called when a key is pressed on the
// item, clicked or the user starts to drag it: by default they all simply
// return false indicating that the events are not handled
virtual bool ActivateCell(const wxRect& cell,
wxDataViewModel *model,
const wxDataViewItem & item,
unsigned int col,
const wxMouseEvent* mouseEvent);
// Deprecated, use (and override) ActivateCell() instead
wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
virtual bool Activate(wxRect WXUNUSED(cell),
wxDataViewModel *WXUNUSED(model),
const wxDataViewItem & WXUNUSED(item),
unsigned int WXUNUSED(col)),
return false; )
// Deprecated, use (and override) ActivateCell() instead
wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
virtual bool LeftClick(wxPoint WXUNUSED(cursor),
wxRect WXUNUSED(cell),
wxDataViewModel *WXUNUSED(model),
const wxDataViewItem & WXUNUSED(item),
unsigned int WXUNUSED(col)),
return false; )
virtual bool StartDrag(const wxPoint& WXUNUSED(cursor),
const wxRect& WXUNUSED(cell),
wxDataViewModel *WXUNUSED(model),
const wxDataViewItem & WXUNUSED(item),
unsigned int WXUNUSED(col) )
{ return false; }
// Helper which can be used by Render() implementation in the derived
// classes: it will draw the text in the same manner as the standard
// renderers do.
virtual void RenderText(const wxString& text,
int xoffset,
wxRect cell,
wxDC *dc,
int state);
// Override the base class virtual method to simply store the attribute so
// that it can be accessed using GetAttr() from Render() if needed.
virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE { m_attr = attr; }
const wxDataViewItemAttr& GetAttr() const { return m_attr; }
// Store the enabled state of the item so that it can be accessed from
// Render() via GetEnabled() if needed.
virtual void SetEnabled(bool enabled) wxOVERRIDE;
bool GetEnabled() const { return m_enabled; }
// Implementation only from now on
// Retrieve the DC to use for drawing. This is implemented in derived
// platform-specific classes.
virtual wxDC *GetDC() = 0;
// To draw background use the background colour in wxDataViewItemAttr
virtual void RenderBackground(wxDC* dc, const wxRect& rect);
// Prepare DC to use attributes and call Render().
void WXCallRender(wxRect rect, wxDC *dc, int state);
virtual bool IsCustomRenderer() const wxOVERRIDE { return true; }
protected:
// helper for GetSize() implementations, respects attributes
wxSize GetTextExtent(const wxString& str) const;
private:
wxDataViewItemAttr m_attr;
bool m_enabled;
wxDECLARE_NO_COPY_CLASS(wxDataViewCustomRendererBase);
};
// include the declaration of all the other renderers to get the real
// wxDataViewCustomRenderer from which we need to inherit below
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
// because of the different renderer classes hierarchy in the generic
// version, as explained above, we can include the header defining
// wxDataViewRenderer only here and not before wxDataViewCustomRendererBase
// declaration as for the native ports
#include "wx/generic/dvrenderer.h"
#include "wx/generic/dvrenderers.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/dvrenderers.h"
#elif defined(__WXMAC__)
#include "wx/osx/dvrenderers.h"
#elif defined(__WXQT__)
#include "wx/qt/dvrenderers.h"
#else
#error "unknown native wxDataViewCtrl implementation"
#endif
#if wxUSE_SPINCTRL
// ----------------------------------------------------------------------------
// wxDataViewSpinRenderer
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewSpinRenderer: public wxDataViewCustomRenderer
{
public:
wxDataViewSpinRenderer( int min, int max,
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int alignment = wxDVR_DEFAULT_ALIGNMENT );
virtual bool HasEditorCtrl() const wxOVERRIDE { return true; }
virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) wxOVERRIDE;
virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE;
virtual bool Render( wxRect rect, wxDC *dc, int state ) wxOVERRIDE;
virtual wxSize GetSize() const wxOVERRIDE;
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
#if wxUSE_ACCESSIBILITY
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
#endif // wxUSE_ACCESSIBILITY
private:
long m_data;
long m_min,m_max;
};
#endif // wxUSE_SPINCTRL
#if defined(wxHAS_GENERIC_DATAVIEWCTRL)
// ----------------------------------------------------------------------------
// wxDataViewChoiceRenderer
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewChoiceRenderer: public wxDataViewCustomRenderer
{
public:
wxDataViewChoiceRenderer( const wxArrayString &choices,
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int alignment = wxDVR_DEFAULT_ALIGNMENT );
virtual bool HasEditorCtrl() const wxOVERRIDE { return true; }
virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) wxOVERRIDE;
virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE;
virtual bool Render( wxRect rect, wxDC *dc, int state ) wxOVERRIDE;
virtual wxSize GetSize() const wxOVERRIDE;
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
#if wxUSE_ACCESSIBILITY
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
#endif // wxUSE_ACCESSIBILITY
wxString GetChoice(size_t index) const { return m_choices[index]; }
const wxArrayString& GetChoices() const { return m_choices; }
private:
wxArrayString m_choices;
wxString m_data;
};
// ----------------------------------------------------------------------------
// wxDataViewChoiceByIndexRenderer
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewChoiceByIndexRenderer: public wxDataViewChoiceRenderer
{
public:
wxDataViewChoiceByIndexRenderer( const wxArrayString &choices,
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int alignment = wxDVR_DEFAULT_ALIGNMENT );
virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) wxOVERRIDE;
virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE;
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
#if wxUSE_ACCESSIBILITY
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
#endif // wxUSE_ACCESSIBILITY
};
#endif // generic version
#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXGTK__)
// ----------------------------------------------------------------------------
// wxDataViewDateRenderer
// ----------------------------------------------------------------------------
#if wxUSE_DATEPICKCTRL
class WXDLLIMPEXP_CORE wxDataViewDateRenderer: public wxDataViewCustomRenderer
{
public:
static wxString GetDefaultType() { return wxS("datetime"); }
wxDataViewDateRenderer(const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int align = wxDVR_DEFAULT_ALIGNMENT);
virtual bool HasEditorCtrl() const wxOVERRIDE { return true; }
virtual wxWindow *CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant &value) wxOVERRIDE;
virtual bool GetValueFromEditorCtrl(wxWindow* editor, wxVariant &value) wxOVERRIDE;
virtual bool SetValue(const wxVariant &value) wxOVERRIDE;
virtual bool GetValue(wxVariant& value) const wxOVERRIDE;
#if wxUSE_ACCESSIBILITY
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
#endif // wxUSE_ACCESSIBILITY
virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE;
virtual wxSize GetSize() const wxOVERRIDE;
private:
wxDateTime m_date;
};
#else // !wxUSE_DATEPICKCTRL
typedef wxDataViewTextRenderer wxDataViewDateRenderer;
#endif
#endif // generic or GTK+ versions
// ----------------------------------------------------------------------------
// wxDataViewCheckIconTextRenderer: 3-state checkbox + text + optional icon
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewCheckIconTextRenderer
: public wxDataViewCustomRenderer
{
public:
static wxString GetDefaultType() { return wxS("wxDataViewCheckIconText"); }
explicit wxDataViewCheckIconTextRenderer
(
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
int align = wxDVR_DEFAULT_ALIGNMENT
);
// This renderer can always display the 3rd ("indeterminate") checkbox
// state if the model contains cells with wxCHK_UNDETERMINED value, but it
// doesn't allow the user to set it by default. Call this method to allow
// this to happen.
void Allow3rdStateForUser(bool allow = true);
virtual bool SetValue(const wxVariant& value) wxOVERRIDE;
virtual bool GetValue(wxVariant& value) const wxOVERRIDE;
#if wxUSE_ACCESSIBILITY
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
#endif // wxUSE_ACCESSIBILITY
virtual wxSize GetSize() const wxOVERRIDE;
virtual bool Render(wxRect cell, wxDC* dc, int state) wxOVERRIDE;
virtual bool ActivateCell(const wxRect& cell,
wxDataViewModel *model,
const wxDataViewItem & item,
unsigned int col,
const wxMouseEvent *mouseEvent) wxOVERRIDE;
private:
wxSize GetCheckSize() const;
// Just some arbitrary constants defining margins, in pixels.
enum
{
MARGIN_CHECK_ICON = 3,
MARGIN_ICON_TEXT = 4
};
wxDataViewCheckIconText m_value;
bool m_allow3rdStateForUser;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCheckIconTextRenderer);
};
// this class is obsolete, its functionality was merged in
// wxDataViewTextRenderer itself now, don't use it any more
#define wxDataViewTextRendererAttr wxDataViewTextRenderer
#endif // _WX_DVRENDERERS_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/splash.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/splash.h
// Purpose: Base header for wxSplashScreen
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SPLASH_H_BASE_
#define _WX_SPLASH_H_BASE_
#include "wx/generic/splash.h"
#endif
// _WX_SPLASH_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/cmdproc.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/cmdproc.h
// Purpose: undo/redo capable command processing framework
// Author: Julian Smart (extracted from docview.h by VZ)
// Modified by:
// Created: 05.11.00
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CMDPROC_H_
#define _WX_CMDPROC_H_
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/list.h"
class WXDLLIMPEXP_FWD_CORE wxMenu;
// ----------------------------------------------------------------------------
// wxCommand: a single command capable of performing itself
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCommand : public wxObject
{
public:
wxCommand(bool canUndoIt = false, const wxString& name = wxEmptyString);
virtual ~wxCommand(){}
// Override this to perform a command
virtual bool Do() = 0;
// Override this to undo a command
virtual bool Undo() = 0;
virtual bool CanUndo() const { return m_canUndo; }
virtual wxString GetName() const { return m_commandName; }
protected:
bool m_canUndo;
wxString m_commandName;
private:
wxDECLARE_CLASS(wxCommand);
};
// ----------------------------------------------------------------------------
// wxCommandProcessor: wxCommand manager
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCommandProcessor : public wxObject
{
public:
// if max number of commands is -1, it is unlimited
wxCommandProcessor(int maxCommands = -1);
virtual ~wxCommandProcessor();
// Pass a command to the processor. The processor calls Do(); if
// successful, is appended to the command history unless storeIt is false.
virtual bool Submit(wxCommand *command, bool storeIt = true);
// just store the command without executing it
virtual void Store(wxCommand *command);
virtual bool Undo();
virtual bool Redo();
virtual bool CanUndo() const;
virtual bool CanRedo() const;
// Initialises the current command and menu strings.
virtual void Initialize();
// Sets the Undo/Redo menu strings for the current menu.
virtual void SetMenuStrings();
// Gets the current Undo menu label.
wxString GetUndoMenuLabel() const;
// Gets the current Undo menu label.
wxString GetRedoMenuLabel() const;
#if wxUSE_MENUS
// Call this to manage an edit menu.
void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; }
wxMenu *GetEditMenu() const { return m_commandEditMenu; }
#endif // wxUSE_MENUS
// command list access
wxList& GetCommands() { return m_commands; }
const wxList& GetCommands() const { return m_commands; }
wxCommand *GetCurrentCommand() const
{
return (wxCommand *)(m_currentCommand ? m_currentCommand->GetData() : NULL);
}
int GetMaxCommands() const { return m_maxNoCommands; }
virtual void ClearCommands();
// Has the current project been changed?
virtual bool IsDirty() const;
// Mark the current command as the one where the last save took place
void MarkAsSaved()
{
m_lastSavedCommand = m_currentCommand;
}
// By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y"
const wxString& GetUndoAccelerator() const { return m_undoAccelerator; }
const wxString& GetRedoAccelerator() const { return m_redoAccelerator; }
void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; }
void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; }
protected:
// for further flexibility, command processor doesn't call wxCommand::Do()
// and Undo() directly but uses these functions which can be overridden in
// the derived class
virtual bool DoCommand(wxCommand& cmd);
virtual bool UndoCommand(wxCommand& cmd);
int m_maxNoCommands;
wxList m_commands;
wxList::compatibility_iterator m_currentCommand,
m_lastSavedCommand;
#if wxUSE_MENUS
wxMenu* m_commandEditMenu;
#endif // wxUSE_MENUS
wxString m_undoAccelerator;
wxString m_redoAccelerator;
private:
wxDECLARE_DYNAMIC_CLASS(wxCommandProcessor);
wxDECLARE_NO_COPY_CLASS(wxCommandProcessor);
};
#endif // _WX_CMDPROC_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/string.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/string.h
// Purpose: wxString class
// Author: Vadim Zeitlin
// Modified by:
// Created: 29/01/98
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/*
Efficient string class [more or less] compatible with MFC CString,
wxWidgets version 1 wxString and std::string and some handy functions
missing from string.h.
*/
#ifndef _WX_WXSTRING_H__
#define _WX_WXSTRING_H__
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h" // everybody should include this
#if defined(__WXMAC__)
#include <ctype.h>
#endif
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <limits.h>
#include <stdlib.h>
#include "wx/wxcrtbase.h" // for wxChar, wxStrlen() etc.
#include "wx/strvararg.h"
#include "wx/buffer.h" // for wxCharBuffer
#include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes
#include "wx/stringimpl.h"
#include "wx/stringops.h"
#include "wx/unichar.h"
// by default we cache the mapping of the positions in UTF-8 string to the byte
// offset as this results in noticeable performance improvements for loops over
// strings using indices; comment out this line to disable this
//
// notice that this optimization is well worth using even in debug builds as it
// changes asymptotic complexity of algorithms using indices to iterate over
// wxString back to expected linear from quadratic
//
// also notice that wxTLS_TYPE() (__declspec(thread) in this case) is unsafe to
// use in DLL build under pre-Vista Windows so we disable this code for now, if
// anybody really needs to use UTF-8 build under Windows with this optimization
// it would have to be re-tested and probably corrected
// CS: under OSX release builds the string destructor/cache cleanup sometimes
// crashes, disable until we find the true reason or a better workaround
#if wxUSE_UNICODE_UTF8 && !defined(__WINDOWS__) && !defined(__WXOSX__)
#define wxUSE_STRING_POS_CACHE 1
#else
#define wxUSE_STRING_POS_CACHE 0
#endif
#if wxUSE_STRING_POS_CACHE
#include "wx/tls.h"
// change this 0 to 1 to enable additional (very expensive) asserts
// verifying that string caching logic works as expected
#if 0
#define wxSTRING_CACHE_ASSERT(cond) wxASSERT(cond)
#else
#define wxSTRING_CACHE_ASSERT(cond)
#endif
#endif // wxUSE_STRING_POS_CACHE
class WXDLLIMPEXP_FWD_BASE wxString;
// unless this symbol is predefined to disable the compatibility functions, do
// use them
#ifndef WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
#define WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER 1
#endif
namespace wxPrivate
{
template <typename T> struct wxStringAsBufHelper;
}
// ---------------------------------------------------------------------------
// macros
// ---------------------------------------------------------------------------
// These macros are not used by wxWidgets itself any longer and are only
// preserved for compatibility with the user code that might be still using
// them. Do _not_ use them in the new code, just use const_cast<> instead.
#define WXSTRINGCAST (wxChar *)(const wxChar *)
#define wxCSTRINGCAST (wxChar *)(const wxChar *)
#define wxMBSTRINGCAST (char *)(const char *)
#define wxWCSTRINGCAST (wchar_t *)(const wchar_t *)
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// global functions complementing standard C string library replacements for
// strlen() and portable strcasecmp()
//---------------------------------------------------------------------------
#if WXWIN_COMPATIBILITY_2_8
// Use wxXXX() functions from wxcrt.h instead! These functions are for
// backwards compatibility only.
// checks whether the passed in pointer is NULL and if the string is empty
wxDEPRECATED_MSG("use wxIsEmpty() instead")
inline bool IsEmpty(const char *p) { return (!p || !*p); }
// safe version of strlen() (returns 0 if passed NULL pointer)
wxDEPRECATED_MSG("use wxStrlen() instead")
inline size_t Strlen(const char *psz)
{ return psz ? strlen(psz) : 0; }
// portable strcasecmp/_stricmp
wxDEPRECATED_MSG("use wxStricmp() instead")
inline int Stricmp(const char *psz1, const char *psz2)
{ return wxCRT_StricmpA(psz1, psz2); }
#endif // WXWIN_COMPATIBILITY_2_8
// ----------------------------------------------------------------------------
// wxCStrData
// ----------------------------------------------------------------------------
// Lightweight object returned by wxString::c_str() and implicitly convertible
// to either const char* or const wchar_t*.
class wxCStrData
{
private:
// Ctors; for internal use by wxString and wxCStrData only
wxCStrData(const wxString *str, size_t offset = 0, bool owned = false)
: m_str(str), m_offset(offset), m_owned(owned) {}
public:
// Ctor constructs the object from char literal; they are needed to make
// operator?: compile and they intentionally take char*, not const char*
inline wxCStrData(char *buf);
inline wxCStrData(wchar_t *buf);
inline wxCStrData(const wxCStrData& data);
inline ~wxCStrData();
// AsWChar() and AsChar() can't be defined here as they use wxString and so
// must come after it and because of this won't be inlined when called from
// wxString methods (without a lot of work to extract these wxString methods
// from inside the class itself). But we still define them being inline
// below to let compiler inline them from elsewhere. And because of this we
// must declare them as inline here because otherwise some compilers give
// warnings about them, e.g. mingw32 3.4.5 warns about "<symbol> defined
// locally after being referenced with dllimport linkage" while IRIX
// mipsPro 7.4 warns about "function declared inline after being called".
inline const wchar_t* AsWChar() const;
operator const wchar_t*() const { return AsWChar(); }
inline const char* AsChar() const;
const unsigned char* AsUnsignedChar() const
{ return (const unsigned char *) AsChar(); }
operator const char*() const { return AsChar(); }
operator const unsigned char*() const { return AsUnsignedChar(); }
operator const void*() const { return AsChar(); }
// returns buffers that are valid as long as the associated wxString exists
const wxScopedCharBuffer AsCharBuf() const
{
return wxScopedCharBuffer::CreateNonOwned(AsChar());
}
const wxScopedWCharBuffer AsWCharBuf() const
{
return wxScopedWCharBuffer::CreateNonOwned(AsWChar());
}
inline wxString AsString() const;
// returns the value as C string in internal representation (equivalent
// to AsString().wx_str(), but more efficient)
const wxStringCharType *AsInternal() const;
// allow expressions like "c_str()[0]":
inline wxUniChar operator[](size_t n) const;
wxUniChar operator[](int n) const { return operator[](size_t(n)); }
wxUniChar operator[](long n) const { return operator[](size_t(n)); }
#ifndef wxSIZE_T_IS_UINT
wxUniChar operator[](unsigned int n) const { return operator[](size_t(n)); }
#endif // size_t != unsigned int
// These operators are needed to emulate the pointer semantics of c_str():
// expressions like "wxChar *p = str.c_str() + 1;" should continue to work
// (we need both versions to resolve ambiguities). Note that this means
// the 'n' value is interpreted as addition to char*/wchar_t* pointer, it
// is *not* number of Unicode characters in wxString.
wxCStrData operator+(int n) const
{ return wxCStrData(m_str, m_offset + n, m_owned); }
wxCStrData operator+(long n) const
{ return wxCStrData(m_str, m_offset + n, m_owned); }
wxCStrData operator+(size_t n) const
{ return wxCStrData(m_str, m_offset + n, m_owned); }
// and these for "str.c_str() + (p2 - p1)" (it also works for any integer
// expression but it must be ptrdiff_t and not e.g. int to work in this
// example):
wxCStrData operator-(ptrdiff_t n) const
{
wxASSERT_MSG( n <= (ptrdiff_t)m_offset,
wxT("attempt to construct address before the beginning of the string") );
return wxCStrData(m_str, m_offset - n, m_owned);
}
// this operator is needed to make expressions like "*c_str()" or
// "*(c_str() + 2)" work
inline wxUniChar operator*() const;
private:
// the wxString this object was returned for
const wxString *m_str;
// Offset into c_str() return value. Note that this is *not* offset in
// m_str in Unicode characters. Instead, it is index into the
// char*/wchar_t* buffer returned by c_str(). It's interpretation depends
// on how is the wxCStrData instance used: if it is eventually cast to
// const char*, m_offset will be in bytes form string's start; if it is
// cast to const wchar_t*, it will be in wchar_t values.
size_t m_offset;
// should m_str be deleted, i.e. is it owned by us?
bool m_owned;
friend class WXDLLIMPEXP_FWD_BASE wxString;
};
// ----------------------------------------------------------------------------
// wxString: string class trying to be compatible with std::string, MFC
// CString and wxWindows 1.x wxString all at once
// ---------------------------------------------------------------------------
#if wxUSE_UNICODE_UTF8
// see the comment near wxString::iterator for why we need this
class WXDLLIMPEXP_BASE wxStringIteratorNode
{
public:
wxStringIteratorNode()
: m_str(NULL), m_citer(NULL), m_iter(NULL), m_prev(NULL), m_next(NULL) {}
wxStringIteratorNode(const wxString *str,
wxStringImpl::const_iterator *citer)
{ DoSet(str, citer, NULL); }
wxStringIteratorNode(const wxString *str, wxStringImpl::iterator *iter)
{ DoSet(str, NULL, iter); }
~wxStringIteratorNode()
{ clear(); }
inline void set(const wxString *str, wxStringImpl::const_iterator *citer)
{ clear(); DoSet(str, citer, NULL); }
inline void set(const wxString *str, wxStringImpl::iterator *iter)
{ clear(); DoSet(str, NULL, iter); }
const wxString *m_str;
wxStringImpl::const_iterator *m_citer;
wxStringImpl::iterator *m_iter;
wxStringIteratorNode *m_prev, *m_next;
private:
inline void clear();
inline void DoSet(const wxString *str,
wxStringImpl::const_iterator *citer,
wxStringImpl::iterator *iter);
// the node belongs to a particular iterator instance, it's not copied
// when a copy of the iterator is made
wxDECLARE_NO_COPY_CLASS(wxStringIteratorNode);
};
#endif // wxUSE_UNICODE_UTF8
class WXDLLIMPEXP_BASE wxString
{
// NB: special care was taken in arranging the member functions in such order
// that all inline functions can be effectively inlined, verify that all
// performance critical functions are still inlined if you change order!
public:
// an 'invalid' value for string index, moved to this place due to a CW bug
static const size_t npos;
private:
// if we hadn't made these operators private, it would be possible to
// compile "wxString s; s = 17;" without any warnings as 17 is implicitly
// converted to char in C and we do have operator=(char)
//
// NB: we don't need other versions (short/long and unsigned) as attempt
// to assign another numeric type to wxString will now result in
// ambiguity between operator=(char) and operator=(int)
wxString& operator=(int);
// these methods are not implemented - there is _no_ conversion from int to
// string, you're doing something wrong if the compiler wants to call it!
//
// try `s << i' or `s.Printf("%d", i)' instead
wxString(int);
// buffer for holding temporary substring when using any of the methods
// that take (char*,size_t) or (wchar_t*,size_t) arguments:
template<typename T>
struct SubstrBufFromType
{
T data;
size_t len;
SubstrBufFromType(const T& data_, size_t len_)
: data(data_), len(len_)
{
wxASSERT_MSG( len != npos, "must have real length" );
}
};
#if wxUSE_UNICODE_UTF8
// even char* -> char* needs conversion, from locale charset to UTF-8
typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromWC;
typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromMB;
#elif wxUSE_UNICODE_WCHAR
typedef SubstrBufFromType<const wchar_t*> SubstrBufFromWC;
typedef SubstrBufFromType<wxScopedWCharBuffer> SubstrBufFromMB;
#else
typedef SubstrBufFromType<const char*> SubstrBufFromMB;
typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromWC;
#endif
// Functions implementing primitive operations on string data; wxString
// methods and iterators are implemented in terms of it. The differences
// between UTF-8 and wchar_t* representations of the string are mostly
// contained here.
#if wxUSE_UNICODE_UTF8
static SubstrBufFromMB ConvertStr(const char *psz, size_t nLength,
const wxMBConv& conv);
static SubstrBufFromWC ConvertStr(const wchar_t *pwz, size_t nLength,
const wxMBConv& conv);
#elif wxUSE_UNICODE_WCHAR
static SubstrBufFromMB ConvertStr(const char *psz, size_t nLength,
const wxMBConv& conv);
#else
static SubstrBufFromWC ConvertStr(const wchar_t *pwz, size_t nLength,
const wxMBConv& conv);
#endif
#if !wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_WCHAR or !wxUSE_UNICODE
// returns C string encoded as the implementation expects:
#if wxUSE_UNICODE
static const wchar_t* ImplStr(const wchar_t* str)
{ return str ? str : wxT(""); }
static const SubstrBufFromWC ImplStr(const wchar_t* str, size_t n)
{ return SubstrBufFromWC(str, (str && n == npos) ? wxWcslen(str) : n); }
static wxScopedWCharBuffer ImplStr(const char* str,
const wxMBConv& conv = wxConvLibc)
{ return ConvertStr(str, npos, conv).data; }
static SubstrBufFromMB ImplStr(const char* str, size_t n,
const wxMBConv& conv = wxConvLibc)
{ return ConvertStr(str, n, conv); }
#else
static const char* ImplStr(const char* str,
const wxMBConv& WXUNUSED(conv) = wxConvLibc)
{ return str ? str : ""; }
static const SubstrBufFromMB ImplStr(const char* str, size_t n,
const wxMBConv& WXUNUSED(conv) = wxConvLibc)
{ return SubstrBufFromMB(str, (str && n == npos) ? wxStrlen(str) : n); }
static wxScopedCharBuffer ImplStr(const wchar_t* str)
{ return ConvertStr(str, npos, wxConvLibc).data; }
static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n)
{ return ConvertStr(str, n, wxConvLibc); }
#endif
// translates position index in wxString to/from index in underlying
// wxStringImpl:
static size_t PosToImpl(size_t pos) { return pos; }
static void PosLenToImpl(size_t pos, size_t len,
size_t *implPos, size_t *implLen)
{ *implPos = pos; *implLen = len; }
static size_t LenToImpl(size_t len) { return len; }
static size_t PosFromImpl(size_t pos) { return pos; }
// we don't want to define these as empty inline functions as it could
// result in noticeable (and quite unnecessary in non-UTF-8 build) slowdown
// in debug build where the inline functions are not effectively inlined
#define wxSTRING_INVALIDATE_CACHE()
#define wxSTRING_INVALIDATE_CACHED_LENGTH()
#define wxSTRING_UPDATE_CACHED_LENGTH(n)
#define wxSTRING_SET_CACHED_LENGTH(n)
#else // wxUSE_UNICODE_UTF8
static wxScopedCharBuffer ImplStr(const char* str,
const wxMBConv& conv = wxConvLibc)
{ return ConvertStr(str, npos, conv).data; }
static SubstrBufFromMB ImplStr(const char* str, size_t n,
const wxMBConv& conv = wxConvLibc)
{ return ConvertStr(str, n, conv); }
static wxScopedCharBuffer ImplStr(const wchar_t* str)
{ return ConvertStr(str, npos, wxMBConvUTF8()).data; }
static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n)
{ return ConvertStr(str, n, wxMBConvUTF8()); }
#if wxUSE_STRING_POS_CACHE
// this is an extremely simple cache used by PosToImpl(): each cache element
// contains the string it applies to and the index corresponding to the last
// used position in this wxString in its m_impl string
//
// NB: notice that this struct (and nested Element one) must be a POD or we
// wouldn't be able to use a thread-local variable of this type, in
// particular it should have no ctor -- we rely on statics being
// initialized to 0 instead
struct Cache
{
enum { SIZE = 8 };
struct Element
{
const wxString *str; // the string to which this element applies
size_t pos, // the cached index in this string
impl, // the corresponding position in its m_impl
len; // cached length or npos if unknown
// reset cached index to 0
void ResetPos() { pos = impl = 0; }
// reset position and length
void Reset() { ResetPos(); len = npos; }
};
// cache the indices mapping for the last few string used
Element cached[SIZE];
// the last used index
unsigned lastUsed;
};
#ifndef wxHAS_COMPILER_TLS
// we must use an accessor function and not a static variable when the TLS
// variables support is implemented in the library (and not by the compiler)
// because the global s_cache variable could be not yet initialized when a
// ctor of another global object is executed and if that ctor uses any
// wxString methods, bad things happen
//
// however notice that this approach does not work when compiler TLS is used,
// at least not with g++ 4.1.2 under amd64 as it apparently compiles code
// using this accessor incorrectly when optimizations are enabled (-O2 is
// enough) -- luckily we don't need it then neither as static __thread
// variables are initialized by 0 anyhow then and so we can use the variable
// directly
WXEXPORT static Cache& GetCache()
{
static wxTLS_TYPE(Cache) s_cache;
return wxTLS_VALUE(s_cache);
}
// this helper struct is used to ensure that GetCache() is called during
// static initialization time, i.e. before any threads creation, as otherwise
// the static s_cache construction inside GetCache() wouldn't be MT-safe
friend struct wxStrCacheInitializer;
#else // wxHAS_COMPILER_TLS
static wxTLS_TYPE(Cache) ms_cache;
static Cache& GetCache() { return wxTLS_VALUE(ms_cache); }
#endif // !wxHAS_COMPILER_TLS/wxHAS_COMPILER_TLS
static Cache::Element *GetCacheBegin() { return GetCache().cached; }
static Cache::Element *GetCacheEnd() { return GetCacheBegin() + Cache::SIZE; }
static unsigned& LastUsedCacheElement() { return GetCache().lastUsed; }
// this is used in debug builds only to provide a convenient function,
// callable from a debugger, to show the cache contents
friend struct wxStrCacheDumper;
// uncomment this to have access to some profiling statistics on program
// termination
//#define wxPROFILE_STRING_CACHE
#ifdef wxPROFILE_STRING_CACHE
static struct PosToImplCacheStats
{
unsigned postot, // total non-trivial calls to PosToImpl
poshits, // cache hits from PosToImpl()
mishits, // cached position beyond the needed one
sumpos, // sum of all positions, used to compute the
// average position after dividing by postot
sumofs, // sum of all offsets after using the cache, used to
// compute the average after dividing by hits
lentot, // number of total calls to length()
lenhits; // number of cache hits in length()
} ms_cacheStats;
friend struct wxStrCacheStatsDumper;
#define wxCACHE_PROFILE_FIELD_INC(field) ms_cacheStats.field++
#define wxCACHE_PROFILE_FIELD_ADD(field, val) ms_cacheStats.field += (val)
#else // !wxPROFILE_STRING_CACHE
#define wxCACHE_PROFILE_FIELD_INC(field)
#define wxCACHE_PROFILE_FIELD_ADD(field, val)
#endif // wxPROFILE_STRING_CACHE/!wxPROFILE_STRING_CACHE
// note: it could seem that the functions below shouldn't be inline because
// they are big, contain loops and so the compiler shouldn't be able to
// inline them anyhow, however moving them into string.cpp does decrease the
// code performance by ~5%, at least when using g++ 4.1 so do keep them here
// unless tests show that it's not advantageous any more
// return the pointer to the cache element for this string or NULL if not
// cached
Cache::Element *FindCacheElement() const
{
// profiling seems to show a small but consistent gain if we use this
// simple loop instead of starting from the last used element (there are
// a lot of misses in this function...)
Cache::Element * const cacheBegin = GetCacheBegin();
#ifndef wxHAS_COMPILER_TLS
// during destruction tls calls may return NULL, in this case return NULL
// immediately without accessing anything else
if ( cacheBegin == NULL )
return NULL;
#endif
Cache::Element * const cacheEnd = GetCacheEnd();
for ( Cache::Element *c = cacheBegin; c != cacheEnd; c++ )
{
if ( c->str == this )
return c;
}
return NULL;
}
// unlike FindCacheElement(), this one always returns a valid pointer to the
// cache element for this string, it may have valid last cached position and
// its corresponding index in the byte string or not
Cache::Element *GetCacheElement() const
{
Cache::Element * const cacheBegin = GetCacheBegin();
Cache::Element * const cacheEnd = GetCacheEnd();
Cache::Element * const cacheStart = cacheBegin + LastUsedCacheElement();
// check the last used first, this does no (measurable) harm for a miss
// but does help for simple loops addressing the same string all the time
if ( cacheStart->str == this )
return cacheStart;
// notice that we're going to check cacheStart again inside this call but
// profiling shows that it's still faster to use a simple loop like
// inside FindCacheElement() than manually looping with wrapping starting
// from the cache entry after the start one
Cache::Element *c = FindCacheElement();
if ( !c )
{
// claim the next cache entry for this string
c = cacheStart;
if ( ++c == cacheEnd )
c = cacheBegin;
c->str = this;
c->Reset();
// and remember the last used element
LastUsedCacheElement() = c - cacheBegin;
}
return c;
}
size_t DoPosToImpl(size_t pos) const
{
wxCACHE_PROFILE_FIELD_INC(postot);
// NB: although the case of pos == 1 (and offset from cached position
// equal to 1) are common, nothing is gained by writing special code
// for handling them, the compiler (at least g++ 4.1 used) seems to
// optimize the code well enough on its own
wxCACHE_PROFILE_FIELD_ADD(sumpos, pos);
Cache::Element * const cache = GetCacheElement();
// cached position can't be 0 so if it is, it means that this entry was
// used for length caching only so far, i.e. it doesn't count as a hit
// from our point of view
if ( cache->pos )
{
wxCACHE_PROFILE_FIELD_INC(poshits);
}
if ( pos == cache->pos )
return cache->impl;
// this seems to happen only rarely so just reset the cache in this case
// instead of complicating code even further by seeking backwards in this
// case
if ( cache->pos > pos )
{
wxCACHE_PROFILE_FIELD_INC(mishits);
cache->ResetPos();
}
wxCACHE_PROFILE_FIELD_ADD(sumofs, pos - cache->pos);
wxStringImpl::const_iterator i(m_impl.begin() + cache->impl);
for ( size_t n = cache->pos; n < pos; n++ )
wxStringOperations::IncIter(i);
cache->pos = pos;
cache->impl = i - m_impl.begin();
wxSTRING_CACHE_ASSERT(
(int)cache->impl == (begin() + pos).impl() - m_impl.begin() );
return cache->impl;
}
void InvalidateCache()
{
Cache::Element * const cache = FindCacheElement();
if ( cache )
cache->Reset();
}
void InvalidateCachedLength()
{
Cache::Element * const cache = FindCacheElement();
if ( cache )
cache->len = npos;
}
void SetCachedLength(size_t len)
{
// we optimistically cache the length here even if the string wasn't
// present in the cache before, this seems to do no harm and the
// potential for avoiding length recomputation for long strings looks
// interesting
GetCacheElement()->len = len;
}
void UpdateCachedLength(ptrdiff_t delta)
{
Cache::Element * const cache = FindCacheElement();
if ( cache && cache->len != npos )
{
wxSTRING_CACHE_ASSERT( (ptrdiff_t)cache->len + delta >= 0 );
cache->len += delta;
}
}
#define wxSTRING_INVALIDATE_CACHE() InvalidateCache()
#define wxSTRING_INVALIDATE_CACHED_LENGTH() InvalidateCachedLength()
#define wxSTRING_UPDATE_CACHED_LENGTH(n) UpdateCachedLength(n)
#define wxSTRING_SET_CACHED_LENGTH(n) SetCachedLength(n)
#else // !wxUSE_STRING_POS_CACHE
size_t DoPosToImpl(size_t pos) const
{
return (begin() + pos).impl() - m_impl.begin();
}
#define wxSTRING_INVALIDATE_CACHE()
#define wxSTRING_INVALIDATE_CACHED_LENGTH()
#define wxSTRING_UPDATE_CACHED_LENGTH(n)
#define wxSTRING_SET_CACHED_LENGTH(n)
#endif // wxUSE_STRING_POS_CACHE/!wxUSE_STRING_POS_CACHE
size_t PosToImpl(size_t pos) const
{
return pos == 0 || pos == npos ? pos : DoPosToImpl(pos);
}
void PosLenToImpl(size_t pos, size_t len, size_t *implPos, size_t *implLen) const;
size_t LenToImpl(size_t len) const
{
size_t pos, len2;
PosLenToImpl(0, len, &pos, &len2);
return len2;
}
size_t PosFromImpl(size_t pos) const
{
if ( pos == 0 || pos == npos )
return pos;
else
return const_iterator(this, m_impl.begin() + pos) - begin();
}
#endif // !wxUSE_UNICODE_UTF8/wxUSE_UNICODE_UTF8
public:
// standard types
typedef wxUniChar value_type;
typedef wxUniChar char_type;
typedef wxUniCharRef reference;
typedef wxChar* pointer;
typedef const wxChar* const_pointer;
typedef size_t size_type;
typedef const wxUniChar const_reference;
#if wxUSE_STD_STRING
#if wxUSE_UNICODE_UTF8
// random access is not O(1), as required by Random Access Iterator
#define WX_STR_ITERATOR_TAG std::bidirectional_iterator_tag
#else
#define WX_STR_ITERATOR_TAG std::random_access_iterator_tag
#endif
#define WX_DEFINE_ITERATOR_CATEGORY(cat) typedef cat iterator_category;
#else
// not defining iterator_category at all in this case is better than defining
// it as some dummy type -- at least it results in more intelligible error
// messages
#define WX_DEFINE_ITERATOR_CATEGORY(cat)
#endif
#define WX_STR_ITERATOR_IMPL(iterator_name, pointer_type, reference_type) \
private: \
typedef wxStringImpl::iterator_name underlying_iterator; \
public: \
WX_DEFINE_ITERATOR_CATEGORY(WX_STR_ITERATOR_TAG) \
typedef wxUniChar value_type; \
typedef ptrdiff_t difference_type; \
typedef reference_type reference; \
typedef pointer_type pointer; \
\
reference operator[](size_t n) const { return *(*this + n); } \
\
iterator_name& operator++() \
{ wxStringOperations::IncIter(m_cur); return *this; } \
iterator_name& operator--() \
{ wxStringOperations::DecIter(m_cur); return *this; } \
iterator_name operator++(int) \
{ \
iterator_name tmp = *this; \
wxStringOperations::IncIter(m_cur); \
return tmp; \
} \
iterator_name operator--(int) \
{ \
iterator_name tmp = *this; \
wxStringOperations::DecIter(m_cur); \
return tmp; \
} \
\
iterator_name& operator+=(ptrdiff_t n) \
{ \
m_cur = wxStringOperations::AddToIter(m_cur, n); \
return *this; \
} \
iterator_name& operator-=(ptrdiff_t n) \
{ \
m_cur = wxStringOperations::AddToIter(m_cur, -n); \
return *this; \
} \
\
difference_type operator-(const iterator_name& i) const \
{ return wxStringOperations::DiffIters(m_cur, i.m_cur); } \
\
bool operator==(const iterator_name& i) const \
{ return m_cur == i.m_cur; } \
bool operator!=(const iterator_name& i) const \
{ return m_cur != i.m_cur; } \
\
bool operator<(const iterator_name& i) const \
{ return m_cur < i.m_cur; } \
bool operator>(const iterator_name& i) const \
{ return m_cur > i.m_cur; } \
bool operator<=(const iterator_name& i) const \
{ return m_cur <= i.m_cur; } \
bool operator>=(const iterator_name& i) const \
{ return m_cur >= i.m_cur; } \
\
private: \
/* for internal wxString use only: */ \
underlying_iterator impl() const { return m_cur; } \
\
friend class wxString; \
friend class wxCStrData; \
\
private: \
underlying_iterator m_cur
class WXDLLIMPEXP_FWD_BASE const_iterator;
#if wxUSE_UNICODE_UTF8
// NB: In UTF-8 build, (non-const) iterator needs to keep reference
// to the underlying wxStringImpl, because UTF-8 is variable-length
// encoding and changing the value pointer to by an iterator (using
// its operator*) requires calling wxStringImpl::replace() if the old
// and new values differ in their encoding's length.
//
// Furthermore, the replace() call may invalid all iterators for the
// string, so we have to keep track of outstanding iterators and update
// them if replace() happens.
//
// This is implemented by maintaining linked list of iterators for every
// string and traversing it in wxUniCharRef::operator=(). Head of the
// list is stored in wxString. (FIXME-UTF8)
class WXDLLIMPEXP_BASE iterator
{
WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef);
public:
iterator() {}
iterator(const iterator& i)
: m_cur(i.m_cur), m_node(i.str(), &m_cur) {}
iterator& operator=(const iterator& i)
{
if (&i != this)
{
m_cur = i.m_cur;
m_node.set(i.str(), &m_cur);
}
return *this;
}
reference operator*()
{ return wxUniCharRef::CreateForString(*str(), m_cur); }
iterator operator+(ptrdiff_t n) const
{ return iterator(str(), wxStringOperations::AddToIter(m_cur, n)); }
iterator operator-(ptrdiff_t n) const
{ return iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); }
// Normal iterators need to be comparable with the const_iterators so
// declare the comparison operators and implement them below after the
// full const_iterator declaration.
bool operator==(const const_iterator& i) const;
bool operator!=(const const_iterator& i) const;
bool operator<(const const_iterator& i) const;
bool operator>(const const_iterator& i) const;
bool operator<=(const const_iterator& i) const;
bool operator>=(const const_iterator& i) const;
private:
iterator(wxString *wxstr, underlying_iterator ptr)
: m_cur(ptr), m_node(wxstr, &m_cur) {}
wxString* str() const { return const_cast<wxString*>(m_node.m_str); }
wxStringIteratorNode m_node;
friend class const_iterator;
};
class WXDLLIMPEXP_BASE const_iterator
{
// NB: reference_type is intentionally value, not reference, the character
// may be encoded differently in wxString data:
WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar);
public:
const_iterator() {}
const_iterator(const const_iterator& i)
: m_cur(i.m_cur), m_node(i.str(), &m_cur) {}
const_iterator(const iterator& i)
: m_cur(i.m_cur), m_node(i.str(), &m_cur) {}
const_iterator& operator=(const const_iterator& i)
{
if (&i != this)
{
m_cur = i.m_cur;
m_node.set(i.str(), &m_cur);
}
return *this;
}
const_iterator& operator=(const iterator& i)
{ m_cur = i.m_cur; m_node.set(i.str(), &m_cur); return *this; }
reference operator*() const
{ return wxStringOperations::DecodeChar(m_cur); }
const_iterator operator+(ptrdiff_t n) const
{ return const_iterator(str(), wxStringOperations::AddToIter(m_cur, n)); }
const_iterator operator-(ptrdiff_t n) const
{ return const_iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); }
// Notice that comparison operators taking non-const iterator are not
// needed here because of the implicit conversion from non-const iterator
// to const ones ensure that the versions for const_iterator declared
// inside WX_STR_ITERATOR_IMPL can be used.
private:
// for internal wxString use only:
const_iterator(const wxString *wxstr, underlying_iterator ptr)
: m_cur(ptr), m_node(wxstr, &m_cur) {}
const wxString* str() const { return m_node.m_str; }
wxStringIteratorNode m_node;
};
iterator GetIterForNthChar(size_t n)
{ return iterator(this, m_impl.begin() + PosToImpl(n)); }
const_iterator GetIterForNthChar(size_t n) const
{ return const_iterator(this, m_impl.begin() + PosToImpl(n)); }
#else // !wxUSE_UNICODE_UTF8
class WXDLLIMPEXP_BASE iterator
{
WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef);
public:
iterator() {}
iterator(const iterator& i) : m_cur(i.m_cur) {}
reference operator*()
{ return wxUniCharRef::CreateForString(m_cur); }
iterator operator+(ptrdiff_t n) const
{ return iterator(wxStringOperations::AddToIter(m_cur, n)); }
iterator operator-(ptrdiff_t n) const
{ return iterator(wxStringOperations::AddToIter(m_cur, -n)); }
// As in UTF-8 case above, define comparison operators taking
// const_iterator too.
bool operator==(const const_iterator& i) const;
bool operator!=(const const_iterator& i) const;
bool operator<(const const_iterator& i) const;
bool operator>(const const_iterator& i) const;
bool operator<=(const const_iterator& i) const;
bool operator>=(const const_iterator& i) const;
private:
// for internal wxString use only:
iterator(underlying_iterator ptr) : m_cur(ptr) {}
iterator(wxString *WXUNUSED(str), underlying_iterator ptr) : m_cur(ptr) {}
friend class const_iterator;
};
class WXDLLIMPEXP_BASE const_iterator
{
// NB: reference_type is intentionally value, not reference, the character
// may be encoded differently in wxString data:
WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar);
public:
const_iterator() {}
const_iterator(const const_iterator& i) : m_cur(i.m_cur) {}
const_iterator(const iterator& i) : m_cur(i.m_cur) {}
const_reference operator*() const
{ return wxStringOperations::DecodeChar(m_cur); }
const_iterator operator+(ptrdiff_t n) const
{ return const_iterator(wxStringOperations::AddToIter(m_cur, n)); }
const_iterator operator-(ptrdiff_t n) const
{ return const_iterator(wxStringOperations::AddToIter(m_cur, -n)); }
// As in UTF-8 case above, we don't need comparison operators taking
// iterator because we have an implicit conversion from iterator to
// const_iterator so the operators declared by WX_STR_ITERATOR_IMPL will
// be used.
private:
// for internal wxString use only:
const_iterator(underlying_iterator ptr) : m_cur(ptr) {}
const_iterator(const wxString *WXUNUSED(str), underlying_iterator ptr)
: m_cur(ptr) {}
};
iterator GetIterForNthChar(size_t n) { return begin() + n; }
const_iterator GetIterForNthChar(size_t n) const { return begin() + n; }
#endif // wxUSE_UNICODE_UTF8/!wxUSE_UNICODE_UTF8
size_t IterToImplPos(wxString::iterator i) const
{ return wxStringImpl::const_iterator(i.impl()) - m_impl.begin(); }
#undef WX_STR_ITERATOR_TAG
#undef WX_STR_ITERATOR_IMPL
// This method is mostly used by wxWidgets itself and return the offset of
// the given iterator in bytes relative to the start of the buffer
// representing the current string contents in the current locale encoding.
//
// It is inefficient as it involves converting part of the string to this
// encoding (and also unsafe as it simply returns 0 if the conversion fails)
// and so should be avoided if possible, wx itself only uses it to implement
// backwards-compatible API.
ptrdiff_t IterOffsetInMBStr(const const_iterator& i) const
{
const wxString str(begin(), i);
// This is logically equivalent to strlen(str.mb_str()) but avoids
// actually converting the string to multibyte and just computes the
// length that it would have after conversion.
const size_t ofs = wxConvLibc.FromWChar(NULL, 0, str.wc_str(), str.length());
return ofs == wxCONV_FAILED ? 0 : static_cast<ptrdiff_t>(ofs);
}
friend class iterator;
friend class const_iterator;
template <typename T>
class reverse_iterator_impl
{
public:
typedef T iterator_type;
WX_DEFINE_ITERATOR_CATEGORY(typename T::iterator_category)
typedef typename T::value_type value_type;
typedef typename T::difference_type difference_type;
typedef typename T::reference reference;
typedef typename T::pointer *pointer;
reverse_iterator_impl() {}
reverse_iterator_impl(iterator_type i) : m_cur(i) {}
reverse_iterator_impl(const reverse_iterator_impl& ri)
: m_cur(ri.m_cur) {}
iterator_type base() const { return m_cur; }
reference operator*() const { return *(m_cur-1); }
reference operator[](size_t n) const { return *(*this + n); }
reverse_iterator_impl& operator++()
{ --m_cur; return *this; }
reverse_iterator_impl operator++(int)
{ reverse_iterator_impl tmp = *this; --m_cur; return tmp; }
reverse_iterator_impl& operator--()
{ ++m_cur; return *this; }
reverse_iterator_impl operator--(int)
{ reverse_iterator_impl tmp = *this; ++m_cur; return tmp; }
// NB: explicit <T> in the functions below is to keep BCC 5.5 happy
reverse_iterator_impl operator+(ptrdiff_t n) const
{ return reverse_iterator_impl<T>(m_cur - n); }
reverse_iterator_impl operator-(ptrdiff_t n) const
{ return reverse_iterator_impl<T>(m_cur + n); }
reverse_iterator_impl operator+=(ptrdiff_t n)
{ m_cur -= n; return *this; }
reverse_iterator_impl operator-=(ptrdiff_t n)
{ m_cur += n; return *this; }
difference_type operator-(const reverse_iterator_impl& i) const
{ return i.m_cur - m_cur; }
bool operator==(const reverse_iterator_impl& ri) const
{ return m_cur == ri.m_cur; }
bool operator!=(const reverse_iterator_impl& ri) const
{ return !(*this == ri); }
bool operator<(const reverse_iterator_impl& i) const
{ return m_cur > i.m_cur; }
bool operator>(const reverse_iterator_impl& i) const
{ return m_cur < i.m_cur; }
bool operator<=(const reverse_iterator_impl& i) const
{ return m_cur >= i.m_cur; }
bool operator>=(const reverse_iterator_impl& i) const
{ return m_cur <= i.m_cur; }
private:
iterator_type m_cur;
};
typedef reverse_iterator_impl<iterator> reverse_iterator;
typedef reverse_iterator_impl<const_iterator> const_reverse_iterator;
private:
// used to transform an expression built using c_str() (and hence of type
// wxCStrData) to an iterator into the string
static const_iterator CreateConstIterator(const wxCStrData& data)
{
return const_iterator(data.m_str,
(data.m_str->begin() + data.m_offset).impl());
}
// in UTF-8 STL build, creation from std::string requires conversion under
// non-UTF8 locales, so we can't have and use wxString(wxStringImpl) ctor;
// instead we define dummy type that lets us have wxString ctor for creation
// from wxStringImpl that couldn't be used by user code (in all other builds,
// "standard" ctors can be used):
#if wxUSE_UNICODE_UTF8 && wxUSE_STL_BASED_WXSTRING
struct CtorFromStringImplTag {};
wxString(CtorFromStringImplTag* WXUNUSED(dummy), const wxStringImpl& src)
: m_impl(src) {}
static wxString FromImpl(const wxStringImpl& src)
{ return wxString((CtorFromStringImplTag*)NULL, src); }
#else
#if !wxUSE_STL_BASED_WXSTRING
wxString(const wxStringImpl& src) : m_impl(src) { }
// else: already defined as wxString(wxStdString) below
#endif
static wxString FromImpl(const wxStringImpl& src) { return wxString(src); }
#endif
public:
// constructors and destructor
// ctor for an empty string
wxString() {}
// copy ctor
wxString(const wxString& stringSrc) : m_impl(stringSrc.m_impl) { }
// string containing nRepeat copies of ch
wxString(wxUniChar ch, size_t nRepeat = 1 )
{ assign(nRepeat, ch); }
wxString(size_t nRepeat, wxUniChar ch)
{ assign(nRepeat, ch); }
wxString(wxUniCharRef ch, size_t nRepeat = 1)
{ assign(nRepeat, ch); }
wxString(size_t nRepeat, wxUniCharRef ch)
{ assign(nRepeat, ch); }
wxString(char ch, size_t nRepeat = 1)
{ assign(nRepeat, ch); }
wxString(size_t nRepeat, char ch)
{ assign(nRepeat, ch); }
wxString(wchar_t ch, size_t nRepeat = 1)
{ assign(nRepeat, ch); }
wxString(size_t nRepeat, wchar_t ch)
{ assign(nRepeat, ch); }
// ctors from char* strings:
wxString(const char *psz)
: m_impl(ImplStr(psz)) {}
wxString(const char *psz, const wxMBConv& conv)
: m_impl(ImplStr(psz, conv)) {}
wxString(const char *psz, size_t nLength)
{ assign(psz, nLength); }
wxString(const char *psz, const wxMBConv& conv, size_t nLength)
{
SubstrBufFromMB str(ImplStr(psz, nLength, conv));
m_impl.assign(str.data, str.len);
}
// and unsigned char*:
wxString(const unsigned char *psz)
: m_impl(ImplStr((const char*)psz)) {}
wxString(const unsigned char *psz, const wxMBConv& conv)
: m_impl(ImplStr((const char*)psz, conv)) {}
wxString(const unsigned char *psz, size_t nLength)
{ assign((const char*)psz, nLength); }
wxString(const unsigned char *psz, const wxMBConv& conv, size_t nLength)
{
SubstrBufFromMB str(ImplStr((const char*)psz, nLength, conv));
m_impl.assign(str.data, str.len);
}
// ctors from wchar_t* strings:
wxString(const wchar_t *pwz)
: m_impl(ImplStr(pwz)) {}
wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv))
: m_impl(ImplStr(pwz)) {}
wxString(const wchar_t *pwz, size_t nLength)
{ assign(pwz, nLength); }
wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv), size_t nLength)
{ assign(pwz, nLength); }
wxString(const wxScopedCharBuffer& buf)
{ assign(buf.data(), buf.length()); }
wxString(const wxScopedWCharBuffer& buf)
{ assign(buf.data(), buf.length()); }
wxString(const wxScopedCharBuffer& buf, const wxMBConv& conv)
{ assign(buf, conv); }
// NB: this version uses m_impl.c_str() to force making a copy of the
// string, so that "wxString(str.c_str())" idiom for passing strings
// between threads works
wxString(const wxCStrData& cstr)
: m_impl(cstr.AsString().m_impl.c_str()) { }
// as we provide both ctors with this signature for both char and unsigned
// char string, we need to provide one for wxCStrData to resolve ambiguity
wxString(const wxCStrData& cstr, size_t nLength)
: m_impl(cstr.AsString().Mid(0, nLength).m_impl) {}
// and because wxString is convertible to wxCStrData and const wxChar *
// we also need to provide this one
wxString(const wxString& str, size_t nLength)
{ assign(str, nLength); }
#if wxUSE_STRING_POS_CACHE
~wxString()
{
// we need to invalidate our cache entry as another string could be
// recreated at the same address (unlikely, but still possible, with the
// heap-allocated strings but perfectly common with stack-allocated ones)
InvalidateCache();
}
#endif // wxUSE_STRING_POS_CACHE
// even if we're not built with wxUSE_STD_STRING_CONV_IN_WXSTRING == 1 it is
// very convenient to allow implicit conversions from std::string to wxString
// and vice verse as this allows to use the same strings in non-GUI and GUI
// code, however we don't want to unconditionally add this ctor as it would
// make wx lib dependent on libstdc++ on some Linux versions which is bad, so
// instead we ask the client code to define this wxUSE_STD_STRING symbol if
// they need it
#if wxUSE_STD_STRING
#if wxUSE_UNICODE_WCHAR
wxString(const wxStdWideString& str) : m_impl(str) {}
#else // UTF-8 or ANSI
wxString(const wxStdWideString& str)
{ assign(str.c_str(), str.length()); }
#endif
#if !wxUSE_UNICODE // ANSI build
// FIXME-UTF8: do this in UTF8 build #if wxUSE_UTF8_LOCALE_ONLY, too
wxString(const std::string& str) : m_impl(str) {}
#else // Unicode
wxString(const std::string& str)
{ assign(str.c_str(), str.length()); }
#endif
#endif // wxUSE_STD_STRING
// Also always provide explicit conversions to std::[w]string in any case,
// see below for the implicit ones.
#if wxUSE_STD_STRING
// We can avoid a copy if we already use this string type internally,
// otherwise we create a copy on the fly:
#if wxUSE_UNICODE_WCHAR && wxUSE_STL_BASED_WXSTRING
#define wxStringToStdWstringRetType const wxStdWideString&
const wxStdWideString& ToStdWstring() const { return m_impl; }
#else
// wxStringImpl is either not std::string or needs conversion
#define wxStringToStdWstringRetType wxStdWideString
wxStdWideString ToStdWstring() const
{
#if wxUSE_UNICODE_WCHAR
wxScopedWCharBuffer buf =
wxScopedWCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length());
#else // !wxUSE_UNICODE_WCHAR
wxScopedWCharBuffer buf(wc_str());
#endif
return wxStdWideString(buf.data(), buf.length());
}
#endif
#if (!wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY) && wxUSE_STL_BASED_WXSTRING
// wxStringImpl is std::string in the encoding we want
#define wxStringToStdStringRetType const std::string&
const std::string& ToStdString() const { return m_impl; }
std::string ToStdString(const wxMBConv& WXUNUSED(conv)) const
{
// No conversions are done when not using Unicode as everything is
// supposed to be in 7 bit ASCII anyhow, this method is provided just
// for compatibility with the Unicode build.
return ToStdString();
}
#else
// wxStringImpl is either not std::string or needs conversion
#define wxStringToStdStringRetType std::string
std::string ToStdString(const wxMBConv& conv = wxConvLibc) const
{
wxScopedCharBuffer buf(mb_str(conv));
return std::string(buf.data(), buf.length());
}
#endif
#if wxUSE_STD_STRING_CONV_IN_WXSTRING
// Implicit conversions to std::[w]string are not provided by default as
// they conflict with the implicit conversions to "const char/wchar_t *"
// which we use for backwards compatibility but do provide them if
// explicitly requested.
#if wxUSE_UNSAFE_WXSTRING_CONV && !defined(wxNO_UNSAFE_WXSTRING_CONV)
operator wxStringToStdStringRetType() const { return ToStdString(); }
#endif // wxUSE_UNSAFE_WXSTRING_CONV
operator wxStringToStdWstringRetType() const { return ToStdWstring(); }
#endif // wxUSE_STD_STRING_CONV_IN_WXSTRING
#undef wxStringToStdStringRetType
#undef wxStringToStdWstringRetType
#endif // wxUSE_STD_STRING
wxString Clone() const
{
// make a deep copy of the string, i.e. the returned string will have
// ref count = 1 with refcounted implementation
return wxString::FromImpl(wxStringImpl(m_impl.c_str(), m_impl.length()));
}
// first valid index position
const_iterator begin() const { return const_iterator(this, m_impl.begin()); }
iterator begin() { return iterator(this, m_impl.begin()); }
const_iterator cbegin() const { return const_iterator(this, m_impl.begin()); }
// position one after the last valid one
const_iterator end() const { return const_iterator(this, m_impl.end()); }
iterator end() { return iterator(this, m_impl.end()); }
const_iterator cend() const { return const_iterator(this, m_impl.end()); }
// first element of the reversed string
const_reverse_iterator rbegin() const
{ return const_reverse_iterator(end()); }
reverse_iterator rbegin()
{ return reverse_iterator(end()); }
const_reverse_iterator crbegin() const
{ return const_reverse_iterator(end()); }
// one beyond the end of the reversed string
const_reverse_iterator rend() const
{ return const_reverse_iterator(begin()); }
reverse_iterator rend()
{ return reverse_iterator(begin()); }
const_reverse_iterator crend() const
{ return const_reverse_iterator(begin()); }
// std::string methods:
#if wxUSE_UNICODE_UTF8
size_t length() const
{
#if wxUSE_STRING_POS_CACHE
wxCACHE_PROFILE_FIELD_INC(lentot);
Cache::Element * const cache = GetCacheElement();
if ( cache->len == npos )
{
// it's probably not worth trying to be clever and using cache->pos
// here as it's probably 0 anyhow -- you usually call length() before
// starting to index the string
cache->len = end() - begin();
}
else
{
wxCACHE_PROFILE_FIELD_INC(lenhits);
wxSTRING_CACHE_ASSERT( (int)cache->len == end() - begin() );
}
return cache->len;
#else // !wxUSE_STRING_POS_CACHE
return end() - begin();
#endif // wxUSE_STRING_POS_CACHE/!wxUSE_STRING_POS_CACHE
}
#else
size_t length() const { return m_impl.length(); }
#endif
size_type size() const { return length(); }
size_type max_size() const { return npos; }
bool empty() const { return m_impl.empty(); }
// NB: these methods don't have a well-defined meaning in UTF-8 case
size_type capacity() const { return m_impl.capacity(); }
void reserve(size_t sz) { m_impl.reserve(sz); }
void resize(size_t nSize, wxUniChar ch = wxT('\0'))
{
const size_t len = length();
if ( nSize == len)
return;
#if wxUSE_UNICODE_UTF8
if ( nSize < len )
{
wxSTRING_INVALIDATE_CACHE();
// we can't use wxStringImpl::resize() for truncating the string as it
// counts in bytes, not characters
erase(nSize);
return;
}
// we also can't use (presumably more efficient) resize() if we have to
// append characters taking more than one byte
if ( !ch.IsAscii() )
{
append(nSize - len, ch);
}
else // can use (presumably faster) resize() version
#endif // wxUSE_UNICODE_UTF8
{
wxSTRING_INVALIDATE_CACHED_LENGTH();
m_impl.resize(nSize, (wxStringCharType)ch);
}
}
wxString substr(size_t nStart = 0, size_t nLen = npos) const
{
size_t pos, len;
PosLenToImpl(nStart, nLen, &pos, &len);
return FromImpl(m_impl.substr(pos, len));
}
// generic attributes & operations
// as standard strlen()
size_t Len() const { return length(); }
// string contains any characters?
bool IsEmpty() const { return empty(); }
// empty string is "false", so !str will return true
bool operator!() const { return empty(); }
// truncate the string to given length
wxString& Truncate(size_t uiLen);
// empty string contents
void Empty() { clear(); }
// empty the string and free memory
void Clear() { clear(); }
// contents test
// Is an ascii value
bool IsAscii() const;
// Is a number
bool IsNumber() const;
// Is a word
bool IsWord() const;
// data access (all indexes are 0 based)
// read access
wxUniChar at(size_t n) const
{ return wxStringOperations::DecodeChar(m_impl.begin() + PosToImpl(n)); }
wxUniChar GetChar(size_t n) const
{ return at(n); }
// read/write access
wxUniCharRef at(size_t n)
{ return *GetIterForNthChar(n); }
wxUniCharRef GetWritableChar(size_t n)
{ return at(n); }
// write access
void SetChar(size_t n, wxUniChar ch)
{ at(n) = ch; }
// get last character
wxUniChar Last() const
{
wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") );
return *rbegin();
}
// get writable last character
wxUniCharRef Last()
{
wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") );
return *rbegin();
}
/*
Note that we we must define all of the overloads below to avoid
ambiguity when using str[0].
*/
wxUniChar operator[](int n) const
{ return at(n); }
wxUniChar operator[](long n) const
{ return at(n); }
wxUniChar operator[](size_t n) const
{ return at(n); }
#ifndef wxSIZE_T_IS_UINT
wxUniChar operator[](unsigned int n) const
{ return at(n); }
#endif // size_t != unsigned int
// operator versions of GetWriteableChar()
wxUniCharRef operator[](int n)
{ return at(n); }
wxUniCharRef operator[](long n)
{ return at(n); }
wxUniCharRef operator[](size_t n)
{ return at(n); }
#ifndef wxSIZE_T_IS_UINT
wxUniCharRef operator[](unsigned int n)
{ return at(n); }
#endif // size_t != unsigned int
/*
Overview of wxString conversions, implicit and explicit:
- wxString has a std::[w]string-like c_str() method, however it does
not return a C-style string directly but instead returns wxCStrData
helper object which is convertible to either "char *" narrow string
or "wchar_t *" wide string. Usually the correct conversion will be
applied by the compiler automatically but if this doesn't happen you
need to explicitly choose one using wxCStrData::AsChar() or AsWChar()
methods or another wxString conversion function.
- One of the places where the conversion does *NOT* happen correctly is
when c_str() is passed to a vararg function such as printf() so you
must *NOT* use c_str() with them. Either use wxPrintf() (all wx
functions do handle c_str() correctly, even if they appear to be
vararg (but they're not, really)) or add an explicit AsChar() or, if
compatibility with previous wxWidgets versions is important, add a
cast to "const char *".
- In non-STL mode only, wxString is also implicitly convertible to
wxCStrData. The same warning as above applies.
- c_str() is polymorphic as it can be converted to either narrow or
wide string. If you explicitly need one or the other, choose to use
mb_str() (for narrow) or wc_str() (for wide) instead. Notice that
these functions can return either the pointer to string directly (if
this is what the string uses internally) or a temporary buffer
containing the string and convertible to it. Again, conversion will
usually be done automatically by the compiler but beware of the
vararg functions: you need an explicit cast when using them.
- There are also non-const versions of mb_str() and wc_str() called
char_str() and wchar_str(). They are only meant to be used with
non-const-correct functions and they always return buffers.
- Finally wx_str() returns whatever string representation is used by
wxString internally. It may be either a narrow or wide string
depending on wxWidgets build mode but it will always be a raw pointer
(and not a buffer).
*/
// explicit conversion to wxCStrData
wxCStrData c_str() const { return wxCStrData(this); }
wxCStrData data() const { return c_str(); }
// implicit conversion to wxCStrData
operator wxCStrData() const { return c_str(); }
// the first two operators conflict with operators for conversion to
// std::string and they must be disabled if those conversions are enabled;
// the next one only makes sense if conversions to char* are also defined
// and not defining it in STL build also helps us to get more clear error
// messages for the code which relies on implicit conversion to char* in
// STL build
#if !wxUSE_STD_STRING_CONV_IN_WXSTRING
operator const wchar_t*() const { return c_str(); }
#if wxUSE_UNSAFE_WXSTRING_CONV && !defined(wxNO_UNSAFE_WXSTRING_CONV)
operator const char*() const { return c_str(); }
// implicit conversion to untyped pointer for compatibility with previous
// wxWidgets versions: this is the same as conversion to const char * so it
// may fail!
operator const void*() const { return c_str(); }
#endif // wxUSE_UNSAFE_WXSTRING_CONV && !defined(wxNO_UNSAFE_WXSTRING_CONV)
#endif // !wxUSE_STD_STRING_CONV_IN_WXSTRING
// identical to c_str(), for MFC compatibility
const wxCStrData GetData() const { return c_str(); }
// explicit conversion to C string in internal representation (char*,
// wchar_t*, UTF-8-encoded char*, depending on the build):
const wxStringCharType *wx_str() const { return m_impl.c_str(); }
// conversion to *non-const* multibyte or widestring buffer; modifying
// returned buffer won't affect the string, these methods are only useful
// for passing values to const-incorrect functions
wxWritableCharBuffer char_str(const wxMBConv& conv = wxConvLibc) const
{ return mb_str(conv); }
wxWritableWCharBuffer wchar_str() const { return wc_str(); }
// conversion to the buffer of the given type T (= char or wchar_t) and
// also optionally return the buffer length
//
// this is mostly/only useful for the template functions
template <typename T>
wxCharTypeBuffer<T> tchar_str(size_t *len = NULL) const
{
#if wxUSE_UNICODE
// we need a helper dispatcher depending on type
return wxPrivate::wxStringAsBufHelper<T>::Get(*this, len);
#else // ANSI
// T can only be char in ANSI build
if ( len )
*len = length();
return wxCharTypeBuffer<T>::CreateNonOwned(wx_str(), length());
#endif // Unicode build kind
}
// conversion to/from plain (i.e. 7 bit) ASCII: this is useful for
// converting numbers or strings which are certain not to contain special
// chars (typically system functions, X atoms, environment variables etc.)
//
// the behaviour of these functions with the strings containing anything
// else than 7 bit ASCII characters is undefined, use at your own risk.
#if wxUSE_UNICODE
static wxString FromAscii(const char *ascii, size_t len);
static wxString FromAscii(const char *ascii);
static wxString FromAscii(char ascii);
const wxScopedCharBuffer ToAscii(char replaceWith = '_') const;
#else // ANSI
static wxString FromAscii(const char *ascii) { return wxString( ascii ); }
static wxString FromAscii(const char *ascii, size_t len)
{ return wxString( ascii, len ); }
static wxString FromAscii(char ascii) { return wxString( ascii ); }
const char *ToAscii(char WXUNUSED(replaceWith) = '_') const { return c_str(); }
#endif // Unicode/!Unicode
// also provide unsigned char overloads as signed/unsigned doesn't matter
// for 7 bit ASCII characters
static wxString FromAscii(const unsigned char *ascii)
{ return FromAscii((const char *)ascii); }
static wxString FromAscii(const unsigned char *ascii, size_t len)
{ return FromAscii((const char *)ascii, len); }
// conversion to/from UTF-8:
#if wxUSE_UNICODE_UTF8
static wxString FromUTF8Unchecked(const char *utf8)
{
if ( !utf8 )
return wxEmptyString;
wxASSERT( wxStringOperations::IsValidUtf8String(utf8) );
return FromImpl(wxStringImpl(utf8));
}
static wxString FromUTF8Unchecked(const char *utf8, size_t len)
{
if ( !utf8 )
return wxEmptyString;
if ( len == npos )
return FromUTF8Unchecked(utf8);
wxASSERT( wxStringOperations::IsValidUtf8String(utf8, len) );
return FromImpl(wxStringImpl(utf8, len));
}
static wxString FromUTF8(const char *utf8)
{
if ( !utf8 || !wxStringOperations::IsValidUtf8String(utf8) )
return wxString();
return FromImpl(wxStringImpl(utf8));
}
static wxString FromUTF8(const char *utf8, size_t len)
{
if ( len == npos )
return FromUTF8(utf8);
if ( !utf8 || !wxStringOperations::IsValidUtf8String(utf8, len) )
return wxString();
return FromImpl(wxStringImpl(utf8, len));
}
#if wxUSE_STD_STRING
static wxString FromUTF8Unchecked(const std::string& utf8)
{
wxASSERT( wxStringOperations::IsValidUtf8String(utf8.c_str(), utf8.length()) );
/*
Note that, under wxUSE_UNICODE_UTF8 and wxUSE_STD_STRING, wxStringImpl can be
initialized with a std::string whether wxUSE_STL_BASED_WXSTRING is 1 or not.
*/
return FromImpl(utf8);
}
static wxString FromUTF8(const std::string& utf8)
{
if ( utf8.empty() || !wxStringOperations::IsValidUtf8String(utf8.c_str(), utf8.length()) )
return wxString();
return FromImpl(utf8);
}
#endif
const wxScopedCharBuffer utf8_str() const
{ return wxCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); }
// this function exists in UTF-8 build only and returns the length of the
// internal UTF-8 representation
size_t utf8_length() const { return m_impl.length(); }
#elif wxUSE_UNICODE_WCHAR
static wxString FromUTF8(const char *utf8, size_t len = npos)
{ return wxString(utf8, wxMBConvUTF8(), len); }
static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos)
{
const wxString s(utf8, wxMBConvUTF8(), len);
wxASSERT_MSG( !utf8 || !*utf8 || !s.empty(),
"string must be valid UTF-8" );
return s;
}
#if wxUSE_STD_STRING
static wxString FromUTF8(const std::string& utf8)
{ return FromUTF8(utf8.c_str(), utf8.length()); }
static wxString FromUTF8Unchecked(const std::string& utf8)
{ return FromUTF8Unchecked(utf8.c_str(), utf8.length()); }
#endif
const wxScopedCharBuffer utf8_str() const { return mb_str(wxMBConvUTF8()); }
#else // ANSI
static wxString FromUTF8(const char *utf8)
{ return wxString(wxMBConvUTF8().cMB2WC(utf8)); }
static wxString FromUTF8(const char *utf8, size_t len)
{
size_t wlen;
wxScopedWCharBuffer buf(wxMBConvUTF8().cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen));
return wxString(buf.data(), wlen);
}
static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos)
{
size_t wlen;
wxScopedWCharBuffer buf
(
wxMBConvUTF8().cMB2WC
(
utf8,
len == npos ? wxNO_LEN : len,
&wlen
)
);
wxASSERT_MSG( !utf8 || !*utf8 || wlen,
"string must be valid UTF-8" );
return wxString(buf.data(), wlen);
}
#if wxUSE_STD_STRING
static wxString FromUTF8(const std::string& utf8)
{ return FromUTF8(utf8.c_str(), utf8.length()); }
static wxString FromUTF8Unchecked(const std::string& utf8)
{ return FromUTF8Unchecked(utf8.c_str(), utf8.length()); }
#endif
const wxScopedCharBuffer utf8_str() const
{ return wxMBConvUTF8().cWC2MB(wc_str()); }
#endif
const wxScopedCharBuffer ToUTF8() const { return utf8_str(); }
// functions for storing binary data in wxString:
#if wxUSE_UNICODE
static wxString From8BitData(const char *data, size_t len)
{ return wxString(data, wxConvISO8859_1, len); }
// version for NUL-terminated data:
static wxString From8BitData(const char *data)
{ return wxString(data, wxConvISO8859_1); }
const wxScopedCharBuffer To8BitData() const
{ return mb_str(wxConvISO8859_1); }
#else // ANSI
static wxString From8BitData(const char *data, size_t len)
{ return wxString(data, len); }
// version for NUL-terminated data:
static wxString From8BitData(const char *data)
{ return wxString(data); }
const wxScopedCharBuffer To8BitData() const
{ return wxScopedCharBuffer::CreateNonOwned(wx_str(), length()); }
#endif // Unicode/ANSI
// conversions with (possible) format conversions: have to return a
// buffer with temporary data
//
// the functions defined (in either Unicode or ANSI) mode are mb_str() to
// return an ANSI (multibyte) string, wc_str() to return a wide string and
// fn_str() to return a string which should be used with the OS APIs
// accepting the file names. The return value is always the same, but the
// type differs because a function may either return pointer to the buffer
// directly or have to use intermediate buffer for translation.
#if wxUSE_UNICODE
// this is an optimization: even though using mb_str(wxConvLibc) does the
// same thing (i.e. returns pointer to internal representation as locale is
// always an UTF-8 one) in wxUSE_UTF8_LOCALE_ONLY case, we can avoid the
// extra checks and the temporary buffer construction by providing a
// separate mb_str() overload
#if wxUSE_UTF8_LOCALE_ONLY
const char* mb_str() const { return wx_str(); }
const wxScopedCharBuffer mb_str(const wxMBConv& conv) const
{
return AsCharBuf(conv);
}
#else // !wxUSE_UTF8_LOCALE_ONLY
const wxScopedCharBuffer mb_str(const wxMBConv& conv = wxConvLibc) const
{
return AsCharBuf(conv);
}
#endif // wxUSE_UTF8_LOCALE_ONLY/!wxUSE_UTF8_LOCALE_ONLY
const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
#if wxUSE_UNICODE_WCHAR
const wchar_t* wc_str() const { return wx_str(); }
#elif wxUSE_UNICODE_UTF8
const wxScopedWCharBuffer wc_str() const
{ return AsWCharBuf(wxMBConvStrictUTF8()); }
#endif
// for compatibility with !wxUSE_UNICODE version
const wxWX2WCbuf wc_str(const wxMBConv& WXUNUSED(conv)) const
{ return wc_str(); }
#if wxMBFILES
const wxScopedCharBuffer fn_str() const { return mb_str(wxConvFile); }
#else // !wxMBFILES
const wxWX2WCbuf fn_str() const { return wc_str(); }
#endif // wxMBFILES/!wxMBFILES
#else // ANSI
const char* mb_str() const { return wx_str(); }
// for compatibility with wxUSE_UNICODE version
const char* mb_str(const wxMBConv& WXUNUSED(conv)) const { return wx_str(); }
const wxWX2MBbuf mbc_str() const { return mb_str(); }
const wxScopedWCharBuffer wc_str(const wxMBConv& conv = wxConvLibc) const
{ return AsWCharBuf(conv); }
const wxScopedCharBuffer fn_str() const
{ return wxConvFile.cWC2WX( wc_str( wxConvLibc ) ); }
#endif // Unicode/ANSI
#if wxUSE_UNICODE_UTF8
const wxScopedWCharBuffer t_str() const { return wc_str(); }
#elif wxUSE_UNICODE_WCHAR
const wchar_t* t_str() const { return wx_str(); }
#else
const char* t_str() const { return wx_str(); }
#endif
// overloaded assignment
// from another wxString
wxString& operator=(const wxString& stringSrc)
{
if ( this != &stringSrc )
{
wxSTRING_INVALIDATE_CACHE();
m_impl = stringSrc.m_impl;
}
return *this;
}
wxString& operator=(const wxCStrData& cstr)
{ return *this = cstr.AsString(); }
// from a character
wxString& operator=(wxUniChar ch)
{
wxSTRING_INVALIDATE_CACHE();
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
m_impl = (wxStringCharType)ch;
else
m_impl = wxStringOperations::EncodeChar(ch);
return *this;
}
wxString& operator=(wxUniCharRef ch)
{ return operator=((wxUniChar)ch); }
wxString& operator=(char ch)
{ return operator=(wxUniChar(ch)); }
wxString& operator=(unsigned char ch)
{ return operator=(wxUniChar(ch)); }
wxString& operator=(wchar_t ch)
{ return operator=(wxUniChar(ch)); }
// from a C string - STL probably will crash on NULL,
// so we need to compensate in that case
#if wxUSE_STL_BASED_WXSTRING
wxString& operator=(const char *psz)
{
wxSTRING_INVALIDATE_CACHE();
if ( psz )
m_impl = ImplStr(psz);
else
clear();
return *this;
}
wxString& operator=(const wchar_t *pwz)
{
wxSTRING_INVALIDATE_CACHE();
if ( pwz )
m_impl = ImplStr(pwz);
else
clear();
return *this;
}
#else // !wxUSE_STL_BASED_WXSTRING
wxString& operator=(const char *psz)
{
wxSTRING_INVALIDATE_CACHE();
m_impl = ImplStr(psz);
return *this;
}
wxString& operator=(const wchar_t *pwz)
{
wxSTRING_INVALIDATE_CACHE();
m_impl = ImplStr(pwz);
return *this;
}
#endif // wxUSE_STL_BASED_WXSTRING/!wxUSE_STL_BASED_WXSTRING
wxString& operator=(const unsigned char *psz)
{ return operator=((const char*)psz); }
// from wxScopedWCharBuffer
wxString& operator=(const wxScopedWCharBuffer& s)
{ return assign(s); }
// from wxScopedCharBuffer
wxString& operator=(const wxScopedCharBuffer& s)
{ return assign(s); }
// string concatenation
// in place concatenation
/*
Concatenate and return the result. Note that the left to right
associativity of << allows to write things like "str << str1 << str2
<< ..." (unlike with +=)
*/
// string += string
wxString& operator<<(const wxString& s)
{
#if WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
wxASSERT_MSG( s.IsValid(),
wxT("did you forget to call UngetWriteBuf()?") );
#endif
append(s);
return *this;
}
// string += C string
wxString& operator<<(const char *psz)
{ append(psz); return *this; }
wxString& operator<<(const wchar_t *pwz)
{ append(pwz); return *this; }
wxString& operator<<(const wxCStrData& psz)
{ append(psz.AsString()); return *this; }
// string += char
wxString& operator<<(wxUniChar ch) { append(1, ch); return *this; }
wxString& operator<<(wxUniCharRef ch) { append(1, ch); return *this; }
wxString& operator<<(char ch) { append(1, ch); return *this; }
wxString& operator<<(unsigned char ch) { append(1, ch); return *this; }
wxString& operator<<(wchar_t ch) { append(1, ch); return *this; }
// string += buffer (i.e. from wxGetString)
wxString& operator<<(const wxScopedWCharBuffer& s)
{ return append(s); }
wxString& operator<<(const wxScopedCharBuffer& s)
{ return append(s); }
// string += C string
wxString& Append(const wxString& s)
{
// test for empty() to share the string if possible
if ( empty() )
*this = s;
else
append(s);
return *this;
}
wxString& Append(const char* psz)
{ append(psz); return *this; }
wxString& Append(const wchar_t* pwz)
{ append(pwz); return *this; }
wxString& Append(const wxCStrData& psz)
{ append(psz); return *this; }
wxString& Append(const wxScopedCharBuffer& psz)
{ append(psz); return *this; }
wxString& Append(const wxScopedWCharBuffer& psz)
{ append(psz); return *this; }
wxString& Append(const char* psz, size_t nLen)
{ append(psz, nLen); return *this; }
wxString& Append(const wchar_t* pwz, size_t nLen)
{ append(pwz, nLen); return *this; }
wxString& Append(const wxCStrData& psz, size_t nLen)
{ append(psz, nLen); return *this; }
wxString& Append(const wxScopedCharBuffer& psz, size_t nLen)
{ append(psz, nLen); return *this; }
wxString& Append(const wxScopedWCharBuffer& psz, size_t nLen)
{ append(psz, nLen); return *this; }
// append count copies of given character
wxString& Append(wxUniChar ch, size_t count = 1u)
{ append(count, ch); return *this; }
wxString& Append(wxUniCharRef ch, size_t count = 1u)
{ append(count, ch); return *this; }
wxString& Append(char ch, size_t count = 1u)
{ append(count, ch); return *this; }
wxString& Append(unsigned char ch, size_t count = 1u)
{ append(count, ch); return *this; }
wxString& Append(wchar_t ch, size_t count = 1u)
{ append(count, ch); return *this; }
// prepend a string, return the string itself
wxString& Prepend(const wxString& str)
{ *this = str + *this; return *this; }
// non-destructive concatenation
// two strings
friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1,
const wxString& string2);
// string with a single char
friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch);
// char with a string
friend wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string);
// string with C string
friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string,
const char *psz);
friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string,
const wchar_t *pwz);
// C string with string
friend wxString WXDLLIMPEXP_BASE operator+(const char *psz,
const wxString& string);
friend wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz,
const wxString& string);
// stream-like functions
// insert an int into string
wxString& operator<<(int i)
{ return (*this) << Format(wxT("%d"), i); }
// insert an unsigned int into string
wxString& operator<<(unsigned int ui)
{ return (*this) << Format(wxT("%u"), ui); }
// insert a long into string
wxString& operator<<(long l)
{ return (*this) << Format(wxT("%ld"), l); }
// insert an unsigned long into string
wxString& operator<<(unsigned long ul)
{ return (*this) << Format(wxT("%lu"), ul); }
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
// insert a long long if they exist and aren't longs
wxString& operator<<(wxLongLong_t ll)
{
return (*this) << Format("%" wxLongLongFmtSpec "d", ll);
}
// insert an unsigned long long
wxString& operator<<(wxULongLong_t ull)
{
return (*this) << Format("%" wxLongLongFmtSpec "u" , ull);
}
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
// insert a float into string
wxString& operator<<(float f)
{ return (*this) << Format(wxT("%f"), f); }
// insert a double into string
wxString& operator<<(double d)
{ return (*this) << Format(wxT("%g"), d); }
// string comparison
// case-sensitive comparison (returns a value < 0, = 0 or > 0)
int Cmp(const char *psz) const
{ return compare(psz); }
int Cmp(const wchar_t *pwz) const
{ return compare(pwz); }
int Cmp(const wxString& s) const
{ return compare(s); }
int Cmp(const wxCStrData& s) const
{ return compare(s); }
int Cmp(const wxScopedCharBuffer& s) const
{ return compare(s); }
int Cmp(const wxScopedWCharBuffer& s) const
{ return compare(s); }
// same as Cmp() but not case-sensitive
int CmpNoCase(const wxString& s) const;
// test for the string equality, either considering case or not
// (if compareWithCase then the case matters)
bool IsSameAs(const wxString& str, bool compareWithCase = true) const
{
#if !wxUSE_UNICODE_UTF8
// in UTF-8 build, length() is O(n) and doing this would be _slower_
if ( length() != str.length() )
return false;
#endif
return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0;
}
bool IsSameAs(const char *str, bool compareWithCase = true) const
{ return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; }
bool IsSameAs(const wchar_t *str, bool compareWithCase = true) const
{ return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; }
bool IsSameAs(const wxCStrData& str, bool compareWithCase = true) const
{ return IsSameAs(str.AsString(), compareWithCase); }
bool IsSameAs(const wxScopedCharBuffer& str, bool compareWithCase = true) const
{ return IsSameAs(str.data(), compareWithCase); }
bool IsSameAs(const wxScopedWCharBuffer& str, bool compareWithCase = true) const
{ return IsSameAs(str.data(), compareWithCase); }
// comparison with a single character: returns true if equal
bool IsSameAs(wxUniChar c, bool compareWithCase = true) const;
// FIXME-UTF8: remove these overloads
bool IsSameAs(wxUniCharRef c, bool compareWithCase = true) const
{ return IsSameAs(wxUniChar(c), compareWithCase); }
bool IsSameAs(char c, bool compareWithCase = true) const
{ return IsSameAs(wxUniChar(c), compareWithCase); }
bool IsSameAs(unsigned char c, bool compareWithCase = true) const
{ return IsSameAs(wxUniChar(c), compareWithCase); }
bool IsSameAs(wchar_t c, bool compareWithCase = true) const
{ return IsSameAs(wxUniChar(c), compareWithCase); }
bool IsSameAs(int c, bool compareWithCase = true) const
{ return IsSameAs(wxUniChar(c), compareWithCase); }
// simple sub-string extraction
// return substring starting at nFirst of length nCount (or till the end
// if nCount = default value)
wxString Mid(size_t nFirst, size_t nCount = npos) const;
// operator version of Mid()
wxString operator()(size_t start, size_t len) const
{ return Mid(start, len); }
// check if the string starts with the given prefix and return the rest
// of the string in the provided pointer if it is not NULL; otherwise
// return false
bool StartsWith(const wxString& prefix, wxString *rest = NULL) const;
// check if the string ends with the given suffix and return the
// beginning of the string before the suffix in the provided pointer if
// it is not NULL; otherwise return false
bool EndsWith(const wxString& suffix, wxString *rest = NULL) const;
// get first nCount characters
wxString Left(size_t nCount) const;
// get last nCount characters
wxString Right(size_t nCount) const;
// get all characters before the first occurrence of ch
// (returns the whole string if ch not found) and also put everything
// following the first occurrence of ch into rest if it's non-NULL
wxString BeforeFirst(wxUniChar ch, wxString *rest = NULL) const;
// get all characters before the last occurrence of ch
// (returns empty string if ch not found) and also put everything
// following the last occurrence of ch into rest if it's non-NULL
wxString BeforeLast(wxUniChar ch, wxString *rest = NULL) const;
// get all characters after the first occurrence of ch
// (returns empty string if ch not found)
wxString AfterFirst(wxUniChar ch) const;
// get all characters after the last occurrence of ch
// (returns the whole string if ch not found)
wxString AfterLast(wxUniChar ch) const;
// for compatibility only, use more explicitly named functions above
wxString Before(wxUniChar ch) const { return BeforeLast(ch); }
wxString After(wxUniChar ch) const { return AfterFirst(ch); }
// case conversion
// convert to upper case in place, return the string itself
wxString& MakeUpper();
// convert to upper case, return the copy of the string
wxString Upper() const { return wxString(*this).MakeUpper(); }
// convert to lower case in place, return the string itself
wxString& MakeLower();
// convert to lower case, return the copy of the string
wxString Lower() const { return wxString(*this).MakeLower(); }
// convert the first character to the upper case and the rest to the
// lower one, return the modified string itself
wxString& MakeCapitalized();
// convert the first character to the upper case and the rest to the
// lower one, return the copy of the string
wxString Capitalize() const { return wxString(*this).MakeCapitalized(); }
// trimming/padding whitespace (either side) and truncating
// remove spaces from left or from right (default) side
wxString& Trim(bool bFromRight = true);
// add nCount copies chPad in the beginning or at the end (default)
wxString& Pad(size_t nCount, wxUniChar chPad = wxT(' '), bool bFromRight = true);
// searching and replacing
// searching (return starting index, or -1 if not found)
int Find(wxUniChar ch, bool bFromEnd = false) const; // like strchr/strrchr
int Find(wxUniCharRef ch, bool bFromEnd = false) const
{ return Find(wxUniChar(ch), bFromEnd); }
int Find(char ch, bool bFromEnd = false) const
{ return Find(wxUniChar(ch), bFromEnd); }
int Find(unsigned char ch, bool bFromEnd = false) const
{ return Find(wxUniChar(ch), bFromEnd); }
int Find(wchar_t ch, bool bFromEnd = false) const
{ return Find(wxUniChar(ch), bFromEnd); }
// searching (return starting index, or -1 if not found)
int Find(const wxString& sub) const // like strstr
{
const size_type idx = find(sub);
return (idx == npos) ? wxNOT_FOUND : (int)idx;
}
int Find(const char *sub) const // like strstr
{
const size_type idx = find(sub);
return (idx == npos) ? wxNOT_FOUND : (int)idx;
}
int Find(const wchar_t *sub) const // like strstr
{
const size_type idx = find(sub);
return (idx == npos) ? wxNOT_FOUND : (int)idx;
}
int Find(const wxCStrData& sub) const
{ return Find(sub.AsString()); }
int Find(const wxScopedCharBuffer& sub) const
{ return Find(sub.data()); }
int Find(const wxScopedWCharBuffer& sub) const
{ return Find(sub.data()); }
// replace first (or all of bReplaceAll) occurrences of substring with
// another string, returns the number of replacements made
size_t Replace(const wxString& strOld,
const wxString& strNew,
bool bReplaceAll = true);
// check if the string contents matches a mask containing '*' and '?'
bool Matches(const wxString& mask) const;
// conversion to numbers: all functions return true only if the whole
// string is a number and put the value of this number into the pointer
// provided, the base is the numeric base in which the conversion should be
// done and must be comprised between 2 and 36 or be 0 in which case the
// standard C rules apply (leading '0' => octal, "0x" => hex)
// convert to a signed integer
bool ToLong(long *val, int base = 10) const;
// convert to an unsigned integer
bool ToULong(unsigned long *val, int base = 10) const;
// convert to wxLongLong
#if defined(wxLongLong_t)
bool ToLongLong(wxLongLong_t *val, int base = 10) const;
// convert to wxULongLong
bool ToULongLong(wxULongLong_t *val, int base = 10) const;
#endif // wxLongLong_t
// convert to a double
bool ToDouble(double *val) const;
// conversions to numbers using C locale
// convert to a signed integer
bool ToCLong(long *val, int base = 10) const;
// convert to an unsigned integer
bool ToCULong(unsigned long *val, int base = 10) const;
// convert to a double
bool ToCDouble(double *val) const;
// create a string representing the given floating point number with the
// default (like %g) or fixed (if precision >=0) precision
// in the current locale
static wxString FromDouble(double val, int precision = -1);
// in C locale
static wxString FromCDouble(double val, int precision = -1);
// formatted input/output
// as sprintf(), returns the number of characters written or < 0 on error
// (take 'this' into account in attribute parameter count)
// int Printf(const wxString& format, ...);
WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&),
DoPrintfWchar, DoPrintfUtf8)
// as vprintf(), returns the number of characters written or < 0 on error
int PrintfV(const wxString& format, va_list argptr);
// returns the string containing the result of Printf() to it
// static wxString Format(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_1;
WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxFormatString&),
DoFormatWchar, DoFormatUtf8)
// the same as above, but takes a va_list
static wxString FormatV(const wxString& format, va_list argptr);
// raw access to string memory
// ensure that string has space for at least nLen characters
// only works if the data of this string is not shared
bool Alloc(size_t nLen) { reserve(nLen); return capacity() >= nLen; }
// minimize the string's memory
// only works if the data of this string is not shared
bool Shrink();
#if WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
// These are deprecated, use wxStringBuffer or wxStringBufferLength instead
//
// get writable buffer of at least nLen bytes. Unget() *must* be called
// a.s.a.p. to put string back in a reasonable state!
wxDEPRECATED( wxStringCharType *GetWriteBuf(size_t nLen) );
// call this immediately after GetWriteBuf() has been used
wxDEPRECATED( void UngetWriteBuf() );
wxDEPRECATED( void UngetWriteBuf(size_t nLen) );
#endif // WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && wxUSE_UNICODE_UTF8
// wxWidgets version 1 compatibility functions
// use Mid()
wxString SubString(size_t from, size_t to) const
{ return Mid(from, (to - from + 1)); }
// values for second parameter of CompareTo function
enum caseCompare {exact, ignoreCase};
// values for first parameter of Strip function
enum stripType {leading = 0x1, trailing = 0x2, both = 0x3};
// use Printf()
// (take 'this' into account in attribute parameter count)
// int sprintf(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_2;
WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&),
DoPrintfWchar, DoPrintfUtf8)
// use Cmp()
int CompareTo(const wxChar* psz, caseCompare cmp = exact) const
{ return cmp == exact ? Cmp(psz) : CmpNoCase(psz); }
// use length()
size_t Length() const { return length(); }
// Count the number of characters
int Freq(wxUniChar ch) const;
// use MakeLower
void LowerCase() { MakeLower(); }
// use MakeUpper
void UpperCase() { MakeUpper(); }
// use Trim except that it doesn't change this string
wxString Strip(stripType w = trailing) const;
// use Find (more general variants not yet supported)
size_t Index(const wxChar* psz) const { return Find(psz); }
size_t Index(wxUniChar ch) const { return Find(ch); }
// use Truncate
wxString& Remove(size_t pos) { return Truncate(pos); }
wxString& RemoveLast(size_t n = 1) { return Truncate(length() - n); }
wxString& Remove(size_t nStart, size_t nLen)
{ return (wxString&)erase( nStart, nLen ); }
// use Find()
int First( wxUniChar ch ) const { return Find(ch); }
int First( wxUniCharRef ch ) const { return Find(ch); }
int First( char ch ) const { return Find(ch); }
int First( unsigned char ch ) const { return Find(ch); }
int First( wchar_t ch ) const { return Find(ch); }
int First( const wxString& str ) const { return Find(str); }
int Last( wxUniChar ch ) const { return Find(ch, true); }
bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; }
// use empty()
bool IsNull() const { return empty(); }
// std::string compatibility functions
// take nLen chars starting at nPos
wxString(const wxString& str, size_t nPos, size_t nLen)
{ assign(str, nPos, nLen); }
// take all characters from first to last
wxString(const_iterator first, const_iterator last)
: m_impl(first.impl(), last.impl()) { }
#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
// the 2 overloads below are for compatibility with the existing code using
// pointers instead of iterators
wxString(const char *first, const char *last)
{
SubstrBufFromMB str(ImplStr(first, last - first));
m_impl.assign(str.data, str.len);
}
wxString(const wchar_t *first, const wchar_t *last)
{
SubstrBufFromWC str(ImplStr(first, last - first));
m_impl.assign(str.data, str.len);
}
// and this one is needed to compile code adding offsets to c_str() result
wxString(const wxCStrData& first, const wxCStrData& last)
: m_impl(CreateConstIterator(first).impl(),
CreateConstIterator(last).impl())
{
wxASSERT_MSG( first.m_str == last.m_str,
wxT("pointers must be into the same string") );
}
#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
// lib.string.modifiers
// append elements str[pos], ..., str[pos+n]
wxString& append(const wxString& str, size_t pos, size_t n)
{
wxSTRING_UPDATE_CACHED_LENGTH(n);
size_t from, len;
str.PosLenToImpl(pos, n, &from, &len);
m_impl.append(str.m_impl, from, len);
return *this;
}
// append a string
wxString& append(const wxString& str)
{
wxSTRING_UPDATE_CACHED_LENGTH(str.length());
m_impl.append(str.m_impl);
return *this;
}
// append first n (or all if n == npos) characters of sz
wxString& append(const char *sz)
{
wxSTRING_INVALIDATE_CACHED_LENGTH();
m_impl.append(ImplStr(sz));
return *this;
}
wxString& append(const wchar_t *sz)
{
wxSTRING_INVALIDATE_CACHED_LENGTH();
m_impl.append(ImplStr(sz));
return *this;
}
wxString& append(const char *sz, size_t n)
{
wxSTRING_INVALIDATE_CACHED_LENGTH();
SubstrBufFromMB str(ImplStr(sz, n));
m_impl.append(str.data, str.len);
return *this;
}
wxString& append(const wchar_t *sz, size_t n)
{
wxSTRING_UPDATE_CACHED_LENGTH(n);
SubstrBufFromWC str(ImplStr(sz, n));
m_impl.append(str.data, str.len);
return *this;
}
wxString& append(const wxCStrData& str)
{ return append(str.AsString()); }
wxString& append(const wxScopedCharBuffer& str)
{ return append(str.data(), str.length()); }
wxString& append(const wxScopedWCharBuffer& str)
{ return append(str.data(), str.length()); }
wxString& append(const wxCStrData& str, size_t n)
{ return append(str.AsString(), 0, n); }
wxString& append(const wxScopedCharBuffer& str, size_t n)
{ return append(str.data(), n); }
wxString& append(const wxScopedWCharBuffer& str, size_t n)
{ return append(str.data(), n); }
// append n copies of ch
wxString& append(size_t n, wxUniChar ch)
{
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
{
wxSTRING_UPDATE_CACHED_LENGTH(n);
m_impl.append(n, (wxStringCharType)ch);
}
else
{
wxSTRING_INVALIDATE_CACHED_LENGTH();
m_impl.append(wxStringOperations::EncodeNChars(n, ch));
}
return *this;
}
wxString& append(size_t n, wxUniCharRef ch)
{ return append(n, wxUniChar(ch)); }
wxString& append(size_t n, char ch)
{ return append(n, wxUniChar(ch)); }
wxString& append(size_t n, unsigned char ch)
{ return append(n, wxUniChar(ch)); }
wxString& append(size_t n, wchar_t ch)
{ return append(n, wxUniChar(ch)); }
// append from first to last
wxString& append(const_iterator first, const_iterator last)
{
wxSTRING_INVALIDATE_CACHED_LENGTH();
m_impl.append(first.impl(), last.impl());
return *this;
}
#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
wxString& append(const char *first, const char *last)
{ return append(first, last - first); }
wxString& append(const wchar_t *first, const wchar_t *last)
{ return append(first, last - first); }
wxString& append(const wxCStrData& first, const wxCStrData& last)
{ return append(CreateConstIterator(first), CreateConstIterator(last)); }
#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
// same as `this_string = str'
wxString& assign(const wxString& str)
{
wxSTRING_SET_CACHED_LENGTH(str.length());
m_impl = str.m_impl;
return *this;
}
// This is a non-standard-compliant overload taking the first "len"
// characters of the source string.
wxString& assign(const wxString& str, size_t len)
{
#if wxUSE_STRING_POS_CACHE
// It is legal to pass len > str.length() to wxStringImpl::assign() but
// by restricting it here we save some work for that function so it's not
// really less efficient and, at the same time, ensure that we don't
// cache invalid length.
const size_t lenSrc = str.length();
if ( len > lenSrc )
len = lenSrc;
wxSTRING_SET_CACHED_LENGTH(len);
#endif // wxUSE_STRING_POS_CACHE
m_impl.assign(str.m_impl, 0, str.LenToImpl(len));
return *this;
}
// same as ` = str[pos..pos + n]
wxString& assign(const wxString& str, size_t pos, size_t n)
{
size_t from, len;
str.PosLenToImpl(pos, n, &from, &len);
m_impl.assign(str.m_impl, from, len);
// it's important to call this after PosLenToImpl() above in case str is
// the same string as this one
wxSTRING_SET_CACHED_LENGTH(n);
return *this;
}
// same as `= first n (or all if n == npos) characters of sz'
wxString& assign(const char *sz)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.assign(ImplStr(sz));
return *this;
}
wxString& assign(const wchar_t *sz)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.assign(ImplStr(sz));
return *this;
}
wxString& assign(const char *sz, size_t n)
{
wxSTRING_INVALIDATE_CACHE();
SubstrBufFromMB str(ImplStr(sz, n));
m_impl.assign(str.data, str.len);
return *this;
}
wxString& assign(const wchar_t *sz, size_t n)
{
wxSTRING_SET_CACHED_LENGTH(n);
SubstrBufFromWC str(ImplStr(sz, n));
m_impl.assign(str.data, str.len);
return *this;
}
wxString& assign(const wxCStrData& str)
{ return assign(str.AsString()); }
wxString& assign(const wxScopedCharBuffer& str)
{ return assign(str.data(), str.length()); }
wxString& assign(const wxScopedCharBuffer& buf, const wxMBConv& conv)
{
SubstrBufFromMB str(ImplStr(buf.data(), buf.length(), conv));
m_impl.assign(str.data, str.len);
return *this;
}
wxString& assign(const wxScopedWCharBuffer& str)
{ return assign(str.data(), str.length()); }
wxString& assign(const wxCStrData& str, size_t len)
{ return assign(str.AsString(), len); }
wxString& assign(const wxScopedCharBuffer& str, size_t len)
{ return assign(str.data(), len); }
wxString& assign(const wxScopedWCharBuffer& str, size_t len)
{ return assign(str.data(), len); }
// same as `= n copies of ch'
wxString& assign(size_t n, wxUniChar ch)
{
wxSTRING_SET_CACHED_LENGTH(n);
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
m_impl.assign(n, (wxStringCharType)ch);
else
m_impl.assign(wxStringOperations::EncodeNChars(n, ch));
return *this;
}
wxString& assign(size_t n, wxUniCharRef ch)
{ return assign(n, wxUniChar(ch)); }
wxString& assign(size_t n, char ch)
{ return assign(n, wxUniChar(ch)); }
wxString& assign(size_t n, unsigned char ch)
{ return assign(n, wxUniChar(ch)); }
wxString& assign(size_t n, wchar_t ch)
{ return assign(n, wxUniChar(ch)); }
// assign from first to last
wxString& assign(const_iterator first, const_iterator last)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.assign(first.impl(), last.impl());
return *this;
}
#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
wxString& assign(const char *first, const char *last)
{ return assign(first, last - first); }
wxString& assign(const wchar_t *first, const wchar_t *last)
{ return assign(first, last - first); }
wxString& assign(const wxCStrData& first, const wxCStrData& last)
{ return assign(CreateConstIterator(first), CreateConstIterator(last)); }
#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
// string comparison
int compare(const wxString& str) const;
int compare(const char* sz) const;
int compare(const wchar_t* sz) const;
int compare(const wxCStrData& str) const
{ return compare(str.AsString()); }
int compare(const wxScopedCharBuffer& str) const
{ return compare(str.data()); }
int compare(const wxScopedWCharBuffer& str) const
{ return compare(str.data()); }
// comparison with a substring
int compare(size_t nStart, size_t nLen, const wxString& str) const;
// comparison of 2 substrings
int compare(size_t nStart, size_t nLen,
const wxString& str, size_t nStart2, size_t nLen2) const;
// substring comparison with first nCount characters of sz
int compare(size_t nStart, size_t nLen,
const char* sz, size_t nCount = npos) const;
int compare(size_t nStart, size_t nLen,
const wchar_t* sz, size_t nCount = npos) const;
// insert another string
wxString& insert(size_t nPos, const wxString& str)
{ insert(GetIterForNthChar(nPos), str.begin(), str.end()); return *this; }
// insert n chars of str starting at nStart (in str)
wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n)
{
wxSTRING_UPDATE_CACHED_LENGTH(n);
size_t from, len;
str.PosLenToImpl(nStart, n, &from, &len);
m_impl.insert(PosToImpl(nPos), str.m_impl, from, len);
return *this;
}
// insert first n (or all if n == npos) characters of sz
wxString& insert(size_t nPos, const char *sz)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.insert(PosToImpl(nPos), ImplStr(sz));
return *this;
}
wxString& insert(size_t nPos, const wchar_t *sz)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.insert(PosToImpl(nPos), ImplStr(sz)); return *this;
}
wxString& insert(size_t nPos, const char *sz, size_t n)
{
wxSTRING_UPDATE_CACHED_LENGTH(n);
SubstrBufFromMB str(ImplStr(sz, n));
m_impl.insert(PosToImpl(nPos), str.data, str.len);
return *this;
}
wxString& insert(size_t nPos, const wchar_t *sz, size_t n)
{
wxSTRING_UPDATE_CACHED_LENGTH(n);
SubstrBufFromWC str(ImplStr(sz, n));
m_impl.insert(PosToImpl(nPos), str.data, str.len);
return *this;
}
// insert n copies of ch
wxString& insert(size_t nPos, size_t n, wxUniChar ch)
{
wxSTRING_UPDATE_CACHED_LENGTH(n);
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
m_impl.insert(PosToImpl(nPos), n, (wxStringCharType)ch);
else
m_impl.insert(PosToImpl(nPos), wxStringOperations::EncodeNChars(n, ch));
return *this;
}
iterator insert(iterator it, wxUniChar ch)
{
wxSTRING_UPDATE_CACHED_LENGTH(1);
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
return iterator(this, m_impl.insert(it.impl(), (wxStringCharType)ch));
else
{
size_t pos = IterToImplPos(it);
m_impl.insert(pos, wxStringOperations::EncodeChar(ch));
return iterator(this, m_impl.begin() + pos);
}
}
void insert(iterator it, const_iterator first, const_iterator last)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.insert(it.impl(), first.impl(), last.impl());
}
#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
void insert(iterator it, const char *first, const char *last)
{ insert(it - begin(), first, last - first); }
void insert(iterator it, const wchar_t *first, const wchar_t *last)
{ insert(it - begin(), first, last - first); }
void insert(iterator it, const wxCStrData& first, const wxCStrData& last)
{ insert(it, CreateConstIterator(first), CreateConstIterator(last)); }
#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
void insert(iterator it, size_type n, wxUniChar ch)
{
wxSTRING_UPDATE_CACHED_LENGTH(n);
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
m_impl.insert(it.impl(), n, (wxStringCharType)ch);
else
m_impl.insert(IterToImplPos(it), wxStringOperations::EncodeNChars(n, ch));
}
// delete characters from nStart to nStart + nLen
wxString& erase(size_type pos = 0, size_type n = npos)
{
wxSTRING_INVALIDATE_CACHE();
size_t from, len;
PosLenToImpl(pos, n, &from, &len);
m_impl.erase(from, len);
return *this;
}
// delete characters from first up to last
iterator erase(iterator first, iterator last)
{
wxSTRING_INVALIDATE_CACHE();
return iterator(this, m_impl.erase(first.impl(), last.impl()));
}
iterator erase(iterator first)
{
wxSTRING_UPDATE_CACHED_LENGTH(-1);
return iterator(this, m_impl.erase(first.impl()));
}
void clear()
{
wxSTRING_SET_CACHED_LENGTH(0);
m_impl.clear();
}
// replaces the substring of length nLen starting at nStart
wxString& replace(size_t nStart, size_t nLen, const char* sz)
{
wxSTRING_INVALIDATE_CACHE();
size_t from, len;
PosLenToImpl(nStart, nLen, &from, &len);
m_impl.replace(from, len, ImplStr(sz));
return *this;
}
wxString& replace(size_t nStart, size_t nLen, const wchar_t* sz)
{
wxSTRING_INVALIDATE_CACHE();
size_t from, len;
PosLenToImpl(nStart, nLen, &from, &len);
m_impl.replace(from, len, ImplStr(sz));
return *this;
}
// replaces the substring of length nLen starting at nStart
wxString& replace(size_t nStart, size_t nLen, const wxString& str)
{
wxSTRING_INVALIDATE_CACHE();
size_t from, len;
PosLenToImpl(nStart, nLen, &from, &len);
m_impl.replace(from, len, str.m_impl);
return *this;
}
// replaces the substring with nCount copies of ch
wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxUniChar ch)
{
wxSTRING_INVALIDATE_CACHE();
size_t from, len;
PosLenToImpl(nStart, nLen, &from, &len);
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
m_impl.replace(from, len, nCount, (wxStringCharType)ch);
else
m_impl.replace(from, len, wxStringOperations::EncodeNChars(nCount, ch));
return *this;
}
// replaces a substring with another substring
wxString& replace(size_t nStart, size_t nLen,
const wxString& str, size_t nStart2, size_t nLen2)
{
wxSTRING_INVALIDATE_CACHE();
size_t from, len;
PosLenToImpl(nStart, nLen, &from, &len);
size_t from2, len2;
str.PosLenToImpl(nStart2, nLen2, &from2, &len2);
m_impl.replace(from, len, str.m_impl, from2, len2);
return *this;
}
// replaces the substring with first nCount chars of sz
wxString& replace(size_t nStart, size_t nLen,
const char* sz, size_t nCount)
{
wxSTRING_INVALIDATE_CACHE();
size_t from, len;
PosLenToImpl(nStart, nLen, &from, &len);
SubstrBufFromMB str(ImplStr(sz, nCount));
m_impl.replace(from, len, str.data, str.len);
return *this;
}
wxString& replace(size_t nStart, size_t nLen,
const wchar_t* sz, size_t nCount)
{
wxSTRING_INVALIDATE_CACHE();
size_t from, len;
PosLenToImpl(nStart, nLen, &from, &len);
SubstrBufFromWC str(ImplStr(sz, nCount));
m_impl.replace(from, len, str.data, str.len);
return *this;
}
wxString& replace(size_t nStart, size_t nLen,
const wxString& s, size_t nCount)
{
wxSTRING_INVALIDATE_CACHE();
size_t from, len;
PosLenToImpl(nStart, nLen, &from, &len);
m_impl.replace(from, len, s.m_impl.c_str(), s.LenToImpl(nCount));
return *this;
}
wxString& replace(iterator first, iterator last, const char* s)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.replace(first.impl(), last.impl(), ImplStr(s));
return *this;
}
wxString& replace(iterator first, iterator last, const wchar_t* s)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.replace(first.impl(), last.impl(), ImplStr(s));
return *this;
}
wxString& replace(iterator first, iterator last, const char* s, size_type n)
{
wxSTRING_INVALIDATE_CACHE();
SubstrBufFromMB str(ImplStr(s, n));
m_impl.replace(first.impl(), last.impl(), str.data, str.len);
return *this;
}
wxString& replace(iterator first, iterator last, const wchar_t* s, size_type n)
{
wxSTRING_INVALIDATE_CACHE();
SubstrBufFromWC str(ImplStr(s, n));
m_impl.replace(first.impl(), last.impl(), str.data, str.len);
return *this;
}
wxString& replace(iterator first, iterator last, const wxString& s)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.replace(first.impl(), last.impl(), s.m_impl);
return *this;
}
wxString& replace(iterator first, iterator last, size_type n, wxUniChar ch)
{
wxSTRING_INVALIDATE_CACHE();
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
m_impl.replace(first.impl(), last.impl(), n, (wxStringCharType)ch);
else
m_impl.replace(first.impl(), last.impl(),
wxStringOperations::EncodeNChars(n, ch));
return *this;
}
wxString& replace(iterator first, iterator last,
const_iterator first1, const_iterator last1)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.replace(first.impl(), last.impl(), first1.impl(), last1.impl());
return *this;
}
wxString& replace(iterator first, iterator last,
const char *first1, const char *last1)
{ replace(first, last, first1, last1 - first1); return *this; }
wxString& replace(iterator first, iterator last,
const wchar_t *first1, const wchar_t *last1)
{ replace(first, last, first1, last1 - first1); return *this; }
// swap two strings
void swap(wxString& str)
{
#if wxUSE_STRING_POS_CACHE
// we modify not only this string but also the other one directly so we
// need to invalidate cache for both of them (we could also try to
// exchange their cache entries but it seems unlikely to be worth it)
InvalidateCache();
str.InvalidateCache();
#endif // wxUSE_STRING_POS_CACHE
m_impl.swap(str.m_impl);
}
// find a substring
size_t find(const wxString& str, size_t nStart = 0) const
{ return PosFromImpl(m_impl.find(str.m_impl, PosToImpl(nStart))); }
// find first n characters of sz
size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const
{
SubstrBufFromMB str(ImplStr(sz, n));
return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len));
}
size_t find(const wchar_t* sz, size_t nStart = 0, size_t n = npos) const
{
SubstrBufFromWC str(ImplStr(sz, n));
return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len));
}
size_t find(const wxScopedCharBuffer& s, size_t nStart = 0, size_t n = npos) const
{ return find(s.data(), nStart, n); }
size_t find(const wxScopedWCharBuffer& s, size_t nStart = 0, size_t n = npos) const
{ return find(s.data(), nStart, n); }
size_t find(const wxCStrData& s, size_t nStart = 0, size_t n = npos) const
{ return find(s.AsWChar(), nStart, n); }
// find the first occurrence of character ch after nStart
size_t find(wxUniChar ch, size_t nStart = 0) const
{
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
return PosFromImpl(m_impl.find((wxStringCharType)ch,
PosToImpl(nStart)));
else
return PosFromImpl(m_impl.find(wxStringOperations::EncodeChar(ch),
PosToImpl(nStart)));
}
size_t find(wxUniCharRef ch, size_t nStart = 0) const
{ return find(wxUniChar(ch), nStart); }
size_t find(char ch, size_t nStart = 0) const
{ return find(wxUniChar(ch), nStart); }
size_t find(unsigned char ch, size_t nStart = 0) const
{ return find(wxUniChar(ch), nStart); }
size_t find(wchar_t ch, size_t nStart = 0) const
{ return find(wxUniChar(ch), nStart); }
// rfind() family is exactly like find() but works right to left
// as find, but from the end
size_t rfind(const wxString& str, size_t nStart = npos) const
{ return PosFromImpl(m_impl.rfind(str.m_impl, PosToImpl(nStart))); }
// as find, but from the end
size_t rfind(const char* sz, size_t nStart = npos, size_t n = npos) const
{
SubstrBufFromMB str(ImplStr(sz, n));
return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len));
}
size_t rfind(const wchar_t* sz, size_t nStart = npos, size_t n = npos) const
{
SubstrBufFromWC str(ImplStr(sz, n));
return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len));
}
size_t rfind(const wxScopedCharBuffer& s, size_t nStart = npos, size_t n = npos) const
{ return rfind(s.data(), nStart, n); }
size_t rfind(const wxScopedWCharBuffer& s, size_t nStart = npos, size_t n = npos) const
{ return rfind(s.data(), nStart, n); }
size_t rfind(const wxCStrData& s, size_t nStart = npos, size_t n = npos) const
{ return rfind(s.AsWChar(), nStart, n); }
// as find, but from the end
size_t rfind(wxUniChar ch, size_t nStart = npos) const
{
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
return PosFromImpl(m_impl.rfind((wxStringCharType)ch,
PosToImpl(nStart)));
else
return PosFromImpl(m_impl.rfind(wxStringOperations::EncodeChar(ch),
PosToImpl(nStart)));
}
size_t rfind(wxUniCharRef ch, size_t nStart = npos) const
{ return rfind(wxUniChar(ch), nStart); }
size_t rfind(char ch, size_t nStart = npos) const
{ return rfind(wxUniChar(ch), nStart); }
size_t rfind(unsigned char ch, size_t nStart = npos) const
{ return rfind(wxUniChar(ch), nStart); }
size_t rfind(wchar_t ch, size_t nStart = npos) const
{ return rfind(wxUniChar(ch), nStart); }
// find first/last occurrence of any character (not) in the set:
#if wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
// FIXME-UTF8: this is not entirely correct, because it doesn't work if
// sizeof(wchar_t)==2 and surrogates are present in the string;
// should we care? Probably not.
size_t find_first_of(const wxString& str, size_t nStart = 0) const
{ return m_impl.find_first_of(str.m_impl, nStart); }
size_t find_first_of(const char* sz, size_t nStart = 0) const
{ return m_impl.find_first_of(ImplStr(sz), nStart); }
size_t find_first_of(const wchar_t* sz, size_t nStart = 0) const
{ return m_impl.find_first_of(ImplStr(sz), nStart); }
size_t find_first_of(const char* sz, size_t nStart, size_t n) const
{ return m_impl.find_first_of(ImplStr(sz), nStart, n); }
size_t find_first_of(const wchar_t* sz, size_t nStart, size_t n) const
{ return m_impl.find_first_of(ImplStr(sz), nStart, n); }
size_t find_first_of(wxUniChar c, size_t nStart = 0) const
{ return m_impl.find_first_of((wxChar)c, nStart); }
size_t find_last_of(const wxString& str, size_t nStart = npos) const
{ return m_impl.find_last_of(str.m_impl, nStart); }
size_t find_last_of(const char* sz, size_t nStart = npos) const
{ return m_impl.find_last_of(ImplStr(sz), nStart); }
size_t find_last_of(const wchar_t* sz, size_t nStart = npos) const
{ return m_impl.find_last_of(ImplStr(sz), nStart); }
size_t find_last_of(const char* sz, size_t nStart, size_t n) const
{ return m_impl.find_last_of(ImplStr(sz), nStart, n); }
size_t find_last_of(const wchar_t* sz, size_t nStart, size_t n) const
{ return m_impl.find_last_of(ImplStr(sz), nStart, n); }
size_t find_last_of(wxUniChar c, size_t nStart = npos) const
{ return m_impl.find_last_of((wxChar)c, nStart); }
size_t find_first_not_of(const wxString& str, size_t nStart = 0) const
{ return m_impl.find_first_not_of(str.m_impl, nStart); }
size_t find_first_not_of(const char* sz, size_t nStart = 0) const
{ return m_impl.find_first_not_of(ImplStr(sz), nStart); }
size_t find_first_not_of(const wchar_t* sz, size_t nStart = 0) const
{ return m_impl.find_first_not_of(ImplStr(sz), nStart); }
size_t find_first_not_of(const char* sz, size_t nStart, size_t n) const
{ return m_impl.find_first_not_of(ImplStr(sz), nStart, n); }
size_t find_first_not_of(const wchar_t* sz, size_t nStart, size_t n) const
{ return m_impl.find_first_not_of(ImplStr(sz), nStart, n); }
size_t find_first_not_of(wxUniChar c, size_t nStart = 0) const
{ return m_impl.find_first_not_of((wxChar)c, nStart); }
size_t find_last_not_of(const wxString& str, size_t nStart = npos) const
{ return m_impl.find_last_not_of(str.m_impl, nStart); }
size_t find_last_not_of(const char* sz, size_t nStart = npos) const
{ return m_impl.find_last_not_of(ImplStr(sz), nStart); }
size_t find_last_not_of(const wchar_t* sz, size_t nStart = npos) const
{ return m_impl.find_last_not_of(ImplStr(sz), nStart); }
size_t find_last_not_of(const char* sz, size_t nStart, size_t n) const
{ return m_impl.find_last_not_of(ImplStr(sz), nStart, n); }
size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const
{ return m_impl.find_last_not_of(ImplStr(sz), nStart, n); }
size_t find_last_not_of(wxUniChar c, size_t nStart = npos) const
{ return m_impl.find_last_not_of((wxChar)c, nStart); }
#else
// we can't use std::string implementation in UTF-8 build, because the
// character sets would be interpreted wrongly:
// as strpbrk() but starts at nStart, returns npos if not found
size_t find_first_of(const wxString& str, size_t nStart = 0) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
{ return find_first_of(str.wc_str(), nStart); }
#else
{ return find_first_of(str.mb_str(), nStart); }
#endif
// same as above
size_t find_first_of(const char* sz, size_t nStart = 0) const;
size_t find_first_of(const wchar_t* sz, size_t nStart = 0) const;
size_t find_first_of(const char* sz, size_t nStart, size_t n) const;
size_t find_first_of(const wchar_t* sz, size_t nStart, size_t n) const;
// same as find(char, size_t)
size_t find_first_of(wxUniChar c, size_t nStart = 0) const
{ return find(c, nStart); }
// find the last (starting from nStart) char from str in this string
size_t find_last_of (const wxString& str, size_t nStart = npos) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
{ return find_last_of(str.wc_str(), nStart); }
#else
{ return find_last_of(str.mb_str(), nStart); }
#endif
// same as above
size_t find_last_of (const char* sz, size_t nStart = npos) const;
size_t find_last_of (const wchar_t* sz, size_t nStart = npos) const;
size_t find_last_of(const char* sz, size_t nStart, size_t n) const;
size_t find_last_of(const wchar_t* sz, size_t nStart, size_t n) const;
// same as above
size_t find_last_of(wxUniChar c, size_t nStart = npos) const
{ return rfind(c, nStart); }
// find first/last occurrence of any character not in the set
// as strspn() (starting from nStart), returns npos on failure
size_t find_first_not_of(const wxString& str, size_t nStart = 0) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
{ return find_first_not_of(str.wc_str(), nStart); }
#else
{ return find_first_not_of(str.mb_str(), nStart); }
#endif
// same as above
size_t find_first_not_of(const char* sz, size_t nStart = 0) const;
size_t find_first_not_of(const wchar_t* sz, size_t nStart = 0) const;
size_t find_first_not_of(const char* sz, size_t nStart, size_t n) const;
size_t find_first_not_of(const wchar_t* sz, size_t nStart, size_t n) const;
// same as above
size_t find_first_not_of(wxUniChar ch, size_t nStart = 0) const;
// as strcspn()
size_t find_last_not_of(const wxString& str, size_t nStart = npos) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
{ return find_last_not_of(str.wc_str(), nStart); }
#else
{ return find_last_not_of(str.mb_str(), nStart); }
#endif
// same as above
size_t find_last_not_of(const char* sz, size_t nStart = npos) const;
size_t find_last_not_of(const wchar_t* sz, size_t nStart = npos) const;
size_t find_last_not_of(const char* sz, size_t nStart, size_t n) const;
size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const;
// same as above
size_t find_last_not_of(wxUniChar ch, size_t nStart = npos) const;
#endif // wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 or not
// provide char/wchar_t/wxUniCharRef overloads for char-finding functions
// above to resolve ambiguities:
size_t find_first_of(wxUniCharRef ch, size_t nStart = 0) const
{ return find_first_of(wxUniChar(ch), nStart); }
size_t find_first_of(char ch, size_t nStart = 0) const
{ return find_first_of(wxUniChar(ch), nStart); }
size_t find_first_of(unsigned char ch, size_t nStart = 0) const
{ return find_first_of(wxUniChar(ch), nStart); }
size_t find_first_of(wchar_t ch, size_t nStart = 0) const
{ return find_first_of(wxUniChar(ch), nStart); }
size_t find_last_of(wxUniCharRef ch, size_t nStart = npos) const
{ return find_last_of(wxUniChar(ch), nStart); }
size_t find_last_of(char ch, size_t nStart = npos) const
{ return find_last_of(wxUniChar(ch), nStart); }
size_t find_last_of(unsigned char ch, size_t nStart = npos) const
{ return find_last_of(wxUniChar(ch), nStart); }
size_t find_last_of(wchar_t ch, size_t nStart = npos) const
{ return find_last_of(wxUniChar(ch), nStart); }
size_t find_first_not_of(wxUniCharRef ch, size_t nStart = 0) const
{ return find_first_not_of(wxUniChar(ch), nStart); }
size_t find_first_not_of(char ch, size_t nStart = 0) const
{ return find_first_not_of(wxUniChar(ch), nStart); }
size_t find_first_not_of(unsigned char ch, size_t nStart = 0) const
{ return find_first_not_of(wxUniChar(ch), nStart); }
size_t find_first_not_of(wchar_t ch, size_t nStart = 0) const
{ return find_first_not_of(wxUniChar(ch), nStart); }
size_t find_last_not_of(wxUniCharRef ch, size_t nStart = npos) const
{ return find_last_not_of(wxUniChar(ch), nStart); }
size_t find_last_not_of(char ch, size_t nStart = npos) const
{ return find_last_not_of(wxUniChar(ch), nStart); }
size_t find_last_not_of(unsigned char ch, size_t nStart = npos) const
{ return find_last_not_of(wxUniChar(ch), nStart); }
size_t find_last_not_of(wchar_t ch, size_t nStart = npos) const
{ return find_last_not_of(wxUniChar(ch), nStart); }
// and additional overloads for the versions taking strings:
size_t find_first_of(const wxCStrData& sz, size_t nStart = 0) const
{ return find_first_of(sz.AsString(), nStart); }
size_t find_first_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const
{ return find_first_of(sz.data(), nStart); }
size_t find_first_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const
{ return find_first_of(sz.data(), nStart); }
size_t find_first_of(const wxCStrData& sz, size_t nStart, size_t n) const
{ return find_first_of(sz.AsWChar(), nStart, n); }
size_t find_first_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const
{ return find_first_of(sz.data(), nStart, n); }
size_t find_first_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const
{ return find_first_of(sz.data(), nStart, n); }
size_t find_last_of(const wxCStrData& sz, size_t nStart = 0) const
{ return find_last_of(sz.AsString(), nStart); }
size_t find_last_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const
{ return find_last_of(sz.data(), nStart); }
size_t find_last_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const
{ return find_last_of(sz.data(), nStart); }
size_t find_last_of(const wxCStrData& sz, size_t nStart, size_t n) const
{ return find_last_of(sz.AsWChar(), nStart, n); }
size_t find_last_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const
{ return find_last_of(sz.data(), nStart, n); }
size_t find_last_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const
{ return find_last_of(sz.data(), nStart, n); }
size_t find_first_not_of(const wxCStrData& sz, size_t nStart = 0) const
{ return find_first_not_of(sz.AsString(), nStart); }
size_t find_first_not_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const
{ return find_first_not_of(sz.data(), nStart); }
size_t find_first_not_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const
{ return find_first_not_of(sz.data(), nStart); }
size_t find_first_not_of(const wxCStrData& sz, size_t nStart, size_t n) const
{ return find_first_not_of(sz.AsWChar(), nStart, n); }
size_t find_first_not_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const
{ return find_first_not_of(sz.data(), nStart, n); }
size_t find_first_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const
{ return find_first_not_of(sz.data(), nStart, n); }
size_t find_last_not_of(const wxCStrData& sz, size_t nStart = 0) const
{ return find_last_not_of(sz.AsString(), nStart); }
size_t find_last_not_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const
{ return find_last_not_of(sz.data(), nStart); }
size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const
{ return find_last_not_of(sz.data(), nStart); }
size_t find_last_not_of(const wxCStrData& sz, size_t nStart, size_t n) const
{ return find_last_not_of(sz.AsWChar(), nStart, n); }
size_t find_last_not_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const
{ return find_last_not_of(sz.data(), nStart, n); }
size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const
{ return find_last_not_of(sz.data(), nStart, n); }
// string += string
wxString& operator+=(const wxString& s)
{
wxSTRING_INVALIDATE_CACHED_LENGTH();
m_impl += s.m_impl;
return *this;
}
// string += C string
wxString& operator+=(const char *psz)
{
wxSTRING_INVALIDATE_CACHED_LENGTH();
m_impl += ImplStr(psz);
return *this;
}
wxString& operator+=(const wchar_t *pwz)
{
wxSTRING_INVALIDATE_CACHED_LENGTH();
m_impl += ImplStr(pwz);
return *this;
}
wxString& operator+=(const wxCStrData& s)
{
wxSTRING_INVALIDATE_CACHED_LENGTH();
m_impl += s.AsString().m_impl;
return *this;
}
wxString& operator+=(const wxScopedCharBuffer& s)
{ return append(s); }
wxString& operator+=(const wxScopedWCharBuffer& s)
{ return append(s); }
// string += char
wxString& operator+=(wxUniChar ch)
{
wxSTRING_UPDATE_CACHED_LENGTH(1);
if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) )
m_impl += (wxStringCharType)ch;
else
m_impl += wxStringOperations::EncodeChar(ch);
return *this;
}
wxString& operator+=(wxUniCharRef ch) { return *this += wxUniChar(ch); }
wxString& operator+=(int ch) { return *this += wxUniChar(ch); }
wxString& operator+=(char ch) { return *this += wxUniChar(ch); }
wxString& operator+=(unsigned char ch) { return *this += wxUniChar(ch); }
wxString& operator+=(wchar_t ch) { return *this += wxUniChar(ch); }
private:
#if !wxUSE_STL_BASED_WXSTRING
// helpers for wxStringBuffer and wxStringBufferLength
wxStringCharType *DoGetWriteBuf(size_t nLen)
{
return m_impl.DoGetWriteBuf(nLen);
}
void DoUngetWriteBuf()
{
wxSTRING_INVALIDATE_CACHE();
m_impl.DoUngetWriteBuf();
}
void DoUngetWriteBuf(size_t nLen)
{
wxSTRING_INVALIDATE_CACHE();
m_impl.DoUngetWriteBuf(nLen);
}
#endif // !wxUSE_STL_BASED_WXSTRING
#if !wxUSE_UTF8_LOCALE_ONLY
int DoPrintfWchar(const wxChar *format, ...);
static wxString DoFormatWchar(const wxChar *format, ...);
#endif
#if wxUSE_UNICODE_UTF8
int DoPrintfUtf8(const char *format, ...);
static wxString DoFormatUtf8(const char *format, ...);
#endif
#if !wxUSE_STL_BASED_WXSTRING
// check string's data validity
bool IsValid() const { return m_impl.GetStringData()->IsValid(); }
#endif
private:
wxStringImpl m_impl;
// buffers for compatibility conversion from (char*)c_str() and
// (wchar_t*)c_str(): the pointers returned by these functions should remain
// valid until the string itself is modified for compatibility with the
// existing code and consistency with std::string::c_str() so returning a
// temporary buffer won't do and we need to cache the conversion results
// TODO-UTF8: benchmark various approaches to keeping compatibility buffers
template<typename T>
struct ConvertedBuffer
{
// notice that there is no need to initialize m_len here as it's unused
// as long as m_str is NULL
ConvertedBuffer() : m_str(NULL) {}
~ConvertedBuffer()
{ free(m_str); }
bool Extend(size_t len)
{
// add extra 1 for the trailing NUL
void * const str = realloc(m_str, sizeof(T)*(len + 1));
if ( !str )
return false;
m_str = static_cast<T *>(str);
m_len = len;
return true;
}
const wxScopedCharTypeBuffer<T> AsScopedBuffer() const
{
return wxScopedCharTypeBuffer<T>::CreateNonOwned(m_str, m_len);
}
T *m_str; // pointer to the string data
size_t m_len; // length, not size, i.e. in chars and without last NUL
};
#if wxUSE_UNICODE
// common mb_str() and wxCStrData::AsChar() helper: performs the conversion
// and returns either m_convertedToChar.m_str (in which case its m_len is
// also updated) or NULL if it failed
//
// there is an important exception: in wxUSE_UNICODE_UTF8 build if conv is a
// UTF-8 one, we return m_impl.c_str() directly, without doing any conversion
// as optimization and so the caller needs to check for this before using
// m_convertedToChar
//
// NB: AsChar() returns char* in any build, unlike mb_str()
const char *AsChar(const wxMBConv& conv) const;
// mb_str() implementation helper
wxScopedCharBuffer AsCharBuf(const wxMBConv& conv) const
{
#if wxUSE_UNICODE_UTF8
// avoid conversion if we can
if ( conv.IsUTF8() )
{
return wxScopedCharBuffer::CreateNonOwned(m_impl.c_str(),
m_impl.length());
}
#endif // wxUSE_UNICODE_UTF8
// call this solely in order to fill in m_convertedToChar as AsChar()
// updates it as a side effect: this is a bit ugly but it's a completely
// internal function so the users of this class shouldn't care or know
// about it and doing it like this, i.e. having a separate AsChar(),
// allows us to avoid the creation and destruction of a temporary buffer
// when using wxCStrData without duplicating any code
if ( !AsChar(conv) )
{
// although it would be probably more correct to return NULL buffer
// from here if the conversion fails, a lot of existing code doesn't
// expect mb_str() (or wc_str()) to ever return NULL so return an
// empty string otherwise to avoid crashes in it
//
// also, some existing code does check for the conversion success and
// so asserting here would be bad too -- even if it does mean that
// silently losing data is possible for badly written code
return wxScopedCharBuffer::CreateNonOwned("", 0);
}
return m_convertedToChar.AsScopedBuffer();
}
ConvertedBuffer<char> m_convertedToChar;
#endif // !wxUSE_UNICODE
#if !wxUSE_UNICODE_WCHAR
// common wc_str() and wxCStrData::AsWChar() helper for both UTF-8 and ANSI
// builds: converts the string contents into m_convertedToWChar and returns
// NULL if the conversion failed (this can only happen in ANSI build)
//
// NB: AsWChar() returns wchar_t* in any build, unlike wc_str()
const wchar_t *AsWChar(const wxMBConv& conv) const;
// wc_str() implementation helper
wxScopedWCharBuffer AsWCharBuf(const wxMBConv& conv) const
{
if ( !AsWChar(conv) )
return wxScopedWCharBuffer::CreateNonOwned(L"", 0);
return m_convertedToWChar.AsScopedBuffer();
}
ConvertedBuffer<wchar_t> m_convertedToWChar;
#endif // !wxUSE_UNICODE_WCHAR
#if wxUSE_UNICODE_UTF8
// FIXME-UTF8: (try to) move this elsewhere (TLS) or solve differently
// assigning to character pointer to by wxString::iterator may
// change the underlying wxStringImpl iterator, so we have to
// keep track of all iterators and update them as necessary:
struct wxStringIteratorNodeHead
{
wxStringIteratorNodeHead() : ptr(NULL) {}
wxStringIteratorNode *ptr;
// copying is disallowed as it would result in more than one pointer into
// the same linked list
wxDECLARE_NO_COPY_CLASS(wxStringIteratorNodeHead);
};
wxStringIteratorNodeHead m_iterators;
friend class WXDLLIMPEXP_FWD_BASE wxStringIteratorNode;
friend class WXDLLIMPEXP_FWD_BASE wxUniCharRef;
#endif // wxUSE_UNICODE_UTF8
friend class WXDLLIMPEXP_FWD_BASE wxCStrData;
friend class wxStringInternalBuffer;
friend class wxStringInternalBufferLength;
};
// string iterator operators that satisfy STL Random Access Iterator
// requirements:
inline wxString::iterator operator+(ptrdiff_t n, wxString::iterator i)
{ return i + n; }
inline wxString::const_iterator operator+(ptrdiff_t n, wxString::const_iterator i)
{ return i + n; }
inline wxString::reverse_iterator operator+(ptrdiff_t n, wxString::reverse_iterator i)
{ return i + n; }
inline wxString::const_reverse_iterator operator+(ptrdiff_t n, wxString::const_reverse_iterator i)
{ return i + n; }
// notice that even though for many compilers the friend declarations above are
// enough, from the point of view of C++ standard we must have the declarations
// here as friend ones are not injected in the enclosing namespace and without
// them the code fails to compile with conforming compilers such as xlC or g++4
wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2);
wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const char *psz);
wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wchar_t *pwz);
wxString WXDLLIMPEXP_BASE operator+(const char *psz, const wxString& string);
wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz, const wxString& string);
wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch);
wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string);
inline wxString operator+(const wxString& string, wxUniCharRef ch)
{ return string + (wxUniChar)ch; }
inline wxString operator+(const wxString& string, char ch)
{ return string + wxUniChar(ch); }
inline wxString operator+(const wxString& string, wchar_t ch)
{ return string + wxUniChar(ch); }
inline wxString operator+(wxUniCharRef ch, const wxString& string)
{ return (wxUniChar)ch + string; }
inline wxString operator+(char ch, const wxString& string)
{ return wxUniChar(ch) + string; }
inline wxString operator+(wchar_t ch, const wxString& string)
{ return wxUniChar(ch) + string; }
#define wxGetEmptyString() wxString()
// ----------------------------------------------------------------------------
// helper functions which couldn't be defined inline
// ----------------------------------------------------------------------------
namespace wxPrivate
{
#if wxUSE_UNICODE_WCHAR
template <>
struct wxStringAsBufHelper<char>
{
static wxScopedCharBuffer Get(const wxString& s, size_t *len)
{
wxScopedCharBuffer buf(s.mb_str());
if ( len )
*len = buf ? strlen(buf) : 0;
return buf;
}
};
template <>
struct wxStringAsBufHelper<wchar_t>
{
static wxScopedWCharBuffer Get(const wxString& s, size_t *len)
{
const size_t length = s.length();
if ( len )
*len = length;
return wxScopedWCharBuffer::CreateNonOwned(s.wx_str(), length);
}
};
#elif wxUSE_UNICODE_UTF8
template <>
struct wxStringAsBufHelper<char>
{
static wxScopedCharBuffer Get(const wxString& s, size_t *len)
{
const size_t length = s.utf8_length();
if ( len )
*len = length;
return wxScopedCharBuffer::CreateNonOwned(s.wx_str(), length);
}
};
template <>
struct wxStringAsBufHelper<wchar_t>
{
static wxScopedWCharBuffer Get(const wxString& s, size_t *len)
{
wxScopedWCharBuffer wbuf(s.wc_str());
if ( len )
*len = wxWcslen(wbuf);
return wbuf;
}
};
#endif // Unicode build kind
} // namespace wxPrivate
// ----------------------------------------------------------------------------
// wxStringBuffer: a tiny class allowing to get a writable pointer into string
// ----------------------------------------------------------------------------
#if !wxUSE_STL_BASED_WXSTRING
// string buffer for direct access to string data in their native
// representation:
class wxStringInternalBuffer
{
public:
typedef wxStringCharType CharType;
wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024)
: m_str(str), m_buf(NULL)
{ m_buf = m_str.DoGetWriteBuf(lenWanted); }
~wxStringInternalBuffer() { m_str.DoUngetWriteBuf(); }
operator wxStringCharType*() const { return m_buf; }
private:
wxString& m_str;
wxStringCharType *m_buf;
wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer);
};
class wxStringInternalBufferLength
{
public:
typedef wxStringCharType CharType;
wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024)
: m_str(str), m_buf(NULL), m_len(0), m_lenSet(false)
{
m_buf = m_str.DoGetWriteBuf(lenWanted);
wxASSERT(m_buf != NULL);
}
~wxStringInternalBufferLength()
{
wxASSERT(m_lenSet);
m_str.DoUngetWriteBuf(m_len);
}
operator wxStringCharType*() const { return m_buf; }
void SetLength(size_t length) { m_len = length; m_lenSet = true; }
private:
wxString& m_str;
wxStringCharType *m_buf;
size_t m_len;
bool m_lenSet;
wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength);
};
#endif // !wxUSE_STL_BASED_WXSTRING
template<typename T>
class wxStringTypeBufferBase
{
public:
typedef T CharType;
wxStringTypeBufferBase(wxString& str, size_t lenWanted = 1024)
: m_str(str), m_buf(lenWanted)
{
// for compatibility with old wxStringBuffer which provided direct
// access to wxString internal buffer, initialize ourselves with the
// string initial contents
size_t len;
const wxCharTypeBuffer<CharType> buf(str.tchar_str<CharType>(&len));
if ( buf )
{
if ( len > lenWanted )
{
// in this case there is not enough space for terminating NUL,
// ensure that we still put it there
m_buf.data()[lenWanted] = 0;
len = lenWanted - 1;
}
memcpy(m_buf.data(), buf, (len + 1)*sizeof(CharType));
}
//else: conversion failed, this can happen when trying to get Unicode
// string contents into a char string
}
operator CharType*() { return m_buf.data(); }
protected:
wxString& m_str;
wxCharTypeBuffer<CharType> m_buf;
};
template<typename T>
class wxStringTypeBufferLengthBase : public wxStringTypeBufferBase<T>
{
public:
wxStringTypeBufferLengthBase(wxString& str, size_t lenWanted = 1024)
: wxStringTypeBufferBase<T>(str, lenWanted),
m_len(0),
m_lenSet(false)
{ }
~wxStringTypeBufferLengthBase()
{
wxASSERT_MSG( this->m_lenSet, "forgot to call SetLength()" );
}
void SetLength(size_t length) { m_len = length; m_lenSet = true; }
protected:
size_t m_len;
bool m_lenSet;
};
template<typename T>
class wxStringTypeBuffer : public wxStringTypeBufferBase<T>
{
public:
wxStringTypeBuffer(wxString& str, size_t lenWanted = 1024)
: wxStringTypeBufferBase<T>(str, lenWanted)
{ }
~wxStringTypeBuffer()
{
this->m_str.assign(this->m_buf.data());
}
wxDECLARE_NO_COPY_CLASS(wxStringTypeBuffer);
};
template<typename T>
class wxStringTypeBufferLength : public wxStringTypeBufferLengthBase<T>
{
public:
wxStringTypeBufferLength(wxString& str, size_t lenWanted = 1024)
: wxStringTypeBufferLengthBase<T>(str, lenWanted)
{ }
~wxStringTypeBufferLength()
{
this->m_str.assign(this->m_buf.data(), this->m_len);
}
wxDECLARE_NO_COPY_CLASS(wxStringTypeBufferLength);
};
#if wxUSE_STL_BASED_WXSTRING
class wxStringInternalBuffer : public wxStringTypeBufferBase<wxStringCharType>
{
public:
wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024)
: wxStringTypeBufferBase<wxStringCharType>(str, lenWanted) {}
~wxStringInternalBuffer()
{ m_str.m_impl.assign(m_buf.data()); }
wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer);
};
class wxStringInternalBufferLength
: public wxStringTypeBufferLengthBase<wxStringCharType>
{
public:
wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024)
: wxStringTypeBufferLengthBase<wxStringCharType>(str, lenWanted) {}
~wxStringInternalBufferLength()
{
m_str.m_impl.assign(m_buf.data(), m_len);
}
wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength);
};
#endif // wxUSE_STL_BASED_WXSTRING
#if wxUSE_STL_BASED_WXSTRING || wxUSE_UNICODE_UTF8
typedef wxStringTypeBuffer<wxChar> wxStringBuffer;
typedef wxStringTypeBufferLength<wxChar> wxStringBufferLength;
#else // if !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
typedef wxStringInternalBuffer wxStringBuffer;
typedef wxStringInternalBufferLength wxStringBufferLength;
#endif // !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
#if wxUSE_UNICODE_UTF8
typedef wxStringInternalBuffer wxUTF8StringBuffer;
typedef wxStringInternalBufferLength wxUTF8StringBufferLength;
#elif wxUSE_UNICODE_WCHAR
// Note about inlined dtors in the classes below: this is done not for
// performance reasons but just to avoid linking errors in the MSVC DLL build
// under Windows: if a class has non-inline methods it must be declared as
// being DLL-exported but, due to an extremely interesting feature of MSVC 7
// and later, any template class which is used as a base of a DLL-exported
// class is implicitly made DLL-exported too, as explained at the bottom of
// http://msdn.microsoft.com/en-us/library/twa2aw10.aspx (just to confirm: yes,
// _inheriting_ from a class can change whether it is being exported from DLL)
//
// But this results in link errors because the base template class is not DLL-
// exported, whether it is declared with WXDLLIMPEXP_BASE or not, because it
// does have only inline functions. So the simplest fix is to just make all the
// functions of these classes inline too.
class wxUTF8StringBuffer : public wxStringTypeBufferBase<char>
{
public:
wxUTF8StringBuffer(wxString& str, size_t lenWanted = 1024)
: wxStringTypeBufferBase<char>(str, lenWanted) {}
~wxUTF8StringBuffer()
{
wxMBConvStrictUTF8 conv;
size_t wlen = conv.ToWChar(NULL, 0, m_buf);
wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" );
wxStringInternalBuffer wbuf(m_str, wlen);
conv.ToWChar(wbuf, wlen, m_buf);
}
wxDECLARE_NO_COPY_CLASS(wxUTF8StringBuffer);
};
class wxUTF8StringBufferLength : public wxStringTypeBufferLengthBase<char>
{
public:
wxUTF8StringBufferLength(wxString& str, size_t lenWanted = 1024)
: wxStringTypeBufferLengthBase<char>(str, lenWanted) {}
~wxUTF8StringBufferLength()
{
wxCHECK_RET(m_lenSet, "length not set");
wxMBConvStrictUTF8 conv;
size_t wlen = conv.ToWChar(NULL, 0, m_buf, m_len);
wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" );
wxStringInternalBufferLength wbuf(m_str, wlen);
conv.ToWChar(wbuf, wlen, m_buf, m_len);
wbuf.SetLength(wlen);
}
wxDECLARE_NO_COPY_CLASS(wxUTF8StringBufferLength);
};
#endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR
// ---------------------------------------------------------------------------
// wxString comparison functions: operator versions are always case sensitive
// ---------------------------------------------------------------------------
// comparison with C-style narrow and wide strings.
#define wxCMP_WXCHAR_STRING(p, s, op) 0 op s.Cmp(p)
wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxString&, wxCMP_WXCHAR_STRING)
wxDEFINE_ALL_COMPARISONS(const char *, const wxString&, wxCMP_WXCHAR_STRING)
#undef wxCMP_WXCHAR_STRING
inline bool operator==(const wxString& s1, const wxString& s2)
{ return s1.IsSameAs(s2); }
inline bool operator!=(const wxString& s1, const wxString& s2)
{ return !s1.IsSameAs(s2); }
inline bool operator< (const wxString& s1, const wxString& s2)
{ return s1.Cmp(s2) < 0; }
inline bool operator> (const wxString& s1, const wxString& s2)
{ return s1.Cmp(s2) > 0; }
inline bool operator<=(const wxString& s1, const wxString& s2)
{ return s1.Cmp(s2) <= 0; }
inline bool operator>=(const wxString& s1, const wxString& s2)
{ return s1.Cmp(s2) >= 0; }
inline bool operator==(const wxString& s1, const wxCStrData& s2)
{ return s1 == s2.AsString(); }
inline bool operator==(const wxCStrData& s1, const wxString& s2)
{ return s1.AsString() == s2; }
inline bool operator!=(const wxString& s1, const wxCStrData& s2)
{ return s1 != s2.AsString(); }
inline bool operator!=(const wxCStrData& s1, const wxString& s2)
{ return s1.AsString() != s2; }
inline bool operator==(const wxString& s1, const wxScopedWCharBuffer& s2)
{ return (s1.Cmp((const wchar_t *)s2) == 0); }
inline bool operator==(const wxScopedWCharBuffer& s1, const wxString& s2)
{ return (s2.Cmp((const wchar_t *)s1) == 0); }
inline bool operator!=(const wxString& s1, const wxScopedWCharBuffer& s2)
{ return (s1.Cmp((const wchar_t *)s2) != 0); }
inline bool operator!=(const wxScopedWCharBuffer& s1, const wxString& s2)
{ return (s2.Cmp((const wchar_t *)s1) != 0); }
inline bool operator==(const wxString& s1, const wxScopedCharBuffer& s2)
{ return (s1.Cmp((const char *)s2) == 0); }
inline bool operator==(const wxScopedCharBuffer& s1, const wxString& s2)
{ return (s2.Cmp((const char *)s1) == 0); }
inline bool operator!=(const wxString& s1, const wxScopedCharBuffer& s2)
{ return (s1.Cmp((const char *)s2) != 0); }
inline bool operator!=(const wxScopedCharBuffer& s1, const wxString& s2)
{ return (s2.Cmp((const char *)s1) != 0); }
inline wxString operator+(const wxString& string, const wxScopedWCharBuffer& buf)
{ return string + (const wchar_t *)buf; }
inline wxString operator+(const wxScopedWCharBuffer& buf, const wxString& string)
{ return (const wchar_t *)buf + string; }
inline wxString operator+(const wxString& string, const wxScopedCharBuffer& buf)
{ return string + (const char *)buf; }
inline wxString operator+(const wxScopedCharBuffer& buf, const wxString& string)
{ return (const char *)buf + string; }
// comparison with char
inline bool operator==(const wxUniChar& c, const wxString& s) { return s.IsSameAs(c); }
inline bool operator==(const wxUniCharRef& c, const wxString& s) { return s.IsSameAs(c); }
inline bool operator==(char c, const wxString& s) { return s.IsSameAs(c); }
inline bool operator==(wchar_t c, const wxString& s) { return s.IsSameAs(c); }
inline bool operator==(int c, const wxString& s) { return s.IsSameAs(c); }
inline bool operator==(const wxString& s, const wxUniChar& c) { return s.IsSameAs(c); }
inline bool operator==(const wxString& s, const wxUniCharRef& c) { return s.IsSameAs(c); }
inline bool operator==(const wxString& s, char c) { return s.IsSameAs(c); }
inline bool operator==(const wxString& s, wchar_t c) { return s.IsSameAs(c); }
inline bool operator!=(const wxUniChar& c, const wxString& s) { return !s.IsSameAs(c); }
inline bool operator!=(const wxUniCharRef& c, const wxString& s) { return !s.IsSameAs(c); }
inline bool operator!=(char c, const wxString& s) { return !s.IsSameAs(c); }
inline bool operator!=(wchar_t c, const wxString& s) { return !s.IsSameAs(c); }
inline bool operator!=(int c, const wxString& s) { return !s.IsSameAs(c); }
inline bool operator!=(const wxString& s, const wxUniChar& c) { return !s.IsSameAs(c); }
inline bool operator!=(const wxString& s, const wxUniCharRef& c) { return !s.IsSameAs(c); }
inline bool operator!=(const wxString& s, char c) { return !s.IsSameAs(c); }
inline bool operator!=(const wxString& s, wchar_t c) { return !s.IsSameAs(c); }
// wxString iterators comparisons
inline bool wxString::iterator::operator==(const const_iterator& i) const
{ return i == *this; }
inline bool wxString::iterator::operator!=(const const_iterator& i) const
{ return i != *this; }
inline bool wxString::iterator::operator<(const const_iterator& i) const
{ return i > *this; }
inline bool wxString::iterator::operator>(const const_iterator& i) const
{ return i < *this; }
inline bool wxString::iterator::operator<=(const const_iterator& i) const
{ return i >= *this; }
inline bool wxString::iterator::operator>=(const const_iterator& i) const
{ return i <= *this; }
// we also need to provide the operators for comparison with wxCStrData to
// resolve ambiguity between operator(const wxChar *,const wxString &) and
// operator(const wxChar *, const wxChar *) for "p == s.c_str()"
//
// notice that these are (shallow) pointer comparisons, not (deep) string ones
#define wxCMP_CHAR_CSTRDATA(p, s, op) p op s.AsChar()
#define wxCMP_WCHAR_CSTRDATA(p, s, op) p op s.AsWChar()
wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxCStrData&, wxCMP_WCHAR_CSTRDATA)
wxDEFINE_ALL_COMPARISONS(const char *, const wxCStrData&, wxCMP_CHAR_CSTRDATA)
#undef wxCMP_CHAR_CSTRDATA
#undef wxCMP_WCHAR_CSTRDATA
// ----------------------------------------------------------------------------
// Implement hashing using C++11 std::hash<>.
// ----------------------------------------------------------------------------
// Check for both compiler and standard library support for C++11: normally the
// former implies the latter but under Mac OS X < 10.7 C++11 compiler can (and
// even has to be) used with non-C++11 standard library, so explicitly exclude
// this case.
#if (__cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(10)) \
&& ( (!defined __GLIBCXX__) || (__GLIBCXX__ > 20070719) )
// Don't do this if ToStdWstring() is not available. We could work around it
// but, presumably, if using std::wstring is undesirable, then so is using
// std::hash<> anyhow.
#if wxUSE_STD_STRING
#include <functional>
namespace std
{
template<>
struct hash<wxString>
{
size_t operator()(const wxString& s) const
{
return std::hash<std::wstring>()(s.ToStdWstring());
}
};
} // namespace std
#endif // wxUSE_STD_STRING
#endif // C++11
// Specialize std::iter_swap in C++11 to make std::reverse() work with wxString
// iterators: unlike in C++98, where iter_swap() is required to deal with the
// iterator::reference being different from "iterator::value_type&", in C++11
// iter_swap() just calls swap() by default and this doesn't work for us as
// wxUniCharRef is not the same as "wxUniChar&".
//
// Unfortunately currently iter_swap() can't be specialized when using libc++,
// see https://llvm.org/bugs/show_bug.cgi?id=28559
#if (__cplusplus >= 201103L) && !defined(_LIBCPP_VERSION)
namespace std
{
template <>
inline void
iter_swap<wxString::iterator>(wxString::iterator i1, wxString::iterator i2)
{
// We don't check for i1 == i2, this won't happen in normal use, so
// don't pessimize the common code to account for it.
wxUniChar tmp = *i1;
*i1 = *i2;
*i2 = tmp;
}
} // namespace std
#endif // C++11
// ---------------------------------------------------------------------------
// Implementation only from here until the end of file
// ---------------------------------------------------------------------------
#if wxUSE_STD_IOSTREAM
#include "wx/iosfwrap.h"
WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&);
WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxCStrData&);
WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedCharBuffer&);
#ifndef __BORLANDC__
WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedWCharBuffer&);
#endif
#if wxUSE_UNICODE && defined(HAVE_WOSTREAM)
WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxString&);
WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxCStrData&);
WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxScopedWCharBuffer&);
#endif // wxUSE_UNICODE && defined(HAVE_WOSTREAM)
#endif // wxUSE_STD_IOSTREAM
// ---------------------------------------------------------------------------
// wxCStrData implementation
// ---------------------------------------------------------------------------
inline wxCStrData::wxCStrData(char *buf)
: m_str(new wxString(buf)), m_offset(0), m_owned(true) {}
inline wxCStrData::wxCStrData(wchar_t *buf)
: m_str(new wxString(buf)), m_offset(0), m_owned(true) {}
inline wxCStrData::wxCStrData(const wxCStrData& data)
: m_str(data.m_owned ? new wxString(*data.m_str) : data.m_str),
m_offset(data.m_offset),
m_owned(data.m_owned)
{
}
inline wxCStrData::~wxCStrData()
{
if ( m_owned )
delete const_cast<wxString*>(m_str); // cast to silence warnings
}
// AsChar() and AsWChar() implementations simply forward to wxString methods
inline const wchar_t* wxCStrData::AsWChar() const
{
const wchar_t * const p =
#if wxUSE_UNICODE_WCHAR
m_str->wc_str();
#elif wxUSE_UNICODE_UTF8
m_str->AsWChar(wxMBConvStrictUTF8());
#else
m_str->AsWChar(wxConvLibc);
#endif
// in Unicode build the string always has a valid Unicode representation
// and even if a conversion is needed (as in UTF8 case) it can't fail
//
// but in ANSI build the string contents might be not convertible to
// Unicode using the current locale encoding so we do need to check for
// errors
#if !wxUSE_UNICODE
if ( !p )
{
// if conversion fails, return empty string and not NULL to avoid
// crashes in code written with either wxWidgets 2 wxString or
// std::string behaviour in mind: neither of them ever returns NULL
// from its c_str() and so we shouldn't neither
//
// notice that the same is done in AsChar() below and
// wxString::wc_str() and mb_str() for the same reasons
return L"";
}
#endif // !wxUSE_UNICODE
return p + m_offset;
}
inline const char* wxCStrData::AsChar() const
{
#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
const char * const p = m_str->AsChar(wxConvLibc);
if ( !p )
return "";
#else // !wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY
const char * const p = m_str->mb_str();
#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
return p + m_offset;
}
inline wxString wxCStrData::AsString() const
{
if ( m_offset == 0 )
return *m_str;
else
return m_str->Mid(m_offset);
}
inline const wxStringCharType *wxCStrData::AsInternal() const
{
#if wxUSE_UNICODE_UTF8
return wxStringOperations::AddToIter(m_str->wx_str(), m_offset);
#else
return m_str->wx_str() + m_offset;
#endif
}
inline wxUniChar wxCStrData::operator*() const
{
if ( m_str->empty() )
return wxUniChar(wxT('\0'));
else
return (*m_str)[m_offset];
}
inline wxUniChar wxCStrData::operator[](size_t n) const
{
// NB: we intentionally use operator[] and not at() here because the former
// works for the terminating NUL while the latter does not
return (*m_str)[m_offset + n];
}
// ----------------------------------------------------------------------------
// more wxCStrData operators
// ----------------------------------------------------------------------------
// we need to define those to allow "size_t pos = p - s.c_str()" where p is
// some pointer into the string
inline size_t operator-(const char *p, const wxCStrData& cs)
{
return p - cs.AsChar();
}
inline size_t operator-(const wchar_t *p, const wxCStrData& cs)
{
return p - cs.AsWChar();
}
// ----------------------------------------------------------------------------
// implementation of wx[W]CharBuffer inline methods using wxCStrData
// ----------------------------------------------------------------------------
// FIXME-UTF8: move this to buffer.h
inline wxCharBuffer::wxCharBuffer(const wxCStrData& cstr)
: wxCharTypeBufferBase(cstr.AsCharBuf())
{
}
inline wxWCharBuffer::wxWCharBuffer(const wxCStrData& cstr)
: wxCharTypeBufferBase(cstr.AsWCharBuf())
{
}
#if wxUSE_UNICODE_UTF8
// ----------------------------------------------------------------------------
// implementation of wxStringIteratorNode inline methods
// ----------------------------------------------------------------------------
void wxStringIteratorNode::DoSet(const wxString *str,
wxStringImpl::const_iterator *citer,
wxStringImpl::iterator *iter)
{
m_prev = NULL;
m_iter = iter;
m_citer = citer;
m_str = str;
if ( str )
{
m_next = str->m_iterators.ptr;
const_cast<wxString*>(m_str)->m_iterators.ptr = this;
if ( m_next )
m_next->m_prev = this;
}
else
{
m_next = NULL;
}
}
void wxStringIteratorNode::clear()
{
if ( m_next )
m_next->m_prev = m_prev;
if ( m_prev )
m_prev->m_next = m_next;
else if ( m_str ) // first in the list
const_cast<wxString*>(m_str)->m_iterators.ptr = m_next;
m_next = m_prev = NULL;
m_citer = NULL;
m_iter = NULL;
m_str = NULL;
}
#endif // wxUSE_UNICODE_UTF8
#if WXWIN_COMPATIBILITY_2_8
// lot of code out there doesn't explicitly include wx/crt.h, but uses
// CRT wrappers that are now declared in wx/wxcrt.h and wx/wxcrtvararg.h,
// so let's include this header now that wxString is defined and it's safe
// to do it:
#include "wx/crt.h"
#endif
// ----------------------------------------------------------------------------
// Checks on wxString characters
// ----------------------------------------------------------------------------
template<bool (T)(const wxUniChar& c)>
inline bool wxStringCheck(const wxString& val)
{
for ( wxString::const_iterator i = val.begin();
i != val.end();
++i )
if (T(*i) == 0)
return false;
return true;
}
#endif // _WX_WXSTRING_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/sashwin.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/sashwin.h
// Purpose: Base header for wxSashWindow
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SASHWIN_H_BASE_
#define _WX_SASHWIN_H_BASE_
#include "wx/generic/sashwin.h"
#endif
// _WX_SASHWIN_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/help.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/help.h
// Purpose: wxHelpController base header
// Author: wxWidgets Team
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HELP_H_BASE_
#define _WX_HELP_H_BASE_
#include "wx/defs.h"
#if wxUSE_HELP
#include "wx/helpbase.h"
#if defined(__WXMSW__)
#include "wx/msw/helpchm.h"
#define wxHelpController wxCHMHelpController
#else // !MSW
#if wxUSE_WXHTML_HELP
#include "wx/html/helpctrl.h"
#define wxHelpController wxHtmlHelpController
#else
#include "wx/generic/helpext.h"
#define wxHelpController wxExtHelpController
#endif
#endif // MSW/!MSW
#endif // wxUSE_HELP
#endif
// _WX_HELP_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/archive.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/archive.h
// Purpose: Streams for archive formats
// Author: Mike Wetherell
// Copyright: (c) 2004 Mike Wetherell
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ARCHIVE_H__
#define _WX_ARCHIVE_H__
#include "wx/defs.h"
#if wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS
#include "wx/stream.h"
#include "wx/filename.h"
/////////////////////////////////////////////////////////////////////////////
// wxArchiveNotifier
class WXDLLIMPEXP_BASE wxArchiveNotifier
{
public:
virtual ~wxArchiveNotifier() { }
virtual void OnEntryUpdated(class wxArchiveEntry& entry) = 0;
};
/////////////////////////////////////////////////////////////////////////////
// wxArchiveEntry
//
// Holds an entry's meta data, such as filename and timestamp.
class WXDLLIMPEXP_BASE wxArchiveEntry : public wxObject
{
public:
virtual ~wxArchiveEntry() { }
virtual wxDateTime GetDateTime() const = 0;
virtual wxFileOffset GetSize() const = 0;
virtual wxFileOffset GetOffset() const = 0;
virtual bool IsDir() const = 0;
virtual bool IsReadOnly() const = 0;
virtual wxString GetInternalName() const = 0;
virtual wxPathFormat GetInternalFormat() const = 0;
virtual wxString GetName(wxPathFormat format = wxPATH_NATIVE) const = 0;
virtual void SetDateTime(const wxDateTime& dt) = 0;
virtual void SetSize(wxFileOffset size) = 0;
virtual void SetIsDir(bool isDir = true) = 0;
virtual void SetIsReadOnly(bool isReadOnly = true) = 0;
virtual void SetName(const wxString& name,
wxPathFormat format = wxPATH_NATIVE) = 0;
wxArchiveEntry *Clone() const { return DoClone(); }
void SetNotifier(wxArchiveNotifier& notifier);
virtual void UnsetNotifier() { m_notifier = NULL; }
protected:
wxArchiveEntry() : m_notifier(NULL) { }
wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(NULL) { }
virtual void SetOffset(wxFileOffset offset) = 0;
virtual wxArchiveEntry* DoClone() const = 0;
wxArchiveNotifier *GetNotifier() const { return m_notifier; }
wxArchiveEntry& operator=(const wxArchiveEntry& entry);
private:
wxArchiveNotifier *m_notifier;
wxDECLARE_ABSTRACT_CLASS(wxArchiveEntry);
};
/////////////////////////////////////////////////////////////////////////////
// wxArchiveInputStream
//
// GetNextEntry() returns an wxArchiveEntry object containing the meta-data
// for the next entry in the archive (and gives away ownership). Reading from
// the wxArchiveInputStream then returns the entry's data. Eof() becomes true
// after an attempt has been made to read past the end of the entry's data.
//
// When there are no more entries, GetNextEntry() returns NULL and sets Eof().
class WXDLLIMPEXP_BASE wxArchiveInputStream : public wxFilterInputStream
{
public:
typedef wxArchiveEntry entry_type;
virtual ~wxArchiveInputStream() { }
virtual bool OpenEntry(wxArchiveEntry& entry) = 0;
virtual bool CloseEntry() = 0;
wxArchiveEntry *GetNextEntry() { return DoGetNextEntry(); }
virtual char Peek() wxOVERRIDE { return wxInputStream::Peek(); }
protected:
wxArchiveInputStream(wxInputStream& stream, wxMBConv& conv);
wxArchiveInputStream(wxInputStream *stream, wxMBConv& conv);
virtual wxArchiveEntry *DoGetNextEntry() = 0;
wxMBConv& GetConv() const { return m_conv; }
private:
wxMBConv& m_conv;
};
/////////////////////////////////////////////////////////////////////////////
// wxArchiveOutputStream
//
// PutNextEntry is used to create a new entry in the output archive, then
// the entry's data is written to the wxArchiveOutputStream.
//
// Only one entry can be open for output at a time; another call to
// PutNextEntry closes the current entry and begins the next.
//
// The overload 'bool PutNextEntry(wxArchiveEntry *entry)' takes ownership
// of the entry object.
class WXDLLIMPEXP_BASE wxArchiveOutputStream : public wxFilterOutputStream
{
public:
virtual ~wxArchiveOutputStream() { }
virtual bool PutNextEntry(wxArchiveEntry *entry) = 0;
virtual bool PutNextEntry(const wxString& name,
const wxDateTime& dt = wxDateTime::Now(),
wxFileOffset size = wxInvalidOffset) = 0;
virtual bool PutNextDirEntry(const wxString& name,
const wxDateTime& dt = wxDateTime::Now()) = 0;
virtual bool CopyEntry(wxArchiveEntry *entry,
wxArchiveInputStream& stream) = 0;
virtual bool CopyArchiveMetaData(wxArchiveInputStream& stream) = 0;
virtual bool CloseEntry() = 0;
protected:
wxArchiveOutputStream(wxOutputStream& stream, wxMBConv& conv);
wxArchiveOutputStream(wxOutputStream *stream, wxMBConv& conv);
wxMBConv& GetConv() const { return m_conv; }
private:
wxMBConv& m_conv;
};
/////////////////////////////////////////////////////////////////////////////
// wxArchiveIterator
//
// An input iterator that can be used to transfer an archive's catalog to
// a container.
#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR
#include <iterator>
#include <utility>
template <class X, class Y> inline
void _wxSetArchiveIteratorValue(
X& val, Y entry, void *WXUNUSED(d))
{
val = X(entry);
}
template <class X, class Y, class Z> inline
void _wxSetArchiveIteratorValue(
std::pair<X, Y>& val, Z entry, Z WXUNUSED(d))
{
val = std::make_pair(X(entry->GetInternalName()), Y(entry));
}
template <class Arc, class T = typename Arc::entry_type*>
class wxArchiveIterator
{
public:
typedef std::input_iterator_tag iterator_category;
typedef T value_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef T& reference;
wxArchiveIterator() : m_rep(NULL) { }
wxArchiveIterator(Arc& arc) {
typename Arc::entry_type* entry = arc.GetNextEntry();
m_rep = entry ? new Rep(arc, entry) : NULL;
}
wxArchiveIterator(const wxArchiveIterator& it) : m_rep(it.m_rep) {
if (m_rep)
m_rep->AddRef();
}
~wxArchiveIterator() {
if (m_rep)
m_rep->UnRef();
}
const T& operator *() const {
return m_rep->GetValue();
}
const T* operator ->() const {
return &**this;
}
wxArchiveIterator& operator =(const wxArchiveIterator& it) {
if (it.m_rep)
it.m_rep.AddRef();
if (m_rep)
this->m_rep.UnRef();
m_rep = it.m_rep;
return *this;
}
wxArchiveIterator& operator ++() {
m_rep = m_rep->Next();
return *this;
}
wxArchiveIterator operator ++(int) {
wxArchiveIterator it(*this);
++(*this);
return it;
}
bool operator ==(const wxArchiveIterator& j) const {
return m_rep == j.m_rep;
}
bool operator !=(const wxArchiveIterator& j) const {
return !(*this == j);
}
private:
class Rep {
Arc& m_arc;
typename Arc::entry_type* m_entry;
T m_value;
int m_ref;
public:
Rep(Arc& arc, typename Arc::entry_type* entry)
: m_arc(arc), m_entry(entry), m_value(), m_ref(1) { }
~Rep()
{ delete m_entry; }
void AddRef() {
m_ref++;
}
void UnRef() {
if (--m_ref == 0)
delete this;
}
Rep *Next() {
typename Arc::entry_type* entry = m_arc.GetNextEntry();
if (!entry) {
UnRef();
return NULL;
}
if (m_ref > 1) {
m_ref--;
return new Rep(m_arc, entry);
}
delete m_entry;
m_entry = entry;
m_value = T();
return this;
}
const T& GetValue() {
if (m_entry) {
_wxSetArchiveIteratorValue(m_value, m_entry, m_entry);
m_entry = NULL;
}
return m_value;
}
} *m_rep;
};
typedef wxArchiveIterator<wxArchiveInputStream> wxArchiveIter;
typedef wxArchiveIterator<wxArchiveInputStream,
std::pair<wxString, wxArchiveEntry*> > wxArchivePairIter;
#endif // wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR
/////////////////////////////////////////////////////////////////////////////
// wxArchiveClassFactory
//
// A wxArchiveClassFactory instance for a particular archive type allows
// the creation of the other classes that may be needed.
void WXDLLIMPEXP_BASE wxUseArchiveClasses();
class WXDLLIMPEXP_BASE wxArchiveClassFactory : public wxFilterClassFactoryBase
{
public:
typedef wxArchiveEntry entry_type;
typedef wxArchiveInputStream instream_type;
typedef wxArchiveOutputStream outstream_type;
typedef wxArchiveNotifier notifier_type;
#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR
typedef wxArchiveIter iter_type;
typedef wxArchivePairIter pairiter_type;
#endif
virtual ~wxArchiveClassFactory() { }
wxArchiveEntry *NewEntry() const
{ return DoNewEntry(); }
wxArchiveInputStream *NewStream(wxInputStream& stream) const
{ return DoNewStream(stream); }
wxArchiveOutputStream *NewStream(wxOutputStream& stream) const
{ return DoNewStream(stream); }
wxArchiveInputStream *NewStream(wxInputStream *stream) const
{ return DoNewStream(stream); }
wxArchiveOutputStream *NewStream(wxOutputStream *stream) const
{ return DoNewStream(stream); }
virtual wxString GetInternalName(
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,
wxStreamProtocolType type
= wxSTREAM_PROTOCOL);
static const wxArchiveClassFactory *GetFirst();
const wxArchiveClassFactory *GetNext() const { return m_next; }
void PushFront() { Remove(); m_next = sm_first; sm_first = this; }
void Remove();
protected:
// old compilers don't support covarient returns, so 'Do' methods are
// used to simulate them
virtual wxArchiveEntry *DoNewEntry() const = 0;
virtual wxArchiveInputStream *DoNewStream(wxInputStream& stream) const = 0;
virtual wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const = 0;
virtual wxArchiveInputStream *DoNewStream(wxInputStream *stream) const = 0;
virtual wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const = 0;
wxArchiveClassFactory() : m_pConv(NULL), m_next(this) { }
wxArchiveClassFactory& operator=(const wxArchiveClassFactory& WXUNUSED(f))
{ return *this; }
private:
wxMBConv *m_pConv;
static wxArchiveClassFactory *sm_first;
wxArchiveClassFactory *m_next;
wxDECLARE_ABSTRACT_CLASS(wxArchiveClassFactory);
};
#endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS
#endif // _WX_ARCHIVE_H__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/print.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/print.h
// Purpose: Base header for printer classes
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRINT_H_BASE_
#define _WX_PRINT_H_BASE_
#include "wx/defs.h"
#if wxUSE_PRINTING_ARCHITECTURE
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/printwin.h"
#elif defined(__WXMAC__)
#include "wx/osx/printmac.h"
#elif defined(__WXQT__)
#include "wx/qt/printqt.h"
#else
#include "wx/generic/printps.h"
#endif
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif
// _WX_PRINT_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/compiler.h | /*
* Name: wx/compiler.h
* Purpose: Compiler-specific macro definitions.
* Author: Vadim Zeitlin
* Created: 2013-07-13 (extracted from wx/platform.h)
* Copyright: (c) 1997-2013 Vadim Zeitlin <[email protected]>
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_COMPILER_H_
#define _WX_COMPILER_H_
/*
Compiler detection and related helpers.
*/
/*
Notice that Intel compiler can be used as Microsoft Visual C++ add-on and
so we should define both __INTELC__ and __VISUALC__ for it.
*/
#ifdef __INTEL_COMPILER
# define __INTELC__
#endif
#if defined(_MSC_VER)
/*
define another standard symbol for Microsoft Visual C++: the standard
one (_MSC_VER) is also defined by some other compilers.
*/
# define __VISUALC__ _MSC_VER
/*
define special symbols for different VC version instead of writing tests
for magic numbers such as 1200, 1300 &c repeatedly
*/
#if __VISUALC__ < 1300
# error "This Visual C++ version is not supported any longer (at least MSVC 2003 required)."
#elif __VISUALC__ < 1400
# define __VISUALC7__
#elif __VISUALC__ < 1500
# define __VISUALC8__
#elif __VISUALC__ < 1600
# define __VISUALC9__
#elif __VISUALC__ < 1700
# define __VISUALC10__
#elif __VISUALC__ < 1800
# define __VISUALC11__
#elif __VISUALC__ < 1900
# define __VISUALC12__
#elif __VISUALC__ < 2000
/* There is no __VISUALC13__! */
# define __VISUALC14__
#else
/*
Don't forget to update include/msvc/wx/setup.h as well when adding
support for a newer MSVC version here.
*/
# pragma message("Please update wx/compiler.h to recognize this VC++ version")
#endif
#elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
# define __BORLANDC__
#elif defined(__SUNPRO_CC)
# ifndef __SUNCC__
# define __SUNCC__ __SUNPRO_CC
# endif /* Sun CC */
#endif /* compiler */
/*
Macros for checking compiler version.
*/
/*
This macro can be used to test the gcc version and can be used like this:
# if wxCHECK_GCC_VERSION(3, 1)
... we have gcc 3.1 or later ...
# else
... no gcc at all or gcc < 3.1 ...
# endif
*/
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
#define wxCHECK_GCC_VERSION( major, minor ) \
( ( __GNUC__ > (major) ) \
|| ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) )
#else
#define wxCHECK_GCC_VERSION( major, minor ) 0
#endif
/*
This macro can be used to test the Visual C++ version.
*/
#ifndef __VISUALC__
# define wxVISUALC_VERSION(major) 0
# define wxCHECK_VISUALC_VERSION(major) 0
#else
/*
Things used to be simple with the _MSC_VER value and the version number
increasing in lock step, but _MSC_VER value of 1900 is VC14 and not the
non existing (presumably for the superstitious reasons) VC13, so we now
need to account for this with an extra offset.
*/
# define wxVISUALC_VERSION(major) ( (6 - (major >= 14 ? 1 : 0) + major) * 100 )
# define wxCHECK_VISUALC_VERSION(major) ( __VISUALC__ >= wxVISUALC_VERSION(major) )
#endif
/**
This is similar to wxCHECK_GCC_VERSION but for Sun CC compiler.
*/
#ifdef __SUNCC__
/*
__SUNCC__ is 0xVRP where V is major version, R release and P patch level
*/
#define wxCHECK_SUNCC_VERSION(maj, min) (__SUNCC__ >= (((maj)<<8) | ((min)<<4)))
#else
#define wxCHECK_SUNCC_VERSION(maj, min) (0)
#endif
/*
wxCHECK_MINGW32_VERSION() is defined in wx/msw/gccpriv.h which is included
later, see comments there.
*/
#endif // _WX_COMPILER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/wxchar.h | //////////////////////////////////////////////////////////////////////////////
// Name: wx/wxchar.h
// Purpose: Declarations common to wx char/wchar_t usage (wide chars)
// Author: Joel Farley, Ove Kåven
// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
// Created: 1998/06/12
// Copyright: (c) 1998-2006 wxWidgets dev team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WXCHAR_H_
#define _WX_WXCHAR_H_
// This header used to define CRT functions wrappers in wxWidgets 2.8. This is
// now done in (headers included by) wx/crt.h, so include it for compatibility:
#include "wx/crt.h"
#endif /* _WX_WXCHAR_H_ */
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/ptr_scpd.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/ptr_scpd.h
// Purpose: compatibility wrapper for wxScoped{Ptr,Array}
// Author: Vadim Zeitlin
// Created: 2009-02-03
// Copyright: (c) 2009 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// do not include this file in any new code, include either wx/scopedptr.h or
// wx/scopedarray.h (or both) instead
#include "wx/scopedarray.h"
#include "wx/scopedptr.h"
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/containr.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/containr.h
// Purpose: wxControlContainer and wxNavigationEnabled declarations
// Author: Vadim Zeitlin
// Modified by:
// Created: 06.08.01
// Copyright: (c) 2001, 2011 Vadim Zeitlin <[email protected]>
// 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 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.
*/
// ----------------------------------------------------------------------------
// wxControlContainerBase: common part used in both native and generic cases
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxControlContainerBase
{
public:
// default ctor, SetContainerWindow() must be called later
wxControlContainerBase()
{
m_winParent = NULL;
// By default, we accept focus ourselves.
m_acceptsFocusSelf = true;
// But we don't have any children accepting it yet.
m_acceptsFocusChildren = false;
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;
}
// This can be called by the window to indicate that it never wants to have
// the focus for itself.
void DisableSelfFocus()
{ m_acceptsFocusSelf = false; UpdateParentCanFocus(); }
// This can be called to undo the effect of a previous DisableSelfFocus()
// (otherwise calling it is not necessary as the window does accept focus
// by default).
void EnableSelfFocus()
{ m_acceptsFocusSelf = true; UpdateParentCanFocus(); }
// should be called from SetFocus(), returns false if we did nothing with
// the focus and the default processing should take place
bool DoSetFocus();
// returns whether we should accept focus ourselves or not
bool AcceptsFocus() const;
// Returns whether we or one of our children accepts focus.
bool AcceptsFocusRecursively() const
{ return AcceptsFocus() ||
(m_acceptsFocusChildren && HasAnyChildrenAcceptingFocus()); }
// We accept focus from keyboard if we accept it at all.
bool AcceptsFocusFromKeyboard() const { return AcceptsFocusRecursively(); }
// Call this when the number of children of the window changes.
//
// Returns true if we have any focusable children, false otherwise.
bool UpdateCanFocusChildren();
#ifdef __WXMSW__
// This is not strictly related to navigation, but all windows containing
// more than one children controls need to return from this method if any
// of their parents has an inheritable background, so do this automatically
// for all of them (another alternative could be to do it in wxWindow
// itself but this would be potentially more backwards incompatible and
// could conceivably break some custom windows).
bool HasTransparentBackground() const;
#endif // __WXMSW__
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;
// return true if we have any children that do accept focus right now
bool HasAnyChildrenAcceptingFocus() const;
// the parent window we manage the children for
wxWindow *m_winParent;
// the child which had the focus last time this panel was activated
wxWindow *m_winLastFocused;
private:
// Update the window status to reflect whether it is getting focus or not.
void UpdateParentCanFocus();
// Indicates whether the associated window can ever have focus itself.
//
// Usually this is the case, e.g. a wxPanel can be used either as a
// container for its children or just as a normal window which can be
// focused. But sometimes, e.g. for wxStaticBox, we can never have focus
// ourselves and can only get it if we have any focusable children.
bool m_acceptsFocusSelf;
// Cached value remembering whether we have any children accepting focus.
bool m_acceptsFocusChildren;
// a guard against infinite recursion
bool m_inSetFocus;
};
#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() wxOVERRIDE;
};
#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);
// ----------------------------------------------------------------------------
// 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.
// ----------------------------------------------------------------------------
// 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::Bind(wxEVT_NAVIGATION_KEY,
&wxNavigationEnabled::OnNavigationKey, this);
BaseWindowClass::Bind(wxEVT_SET_FOCUS,
&wxNavigationEnabled::OnFocus, this);
BaseWindowClass::Bind(wxEVT_CHILD_FOCUS,
&wxNavigationEnabled::OnChildFocus, this);
#endif // !wxHAS_NATIVE_TAB_TRAVERSAL
}
WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocus() const wxOVERRIDE
{
return m_container.AcceptsFocus();
}
WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusRecursively() const wxOVERRIDE
{
return m_container.AcceptsFocusRecursively();
}
WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE
{
return m_container.AcceptsFocusFromKeyboard();
}
WXDLLIMPEXP_INLINE_CORE virtual void AddChild(wxWindowBase *child) wxOVERRIDE
{
BaseWindowClass::AddChild(child);
if ( m_container.UpdateCanFocusChildren() )
{
// Under MSW we must have wxTAB_TRAVERSAL style for TAB navigation
// to work.
if ( !BaseWindowClass::HasFlag(wxTAB_TRAVERSAL) )
BaseWindowClass::ToggleWindowStyle(wxTAB_TRAVERSAL);
}
}
WXDLLIMPEXP_INLINE_CORE virtual void RemoveChild(wxWindowBase *child) wxOVERRIDE
{
#ifndef wxHAS_NATIVE_TAB_TRAVERSAL
m_container.HandleOnWindowDestroy(child);
#endif // !wxHAS_NATIVE_TAB_TRAVERSAL
BaseWindowClass::RemoveChild(child);
// We could reset wxTAB_TRAVERSAL here but it doesn't seem to do any
// harm to keep it.
m_container.UpdateCanFocusChildren();
}
WXDLLIMPEXP_INLINE_CORE virtual void SetFocus() wxOVERRIDE
{
if ( !m_container.DoSetFocus() )
BaseWindowClass::SetFocus();
}
void SetFocusIgnoringChildren()
{
BaseWindowClass::SetFocus();
}
#ifdef __WXMSW__
WXDLLIMPEXP_INLINE_CORE virtual bool HasTransparentBackground() wxOVERRIDE
{
return m_container.HasTransparentBackground();
}
#endif // __WXMSW__
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(); \
\
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.UpdateCanFocusChildren(); \
} \
\
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.UpdateCanFocusChildren(); \
} \
\
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)
// implement the event table entries for wxControlContainer
#define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \
EVT_SET_FOCUS(classname::OnFocus) \
EVT_CHILD_FOCUS(classname::OnChildFocus) \
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.UpdateCanFocusChildren(); \
} \
\
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); \
}
#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL
#endif // WXWIN_COMPATIBILITY_2_8
#endif // _WX_CONTAINR_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/datetime.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/datetime.h
// Purpose: declarations of time/date related classes (wxDateTime,
// wxTimeSpan)
// Author: Vadim Zeitlin
// Modified by:
// Created: 10.02.99
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DATETIME_H
#define _WX_DATETIME_H
#include "wx/defs.h"
#if wxUSE_DATETIME
#include <time.h>
#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"
// not all c-runtimes are based on 1/1/1970 being (time_t) 0
// set this to the corresponding value in seconds 1/1/1970 has on your
// systems c-runtime
#define WX_TIME_BASE_OFFSET 0
/*
* TODO
*
* + 1. Time zones with minutes (make TimeZone a class)
* ? 2. getdate() function like under Solaris
* + 3. text conversion for wxDateSpan
* + 4. pluggable modules for the workdays calculations
* 5. wxDateTimeHolidayAuthority for Easter and other christian feasts
*/
/*
The three (main) classes declared in this header represent:
1. An absolute moment in the time (wxDateTime)
2. A difference between two moments in the time, positive or negative
(wxTimeSpan)
3. A logical difference between two dates expressed in
years/months/weeks/days (wxDateSpan)
The following arithmetic operations are permitted (all others are not):
addition
--------
wxDateTime + wxTimeSpan = wxDateTime
wxDateTime + wxDateSpan = wxDateTime
wxTimeSpan + wxTimeSpan = wxTimeSpan
wxDateSpan + wxDateSpan = wxDateSpan
subtraction
------------
wxDateTime - wxDateTime = wxTimeSpan
wxDateTime - wxTimeSpan = wxDateTime
wxDateTime - wxDateSpan = wxDateTime
wxTimeSpan - wxTimeSpan = wxTimeSpan
wxDateSpan - wxDateSpan = wxDateSpan
multiplication
--------------
wxTimeSpan * number = wxTimeSpan
number * wxTimeSpan = wxTimeSpan
wxDateSpan * number = wxDateSpan
number * wxDateSpan = wxDateSpan
unitary minus
-------------
-wxTimeSpan = wxTimeSpan
-wxDateSpan = wxDateSpan
For each binary operation OP (+, -, *) we have the following operatorOP=() as
a method and the method with a symbolic name OPER (Add, Subtract, Multiply)
as a synonym for it and another const method with the same name which returns
the changed copy of the object and operatorOP() as a global function which is
implemented in terms of the const version of OPEN. For the unary - we have
operator-() as a method, Neg() as synonym for it and Negate() which returns
the copy of the object with the changed sign.
*/
// an invalid/default date time object which may be used as the default
// argument for arguments of type wxDateTime; it is also returned by all
// functions returning wxDateTime on failure (this is why it is also called
// 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 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
#else
#define wxHAS_STRFTIME
#endif
// ----------------------------------------------------------------------------
// wxDateTime represents an absolute moment in the time
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxDateTime
{
public:
// types
// ------------------------------------------------------------------------
// a small unsigned integer type for storing things like minutes,
// seconds &c. It should be at least short (i.e. not char) to contain
// the number of milliseconds - it may also be 'int' because there is
// no size penalty associated with it in our code, we don't store any
// data in this format
typedef unsigned short wxDateTime_t;
// constants
// ------------------------------------------------------------------------
// the timezones
enum TZ
{
// the time in the current time zone
Local,
// zones from GMT (= Greenwich Mean Time): they're guaranteed to be
// consequent numbers, so writing something like `GMT0 + offset' is
// safe if abs(offset) <= 12
// underscore stands for minus
GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7,
GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1,
GMT0,
GMT1, GMT2, GMT3, GMT4, GMT5, GMT6,
GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13,
// Note that GMT12 and GMT_12 are not the same: there is a difference
// of exactly one day between them
// some symbolic names for TZ
// Europe
WET = GMT0, // Western Europe Time
WEST = GMT1, // Western Europe Summer Time
CET = GMT1, // Central Europe Time
CEST = GMT2, // Central Europe Summer Time
EET = GMT2, // Eastern Europe Time
EEST = GMT3, // Eastern Europe Summer Time
MSK = GMT3, // Moscow Time
MSD = GMT4, // Moscow Summer Time
// US and Canada
AST = GMT_4, // Atlantic Standard Time
ADT = GMT_3, // Atlantic Daylight Time
EST = GMT_5, // Eastern Standard Time
EDT = GMT_4, // Eastern Daylight Saving Time
CST = GMT_6, // Central Standard Time
CDT = GMT_5, // Central Daylight Saving Time
MST = GMT_7, // Mountain Standard Time
MDT = GMT_6, // Mountain Daylight Saving Time
PST = GMT_8, // Pacific Standard Time
PDT = GMT_7, // Pacific Daylight Saving Time
HST = GMT_10, // Hawaiian Standard Time
AKST = GMT_9, // Alaska Standard Time
AKDT = GMT_8, // Alaska Daylight Saving Time
// Australia
A_WST = GMT8, // Western Standard Time
A_CST = GMT13 + 1, // Central Standard Time (+9.5)
A_EST = GMT10, // Eastern Standard Time
A_ESST = GMT11, // Eastern Summer Time
// New Zealand
NZST = GMT12, // Standard Time
NZDT = GMT13, // Daylight Saving Time
// TODO add more symbolic timezone names here
// Universal Coordinated Time = the new and politically correct name
// for GMT
UTC = GMT0
};
// the calendar systems we know about: notice that it's valid (for
// this classes purpose anyhow) to work with any of these calendars
// even with the dates before the historical appearance of the
// calendar
enum Calendar
{
Gregorian, // current calendar
Julian // calendar in use since -45 until the 1582 (or later)
// TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?)
};
// the country parameter is used so far for calculating the start and
// the end of DST period and for deciding whether the date is a work
// day or not
//
// TODO move this to intl.h
enum Country
{
Country_Unknown, // no special information for this country
Country_Default, // set the default country with SetCountry() method
// or use the default country with any other
// TODO add more countries (for this we must know about DST and/or
// holidays for this country)
// Western European countries: we assume that they all follow the same
// DST rules (true or false?)
Country_WesternEurope_Start,
Country_EEC = Country_WesternEurope_Start,
France,
Germany,
UK,
Country_WesternEurope_End = UK,
Russia,
USA
};
// symbolic names for the months
enum Month
{
Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Inv_Month
};
// symbolic names for the weekdays
enum WeekDay
{
Sun, Mon, Tue, Wed, Thu, Fri, Sat, Inv_WeekDay
};
// invalid value for the year
enum Year
{
Inv_Year = SHRT_MIN // should hold in wxDateTime_t
};
// flags for GetWeekDayName and GetMonthName
enum NameFlags
{
Name_Full = 0x01, // return full name
Name_Abbr = 0x02 // return abbreviated name
};
// flags for GetWeekOfYear and GetWeekOfMonth
enum WeekFlags
{
Default_First, // Sunday_First for US, Monday_First for the rest
Monday_First, // week starts with a Monday
Sunday_First // week starts with a Sunday
};
// Currently we assume that DST is always shifted by 1 hour, this seems to
// be always true in practice. If this ever needs to change, search for all
// places using DST_OFFSET and update them.
enum
{
DST_OFFSET = 3600
};
// helper classes
// ------------------------------------------------------------------------
// a class representing a time zone: basically, this is just an offset
// (in seconds) from GMT
class WXDLLIMPEXP_BASE TimeZone
{
public:
TimeZone(TZ tz);
// create time zone object with the given offset
TimeZone(long offset = 0) { m_offset = offset; }
static TimeZone Make(long offset)
{
TimeZone tz;
tz.m_offset = offset;
return tz;
}
bool IsLocal() const { return m_offset == -1; }
long GetOffset() const;
private:
// offset for this timezone from GMT in seconds
long m_offset;
};
// standard struct tm is limited to the years from 1900 (because
// tm_year field is the offset from 1900), so we use our own struct
// instead to represent broken down time
//
// NB: this struct should always be kept normalized (i.e. mon should
// be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays()
// 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.
Month mon;
int year;
// default ctor inits the object to an invalid value
Tm();
// ctor from struct tm and the timezone
Tm(const struct tm& tm, const TimeZone& tz);
// check that the given date/time is valid (in Gregorian calendar)
bool IsValid() const;
// get the week day
WeekDay GetWeekDay() // not const because wday may be changed
{
if ( wday == Inv_WeekDay )
ComputeWeekDay();
return (WeekDay)wday;
}
// add the given number of months to the date keeping it normalized
void AddMonths(int monDiff);
// add the given number of months to the date keeping it normalized
void AddDays(int dayDiff);
private:
// compute the weekday from other fields
void ComputeWeekDay();
// 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;
};
// static methods
// ------------------------------------------------------------------------
// set the current country
static void SetCountry(Country country);
// get the current country
static Country GetCountry();
// return true if the country is a West European one (in practice,
// this means that the same DST rules as for EEC apply)
static bool IsWestEuropeanCountry(Country country = Country_Default);
// return the current year
static int GetCurrentYear(Calendar cal = Gregorian);
// convert the year as returned by wxDateTime::GetYear() to a year
// suitable for BC/AD notation. The difference is that BC year 1
// corresponds to the year 0 (while BC year 0 didn't exist) and AD
// year N is just year N.
static int ConvertYearToBC(int year);
// return the current month
static Month GetCurrentMonth(Calendar cal = Gregorian);
// returns true if the given year is a leap year in the given calendar
static bool IsLeapYear(int year = Inv_Year, Calendar cal = Gregorian);
// acquires the first day of week based on locale and/or OS settings
static bool GetFirstWeekDay(WeekDay *firstDay);
// get the century (19 for 1999, 20 for 2000 and -5 for 492 BC)
static int GetCentury(int year);
// returns the number of days in this year (356 or 355 for Gregorian
// calendar usually :-)
static wxDateTime_t GetNumberOfDays(int year, Calendar cal = Gregorian);
// get the number of the days in the given month (default value for
// the year means the current one)
static wxDateTime_t GetNumberOfDays(Month month,
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);
// return true if the given country uses DST for this year
static bool IsDSTApplicable(int year = Inv_Year,
Country country = Country_Default);
// get the beginning of DST for this year, will return invalid object
// if no DST applicable in this year. The default value of the
// parameter means to take the current year.
static wxDateTime GetBeginDST(int year = Inv_Year,
Country country = Country_Default);
// get the end of DST for this year, will return invalid object
// if no DST applicable in this year. The default value of the
// parameter means to take the current year.
static wxDateTime GetEndDST(int year = Inv_Year,
Country country = Country_Default);
// return the wxDateTime object for the current time
static inline wxDateTime Now();
// return the wxDateTime object for the current time with millisecond
// precision (if available on this platform)
static wxDateTime UNow();
// return the wxDateTime object for today midnight: i.e. as Now() but
// with time set to 0
static inline wxDateTime Today();
// constructors: you should test whether the constructor succeeded with
// IsValid() function. The values Inv_Month and Inv_Year for the
// parameters mean take current month and/or year values.
// ------------------------------------------------------------------------
// default ctor does not initialize the object, use Set()!
wxDateTime() { m_time = wxINT64_MIN; }
// from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970)
inline wxDateTime(time_t timet);
// from broken down time/date (only for standard Unix range)
inline wxDateTime(const struct tm& tm);
// from broken down time/date (any range)
inline wxDateTime(const Tm& tm);
// from JDN (beware of rounding errors)
inline wxDateTime(double jdn);
// from separate values for each component, date set to today
inline wxDateTime(wxDateTime_t hour,
wxDateTime_t minute = 0,
wxDateTime_t second = 0,
wxDateTime_t millisec = 0);
// from separate values for each component with explicit date
inline wxDateTime(wxDateTime_t day, // day of the month
Month month,
int year = Inv_Year, // 1999, not 99 please!
wxDateTime_t hour = 0,
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
// no dtor
// assignment operators and Set() functions: all non const methods return
// the reference to this object. IsValid() should be used to test whether
// the function succeeded.
// ------------------------------------------------------------------------
// set to the current time
inline wxDateTime& SetToCurrent();
// set to given time_t value
inline wxDateTime& Set(time_t timet);
// set to given broken down time/date
wxDateTime& Set(const struct tm& tm);
// set to given broken down time/date
inline wxDateTime& Set(const Tm& tm);
// set to given JDN (beware of rounding errors)
wxDateTime& Set(double jdn);
// set to given time, date = today
wxDateTime& Set(wxDateTime_t hour,
wxDateTime_t minute = 0,
wxDateTime_t second = 0,
wxDateTime_t millisec = 0);
// from separate values for each component with explicit date
// (defaults for month and year are the current values)
wxDateTime& Set(wxDateTime_t day,
Month month,
int year = Inv_Year, // 1999, not 99 please!
wxDateTime_t hour = 0,
wxDateTime_t minute = 0,
wxDateTime_t second = 0,
wxDateTime_t millisec = 0);
// resets time to 00:00:00, doesn't change the date
wxDateTime& ResetTime();
// 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;
// the following functions don't change the values of the other
// fields, i.e. SetMinute() won't change either hour or seconds value
// set the year
wxDateTime& SetYear(int year);
// set the month
wxDateTime& SetMonth(Month month);
// set the day of the month
wxDateTime& SetDay(wxDateTime_t day);
// set hour
wxDateTime& SetHour(wxDateTime_t hour);
// set minute
wxDateTime& SetMinute(wxDateTime_t minute);
// set second
wxDateTime& SetSecond(wxDateTime_t second);
// set millisecond
wxDateTime& SetMillisecond(wxDateTime_t millisecond);
// assignment operator from time_t
wxDateTime& operator=(time_t timet) { return Set(timet); }
// assignment operator from broken down time/date
wxDateTime& operator=(const struct tm& tm) { return Set(tm); }
// assignment operator from broken down time/date
wxDateTime& operator=(const Tm& tm) { return Set(tm); }
// default assignment operator is ok
// calendar calculations (functions which set the date only leave the time
// unchanged, e.g. don't explicitly zero it): SetXXX() functions modify the
// object itself, GetXXX() ones return a new object.
// ------------------------------------------------------------------------
// set to the given week day in the same week as this one
wxDateTime& SetToWeekDayInSameWeek(WeekDay weekday,
WeekFlags flags = Monday_First);
inline wxDateTime GetWeekDayInSameWeek(WeekDay weekday,
WeekFlags flags = Monday_First) const;
// set to the next week day following this one
wxDateTime& SetToNextWeekDay(WeekDay weekday);
inline wxDateTime GetNextWeekDay(WeekDay weekday) const;
// set to the previous week day before this one
wxDateTime& SetToPrevWeekDay(WeekDay weekday);
inline wxDateTime GetPrevWeekDay(WeekDay weekday) const;
// set to Nth occurrence 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())
bool SetToWeekDay(WeekDay weekday,
int n = 1,
Month month = Inv_Month,
int year = Inv_Year);
inline wxDateTime GetWeekDay(WeekDay weekday,
int n = 1,
Month month = Inv_Month,
int year = Inv_Year) const;
// sets to the last weekday in the given month, year
inline bool SetToLastWeekDay(WeekDay weekday,
Month month = Inv_Month,
int year = Inv_Year);
inline wxDateTime GetLastWeekDay(WeekDay weekday,
Month month = Inv_Month,
int year = Inv_Year);
// returns the date corresponding to the given week day of the given
// week (in ISO notation) of the specified year
static wxDateTime SetToWeekOfYear(int year,
wxDateTime_t numWeek,
WeekDay weekday = Mon);
// sets the date to the last day of the given (or current) month or the
// given (or current) year
wxDateTime& SetToLastMonthDay(Month month = Inv_Month,
int year = Inv_Year);
inline wxDateTime GetLastMonthDay(Month month = Inv_Month,
int year = Inv_Year) const;
// sets to the given year day (1..365 or 366)
wxDateTime& SetToYearDay(wxDateTime_t yday);
inline wxDateTime GetYearDay(wxDateTime_t yday) const;
// The definitions below were taken verbatim from
//
// http://www.capecod.net/~pbaum/date/date0.htm
//
// (Peter Baum's home page)
//
// definition: The Julian Day Number, Julian Day, or JD of a
// particular instant of time is the number of days and fractions of a
// day since 12 hours Universal Time (Greenwich mean noon) on January
// 1 of the year -4712, where the year is given in the Julian
// proleptic calendar. The idea of using this reference date was
// originally proposed by Joseph Scalizer in 1582 to count years but
// it was modified by 19th century astronomers to count days. One
// could have equivalently defined the reference time to be noon of
// November 24, -4713 if were understood that Gregorian calendar rules
// were applied. Julian days are Julian Day Numbers and are not to be
// confused with Julian dates.
//
// definition: The Rata Die number is a date specified as the number
// of days relative to a base date of December 31 of the year 0. Thus
// January 1 of the year 1 is Rata Die day 1.
// get the Julian Day number (the fractional part specifies the time of
// the day, related to noon - beware of rounding errors!)
double GetJulianDayNumber() const;
double GetJDN() const { return GetJulianDayNumber(); }
// get the Modified Julian Day number: it is equal to JDN - 2400000.5
// and so integral MJDs correspond to the midnights (and not noons).
// MJD 0 is Nov 17, 1858
double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; }
double GetMJD() const { return GetModifiedJulianDayNumber(); }
// get the Rata Die number
double GetRataDie() const;
// TODO algorithms for calculating some important dates, such as
// religious holidays (Easter...) or moon/solar eclipses? Some
// algorithms can be found in the calendar FAQ
// Timezone stuff: a wxDateTime object constructed using given
// day/month/year/hour/min/sec values is interpreted as this moment in
// local time. Using the functions below, it may be converted to another
// time zone (e.g., the Unix epoch is wxDateTime(1, Jan, 1970).ToGMT()).
//
// These functions try to handle DST internally, but there is no magical
// way to know all rules for it in all countries in the world, so if the
// program can handle it itself (or doesn't want to handle it at all for
// whatever reason), the DST handling can be disabled with noDST.
// ------------------------------------------------------------------------
// transform to any given timezone
inline wxDateTime ToTimezone(const TimeZone& tz, bool noDST = false) const;
wxDateTime& MakeTimezone(const TimeZone& tz, bool noDST = false);
// interpret current value as being in another timezone and transform
// it to local one
inline wxDateTime FromTimezone(const TimeZone& tz, bool noDST = false) const;
wxDateTime& MakeFromTimezone(const TimeZone& tz, bool noDST = false);
// transform to/from GMT/UTC
wxDateTime ToUTC(bool noDST = false) const { return ToTimezone(UTC, noDST); }
wxDateTime& MakeUTC(bool noDST = false) { return MakeTimezone(UTC, noDST); }
wxDateTime ToGMT(bool noDST = false) const { return ToUTC(noDST); }
wxDateTime& MakeGMT(bool noDST = false) { return MakeUTC(noDST); }
wxDateTime FromUTC(bool noDST = false) const
{ return FromTimezone(UTC, noDST); }
wxDateTime& MakeFromUTC(bool noDST = false)
{ return MakeFromTimezone(UTC, noDST); }
// is daylight savings time in effect at this moment according to the
// rules of the specified country?
//
// Return value is > 0 if DST is in effect, 0 if it is not and -1 if
// the information is not available (this is compatible with ANSI C)
int IsDST(Country country = Country_Default) const;
// accessors: many of them take the timezone parameter which indicates the
// timezone for which to make the calculations and the default value means
// to do it for the current timezone of this machine (even if the function
// only operates with the date it's necessary because a date may wrap as
// result of timezone shift)
// ------------------------------------------------------------------------
// is the date valid?
inline bool IsValid() const { return m_time != wxLongLong(wxINT64_MIN); }
// get the broken down date/time representation in the given timezone
//
// If you wish to get several time components (day, month and year),
// consider getting the whole Tm strcuture first and retrieving the
// value from it - this is much more efficient
Tm GetTm(const TimeZone& tz = Local) const;
// get the number of seconds since the Unix epoch - returns (time_t)-1
// if the value is out of range
inline time_t GetTicks() const;
// get the century, same as GetCentury(GetYear())
int GetCentury(const TimeZone& tz = Local) const
{ return GetCentury(GetYear(tz)); }
// get the year (returns Inv_Year if date is invalid)
int GetYear(const TimeZone& tz = Local) const
{ return GetTm(tz).year; }
// get the month (Inv_Month if date is invalid)
Month GetMonth(const TimeZone& tz = Local) const
{ return (Month)GetTm(tz).mon; }
// get the month day (in 1..31 range, 0 if date is invalid)
wxDateTime_t GetDay(const TimeZone& tz = Local) const
{ return GetTm(tz).mday; }
// get the day of the week (Inv_WeekDay if date is invalid)
WeekDay GetWeekDay(const TimeZone& tz = Local) const
{ return GetTm(tz).GetWeekDay(); }
// get the hour of the day
wxDateTime_t GetHour(const TimeZone& tz = Local) const
{ return GetTm(tz).hour; }
// get the minute
wxDateTime_t GetMinute(const TimeZone& tz = Local) const
{ return GetTm(tz).min; }
// get the second
wxDateTime_t GetSecond(const TimeZone& tz = Local) const
{ return GetTm(tz).sec; }
// get milliseconds
wxDateTime_t GetMillisecond(const TimeZone& tz = Local) const
{ return GetTm(tz).msec; }
// get the day since the year start (1..366, 0 if date is invalid)
wxDateTime_t GetDayOfYear(const TimeZone& tz = Local) const;
// get the week number since the year start (1..52 or 53, 0 if date is
// invalid)
wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First,
const TimeZone& tz = Local) const;
// get the year to which the number returned from GetWeekOfYear()
// belongs
int GetWeekBasedYear(const TimeZone& tz = Local) const;
// get the week number since the month start (1..5, 0 if date is
// invalid)
wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First,
const TimeZone& tz = Local) const;
// is this date a work day? This depends on a country, of course,
// because the holidays are different in different countries
bool IsWorkDay(Country country = Country_Default) const;
// dos date and time format
// ------------------------------------------------------------------------
// set from the DOS packed format
wxDateTime& SetFromDOS(unsigned long ddt);
// 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)
// ------------------------------------------------------------------------
// returns true if the two moments are strictly identical
inline bool IsEqualTo(const wxDateTime& datetime) const;
// returns true if the date is strictly earlier than the given one
inline bool IsEarlierThan(const wxDateTime& datetime) const;
// returns true if the date is strictly later than the given one
inline bool IsLaterThan(const wxDateTime& datetime) const;
// returns true if the date is strictly in the given range
inline bool IsStrictlyBetween(const wxDateTime& t1,
const wxDateTime& t2) const;
// returns true if the date is in the given range
inline bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const;
// do these two objects refer to the same date?
inline bool IsSameDate(const wxDateTime& dt) const;
// do these two objects have the same time?
inline bool IsSameTime(const wxDateTime& dt) const;
// are these two objects equal up to given timespan?
inline bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const;
inline bool operator<(const wxDateTime& dt) const
{
return GetValue() < dt.GetValue();
}
inline bool operator<=(const wxDateTime& dt) const
{
return GetValue() <= dt.GetValue();
}
inline bool operator>(const wxDateTime& dt) const
{
return GetValue() > dt.GetValue();
}
inline bool operator>=(const wxDateTime& dt) const
{
return GetValue() >= dt.GetValue();
}
inline bool operator==(const wxDateTime& dt) const
{
// Intentionally do not call GetValue() here, in order that
// invalid wxDateTimes may be compared for equality
return m_time == dt.m_time;
}
inline bool operator!=(const wxDateTime& dt) const
{
// As above, don't use GetValue() here.
return m_time != dt.m_time;
}
// arithmetics with dates (see also below for more operators)
// ------------------------------------------------------------------------
// return the sum of the date with a time span (positive or negative)
inline wxDateTime Add(const wxTimeSpan& diff) const;
// add a time span (positive or negative)
inline wxDateTime& Add(const wxTimeSpan& diff);
// add a time span (positive or negative)
inline wxDateTime& operator+=(const wxTimeSpan& diff);
inline wxDateTime operator+(const wxTimeSpan& ts) const
{
wxDateTime dt(*this);
dt.Add(ts);
return dt;
}
// return the difference of the date with a time span
inline wxDateTime Subtract(const wxTimeSpan& diff) const;
// subtract a time span (positive or negative)
inline wxDateTime& Subtract(const wxTimeSpan& diff);
// subtract a time span (positive or negative)
inline wxDateTime& operator-=(const wxTimeSpan& diff);
inline wxDateTime operator-(const wxTimeSpan& ts) const
{
wxDateTime dt(*this);
dt.Subtract(ts);
return dt;
}
// return the sum of the date with a date span
inline wxDateTime Add(const wxDateSpan& diff) const;
// add a date span (positive or negative)
wxDateTime& Add(const wxDateSpan& diff);
// add a date span (positive or negative)
inline wxDateTime& operator+=(const wxDateSpan& diff);
inline wxDateTime operator+(const wxDateSpan& ds) const
{
wxDateTime dt(*this);
dt.Add(ds);
return dt;
}
// return the difference of the date with a date span
inline wxDateTime Subtract(const wxDateSpan& diff) const;
// subtract a date span (positive or negative)
inline wxDateTime& Subtract(const wxDateSpan& diff);
// subtract a date span (positive or negative)
inline wxDateTime& operator-=(const wxDateSpan& diff);
inline wxDateTime operator-(const wxDateSpan& ds) const
{
wxDateTime dt(*this);
dt.Subtract(ds);
return dt;
}
// return the difference between two dates
inline wxTimeSpan Subtract(const wxDateTime& dt) const;
inline wxTimeSpan operator-(const wxDateTime& dt2) const;
wxDateSpan DiffAsDateSpan(const wxDateTime& dt) const;
// conversion to/from text
// ------------------------------------------------------------------------
// 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);
// 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();
}
// 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);
// parse a string containing the date only in "free" format (less
// flexible than ParseDateTime)
bool ParseDate(const wxString& date,
wxString::const_iterator *end);
// parse a string containing the time only in "free" format
bool ParseTime(const wxString& time,
wxString::const_iterator *end);
// 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,
const TimeZone& tz = Local) const;
// preferred date representation for the current locale
wxString FormatDate() const { return Format(wxS("%x")); }
// preferred time representation for the current locale
wxString FormatTime() const { return Format(wxS("%X")); }
// returns the string representing the date in ISO 8601 format
// (YYYY-MM-DD)
wxString FormatISODate() const { return Format(wxS("%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);
// implementation
// ------------------------------------------------------------------------
// construct from internal representation
wxDateTime(const wxLongLong& time) { m_time = time; }
// get the internal representation
inline wxLongLong GetValue() const;
// a helper function to get the current time_t
static time_t GetTimeNow() { return time(NULL); }
// another one to get the current time broken down
static struct tm *GetTmNow()
{
static struct tm l_CurrentTime;
return GetTmNow(&l_CurrentTime);
}
// get current time using thread-safe function
static struct tm *GetTmNow(struct tm *tmstruct);
private:
// the current country - as it's the same for all program objects (unless
// it runs on a _really_ big cluster system :-), this is a static member:
// see SetCountry() and GetCountry()
static Country ms_country;
// this constant is used to transform a time_t value to the internal
// representation, as time_t is in seconds and we use milliseconds it's
// fixed to 1000
static const long TIME_T_FACTOR;
// returns true if we fall in range in which we can use standard ANSI C
// functions
inline bool IsInStdRange() const;
// assign the preferred first day of a week to flags, if necessary
void UseEffectiveWeekDayFlags(WeekFlags &flags) const;
// the internal representation of the time is the amount of milliseconds
// elapsed since the origin which is set by convention to the UNIX/C epoch
// value: the midnight of January 1, 1970 (UTC)
wxLongLong m_time;
};
// ----------------------------------------------------------------------------
// This class contains a difference between 2 wxDateTime values, so it makes
// sense to add it to wxDateTime and it is the result of subtraction of 2
// objects of that class. See also wxDateSpan.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxTimeSpan
{
public:
// constructors
// ------------------------------------------------------------------------
// return the timespan for the given number of milliseconds
static wxTimeSpan Milliseconds(wxLongLong ms) { return wxTimeSpan(0, 0, 0, ms); }
static wxTimeSpan Millisecond() { return Milliseconds(1); }
// return the timespan for the given number of seconds
static wxTimeSpan Seconds(wxLongLong sec) { return wxTimeSpan(0, 0, sec); }
static wxTimeSpan Second() { return Seconds(1); }
// return the timespan for the given number of minutes
static wxTimeSpan Minutes(long min) { return wxTimeSpan(0, min, 0 ); }
static wxTimeSpan Minute() { return Minutes(1); }
// return the timespan for the given number of hours
static wxTimeSpan Hours(long hours) { return wxTimeSpan(hours, 0, 0); }
static wxTimeSpan Hour() { return Hours(1); }
// return the timespan for the given number of days
static wxTimeSpan Days(long days) { return Hours(24 * days); }
static wxTimeSpan Day() { return Days(1); }
// return the timespan for the given number of weeks
static wxTimeSpan Weeks(long days) { return Days(7 * days); }
static wxTimeSpan Week() { return Weeks(1); }
// default ctor constructs the 0 time span
wxTimeSpan() { }
// from separate values for each component, date set to 0 (hours are
// not restricted to 0..24 range, neither are minutes, seconds or
// milliseconds)
inline wxTimeSpan(long hours,
long minutes = 0,
wxLongLong seconds = 0,
wxLongLong milliseconds = 0);
// default copy ctor is ok
// no dtor
// arithmetics with time spans (see also below for more operators)
// ------------------------------------------------------------------------
// return the sum of two timespans
inline wxTimeSpan Add(const wxTimeSpan& diff) const;
// add two timespans together
inline wxTimeSpan& Add(const wxTimeSpan& diff);
// add two timespans together
wxTimeSpan& operator+=(const wxTimeSpan& diff) { return Add(diff); }
inline wxTimeSpan operator+(const wxTimeSpan& ts) const
{
return wxTimeSpan(GetValue() + ts.GetValue());
}
// return the difference of two timespans
inline wxTimeSpan Subtract(const wxTimeSpan& diff) const;
// subtract another timespan
inline wxTimeSpan& Subtract(const wxTimeSpan& diff);
// subtract another timespan
wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Subtract(diff); }
inline wxTimeSpan operator-(const wxTimeSpan& ts) const
{
return wxTimeSpan(GetValue() - ts.GetValue());
}
// multiply timespan by a scalar
inline wxTimeSpan Multiply(int n) const;
// multiply timespan by a scalar
inline wxTimeSpan& Multiply(int n);
// multiply timespan by a scalar
wxTimeSpan& operator*=(int n) { return Multiply(n); }
inline wxTimeSpan operator*(int n) const
{
return wxTimeSpan(*this).Multiply(n);
}
// return this timespan with opposite sign
wxTimeSpan Negate() const { return wxTimeSpan(-GetValue()); }
// negate the value of the timespan
wxTimeSpan& Neg() { m_diff = -GetValue(); return *this; }
// negate the value of the timespan
wxTimeSpan& operator-() { return Neg(); }
// return the absolute value of the timespan: does _not_ modify the
// object
inline wxTimeSpan Abs() const;
// there is intentionally no division because we don't want to
// introduce rounding errors in time calculations
// comparison (see also operator versions below)
// ------------------------------------------------------------------------
// is the timespan null?
bool IsNull() const { return m_diff == 0l; }
// returns true if the timespan is null
bool operator!() const { return !IsNull(); }
// is the timespan positive?
bool IsPositive() const { return m_diff > 0l; }
// is the timespan negative?
bool IsNegative() const { return m_diff < 0l; }
// are two timespans equal?
inline bool IsEqualTo(const wxTimeSpan& ts) const;
// compare two timestamps: works with the absolute values, i.e. -2
// hours is longer than 1 hour. Also, it will return false if the
// timespans are equal in absolute value.
inline bool IsLongerThan(const wxTimeSpan& ts) const;
// 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;
inline bool operator<(const wxTimeSpan &ts) const
{
return GetValue() < ts.GetValue();
}
inline bool operator<=(const wxTimeSpan &ts) const
{
return GetValue() <= ts.GetValue();
}
inline bool operator>(const wxTimeSpan &ts) const
{
return GetValue() > ts.GetValue();
}
inline bool operator>=(const wxTimeSpan &ts) const
{
return GetValue() >= ts.GetValue();
}
inline bool operator==(const wxTimeSpan &ts) const
{
return GetValue() == ts.GetValue();
}
inline bool operator!=(const wxTimeSpan &ts) const
{
return GetValue() != ts.GetValue();
}
// breaking into days, hours, minutes and seconds
// ------------------------------------------------------------------------
// get the max number of weeks in this timespan
inline int GetWeeks() const;
// get the max number of days in this timespan
inline int GetDays() const;
// get the max number of hours in this timespan
inline int GetHours() const;
// get the max number of minutes in this timespan
inline int GetMinutes() const;
// get the max number of seconds in this timespan
inline wxLongLong GetSeconds() const;
// get the number of milliseconds in this timespan
wxLongLong GetMilliseconds() const { return m_diff; }
// conversion to text
// ------------------------------------------------------------------------
// 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. 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;
// implementation
// ------------------------------------------------------------------------
// construct from internal representation
wxTimeSpan(const wxLongLong& diff) { m_diff = diff; }
// get the internal representation
wxLongLong GetValue() const { return m_diff; }
private:
// the (signed) time span in milliseconds
wxLongLong m_diff;
};
// ----------------------------------------------------------------------------
// This class is a "logical time span" and is useful for implementing program
// logic for such things as "add one month to the date" which, in general,
// doesn't mean to add 60*60*24*31 seconds to it, but to take the same date
// the next month (to understand that this is indeed different consider adding
// one month to Feb, 15 - we want to get Mar, 15, of course).
//
// When adding a month to the date, all lesser components (days, hours, ...)
// won't be changed unless the resulting date would be invalid: for example,
// Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31.
//
// Because of this feature, adding and subtracting back again the same
// wxDateSpan will *not*, in general give back the original date: Feb 28 - 1
// month will be Jan 28, not Jan 31!
//
// wxDateSpan can be either positive or negative. They may be
// multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1
// month and 1 day) is 2 months and 2 days. They can be added together and
// with wxDateTime or wxTimeSpan, but the type of result is different for each
// case.
//
// Beware about weeks: if you specify both weeks and days, the total number of
// days added will be 7*weeks + days! See also GetTotalDays() function.
//
// Equality operators are defined for wxDateSpans. Two datespans are equal if
// they both give the same target date when added to *every* source date.
// Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because
// they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is
// equal to wxDateSpan::Weeks(2)
//
// Finally, notice that for adding hours, minutes &c you don't need this
// class: wxTimeSpan will do the job because there are no subtleties
// associated with those.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxDateSpan
{
public:
// constructors
// ------------------------------------------------------------------------
// this many years/months/weeks/days
wxDateSpan(int years = 0, int months = 0, int weeks = 0, int days = 0)
{
m_years = years;
m_months = months;
m_weeks = weeks;
m_days = days;
}
// get an object for the given number of days
static wxDateSpan Days(int days) { return wxDateSpan(0, 0, 0, days); }
static wxDateSpan Day() { return Days(1); }
// get an object for the given number of weeks
static wxDateSpan Weeks(int weeks) { return wxDateSpan(0, 0, weeks, 0); }
static wxDateSpan Week() { return Weeks(1); }
// get an object for the given number of months
static wxDateSpan Months(int mon) { return wxDateSpan(0, mon, 0, 0); }
static wxDateSpan Month() { return Months(1); }
// get an object for the given number of years
static wxDateSpan Years(int years) { return wxDateSpan(years, 0, 0, 0); }
static wxDateSpan Year() { return Years(1); }
// default copy ctor is ok
// no dtor
// accessors (all SetXXX() return the (modified) wxDateSpan object)
// ------------------------------------------------------------------------
// set number of years
wxDateSpan& SetYears(int n) { m_years = n; return *this; }
// set number of months
wxDateSpan& SetMonths(int n) { m_months = n; return *this; }
// set number of weeks
wxDateSpan& SetWeeks(int n) { m_weeks = n; return *this; }
// set number of days
wxDateSpan& SetDays(int n) { m_days = n; return *this; }
// get number of years
int GetYears() const { return m_years; }
// get number of months
int GetMonths() const { return m_months; }
// returns 12*GetYears() + GetMonths()
int GetTotalMonths() const { return 12*m_years + m_months; }
// get number of weeks
int GetWeeks() const { return m_weeks; }
// get number of days
int GetDays() const { return m_days; }
// returns 7*GetWeeks() + GetDays()
int GetTotalDays() const { return 7*m_weeks + m_days; }
// arithmetics with date spans (see also below for more operators)
// ------------------------------------------------------------------------
// return sum of two date spans
inline wxDateSpan Add(const wxDateSpan& other) const;
// add another wxDateSpan to us
inline wxDateSpan& Add(const wxDateSpan& other);
// add another wxDateSpan to us
inline wxDateSpan& operator+=(const wxDateSpan& other);
inline wxDateSpan operator+(const wxDateSpan& ds) const
{
return wxDateSpan(GetYears() + ds.GetYears(),
GetMonths() + ds.GetMonths(),
GetWeeks() + ds.GetWeeks(),
GetDays() + ds.GetDays());
}
// return difference of two date spans
inline wxDateSpan Subtract(const wxDateSpan& other) const;
// subtract another wxDateSpan from us
inline wxDateSpan& Subtract(const wxDateSpan& other);
// subtract another wxDateSpan from us
inline wxDateSpan& operator-=(const wxDateSpan& other);
inline wxDateSpan operator-(const wxDateSpan& ds) const
{
return wxDateSpan(GetYears() - ds.GetYears(),
GetMonths() - ds.GetMonths(),
GetWeeks() - ds.GetWeeks(),
GetDays() - ds.GetDays());
}
// return a copy of this time span with changed sign
inline wxDateSpan Negate() const;
// inverse the sign of this timespan
inline wxDateSpan& Neg();
// inverse the sign of this timespan
wxDateSpan& operator-() { return Neg(); }
// return the date span proportional to this one with given factor
inline wxDateSpan Multiply(int factor) const;
// multiply all components by a (signed) number
inline wxDateSpan& Multiply(int factor);
// multiply all components by a (signed) number
inline wxDateSpan& operator*=(int factor) { return Multiply(factor); }
inline wxDateSpan operator*(int n) const
{
return wxDateSpan(*this).Multiply(n);
}
// ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2
inline bool operator==(const wxDateSpan& ds) const
{
return GetYears() == ds.GetYears() &&
GetMonths() == ds.GetMonths() &&
GetTotalDays() == ds.GetTotalDays();
}
inline bool operator!=(const wxDateSpan& ds) const
{
return !(*this == ds);
}
private:
int m_years,
m_months,
m_weeks,
m_days;
};
// ----------------------------------------------------------------------------
// wxDateTimeArray: array of dates.
// ----------------------------------------------------------------------------
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray, WXDLLIMPEXP_BASE);
// ----------------------------------------------------------------------------
// wxDateTimeHolidayAuthority: an object of this class will decide whether a
// given date is a holiday and is used by all functions working with "work
// days".
//
// NB: the base class is an ABC, derived classes must implement the pure
// virtual methods to work with the holidays they correspond to.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_BASE wxDateTimeHolidayAuthority;
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxDateTimeHolidayAuthority *,
wxHolidayAuthoritiesArray,
class WXDLLIMPEXP_BASE);
class wxDateTimeHolidaysModule;
class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority
{
friend class wxDateTimeHolidaysModule;
public:
// returns true if the given date is a holiday
static bool IsHoliday(const wxDateTime& dt);
// fills the provided array with all holidays in the given range, returns
// the number of them
static size_t GetHolidaysInRange(const wxDateTime& dtStart,
const wxDateTime& dtEnd,
wxDateTimeArray& holidays);
// clear the list of holiday authorities
static void ClearAllAuthorities();
// add a new holiday authority (the pointer will be deleted by
// wxDateTimeHolidayAuthority)
static void AddAuthority(wxDateTimeHolidayAuthority *auth);
// the base class must have a virtual dtor
virtual ~wxDateTimeHolidayAuthority();
protected:
// this function is called to determine whether a given day is a holiday
virtual bool DoIsHoliday(const wxDateTime& dt) const = 0;
// this function should fill the array with all holidays between the two
// given dates - it is implemented in the base class, but in a very
// inefficient way (it just iterates over all days and uses IsHoliday() for
// each of them), so it must be overridden in the derived class where the
// base class version may be explicitly used if needed
//
// returns the number of holidays in the given range and fills holidays
// array
virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
const wxDateTime& dtEnd,
wxDateTimeArray& holidays) const = 0;
private:
// all holiday authorities
static wxHolidayAuthoritiesArray ms_authorities;
};
// the holidays for this class are all Saturdays and Sundays
class WXDLLIMPEXP_BASE wxDateTimeWorkDays : public wxDateTimeHolidayAuthority
{
protected:
virtual bool DoIsHoliday(const wxDateTime& dt) const wxOVERRIDE;
virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
const wxDateTime& dtEnd,
wxDateTimeArray& holidays) const wxOVERRIDE;
};
// ============================================================================
// inline functions implementation
// ============================================================================
// ----------------------------------------------------------------------------
// private macros
// ----------------------------------------------------------------------------
#define MILLISECONDS_PER_DAY 86400000l
// some broken compilers (HP-UX CC) refuse to compile the "normal" version, but
// using a temp variable always might prevent other compilers from optimising
// it away - hence use of this ugly macro
#ifndef __HPUX__
#define MODIFY_AND_RETURN(op) return wxDateTime(*this).op
#else
#define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt
#endif
// ----------------------------------------------------------------------------
// wxDateTime construction
// ----------------------------------------------------------------------------
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;
}
/* static */
inline wxDateTime wxDateTime::Now()
{
struct tm tmstruct;
return wxDateTime(*GetTmNow(&tmstruct));
}
/* static */
inline wxDateTime wxDateTime::Today()
{
wxDateTime dt(Now());
dt.ResetTime();
return dt;
}
inline wxDateTime& wxDateTime::Set(time_t timet)
{
if ( timet == (time_t)-1 )
{
m_time = wxInvalidDateTime.m_time;
}
else
{
// assign first to avoid long multiplication overflow!
m_time = timet - WX_TIME_BASE_OFFSET;
m_time *= TIME_T_FACTOR;
}
return *this;
}
inline wxDateTime& wxDateTime::SetToCurrent()
{
*this = Now();
return *this;
}
inline wxDateTime::wxDateTime(time_t timet)
{
Set(timet);
}
inline wxDateTime::wxDateTime(const struct tm& tm)
{
Set(tm);
}
inline wxDateTime::wxDateTime(const Tm& tm)
{
Set(tm);
}
inline wxDateTime::wxDateTime(double jdn)
{
Set(jdn);
}
inline wxDateTime& wxDateTime::Set(const Tm& tm)
{
wxASSERT_MSG( tm.IsValid(), wxT("invalid broken down date/time") );
return Set(tm.mday, (Month)tm.mon, tm.year,
tm.hour, tm.min, tm.sec, tm.msec);
}
inline wxDateTime::wxDateTime(wxDateTime_t hour,
wxDateTime_t minute,
wxDateTime_t second,
wxDateTime_t millisec)
{
Set(hour, minute, second, millisec);
}
inline wxDateTime::wxDateTime(wxDateTime_t day,
Month month,
int year,
wxDateTime_t hour,
wxDateTime_t minute,
wxDateTime_t second,
wxDateTime_t millisec)
{
Set(day, month, year, hour, minute, second, millisec);
}
// ----------------------------------------------------------------------------
// wxDateTime accessors
// ----------------------------------------------------------------------------
inline wxLongLong wxDateTime::GetValue() const
{
wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
return m_time;
}
inline time_t wxDateTime::GetTicks() const
{
wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
if ( !IsInStdRange() )
{
return (time_t)-1;
}
return (time_t)((m_time / (long)TIME_T_FACTOR).ToLong()) + WX_TIME_BASE_OFFSET;
}
inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
Month month,
int year)
{
return SetToWeekDay(weekday, -1, month, year);
}
inline wxDateTime
wxDateTime::GetWeekDayInSameWeek(WeekDay weekday,
WeekFlags WXUNUSED(flags)) const
{
MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) );
}
inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const
{
MODIFY_AND_RETURN( SetToNextWeekDay(weekday) );
}
inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const
{
MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) );
}
inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday,
int n,
Month month,
int year) const
{
wxDateTime dt(*this);
return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime;
}
inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday,
Month month,
int year)
{
wxDateTime dt(*this);
return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime;
}
inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const
{
MODIFY_AND_RETURN( SetToLastMonthDay(month, year) );
}
inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
{
MODIFY_AND_RETURN( SetToYearDay(yday) );
}
// ----------------------------------------------------------------------------
// wxDateTime comparison
// ----------------------------------------------------------------------------
inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const
{
return *this == datetime;
}
inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const
{
return *this < datetime;
}
inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const
{
return *this > datetime;
}
inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1,
const wxDateTime& t2) const
{
// no need for assert, will be checked by the functions we call
return IsLaterThan(t1) && IsEarlierThan(t2);
}
inline bool wxDateTime::IsBetween(const wxDateTime& t1,
const wxDateTime& t2) const
{
// no need for assert, will be checked by the functions we call
return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2);
}
inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const
{
Tm tm1 = GetTm(),
tm2 = dt.GetTm();
return tm1.year == tm2.year &&
tm1.mon == tm2.mon &&
tm1.mday == tm2.mday;
}
inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const
{
// notice that we can't do something like this:
//
// m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY
//
// because we have also to deal with (possibly) different DST settings!
Tm tm1 = GetTm(),
tm2 = dt.GetTm();
return tm1.hour == tm2.hour &&
tm1.min == tm2.min &&
tm1.sec == tm2.sec &&
tm1.msec == tm2.msec;
}
inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt,
const wxTimeSpan& ts) const
{
return IsBetween(dt.Subtract(ts), dt.Add(ts));
}
// ----------------------------------------------------------------------------
// wxDateTime arithmetics
// ----------------------------------------------------------------------------
inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const
{
wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
return wxDateTime(m_time + diff.GetValue());
}
inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff)
{
wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
m_time += diff.GetValue();
return *this;
}
inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff)
{
return Add(diff);
}
inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const
{
wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
return wxDateTime(m_time - diff.GetValue());
}
inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff)
{
wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime"));
m_time -= diff.GetValue();
return *this;
}
inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff)
{
return Subtract(diff);
}
inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const
{
wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime"));
return wxTimeSpan(GetValue() - datetime.GetValue());
}
inline wxTimeSpan wxDateTime::operator-(const wxDateTime& dt2) const
{
return this->Subtract(dt2);
}
inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const
{
return wxDateTime(*this).Add(diff);
}
inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff)
{
return Add(diff.Negate());
}
inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const
{
return wxDateTime(*this).Subtract(diff);
}
inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff)
{
return Subtract(diff);
}
inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
{
return Add(diff);
}
// ----------------------------------------------------------------------------
// wxDateTime and timezones
// ----------------------------------------------------------------------------
inline wxDateTime
wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, bool noDST) const
{
MODIFY_AND_RETURN( MakeTimezone(tz, noDST) );
}
inline wxDateTime
wxDateTime::FromTimezone(const wxDateTime::TimeZone& tz, bool noDST) const
{
MODIFY_AND_RETURN( MakeFromTimezone(tz, noDST) );
}
// ----------------------------------------------------------------------------
// wxTimeSpan construction
// ----------------------------------------------------------------------------
inline wxTimeSpan::wxTimeSpan(long hours,
long minutes,
wxLongLong seconds,
wxLongLong milliseconds)
{
// assign first to avoid precision loss
m_diff = hours;
m_diff *= 60l;
m_diff += minutes;
m_diff *= 60l;
m_diff += seconds;
m_diff *= 1000l;
m_diff += milliseconds;
}
// ----------------------------------------------------------------------------
// wxTimeSpan accessors
// ----------------------------------------------------------------------------
inline wxLongLong wxTimeSpan::GetSeconds() const
{
return m_diff / 1000l;
}
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());
}
inline int wxTimeSpan::GetHours() const
{
return GetMinutes() / 60;
}
inline int wxTimeSpan::GetDays() const
{
return GetHours() / 24;
}
inline int wxTimeSpan::GetWeeks() const
{
return GetDays() / 7;
}
// ----------------------------------------------------------------------------
// wxTimeSpan arithmetics
// ----------------------------------------------------------------------------
inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const
{
return wxTimeSpan(m_diff + diff.GetValue());
}
inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff)
{
m_diff += diff.GetValue();
return *this;
}
inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const
{
return wxTimeSpan(m_diff - diff.GetValue());
}
inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff)
{
m_diff -= diff.GetValue();
return *this;
}
inline wxTimeSpan& wxTimeSpan::Multiply(int n)
{
m_diff *= (long)n;
return *this;
}
inline wxTimeSpan wxTimeSpan::Multiply(int n) const
{
return wxTimeSpan(m_diff * (long)n);
}
inline wxTimeSpan wxTimeSpan::Abs() const
{
return wxTimeSpan(GetValue().Abs());
}
inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const
{
return GetValue() == ts.GetValue();
}
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
// ----------------------------------------------------------------------------
inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other)
{
m_years += other.m_years;
m_months += other.m_months;
m_weeks += other.m_weeks;
m_days += other.m_days;
return *this;
}
inline wxDateSpan& wxDateSpan::Add(const wxDateSpan& other)
{
return *this += other;
}
inline wxDateSpan wxDateSpan::Add(const wxDateSpan& other) const
{
wxDateSpan ds(*this);
ds.Add(other);
return ds;
}
inline wxDateSpan& wxDateSpan::Multiply(int factor)
{
m_years *= factor;
m_months *= factor;
m_weeks *= factor;
m_days *= factor;
return *this;
}
inline wxDateSpan wxDateSpan::Multiply(int factor) const
{
wxDateSpan ds(*this);
ds.Multiply(factor);
return ds;
}
inline wxDateSpan wxDateSpan::Negate() const
{
return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days);
}
inline wxDateSpan& wxDateSpan::Neg()
{
m_years = -m_years;
m_months = -m_months;
m_weeks = -m_weeks;
m_days = -m_days;
return *this;
}
inline wxDateSpan& wxDateSpan::operator-=(const wxDateSpan& other)
{
return *this += other.Negate();
}
inline wxDateSpan& wxDateSpan::Subtract(const wxDateSpan& other)
{
return *this -= other;
}
inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const
{
wxDateSpan ds(*this);
ds.Subtract(other);
return ds;
}
#undef MILLISECONDS_PER_DAY
#undef MODIFY_AND_RETURN
// ============================================================================
// binary operators
// ============================================================================
// ----------------------------------------------------------------------------
// wxTimeSpan operators
// ----------------------------------------------------------------------------
wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts);
// ----------------------------------------------------------------------------
// wxDateSpan
// ----------------------------------------------------------------------------
wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds);
// ============================================================================
// other helper functions
// ============================================================================
// ----------------------------------------------------------------------------
// iteration helpers: can be used to write a for loop over enum variable like
// this:
// for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) )
// ----------------------------------------------------------------------------
WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m);
WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m);
WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd);
WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd);
#endif // wxUSE_DATETIME
#endif // _WX_DATETIME_H
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/itemattr.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/itemattr.h
// Purpose: wxItemAttr class declaration
// Author: Vadim Zeitlin
// Created: 2016-04-16 (extracted from wx/listctrl.h)
// Copyright: (c) 2016 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ITEMATTR_H_
#define _WX_ITEMATTR_H_
// ----------------------------------------------------------------------------
// wxItemAttr: a structure containing the visual attributes of an item
// ----------------------------------------------------------------------------
class wxItemAttr
{
public:
// ctors
wxItemAttr() { }
wxItemAttr(const wxColour& colText,
const wxColour& colBack,
const wxFont& font)
: m_colText(colText), m_colBack(colBack), m_font(font)
{
}
// default copy ctor, assignment operator and dtor are ok
bool operator==(const wxItemAttr& other) const
{
return m_colText == other.m_colText &&
m_colBack == other.m_colBack &&
m_font == other.m_font;
}
bool operator!=(const wxItemAttr& other) const
{
return !(*this == other);
}
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; }
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
void SetFont(const wxFont& font) { m_font = font; }
// accessors
bool HasTextColour() const { return m_colText.IsOk(); }
bool HasBackgroundColour() const { return m_colBack.IsOk(); }
bool HasFont() const { return m_font.IsOk(); }
bool HasColours() const { return HasTextColour() || HasBackgroundColour(); }
bool IsDefault() const { return !HasColours() && !HasFont(); }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
const wxFont& GetFont() const { return m_font; }
// this is almost like assignment operator except it doesn't overwrite the
// fields unset in the source attribute
void AssignFrom(const wxItemAttr& source)
{
if ( source.HasTextColour() )
SetTextColour(source.GetTextColour());
if ( source.HasBackgroundColour() )
SetBackgroundColour(source.GetBackgroundColour());
if ( source.HasFont() )
SetFont(source.GetFont());
}
private:
wxColour m_colText,
m_colBack;
wxFont m_font;
};
#endif // _WX_ITEMATTR_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/fontpicker.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/fontpicker.h
// Purpose: wxFontPickerCtrl base header
// Author: Francesco Montorsi
// Modified by:
// Created: 14/4/2006
// Copyright: (c) Francesco Montorsi
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FONTPICKER_H_BASE_
#define _WX_FONTPICKER_H_BASE_
#include "wx/defs.h"
#if wxUSE_FONTPICKERCTRL
#include "wx/pickerbase.h"
class WXDLLIMPEXP_FWD_CORE wxFontPickerEvent;
extern WXDLLIMPEXP_DATA_CORE(const char) wxFontPickerWidgetNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxFontPickerCtrlNameStr[];
// ----------------------------------------------------------------------------
// wxFontPickerWidgetBase: a generic abstract interface which must be
// implemented by controls used by wxFontPickerCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFontPickerWidgetBase
{
public:
wxFontPickerWidgetBase() : m_selectedFont(*wxNORMAL_FONT) { }
virtual ~wxFontPickerWidgetBase() {}
wxFont GetSelectedFont() const
{ return m_selectedFont; }
virtual void SetSelectedFont(const wxFont &f)
{ m_selectedFont = f; UpdateFont(); }
virtual wxColour GetSelectedColour() const = 0;
virtual void SetSelectedColour(const wxColour &colour) = 0;
protected:
virtual void UpdateFont() = 0;
// the current font (may be invalid if none)
// NOTE: don't call this m_font as wxWindow::m_font already exists
wxFont m_selectedFont;
};
// Styles which must be supported by all controls implementing wxFontPickerWidgetBase
// NB: these styles must be defined to carefully-chosen values to
// avoid conflicts with wxButton's styles
// keeps the label of the button updated with the fontface name + font size
// E.g. choosing "Times New Roman bold, italic with size 10" from the fontdialog,
// updates the wxFontButtonGeneric's label (overwriting any previous label)
// with the "Times New Roman, 10" text (only fontface + fontsize is displayed
// to avoid extralong labels).
#define wxFNTP_FONTDESC_AS_LABEL 0x0008
// uses the currently selected font to draw the label of the button
#define wxFNTP_USEFONT_FOR_LABEL 0x0010
#define wxFONTBTN_DEFAULT_STYLE \
(wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL)
// native version currently only exists in wxGTK2
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/fontpicker.h"
#define wxFontPickerWidget wxFontButton
#else
#include "wx/generic/fontpickerg.h"
#define wxFontPickerWidget wxGenericFontButton
#endif
// ----------------------------------------------------------------------------
// wxFontPickerCtrl specific flags
// ----------------------------------------------------------------------------
#define wxFNTP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
#define wxFNTP_DEFAULT_STYLE (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)
// not a style but rather the default value of the minimum/maximum pointsize allowed
#define wxFNTP_MINPOINT_SIZE 0
#define wxFNTP_MAXPOINT_SIZE 100
// ----------------------------------------------------------------------------
// wxFontPickerCtrl: platform-independent class which embeds the
// platform-dependent wxFontPickerWidget andm if wxFNTP_USE_TEXTCTRL style is
// used, a textctrl next to it.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFontPickerCtrl : public wxPickerBase
{
public:
wxFontPickerCtrl()
: m_nMinPointSize(wxFNTP_MINPOINT_SIZE), m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
{
}
virtual ~wxFontPickerCtrl() {}
wxFontPickerCtrl(wxWindow *parent,
wxWindowID id,
const wxFont& initial = wxNullFont,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFNTP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFontPickerCtrlNameStr)
: m_nMinPointSize(wxFNTP_MINPOINT_SIZE), m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
{
Create(parent, id, initial, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxFont& initial = wxNullFont,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFNTP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFontPickerCtrlNameStr);
public: // public API
// get the font chosen
wxFont GetSelectedFont() const
{ return GetPickerWidget()->GetSelectedFont(); }
// sets currently displayed font
void SetSelectedFont(const wxFont& f);
// returns the selected color
wxColour GetSelectedColour() const
{ return GetPickerWidget()->GetSelectedColour(); }
// sets the currently selected color
void SetSelectedColour(const wxColour& colour)
{ GetPickerWidget()->SetSelectedColour(colour); }
// set/get the min point size
void SetMinPointSize(unsigned int min);
unsigned int GetMinPointSize() const
{ return m_nMinPointSize; }
// set/get the max point size
void SetMaxPointSize(unsigned int max);
unsigned int GetMaxPointSize() const
{ return m_nMaxPointSize; }
public: // internal functions
void UpdatePickerFromTextCtrl() wxOVERRIDE;
void UpdateTextCtrlFromPicker() wxOVERRIDE;
// event handler for our picker
void OnFontChange(wxFontPickerEvent &);
// used to convert wxString <-> wxFont
virtual wxString Font2String(const wxFont &font);
virtual wxFont String2Font(const wxString &font);
protected:
// extracts the style for our picker from wxFontPickerCtrl's style
long GetPickerStyle(long style) const wxOVERRIDE
{ return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); }
// the minimum pointsize allowed to the user
unsigned int m_nMinPointSize;
// the maximum pointsize allowed to the user
unsigned int m_nMaxPointSize;
private:
wxFontPickerWidget* GetPickerWidget() const
{ return static_cast<wxFontPickerWidget*>(m_picker); }
wxDECLARE_DYNAMIC_CLASS(wxFontPickerCtrl);
};
// ----------------------------------------------------------------------------
// wxFontPickerEvent: used by wxFontPickerCtrl only
// ----------------------------------------------------------------------------
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FONTPICKER_CHANGED, wxFontPickerEvent );
class WXDLLIMPEXP_CORE wxFontPickerEvent : public wxCommandEvent
{
public:
wxFontPickerEvent() {}
wxFontPickerEvent(wxObject *generator, int id, const wxFont &f)
: wxCommandEvent(wxEVT_FONTPICKER_CHANGED, id),
m_font(f)
{
SetEventObject(generator);
}
wxFont GetFont() const { return m_font; }
void SetFont(const wxFont &c) { m_font = c; }
// default copy ctor, assignment operator and dtor are ok
virtual wxEvent *Clone() const wxOVERRIDE { return new wxFontPickerEvent(*this); }
private:
wxFont m_font;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFontPickerEvent);
};
// ----------------------------------------------------------------------------
// event types and macros
// ----------------------------------------------------------------------------
typedef void (wxEvtHandler::*wxFontPickerEventFunction)(wxFontPickerEvent&);
#define wxFontPickerEventHandler(func) \
wxEVENT_HANDLER_CAST(wxFontPickerEventFunction, func)
#define EVT_FONTPICKER_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_FONTPICKER_CHANGED, id, wxFontPickerEventHandler(fn))
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_FONTPICKER_CHANGED wxEVT_FONTPICKER_CHANGED
#endif // wxUSE_FONTPICKERCTRL
#endif
// _WX_FONTPICKER_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/gbsizer.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/gbsizer.h
// Purpose: wxGridBagSizer: A sizer that can lay out items in a grid,
// with items at specified cells, and with the option of row
// and/or column spanning
//
// Author: Robin Dunn
// Created: 03-Nov-2003
// Copyright: (c) Robin Dunn
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __WXGBSIZER_H__
#define __WXGBSIZER_H__
#include "wx/sizer.h"
//---------------------------------------------------------------------------
// Classes to represent a position in the grid and a size of an item in the
// grid, IOW, the number of rows and columns it occupies. I chose to use these
// instead of wxPoint and wxSize because they are (x,y) and usually pixel
// oriented while grids and tables are usually thought of as (row,col) so some
// confusion would definitely result in using wxPoint...
//
// NOTE: This should probably be refactored to a common RowCol data type which
// is used for this and also for wxGridCellCoords.
//---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGBPosition
{
public:
wxGBPosition() : m_row(0), m_col(0) {}
wxGBPosition(int row, int col) : m_row(row), m_col(col) {}
// default copy ctor and assignment operator are okay.
int GetRow() const { return m_row; }
int GetCol() const { return m_col; }
void SetRow(int row) { m_row = row; }
void SetCol(int col) { m_col = col; }
bool operator==(const wxGBPosition& p) const { return m_row == p.m_row && m_col == p.m_col; }
bool operator!=(const wxGBPosition& p) const { return !(*this == p); }
private:
int m_row;
int m_col;
};
class WXDLLIMPEXP_CORE wxGBSpan
{
public:
wxGBSpan() { Init(); }
wxGBSpan(int rowspan, int colspan)
{
// Initialize the members to valid values as not doing it may result in
// infinite loop in wxGBSizer code if the user passed 0 for any of
// them, see #12934.
Init();
SetRowspan(rowspan);
SetColspan(colspan);
}
// default copy ctor and assignment operator are okay.
// Factor constructor creating an invalid wxGBSpan: this is mostly supposed
// to be used as return value for functions returning wxGBSpan in case of
// errors.
static wxGBSpan Invalid()
{
return wxGBSpan(NULL);
}
int GetRowspan() const { return m_rowspan; }
int GetColspan() const { return m_colspan; }
void SetRowspan(int rowspan)
{
wxCHECK_RET( rowspan > 0, "Row span should be strictly positive" );
m_rowspan = rowspan;
}
void SetColspan(int colspan)
{
wxCHECK_RET( colspan > 0, "Column span should be strictly positive" );
m_colspan = colspan;
}
bool operator==(const wxGBSpan& o) const { return m_rowspan == o.m_rowspan && m_colspan == o.m_colspan; }
bool operator!=(const wxGBSpan& o) const { return !(*this == o); }
private:
// This private ctor is used by Invalid() only.
wxGBSpan(struct InvalidCtorTag*)
{
m_rowspan =
m_colspan = -1;
}
void Init()
{
m_rowspan =
m_colspan = 1;
}
int m_rowspan;
int m_colspan;
};
extern WXDLLIMPEXP_DATA_CORE(const wxGBSpan) wxDefaultSpan;
//---------------------------------------------------------------------------
// wxGBSizerItem
//---------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxGridBagSizer;
class WXDLLIMPEXP_CORE wxGBSizerItem : public wxSizerItem
{
public:
// spacer
wxGBSizerItem( int width,
int height,
const wxGBPosition& pos,
const wxGBSpan& span=wxDefaultSpan,
int flag=0,
int border=0,
wxObject* userData=NULL);
// window
wxGBSizerItem( wxWindow *window,
const wxGBPosition& pos,
const wxGBSpan& span=wxDefaultSpan,
int flag=0,
int border=0,
wxObject* userData=NULL );
// subsizer
wxGBSizerItem( wxSizer *sizer,
const wxGBPosition& pos,
const wxGBSpan& span=wxDefaultSpan,
int flag=0,
int border=0,
wxObject* userData=NULL );
// default ctor
wxGBSizerItem();
// Get the grid position of the item
wxGBPosition GetPos() const { return m_pos; }
void GetPos(int& row, int& col) const;
// Get the row and column spanning of the item
wxGBSpan GetSpan() const { return m_span; }
void GetSpan(int& rowspan, int& colspan) const;
// If the item is already a member of a sizer then first ensure that there
// is no other item that would intersect with this one at the new
// position, then set the new position. Returns true if the change is
// successful and after the next Layout the item will be moved.
bool SetPos( const wxGBPosition& pos );
// If the item is already a member of a sizer then first ensure that there
// is no other item that would intersect with this one with its new
// spanning size, then set the new spanning. Returns true if the change
// is successful and after the next Layout the item will be resized.
bool SetSpan( const wxGBSpan& span );
// Returns true if this item and the other item intersect
bool Intersects(const wxGBSizerItem& other);
// Returns true if the given pos/span would intersect with this item.
bool Intersects(const wxGBPosition& pos, const wxGBSpan& span);
// Get the row and column of the endpoint of this item
void GetEndPos(int& row, int& col);
wxGridBagSizer* GetGBSizer() const { return m_gbsizer; }
void SetGBSizer(wxGridBagSizer* sizer) { m_gbsizer = sizer; }
protected:
wxGBPosition m_pos;
wxGBSpan m_span;
wxGridBagSizer* m_gbsizer; // so SetPos/SetSpan can check for intersects
private:
wxDECLARE_DYNAMIC_CLASS(wxGBSizerItem);
wxDECLARE_NO_COPY_CLASS(wxGBSizerItem);
};
//---------------------------------------------------------------------------
// wxGridBagSizer
//---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGridBagSizer : public wxFlexGridSizer
{
public:
wxGridBagSizer(int vgap = 0, int hgap = 0 );
// The Add methods return true if the item was successfully placed at the
// given position, false if something was already there.
wxSizerItem* Add( wxWindow *window,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
wxSizerItem* Add( wxSizer *sizer,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
wxSizerItem* Add( int width,
int height,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
wxObject* userData = NULL );
wxSizerItem* Add( wxGBSizerItem *item );
// Get/Set the size used for cells in the grid with no item.
wxSize GetEmptyCellSize() const { return m_emptyCellSize; }
void SetEmptyCellSize(const wxSize& sz) { m_emptyCellSize = sz; }
// Get the size of the specified cell, including hgap and vgap. Only
// valid after a Layout.
wxSize GetCellSize(int row, int col) const;
// Get the grid position of the specified item (non-recursive)
wxGBPosition GetItemPosition(wxWindow *window);
wxGBPosition GetItemPosition(wxSizer *sizer);
wxGBPosition GetItemPosition(size_t index);
// Set the grid position of the specified item. Returns true on success.
// If the move is not allowed (because an item is already there) then
// false is returned. (non-recursive)
bool SetItemPosition(wxWindow *window, const wxGBPosition& pos);
bool SetItemPosition(wxSizer *sizer, const wxGBPosition& pos);
bool SetItemPosition(size_t index, const wxGBPosition& pos);
// Get the row/col spanning of the specified item (non-recursive)
wxGBSpan GetItemSpan(wxWindow *window);
wxGBSpan GetItemSpan(wxSizer *sizer);
wxGBSpan GetItemSpan(size_t index);
// Set the row/col spanning of the specified item. Returns true on
// success. If the move is not allowed (because an item is already there)
// then false is returned. (non-recursive)
bool SetItemSpan(wxWindow *window, const wxGBSpan& span);
bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span);
bool SetItemSpan(size_t index, const wxGBSpan& span);
// Find the sizer item for the given window or subsizer, returns NULL if
// not found. (non-recursive)
wxGBSizerItem* FindItem(wxWindow* window);
wxGBSizerItem* FindItem(wxSizer* sizer);
// Return the sizer item for the given grid cell, or NULL if there is no
// item at that position. (non-recursive)
wxGBSizerItem* FindItemAtPosition(const wxGBPosition& pos);
// Return the sizer item located at the point given in pt, or NULL if
// there is no item at that point. The (x,y) coordinates in pt correspond
// to the client coordinates of the window using the sizer for
// layout. (non-recursive)
wxGBSizerItem* FindItemAtPoint(const wxPoint& pt);
// Return the sizer item that has a matching user data (it only compares
// pointer values) or NULL if not found. (non-recursive)
wxGBSizerItem* FindItemWithData(const wxObject* userData);
// These are what make the sizer do size calculations and layout
virtual void RecalcSizes() wxOVERRIDE;
virtual wxSize CalcMin() wxOVERRIDE;
// Look at all items and see if any intersect (or would overlap) the given
// item. Returns true if so, false if there would be no overlap. If an
// excludeItem is given then it will not be checked for intersection, for
// example it may be the item we are checking the position of.
bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL);
bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL);
// The Add base class virtuals should not be used with this class, but
// we'll try to make them automatically select a location for the item
// anyway.
virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
// The Insert and Prepend base class virtuals that are not appropriate for
// this class and should not be used. Their implementation in this class
// simply fails.
virtual wxSizerItem* Add( wxSizerItem *item );
virtual wxSizerItem* Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ) wxOVERRIDE;
virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL );
virtual wxSizerItem* Prepend( wxSizerItem *item );
protected:
wxGBPosition FindEmptyCell();
void AdjustForOverflow();
wxSize m_emptyCellSize;
private:
wxDECLARE_CLASS(wxGridBagSizer);
wxDECLARE_NO_COPY_CLASS(wxGridBagSizer);
};
//---------------------------------------------------------------------------
#endif
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/settings.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/settings.h
// Purpose: wxSystemSettings class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SETTINGS_H_BASE_
#define _WX_SETTINGS_H_BASE_
#include "wx/colour.h"
#include "wx/font.h"
class WXDLLIMPEXP_FWD_CORE wxWindow;
// possible values for wxSystemSettings::GetFont() parameter
//
// NB: wxMSW assumes that they have the same values as the parameters of
// Windows GetStockObject() API, don't change the values!
enum wxSystemFont
{
wxSYS_OEM_FIXED_FONT = 10,
wxSYS_ANSI_FIXED_FONT,
wxSYS_ANSI_VAR_FONT,
wxSYS_SYSTEM_FONT,
wxSYS_DEVICE_DEFAULT_FONT,
// don't use: this is here just to make the values of enum elements
// coincide with the corresponding MSW constants
wxSYS_DEFAULT_PALETTE,
// don't use: MSDN says that this is a stock object provided only
// for compatibility with 16-bit Windows versions earlier than 3.0!
wxSYS_SYSTEM_FIXED_FONT,
wxSYS_DEFAULT_GUI_FONT,
// this was just a temporary aberration, do not use it any more
wxSYS_ICONTITLE_FONT = wxSYS_DEFAULT_GUI_FONT
};
// possible values for wxSystemSettings::GetColour() parameter
//
// NB: wxMSW assumes that they have the same values as the parameters of
// Windows GetSysColor() API, don't change the values!
enum wxSystemColour
{
wxSYS_COLOUR_SCROLLBAR,
wxSYS_COLOUR_DESKTOP,
wxSYS_COLOUR_ACTIVECAPTION,
wxSYS_COLOUR_INACTIVECAPTION,
wxSYS_COLOUR_MENU,
wxSYS_COLOUR_WINDOW,
wxSYS_COLOUR_WINDOWFRAME,
wxSYS_COLOUR_MENUTEXT,
wxSYS_COLOUR_WINDOWTEXT,
wxSYS_COLOUR_CAPTIONTEXT,
wxSYS_COLOUR_ACTIVEBORDER,
wxSYS_COLOUR_INACTIVEBORDER,
wxSYS_COLOUR_APPWORKSPACE,
wxSYS_COLOUR_HIGHLIGHT,
wxSYS_COLOUR_HIGHLIGHTTEXT,
wxSYS_COLOUR_BTNFACE,
wxSYS_COLOUR_BTNSHADOW,
wxSYS_COLOUR_GRAYTEXT,
wxSYS_COLOUR_BTNTEXT,
wxSYS_COLOUR_INACTIVECAPTIONTEXT,
wxSYS_COLOUR_BTNHIGHLIGHT,
wxSYS_COLOUR_3DDKSHADOW,
wxSYS_COLOUR_3DLIGHT,
wxSYS_COLOUR_INFOTEXT,
wxSYS_COLOUR_INFOBK,
wxSYS_COLOUR_LISTBOX,
wxSYS_COLOUR_HOTLIGHT,
wxSYS_COLOUR_GRADIENTACTIVECAPTION,
wxSYS_COLOUR_GRADIENTINACTIVECAPTION,
wxSYS_COLOUR_MENUHILIGHT,
wxSYS_COLOUR_MENUBAR,
wxSYS_COLOUR_LISTBOXTEXT,
wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT,
wxSYS_COLOUR_MAX,
// synonyms
wxSYS_COLOUR_BACKGROUND = wxSYS_COLOUR_DESKTOP,
wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE,
wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW,
wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
wxSYS_COLOUR_FRAMEBK = wxSYS_COLOUR_BTNFACE
};
// possible values for wxSystemSettings::GetMetric() index parameter
//
// NB: update the conversion table in msw/settings.cpp if you change the values
// of the elements of this enum
enum wxSystemMetric
{
wxSYS_MOUSE_BUTTONS = 1,
wxSYS_BORDER_X,
wxSYS_BORDER_Y,
wxSYS_CURSOR_X,
wxSYS_CURSOR_Y,
wxSYS_DCLICK_X,
wxSYS_DCLICK_Y,
wxSYS_DRAG_X,
wxSYS_DRAG_Y,
wxSYS_EDGE_X,
wxSYS_EDGE_Y,
wxSYS_HSCROLL_ARROW_X,
wxSYS_HSCROLL_ARROW_Y,
wxSYS_HTHUMB_X,
wxSYS_ICON_X,
wxSYS_ICON_Y,
wxSYS_ICONSPACING_X,
wxSYS_ICONSPACING_Y,
wxSYS_WINDOWMIN_X,
wxSYS_WINDOWMIN_Y,
wxSYS_SCREEN_X,
wxSYS_SCREEN_Y,
wxSYS_FRAMESIZE_X,
wxSYS_FRAMESIZE_Y,
wxSYS_SMALLICON_X,
wxSYS_SMALLICON_Y,
wxSYS_HSCROLL_Y,
wxSYS_VSCROLL_X,
wxSYS_VSCROLL_ARROW_X,
wxSYS_VSCROLL_ARROW_Y,
wxSYS_VTHUMB_Y,
wxSYS_CAPTION_Y,
wxSYS_MENU_Y,
wxSYS_NETWORK_PRESENT,
wxSYS_PENWINDOWS_PRESENT,
wxSYS_SHOW_SOUNDS,
wxSYS_SWAP_BUTTONS,
wxSYS_DCLICK_MSEC,
wxSYS_CARET_ON_MSEC,
wxSYS_CARET_OFF_MSEC,
wxSYS_CARET_TIMEOUT_MSEC
};
// possible values for wxSystemSettings::HasFeature() parameter
enum wxSystemFeature
{
wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1,
wxSYS_CAN_ICONIZE_FRAME,
wxSYS_TABLET_PRESENT
};
// values for different screen designs
enum wxSystemScreenType
{
wxSYS_SCREEN_NONE = 0, // not yet defined
wxSYS_SCREEN_TINY, // <
wxSYS_SCREEN_PDA, // >= 320x240
wxSYS_SCREEN_SMALL, // >= 640x480
wxSYS_SCREEN_DESKTOP // >= 800x600
};
// ----------------------------------------------------------------------------
// wxSystemSettingsNative: defines the API for wxSystemSettings class
// ----------------------------------------------------------------------------
// this is a namespace rather than a class: it has only non virtual static
// functions
//
// also note that the methods are implemented in the platform-specific source
// files (i.e. this is not a real base class as we can't override its virtual
// functions because it doesn't have any)
class WXDLLIMPEXP_CORE wxSystemSettingsNative
{
public:
// get a standard system colour
static wxColour GetColour(wxSystemColour index);
// get a standard system font
static wxFont GetFont(wxSystemFont index);
// get a system-dependent metric
static int GetMetric(wxSystemMetric index, wxWindow * win = NULL);
// return true if the port has certain feature
static bool HasFeature(wxSystemFeature index);
};
// ----------------------------------------------------------------------------
// include the declaration of the real platform-dependent class
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSystemSettings : public wxSystemSettingsNative
{
public:
#ifdef __WXUNIVERSAL__
// in wxUniversal we want to use the theme standard colours instead of the
// system ones, otherwise wxSystemSettings is just the same as
// wxSystemSettingsNative
static wxColour GetColour(wxSystemColour index);
// some metrics are toolkit-dependent and provided by wxUniv, some are
// lowlevel
static int GetMetric(wxSystemMetric index, wxWindow *win = NULL);
#endif // __WXUNIVERSAL__
// Get system screen design (desktop, pda, ..) used for
// laying out various dialogs.
static wxSystemScreenType GetScreenType();
// Override default.
static void SetScreenType( wxSystemScreenType screen );
// Value
static wxSystemScreenType ms_screen;
};
#endif
// _WX_SETTINGS_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/frame.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/frame.h
// Purpose: wxFrame class interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 15.11.99
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FRAME_H_BASE_
#define _WX_FRAME_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/toplevel.h" // the base class
#include "wx/statusbr.h"
// the default names for various classs
extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[];
class WXDLLIMPEXP_FWD_CORE wxFrame;
class WXDLLIMPEXP_FWD_CORE wxMenuBar;
class WXDLLIMPEXP_FWD_CORE wxMenuItem;
class WXDLLIMPEXP_FWD_CORE wxStatusBar;
class WXDLLIMPEXP_FWD_CORE wxToolBar;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// wxFrame-specific (i.e. not for wxDialog) styles
//
// Also see the bit summary table in wx/toplevel.h.
#define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only)
#define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu
#define wxFRAME_FLOAT_ON_PARENT 0x0008 // Always above its parent
// ----------------------------------------------------------------------------
// wxFrame is a top-level window with optional menubar, statusbar and toolbar
//
// For each of *bars, a frame may have several of them, but only one is
// managed by the frame, i.e. resized/moved when the frame is and whose size
// is accounted for in client size calculations - all others should be taken
// care of manually. The CreateXXXBar() functions create this, main, XXXBar,
// but the actual creation is done in OnCreateXXXBar() functions which may be
// overridden to create custom objects instead of standard ones when
// CreateXXXBar() is called.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFrameBase : public wxTopLevelWindow
{
public:
// construction
wxFrameBase();
virtual ~wxFrameBase();
wxFrame *New(wxWindow *parent,
wxWindowID winid,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
// frame state
// -----------
// get the origin of the client area (which may be different from (0, 0)
// if the frame has a toolbar) in client coordinates
virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE;
// menu bar functions
// ------------------
#if wxUSE_MENUS
virtual void SetMenuBar(wxMenuBar *menubar);
virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; }
// find the item by id in the frame menu bar: this is an internal function
// and exists mainly in order to be overridden in the MDI parent frame
// which also looks at its active child menu bar
virtual wxMenuItem *FindItemInMenuBar(int menuId) const;
// generate menu command corresponding to the given menu item
//
// returns true if processed
bool ProcessCommand(wxMenuItem *item);
// generate menu command corresponding to the given menu command id
//
// returns true if processed
bool ProcessCommand(int winid);
#else
bool ProcessCommand(int WXUNUSED(winid)) { return false; }
#endif // wxUSE_MENUS
// status bar functions
// --------------------
#if wxUSE_STATUSBAR
// create the main status bar by calling OnCreateStatusBar()
virtual wxStatusBar* CreateStatusBar(int number = 1,
long style = wxSTB_DEFAULT_STYLE,
wxWindowID winid = 0,
const wxString& name = wxStatusLineNameStr);
// return a new status bar
virtual wxStatusBar *OnCreateStatusBar(int number,
long style,
wxWindowID winid,
const wxString& name);
// get the main status bar
virtual wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
// sets the main status bar
virtual void SetStatusBar(wxStatusBar *statBar);
// forward these to status bar
virtual void SetStatusText(const wxString &text, int number = 0);
virtual void SetStatusWidths(int n, const int widths_field[]);
void PushStatusText(const wxString &text, int number = 0);
void PopStatusText(int number = 0);
// set the status bar pane the help will be shown in
void SetStatusBarPane(int n) { m_statusBarPane = n; }
int GetStatusBarPane() const { return m_statusBarPane; }
#endif // wxUSE_STATUSBAR
// toolbar functions
// -----------------
#if wxUSE_TOOLBAR
// create main toolbar bycalling OnCreateToolBar()
virtual wxToolBar* CreateToolBar(long style = -1,
wxWindowID winid = wxID_ANY,
const wxString& name = wxToolBarNameStr);
// return a new toolbar
virtual wxToolBar *OnCreateToolBar(long style,
wxWindowID winid,
const wxString& name );
// get/set the main toolbar
virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
virtual void SetToolBar(wxToolBar *toolbar);
#endif // wxUSE_TOOLBAR
// implementation only from now on
// -------------------------------
// event handlers
#if wxUSE_MENUS
void OnMenuOpen(wxMenuEvent& event);
#if wxUSE_STATUSBAR
void OnMenuClose(wxMenuEvent& event);
void OnMenuHighlight(wxMenuEvent& event);
#endif // wxUSE_STATUSBAR
// send wxUpdateUIEvents for all menu items in the menubar,
// or just for menu if non-NULL
virtual void DoMenuUpdates(wxMenu* menu = NULL);
#endif // wxUSE_MENUS
// do the UI update processing for this window
virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) wxOVERRIDE;
// Implement internal behaviour (menu updating on some platforms)
virtual void OnInternalIdle() wxOVERRIDE;
#if wxUSE_MENUS || wxUSE_TOOLBAR
// show help text for the currently selected menu or toolbar item
// (typically in the status bar) or hide it and restore the status bar text
// originally shown before the menu was opened if show == false
virtual void DoGiveHelp(const wxString& text, bool show);
#endif
virtual bool IsClientAreaChild(const wxWindow *child) const wxOVERRIDE
{
return !IsOneOfBars(child) && wxTopLevelWindow::IsClientAreaChild(child);
}
protected:
// the frame main menu/status/tool bars
// ------------------------------------
// this (non virtual!) function should be called from dtor to delete the
// main menubar, statusbar and toolbar (if any)
void DeleteAllBars();
// test whether this window makes part of the frame
virtual bool IsOneOfBars(const wxWindow *win) const wxOVERRIDE;
#if wxUSE_MENUS
// override to update menu bar position when the frame size changes
virtual void PositionMenuBar() { }
// override to do something special when the menu bar is being removed
// from the frame
virtual void DetachMenuBar();
// override to do something special when the menu bar is attached to the
// frame
virtual void AttachMenuBar(wxMenuBar *menubar);
// Return true if we should update the menu item state from idle event
// handler or false if we should delay it until the menu is opened.
static bool ShouldUpdateMenuFromIdle();
wxMenuBar *m_frameMenuBar;
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR)
// the saved status bar text overwritten by DoGiveHelp()
wxString m_oldStatusText;
// the last help string we have shown in the status bar
wxString m_lastHelpShown;
#endif
#if wxUSE_STATUSBAR
// override to update status bar position (or anything else) when
// something changes
virtual void PositionStatusBar() { }
// show the help string for the given menu item using DoGiveHelp() if the
// given item does have a help string (as determined by FindInMenuBar()),
// return false if there is no help for such item
bool ShowMenuHelp(int helpid);
wxStatusBar *m_frameStatusBar;
#endif // wxUSE_STATUSBAR
int m_statusBarPane;
#if wxUSE_TOOLBAR
// override to update status bar position (or anything else) when
// something changes
virtual void PositionToolBar() { }
wxToolBar *m_frameToolBar;
#endif // wxUSE_TOOLBAR
#if wxUSE_MENUS
wxDECLARE_EVENT_TABLE();
#endif // wxUSE_MENUS
wxDECLARE_NO_COPY_CLASS(wxFrameBase);
};
// include the real class declaration
#if defined(__WXUNIVERSAL__)
#include "wx/univ/frame.h"
#else // !__WXUNIVERSAL__
#if defined(__WXMSW__)
#include "wx/msw/frame.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/frame.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/frame.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/frame.h"
#elif defined(__WXMAC__)
#include "wx/osx/frame.h"
#elif defined(__WXQT__)
#include "wx/qt/frame.h"
#endif
#endif
#endif
// _WX_FRAME_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/animdecod.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/animdecod.h
// Purpose: wxAnimationDecoder
// Author: Francesco Montorsi
// Copyright: (c) 2006 Francesco Montorsi
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ANIMDECOD_H
#define _WX_ANIMDECOD_H
#include "wx/defs.h"
#if wxUSE_STREAMS
#include "wx/colour.h"
#include "wx/gdicmn.h"
#include "wx/log.h"
#include "wx/stream.h"
class WXDLLIMPEXP_FWD_CORE wxImage;
/*
Differences between a wxAnimationDecoder and a wxImageHandler:
1) wxImageHandlers always load an input stream directly into a given wxImage
object converting from the format-specific data representation to the
wxImage native format (RGB24).
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.
2) wxAnimationDecoders contain the animation data in some internal variable.
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.
5) wxAnimationDecoders are directly used by wxAnimation (generic implementation)
as wxObjectRefData while they need to be 'wrapped' by a wxImageHandler for
wxImage uses.
*/
// --------------------------------------------------------------------------
// Constants
// --------------------------------------------------------------------------
// NB: the values of these enum items are not casual but coincide with the
// GIF disposal codes. Do not change them !!
enum wxAnimationDisposal
{
// No disposal specified. The decoder is not required to take any action.
wxANIM_UNSPECIFIED = -1,
// 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
// restored to the background color.
wxANIM_TOBACKGROUND = 1,
// 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
};
enum wxAnimationType
{
wxANIMATION_TYPE_INVALID,
wxANIMATION_TYPE_GIF,
wxANIMATION_TYPE_ANI,
wxANIMATION_TYPE_ANY
};
// --------------------------------------------------------------------------
// wxAnimationDecoder class
// --------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxAnimationDecoder : public wxObjectRefData
{
public:
wxAnimationDecoder()
{
m_nFrames = 0;
}
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 wxAnimationDecoder *Clone() const = 0;
virtual wxAnimationType GetType() const = 0;
// convert given frame to wxImage
virtual bool ConvertToImage(unsigned int frame, wxImage *image) const = 0;
// frame specific data getters
// not all frames may be of the same size; e.g. GIF allows to
// specify that between two frames only a smaller portion of the
// entire animation has changed.
virtual wxSize GetFrameSize(unsigned int frame) const = 0;
// the position of this frame in case it's not as big as m_szAnimation
// or wxPoint(0,0) otherwise.
virtual wxPoint GetFramePosition(unsigned int frame) const = 0;
// what should be done after displaying this frame.
virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const = 0;
// the number of milliseconds this frame should be displayed.
// if returns -1 then the frame must be displayed forever.
virtual long GetDelay(unsigned int frame) const = 0;
// the transparent colour for this frame if any or wxNullColour.
virtual wxColour GetTransparentColour(unsigned int frame) const = 0;
// get global data
wxSize GetAnimationSize() const { return m_szAnimation; }
wxColour GetBackgroundColour() const { return m_background; }
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;
// this is the colour to use for the wxANIM_TOBACKGROUND disposal.
// if not specified by the animation, it's set to wxNullColour
wxColour m_background;
};
#endif // wxUSE_STREAMS
#endif // _WX_ANIMDECOD_H
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/encinfo.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/encinfo.h
// Purpose: declares wxNativeEncodingInfo struct
// Author: Vadim Zeitlin
// Modified by:
// Created: 19.09.2003 (extracted from wx/fontenc.h)
// Copyright: (c) 2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ENCINFO_H_
#define _WX_ENCINFO_H_
#include "wx/string.h"
// ----------------------------------------------------------------------------
// wxNativeEncodingInfo contains all encoding parameters for this platform
// ----------------------------------------------------------------------------
// This private structure specifies all the parameters needed to create a font
// with the given encoding on this platform.
//
// Under X, it contains the last 2 elements of the font specifications
// (registry and encoding).
//
// Under Windows, it contains a number which is one of predefined XXX_CHARSET
// values (https://msdn.microsoft.com/en-us/library/cc250412.aspx).
//
// Under all platforms it also contains a facename string which should be
// used, if not empty, to create fonts in this encoding (this is the only way
// to create a font of non-standard encoding (like KOI8) under Windows - the
// facename specifies the encoding then)
struct WXDLLIMPEXP_CORE wxNativeEncodingInfo
{
wxString facename; // may be empty meaning "any"
wxFontEncoding encoding; // so that we know what this struct represents
#if defined(__WXMSW__) || \
defined(__WXMAC__) || \
defined(__WXQT__)
wxNativeEncodingInfo()
: facename()
, encoding(wxFONTENCODING_SYSTEM)
, charset(0) /* ANSI_CHARSET */
{ }
int charset;
#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
#else
#error "Unsupported toolkit"
#endif
// 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);
wxString ToString() const;
};
#endif // _WX_ENCINFO_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/thrimpl.cpp | /////////////////////////////////////////////////////////////////////////////
// Name: wx/thrimpl.cpp
// Purpose: common part of wxThread Implementations
// Author: Vadim Zeitlin
// Modified by:
// Created: 04.06.02 (extracted from src/*/thread.cpp files)
// Copyright: (c) Vadim Zeitlin (2002)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// this file is supposed to be included only by the various thread.cpp
// ----------------------------------------------------------------------------
// wxMutex
// ----------------------------------------------------------------------------
wxMutex::wxMutex(wxMutexType mutexType)
{
m_internal = new wxMutexInternal(mutexType);
if ( !m_internal->IsOk() )
{
delete m_internal;
m_internal = NULL;
}
}
wxMutex::~wxMutex()
{
delete m_internal;
}
bool wxMutex::IsOk() const
{
return m_internal != NULL;
}
wxMutexError wxMutex::Lock()
{
wxCHECK_MSG( m_internal, wxMUTEX_INVALID,
wxT("wxMutex::Lock(): not initialized") );
return m_internal->Lock();
}
wxMutexError wxMutex::LockTimeout(unsigned long ms)
{
wxCHECK_MSG( m_internal, wxMUTEX_INVALID,
wxT("wxMutex::Lock(): not initialized") );
return m_internal->Lock(ms);
}
wxMutexError wxMutex::TryLock()
{
wxCHECK_MSG( m_internal, wxMUTEX_INVALID,
wxT("wxMutex::TryLock(): not initialized") );
return m_internal->TryLock();
}
wxMutexError wxMutex::Unlock()
{
wxCHECK_MSG( m_internal, wxMUTEX_INVALID,
wxT("wxMutex::Unlock(): not initialized") );
return m_internal->Unlock();
}
// --------------------------------------------------------------------------
// wxConditionInternal
// --------------------------------------------------------------------------
// Win32 doesn't have explicit support for the POSIX condition
// variables and its events/event semaphores have quite different semantics,
// so we reimplement the conditions from scratch using the mutexes and
// semaphores
#if defined(__WINDOWS__)
class wxConditionInternal
{
public:
wxConditionInternal(wxMutex& mutex);
bool IsOk() const { return m_mutex.IsOk() && m_semaphore.IsOk(); }
wxCondError Wait();
wxCondError WaitTimeout(unsigned long milliseconds);
wxCondError Signal();
wxCondError Broadcast();
private:
// the number of threads currently waiting for this condition
LONG m_numWaiters;
// the critical section protecting m_numWaiters
wxCriticalSection m_csWaiters;
wxMutex& m_mutex;
wxSemaphore m_semaphore;
wxDECLARE_NO_COPY_CLASS(wxConditionInternal);
};
wxConditionInternal::wxConditionInternal(wxMutex& mutex)
: m_mutex(mutex)
{
// another thread can't access it until we return from ctor, so no need to
// protect access to m_numWaiters here
m_numWaiters = 0;
}
wxCondError wxConditionInternal::Wait()
{
// increment the number of waiters
{
wxCriticalSectionLocker lock(m_csWaiters);
m_numWaiters++;
}
m_mutex.Unlock();
// after unlocking the mutex other threads may Signal() us, but it is ok
// now as we had already incremented m_numWaiters so Signal() will post the
// semaphore and decrement m_numWaiters back even if it is called before we
// start to Wait()
const wxSemaError err = m_semaphore.Wait();
m_mutex.Lock();
if ( err == wxSEMA_NO_ERROR )
{
// m_numWaiters was decremented by Signal()
return wxCOND_NO_ERROR;
}
// but in case of an error we need to do it manually
{
wxCriticalSectionLocker lock(m_csWaiters);
m_numWaiters--;
}
return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR;
}
wxCondError wxConditionInternal::WaitTimeout(unsigned long milliseconds)
{
{
wxCriticalSectionLocker lock(m_csWaiters);
m_numWaiters++;
}
m_mutex.Unlock();
wxSemaError err = m_semaphore.WaitTimeout(milliseconds);
m_mutex.Lock();
if ( err == wxSEMA_NO_ERROR )
return wxCOND_NO_ERROR;
if ( err == wxSEMA_TIMEOUT )
{
// a potential race condition exists here: it happens when a waiting
// thread times out but doesn't have time to decrement m_numWaiters yet
// before Signal() is called in another thread
//
// to handle this particular case, check the semaphore again after
// acquiring m_csWaiters lock -- this will catch the signals missed
// during this window
wxCriticalSectionLocker lock(m_csWaiters);
err = m_semaphore.WaitTimeout(0);
if ( err == wxSEMA_NO_ERROR )
return wxCOND_NO_ERROR;
// we need to decrement m_numWaiters ourselves as it wasn't done by
// Signal()
m_numWaiters--;
return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR;
}
// undo m_numWaiters++ above in case of an error
{
wxCriticalSectionLocker lock(m_csWaiters);
m_numWaiters--;
}
return wxCOND_MISC_ERROR;
}
wxCondError wxConditionInternal::Signal()
{
wxCriticalSectionLocker lock(m_csWaiters);
if ( m_numWaiters > 0 )
{
// increment the semaphore by 1
if ( m_semaphore.Post() != wxSEMA_NO_ERROR )
return wxCOND_MISC_ERROR;
m_numWaiters--;
}
return wxCOND_NO_ERROR;
}
wxCondError wxConditionInternal::Broadcast()
{
wxCriticalSectionLocker lock(m_csWaiters);
while ( m_numWaiters > 0 )
{
if ( m_semaphore.Post() != wxSEMA_NO_ERROR )
return wxCOND_MISC_ERROR;
m_numWaiters--;
}
return wxCOND_NO_ERROR;
}
#endif // __WINDOWS__
// ----------------------------------------------------------------------------
// wxCondition
// ----------------------------------------------------------------------------
wxCondition::wxCondition(wxMutex& mutex)
{
m_internal = new wxConditionInternal(mutex);
if ( !m_internal->IsOk() )
{
delete m_internal;
m_internal = NULL;
}
}
wxCondition::~wxCondition()
{
delete m_internal;
}
bool wxCondition::IsOk() const
{
return m_internal != NULL;
}
wxCondError wxCondition::Wait()
{
wxCHECK_MSG( m_internal, wxCOND_INVALID,
wxT("wxCondition::Wait(): not initialized") );
return m_internal->Wait();
}
wxCondError wxCondition::WaitTimeout(unsigned long milliseconds)
{
wxCHECK_MSG( m_internal, wxCOND_INVALID,
wxT("wxCondition::Wait(): not initialized") );
return m_internal->WaitTimeout(milliseconds);
}
wxCondError wxCondition::Signal()
{
wxCHECK_MSG( m_internal, wxCOND_INVALID,
wxT("wxCondition::Signal(): not initialized") );
return m_internal->Signal();
}
wxCondError wxCondition::Broadcast()
{
wxCHECK_MSG( m_internal, wxCOND_INVALID,
wxT("wxCondition::Broadcast(): not initialized") );
return m_internal->Broadcast();
}
// --------------------------------------------------------------------------
// wxSemaphore
// --------------------------------------------------------------------------
wxSemaphore::wxSemaphore(int initialcount, int maxcount)
{
m_internal = new wxSemaphoreInternal( initialcount, maxcount );
if ( !m_internal->IsOk() )
{
delete m_internal;
m_internal = NULL;
}
}
wxSemaphore::~wxSemaphore()
{
delete m_internal;
}
bool wxSemaphore::IsOk() const
{
return m_internal != NULL;
}
wxSemaError wxSemaphore::Wait()
{
wxCHECK_MSG( m_internal, wxSEMA_INVALID,
wxT("wxSemaphore::Wait(): not initialized") );
return m_internal->Wait();
}
wxSemaError wxSemaphore::TryWait()
{
wxCHECK_MSG( m_internal, wxSEMA_INVALID,
wxT("wxSemaphore::TryWait(): not initialized") );
return m_internal->TryWait();
}
wxSemaError wxSemaphore::WaitTimeout(unsigned long milliseconds)
{
wxCHECK_MSG( m_internal, wxSEMA_INVALID,
wxT("wxSemaphore::WaitTimeout(): not initialized") );
return m_internal->WaitTimeout(milliseconds);
}
wxSemaError wxSemaphore::Post()
{
wxCHECK_MSG( m_internal, wxSEMA_INVALID,
wxT("wxSemaphore::Post(): not initialized") );
return m_internal->Post();
}
// ----------------------------------------------------------------------------
// wxThread
// ----------------------------------------------------------------------------
#include "wx/utils.h"
#include "wx/private/threadinfo.h"
#include "wx/scopeguard.h"
void wxThread::Sleep(unsigned long milliseconds)
{
wxMilliSleep(milliseconds);
}
void *wxThread::CallEntry()
{
wxON_BLOCK_EXIT0(wxThreadSpecificInfo::ThreadCleanUp);
return Entry();
}
| cpp |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/strconv.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/strconv.h
// Purpose: conversion routines for char sets any Unicode
// Author: Ove Kaaven, Robert Roebling, Vadim Zeitlin
// Modified by:
// Created: 29/01/98
// Copyright: (c) 1998 Ove Kaaven, Robert Roebling
// (c) 1998-2006 Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STRCONV_H_
#define _WX_STRCONV_H_
#include "wx/defs.h"
#include "wx/chartype.h"
#include "wx/buffer.h"
#include <stdlib.h>
class WXDLLIMPEXP_FWD_BASE wxString;
// the error value returned by wxMBConv methods
#define wxCONV_FAILED ((size_t)-1)
// ----------------------------------------------------------------------------
// wxMBConv (abstract base class for conversions)
// ----------------------------------------------------------------------------
// When deriving a new class from wxMBConv you must reimplement ToWChar() and
// FromWChar() methods which are not pure virtual only for historical reasons,
// don't let the fact that the existing classes implement MB2WC/WC2MB() instead
// confuse you.
//
// You also have to implement Clone() to allow copying the conversions
// polymorphically.
//
// And you might need to override GetMBNulLen() as well.
class WXDLLIMPEXP_BASE wxMBConv
{
public:
// The functions doing actual conversion from/to narrow to/from wide
// character strings.
//
// On success, the return value is the length (i.e. the number of
// characters, not bytes) of the converted string including any trailing
// L'\0' or (possibly multiple) '\0'(s). If the conversion fails or if
// there is not enough space for everything, including the trailing NUL
// character(s), in the output buffer, wxCONV_FAILED is returned.
//
// In the special case when dst is NULL (the value of dstLen is ignored
// then) the return value is the length of the needed buffer but nothing
// happens otherwise. If srcLen is wxNO_LEN, the entire string, up to and
// including the trailing NUL(s), is converted, otherwise exactly srcLen
// bytes are.
//
// Typical usage:
//
// size_t dstLen = conv.ToWChar(NULL, 0, src);
// if ( dstLen == wxCONV_FAILED )
// ... handle error ...
// wchar_t *wbuf = new wchar_t[dstLen];
// conv.ToWChar(wbuf, dstLen, src);
// ... work with wbuf ...
// delete [] wbuf;
//
virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN) const;
virtual size_t FromWChar(char *dst, size_t dstLen,
const wchar_t *src, size_t srcLen = wxNO_LEN) const;
// Convenience functions for translating NUL-terminated strings: return
// the buffer containing the converted string or empty buffer if the
// conversion failed.
wxWCharBuffer cMB2WC(const char *in) const
{ return DoConvertMB2WC(in, wxNO_LEN); }
wxCharBuffer cWC2MB(const wchar_t *in) const
{ return DoConvertWC2MB(in, wxNO_LEN); }
wxWCharBuffer cMB2WC(const wxScopedCharBuffer& in) const
{ return DoConvertMB2WC(in, in.length()); }
wxCharBuffer cWC2MB(const wxScopedWCharBuffer& in) const
{ return DoConvertWC2MB(in, in.length()); }
// Convenience functions for converting strings which may contain embedded
// NULs and don't have to be NUL-terminated.
//
// inLen is the length of the buffer including trailing NUL if any or
// wxNO_LEN if the input is NUL-terminated.
//
// outLen receives, if not NULL, the length of the converted string or 0 if
// the conversion failed (returning 0 and not -1 in this case makes it
// difficult to distinguish between failed conversion and empty input but
// this is done for backwards compatibility). Notice that the rules for
// whether outLen accounts or not for the last NUL are the same as for
// To/FromWChar() above: if inLen is specified, outLen is exactly the
// number of characters converted, whether the last one of them was NUL or
// not. But if inLen == wxNO_LEN then outLen doesn't account for the last
// NUL even though it is present.
wxWCharBuffer
cMB2WC(const char *in, size_t inLen, size_t *outLen) const;
wxCharBuffer
cWC2MB(const wchar_t *in, size_t inLen, size_t *outLen) const;
// convenience functions for converting MB or WC to/from wxWin default
#if wxUSE_UNICODE
wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); }
wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); }
const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; }
const wchar_t* cWX2WC(const wchar_t *psz) const { return psz; }
#else // ANSI
const char* cMB2WX(const char *psz) const { return psz; }
const char* cWX2MB(const char *psz) const { return psz; }
wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); }
wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); }
#endif // Unicode/ANSI
// this function is used in the implementation of cMB2WC() to distinguish
// between the following cases:
//
// a) var width encoding with strings terminated by a single NUL
// (usual multibyte encodings): return 1 in this case
// b) fixed width encoding with 2 bytes/char and so terminated by
// 2 NULs (UTF-16/UCS-2 and variants): return 2 in this case
// c) fixed width encoding with 4 bytes/char and so terminated by
// 4 NULs (UTF-32/UCS-4 and variants): return 4 in this case
//
// anything else is not supported currently and -1 should be returned
virtual size_t GetMBNulLen() const { return 1; }
// return the maximal value currently returned by GetMBNulLen() for any
// encoding
static size_t GetMaxMBNulLen() { return 4 /* for UTF-32 */; }
// return true if the converter's charset is UTF-8, i.e. char* strings
// decoded using this object can be directly copied to wxString's internal
// storage without converting to WC and than back to UTF-8 MB string
virtual bool IsUTF8() const { return false; }
// The old conversion functions. The existing classes currently mostly
// implement these ones but we're in transition to using To/FromWChar()
// instead and any new classes should implement just the new functions.
// For now, however, we provide default implementation of To/FromWChar() in
// this base class in terms of MB2WC/WC2MB() to avoid having to rewrite all
// the conversions at once.
//
// On success, the return value is the length (i.e. the number of
// characters, not bytes) not counting the trailing NUL(s) of the converted
// string. On failure, (size_t)-1 is returned. In the special case when
// outputBuf is NULL the return value is the same one but nothing is
// written to the buffer.
//
// Note that outLen is the length of the output buffer, not the length of
// the input (which is always supposed to be terminated by one or more
// NULs, as appropriate for the encoding)!
virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const;
virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const;
// make a heap-allocated copy of this object
virtual wxMBConv *Clone() const = 0;
// virtual dtor for any base class
virtual ~wxMBConv() { }
private:
// Common part of single argument cWC2MB() and cMB2WC() overloads above.
wxCharBuffer DoConvertWC2MB(const wchar_t* pwz, size_t srcLen) const;
wxWCharBuffer DoConvertMB2WC(const char* psz, size_t srcLen) const;
};
// ----------------------------------------------------------------------------
// wxMBConvLibc uses standard mbstowcs() and wcstombs() functions for
// conversion (hence it depends on the current locale)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMBConvLibc : public wxMBConv
{
public:
virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const wxOVERRIDE;
virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const wxOVERRIDE;
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvLibc; }
virtual bool IsUTF8() const wxOVERRIDE { return wxLocaleIsUtf8; }
};
#ifdef __UNIX__
// ----------------------------------------------------------------------------
// wxConvBrokenFileNames is made for Unix in Unicode mode when
// files are accidentally written in an encoding which is not
// the system encoding. Typically, the system encoding will be
// UTF8 but there might be files stored in ISO8859-1 on disk.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxConvBrokenFileNames : public wxMBConv
{
public:
wxConvBrokenFileNames(const wxString& charset);
wxConvBrokenFileNames(const wxConvBrokenFileNames& conv)
: wxMBConv(),
m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL)
{
}
virtual ~wxConvBrokenFileNames() { delete m_conv; }
virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const wxOVERRIDE
{
return m_conv->MB2WC(out, in, outLen);
}
virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const wxOVERRIDE
{
return m_conv->WC2MB(out, in, outLen);
}
virtual size_t GetMBNulLen() const wxOVERRIDE
{
// cast needed to call a private function
return m_conv->GetMBNulLen();
}
virtual bool IsUTF8() const wxOVERRIDE { return m_conv->IsUTF8(); }
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxConvBrokenFileNames(*this); }
private:
// the conversion object we forward to
wxMBConv *m_conv;
wxDECLARE_NO_ASSIGN_CLASS(wxConvBrokenFileNames);
};
#endif // __UNIX__
// ----------------------------------------------------------------------------
// wxMBConvUTF7 (for conversion using UTF7 encoding)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMBConvUTF7 : public wxMBConv
{
public:
wxMBConvUTF7() { }
// compiler-generated copy ctor, assignment operator and dtor are ok
// (assuming it's ok to copy the shift state -- not really sure about it)
virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual size_t FromWChar(char *dst, size_t dstLen,
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF7; }
private:
// UTF-7 decoder/encoder may be in direct mode or in shifted mode after a
// '+' (and until the '-' or any other non-base64 character)
struct StateMode
{
enum Mode
{
Direct, // pass through state
Shifted // after a '+' (and before '-')
};
};
// the current decoder state: this is only used by ToWChar() if srcLen
// parameter is not wxNO_LEN, when working on the entire NUL-terminated
// strings we neither update nor use the state
class DecoderState : private StateMode
{
private:
// current state: this one is private as we want to enforce the use of
// ToDirect/ToShifted() methods below
Mode mode;
public:
// the initial state is direct
DecoderState() { mode = Direct; }
// switch to/from shifted mode
void ToDirect() { mode = Direct; }
void ToShifted() { mode = Shifted; accum = bit = 0; isLSB = false; }
bool IsDirect() const { return mode == Direct; }
bool IsShifted() const { return mode == Shifted; }
// these variables are only used in shifted mode
unsigned int accum; // accumulator of the bit we've already got
unsigned int bit; // the number of bits consumed mod 8
unsigned char msb; // the high byte of UTF-16 word
bool isLSB; // whether we're decoding LSB or MSB of UTF-16 word
};
DecoderState m_stateDecoder;
// encoder state is simpler as we always receive entire Unicode characters
// on input
class EncoderState : private StateMode
{
private:
Mode mode;
public:
EncoderState() { mode = Direct; }
void ToDirect() { mode = Direct; }
void ToShifted() { mode = Shifted; accum = bit = 0; }
bool IsDirect() const { return mode == Direct; }
bool IsShifted() const { return mode == Shifted; }
unsigned int accum;
unsigned int bit;
};
EncoderState m_stateEncoder;
};
// ----------------------------------------------------------------------------
// wxMBConvUTF8 (for conversion using UTF8 encoding)
// ----------------------------------------------------------------------------
// this is the real UTF-8 conversion class, it has to be called "strict UTF-8"
// for compatibility reasons: the wxMBConvUTF8 class below also supports lossy
// conversions if it is created with non default options
class WXDLLIMPEXP_BASE wxMBConvStrictUTF8 : public wxMBConv
{
public:
// compiler-generated default ctor and other methods are ok
virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual size_t FromWChar(char *dst, size_t dstLen,
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvStrictUTF8(); }
// NB: other mapping modes are not, strictly speaking, UTF-8, so we can't
// take the shortcut in that case
virtual bool IsUTF8() const wxOVERRIDE { return true; }
};
class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConvStrictUTF8
{
public:
enum
{
MAP_INVALID_UTF8_NOT = 0,
MAP_INVALID_UTF8_TO_PUA = 1,
MAP_INVALID_UTF8_TO_OCTAL = 2
};
wxMBConvUTF8(int options = MAP_INVALID_UTF8_NOT) : m_options(options) { }
virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual size_t FromWChar(char *dst, size_t dstLen,
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF8(m_options); }
// NB: other mapping modes are not, strictly speaking, UTF-8, so we can't
// take the shortcut in that case
virtual bool IsUTF8() const wxOVERRIDE { return m_options == MAP_INVALID_UTF8_NOT; }
private:
int m_options;
};
// ----------------------------------------------------------------------------
// wxMBConvUTF16Base: for both LE and BE variants
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMBConvUTF16Base : public wxMBConv
{
public:
enum { BYTES_PER_CHAR = 2 };
virtual size_t GetMBNulLen() const wxOVERRIDE { return BYTES_PER_CHAR; }
protected:
// return the length of the buffer using srcLen if it's not wxNO_LEN and
// computing the length ourselves if it is; also checks that the length is
// even if specified as we need an entire number of UTF-16 characters and
// returns wxNO_LEN which indicates error if it is odd
static size_t GetLength(const char *src, size_t srcLen);
};
// ----------------------------------------------------------------------------
// wxMBConvUTF16LE (for conversion using UTF16 Little Endian encoding)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMBConvUTF16LE : public wxMBConvUTF16Base
{
public:
virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual size_t FromWChar(char *dst, size_t dstLen,
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF16LE; }
};
// ----------------------------------------------------------------------------
// wxMBConvUTF16BE (for conversion using UTF16 Big Endian encoding)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMBConvUTF16BE : public wxMBConvUTF16Base
{
public:
virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual size_t FromWChar(char *dst, size_t dstLen,
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF16BE; }
};
// ----------------------------------------------------------------------------
// wxMBConvUTF32Base: base class for both LE and BE variants
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMBConvUTF32Base : public wxMBConv
{
public:
enum { BYTES_PER_CHAR = 4 };
virtual size_t GetMBNulLen() const wxOVERRIDE { return BYTES_PER_CHAR; }
protected:
// this is similar to wxMBConvUTF16Base method with the same name except
// that, of course, it verifies that length is divisible by 4 if given and
// not by 2
static size_t GetLength(const char *src, size_t srcLen);
};
// ----------------------------------------------------------------------------
// wxMBConvUTF32LE (for conversion using UTF32 Little Endian encoding)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMBConvUTF32LE : public wxMBConvUTF32Base
{
public:
virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual size_t FromWChar(char *dst, size_t dstLen,
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF32LE; }
};
// ----------------------------------------------------------------------------
// wxMBConvUTF32BE (for conversion using UTF32 Big Endian encoding)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMBConvUTF32BE : public wxMBConvUTF32Base
{
public:
virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual size_t FromWChar(char *dst, size_t dstLen,
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF32BE; }
};
// ----------------------------------------------------------------------------
// wxCSConv (for conversion based on loadable char sets)
// ----------------------------------------------------------------------------
#include "wx/fontenc.h"
class WXDLLIMPEXP_BASE wxCSConv : public wxMBConv
{
public:
// we can be created either from charset name or from an encoding constant
// but we can't have both at once
wxCSConv(const wxString& charset);
wxCSConv(wxFontEncoding encoding);
wxCSConv(const wxCSConv& conv);
virtual ~wxCSConv();
wxCSConv& operator=(const wxCSConv& conv);
virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual size_t FromWChar(char *dst, size_t dstLen,
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual size_t GetMBNulLen() const wxOVERRIDE;
virtual bool IsUTF8() const wxOVERRIDE;
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxCSConv(*this); }
void Clear();
// return true if the conversion could be initialized successfully
bool IsOk() const;
private:
// common part of all ctors
void Init();
// Creates the conversion to use, called from all ctors to initialize
// m_convReal.
wxMBConv *DoCreate() const;
// Set the name (may be only called when m_name == NULL), makes copy of
// the charset string.
void SetName(const char *charset);
// Set m_encoding field respecting the rules below, i.e. making sure it has
// a valid value if m_name == NULL (thus this should be always called after
// SetName()).
//
// Input encoding may be valid or not.
void SetEncoding(wxFontEncoding encoding);
// The encoding we use is specified by the two fields below:
//
// 1. If m_name != NULL, m_encoding corresponds to it if it's one of
// encodings we know about (i.e. member of wxFontEncoding) or is
// wxFONTENCODING_SYSTEM otherwise.
//
// 2. If m_name == NULL, m_encoding is always valid, i.e. not one of
// wxFONTENCODING_{SYSTEM,DEFAULT,MAX}.
char *m_name;
wxFontEncoding m_encoding;
// The conversion object for our encoding or NULL if we failed to create it
// in which case we fall back to hard-coded ISO8859-1 conversion.
wxMBConv *m_convReal;
};
// ----------------------------------------------------------------------------
// wxWhateverWorksConv: use whatever encoding works for the input
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxWhateverWorksConv : public wxMBConv
{
public:
wxWhateverWorksConv()
{
}
// Try to interpret the string as UTF-8, if it fails fall back to the
// current locale encoding (wxConvLibc) and if this fails as well,
// interpret it as wxConvISO8859_1 (which is used because it never fails
// and this conversion is used when we really, really must produce
// something on output).
virtual size_t
ToWChar(wchar_t *dst, size_t dstLen,
const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
// Try to encode the string using the current locale encoding (wxConvLibc)
// and fall back to UTF-8 (which never fails) if it doesn't work. Note that
// we never use wxConvISO8859_1 here as we prefer to fall back on UTF-8
// even for the strings containing only code points representable in 8869-1.
virtual size_t
FromWChar(char *dst, size_t dstLen,
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
virtual wxMBConv *Clone() const wxOVERRIDE
{
return new wxWhateverWorksConv();
}
};
// ----------------------------------------------------------------------------
// declare predefined conversion objects
// ----------------------------------------------------------------------------
// Note: this macro is an implementation detail (see the comment in
// strconv.cpp). The wxGet_XXX() and wxGet_XXXPtr() functions shouldn't be
// used by user code and neither should XXXPtr, use the wxConvXXX macro
// instead.
#define WX_DECLARE_GLOBAL_CONV(klass, name) \
extern WXDLLIMPEXP_DATA_BASE(klass*) name##Ptr; \
extern WXDLLIMPEXP_BASE klass* wxGet_##name##Ptr(); \
inline klass& wxGet_##name() \
{ \
if ( !name##Ptr ) \
name##Ptr = wxGet_##name##Ptr(); \
return *name##Ptr; \
}
// conversion to be used with all standard functions affected by locale, e.g.
// strtol(), strftime(), ...
WX_DECLARE_GLOBAL_CONV(wxMBConv, wxConvLibc)
#define wxConvLibc wxGet_wxConvLibc()
// conversion ISO-8859-1/UTF-7/UTF-8 <-> wchar_t
WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvISO8859_1)
#define wxConvISO8859_1 wxGet_wxConvISO8859_1()
WX_DECLARE_GLOBAL_CONV(wxMBConvStrictUTF8, wxConvUTF8)
#define wxConvUTF8 wxGet_wxConvUTF8()
WX_DECLARE_GLOBAL_CONV(wxMBConvUTF7, wxConvUTF7)
#define wxConvUTF7 wxGet_wxConvUTF7()
// conversion used when we may not afford to lose data when outputting Unicode
// strings (should be avoid in the other direction as it can misinterpret the
// input encoding)
WX_DECLARE_GLOBAL_CONV(wxWhateverWorksConv, wxConvWhateverWorks)
#define wxConvWhateverWorks wxGet_wxConvWhateverWorks()
// conversion used for the file names on the systems where they're not Unicode
// (basically anything except Windows)
//
// this is used by all file functions, can be changed by the application
//
// by default UTF-8 under Mac OS X and wxConvLibc elsewhere (but it's not used
// under Windows normally)
extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName;
// backwards compatible define
#define wxConvFile (*wxConvFileName)
// the current conversion object, may be set to any conversion, is used by
// default in a couple of places inside wx (initially same as wxConvLibc)
extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent;
// the conversion corresponding to the current locale
WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvLocal)
#define wxConvLocal wxGet_wxConvLocal()
// the conversion corresponding to the encoding of the standard UI elements
//
// by default this is the same as wxConvLocal but may be changed if the program
// needs to use a fixed encoding
extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI;
#undef WX_DECLARE_GLOBAL_CONV
// ----------------------------------------------------------------------------
// endianness-dependent conversions
// ----------------------------------------------------------------------------
#ifdef WORDS_BIGENDIAN
typedef wxMBConvUTF16BE wxMBConvUTF16;
typedef wxMBConvUTF32BE wxMBConvUTF32;
#else
typedef wxMBConvUTF16LE wxMBConvUTF16;
typedef wxMBConvUTF32LE wxMBConvUTF32;
#endif
// ----------------------------------------------------------------------------
// filename conversion macros
// ----------------------------------------------------------------------------
// filenames are multibyte on Unix and widechar on Windows
#if wxMBFILES && wxUSE_UNICODE
#define wxFNCONV(name) wxConvFileName->cWX2MB(name)
#define wxFNSTRINGCAST wxMBSTRINGCAST
#else
#if defined(__WXOSX__) && wxMBFILES
#define wxFNCONV(name) wxConvFileName->cWC2MB( wxConvLocal.cWX2WC(name) )
#else
#define wxFNCONV(name) name
#endif
#define wxFNSTRINGCAST WXSTRINGCAST
#endif
// ----------------------------------------------------------------------------
// macros for the most common conversions
// ----------------------------------------------------------------------------
#if wxUSE_UNICODE
#define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s)
#define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s)
// these functions should be used when the conversions really, really have
// to succeed (usually because we pass their results to a standard C
// function which would crash if we passed NULL to it), so these functions
// always return a valid pointer if their argument is non-NULL
inline wxWCharBuffer wxSafeConvertMB2WX(const char *s)
{
return wxConvWhateverWorks.cMB2WC(s);
}
inline wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws)
{
return wxConvWhateverWorks.cWC2MB(ws);
}
#else // ANSI
// no conversions to do
#define wxConvertWX2MB(s) (s)
#define wxConvertMB2WX(s) (s)
#define wxSafeConvertMB2WX(s) (s)
#define wxSafeConvertWX2MB(s) (s)
#endif // Unicode/ANSI
#endif // _WX_STRCONV_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/buffer.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/buffer.h
// Purpose: auto buffer classes: buffers which automatically free memory
// Author: Vadim Zeitlin
// Modified by:
// Created: 12.04.99
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BUFFER_H
#define _WX_BUFFER_H
#include "wx/defs.h"
#include "wx/wxcrtbase.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));
if ( dst )
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)
{
CharType* const str = (CharType *)malloc((len + 1)*sizeof(CharType));
if ( str )
{
str[len] = (CharType)0;
// There is a potential memory leak here if new throws because it
// fails to allocate Data, we ought to use new(nothrow) here, but
// this might fail to compile under some platforms so until this
// can be fully tested, just live with this (rather unlikely, as
// Data is a small object) potential leak.
this->m_data = new Data(str, len);
}
else
{
this->m_data = this->GetNullData();
}
}
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;
}
};
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);
};
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;
#if wxUSE_UNICODE
#define wxWxCharBuffer wxWCharBuffer
#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
#else // ANSI
#define wxWxCharBuffer wxCharBuffer
#define wxMB2WXbuf wxChar*
#define wxWX2MBbuf wxChar*
#define wxWC2WXbuf wxCharBuffer
#define wxWX2WCbuf wxWCharBuffer
#endif // Unicode/ANSI
// ----------------------------------------------------------------------------
// A class for holding growable data buffers (not necessarily strings)
// ----------------------------------------------------------------------------
// This class manages the actual data buffer pointer and is ref-counted.
class wxMemoryBufferData
{
public:
// the initial size and also the size added by ResizeIfNeeded()
enum { DefBufSize = 1024 };
friend class wxMemoryBuffer;
// everything is private as it can only be used by wxMemoryBuffer
private:
wxMemoryBufferData(size_t size = wxMemoryBufferData::DefBufSize)
: m_data(size ? malloc(size) : NULL), m_size(size), m_len(0), m_ref(0)
{
}
~wxMemoryBufferData() { free(m_data); }
void ResizeIfNeeded(size_t newSize)
{
if (newSize > m_size)
{
void* const data = realloc(m_data, newSize + wxMemoryBufferData::DefBufSize);
if ( !data )
{
// It's better to crash immediately dereferencing a null
// pointer in the function calling us than overflowing the
// buffer which couldn't be made big enough.
free(release());
return;
}
m_data = data;
m_size = newSize + wxMemoryBufferData::DefBufSize;
}
}
void IncRef() { m_ref += 1; }
void DecRef()
{
m_ref -= 1;
if (m_ref == 0) // are there no more references?
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;
// the size of the buffer
size_t m_size;
// the amount of data currently in the buffer
size_t m_len;
// the reference count
size_t m_ref;
wxDECLARE_NO_COPY_CLASS(wxMemoryBufferData);
};
class wxMemoryBuffer
{
public:
// ctor and dtor
wxMemoryBuffer(size_t size = wxMemoryBufferData::DefBufSize)
{
m_bufdata = new wxMemoryBufferData(size);
m_bufdata->IncRef();
}
~wxMemoryBuffer() { m_bufdata->DecRef(); }
// copy and assignment
wxMemoryBuffer(const wxMemoryBuffer& src)
: m_bufdata(src.m_bufdata)
{
m_bufdata->IncRef();
}
wxMemoryBuffer& operator=(const wxMemoryBuffer& src)
{
if (&src != this)
{
m_bufdata->DecRef();
m_bufdata = src.m_bufdata;
m_bufdata->IncRef();
}
return *this;
}
// Accessors
void *GetData() const { return m_bufdata->m_data; }
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)
{
wxASSERT(len <= m_bufdata->m_size);
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)
{
m_bufdata->ResizeIfNeeded(sizeNeeded);
return m_bufdata->m_data;
}
// Update the length after the write
void UngetWriteBuf(size_t sizeUsed) { SetDataLen(sizeUsed); }
// Like the above, but appends to the buffer
void *GetAppendBuf(size_t sizeNeeded)
{
m_bufdata->ResizeIfNeeded(m_bufdata->m_len + sizeNeeded);
return (char*)m_bufdata->m_data + m_bufdata->m_len;
}
// Update the length after the append
void UngetAppendBuf(size_t sizeUsed)
{
SetDataLen(m_bufdata->m_len + sizeUsed);
}
// Other ways to append to the buffer
void AppendByte(char data)
{
wxCHECK_RET( m_bufdata->m_data, wxT("invalid wxMemoryBuffer") );
m_bufdata->ResizeIfNeeded(m_bufdata->m_len + 1);
*(((char*)m_bufdata->m_data) + m_bufdata->m_len) = data;
m_bufdata->m_len += 1;
}
void AppendData(const void *data, size_t len)
{
memcpy(GetAppendBuf(len), data, len);
UngetAppendBuf(len);
}
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;
};
// ----------------------------------------------------------------------------
// template class for any kind of data
// ----------------------------------------------------------------------------
// TODO
#endif // _WX_BUFFER_H
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/vms_x_fix.h | /***************************************************************************
* *
* Author : Jouk Jansen ([email protected]) *
* *
* Last revision : 7 October 2005 *
* *
* Repair definitions of Runtime library functions when compiling with *
* /name=(as_is) on OpenVMS *
* *
***************************************************************************/
#ifndef VMS_X_FIX
#define VMS_X_FIX
#define decw$_select DECW$_SELECT
#define DtSaverGetWindows DTSAVERGETWINDOWS
#define MrmFetchWidget MRMFETCHWIDGET
#define MrmInitialize MRMINITIALIZE
#define MrmOpenHierarchy MRMOPENHIERARCHY
#define MrmRegisterNames MRMREGISTERNAMES
#define XAddExtension XADDEXTENSION
#define XAddHosts XADDHOSTS
#define XAllocClassHint XALLOCCLASSHINT
#define XAllocColor XALLOCCOLOR
#define XAllocColorCells XALLOCCOLORCELLS
#define XAllocIconSize XALLOCICONSIZE
#define XAllocNamedColor XALLOCNAMEDCOLOR
#define XAllocSizeHints XALLOCSIZEHINTS
#define XAllocStandardColormap XALLOCSTANDARDCOLORMAP
#define XAllocWMHints XALLOCWMHINTS
#define XAllowEvents XALLOWEVENTS
#define XAutoRepeatOff XAUTOREPEATOFF
#define XAutoRepeatOn XAUTOREPEATON
#define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET
#define XBell XBELL
#define XBitmapPad XBITMAPPAD
#define XBlackPixel XBLACKPIXEL
#define XBlackPixelOfScreen XBLACKPIXELOFSCREEN
#define XCellsOfScreen XCELLSOFSCREEN
#define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB
#define XChangeGC XCHANGEGC
#define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL
#define XChangePointerControl XCHANGEPOINTERCONTROL
#define XChangeProperty XCHANGEPROPERTY
#define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES
#define XCheckIfEvent XCHECKIFEVENT
#define XCheckMaskEvent XCHECKMASKEVENT
#define XCheckTypedEvent XCHECKTYPEDEVENT
#define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT
#define XCheckWindowEvent XCHECKWINDOWEVENT
#define XClearArea XCLEARAREA
#define XClearWindow XCLEARWINDOW
#define XClipBox XCLIPBOX
#define XCloseDisplay XCLOSEDISPLAY
#define XCloseIM XCLOSEIM
#define XConfigureWindow XCONFIGUREWINDOW
#define XConvertSelection XCONVERTSELECTION
#define XCopyArea XCOPYAREA
#define XCopyColormapAndFree XCOPYCOLORMAPANDFREE
#define XCopyGC XCOPYGC
#define XCopyPlane XCOPYPLANE
#define XCreateBitmapFromData XCREATEBITMAPFROMDATA
#define XCreateColormap XCREATECOLORMAP
#define XCreateFontCursor XCREATEFONTCURSOR
#define XCreateFontSet XCREATEFONTSET
#define XCreateGC XCREATEGC
#define XCreateGlyphCursor XCREATEGLYPHCURSOR
#define XCreateIC XCREATEIC
#define XCreateImage XCREATEIMAGE
#define XCreatePixmap XCREATEPIXMAP
#define XCreatePixmapCursor XCREATEPIXMAPCURSOR
#define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA
#define XCreateRegion XCREATEREGION
#define XCreateSimpleWindow XCREATESIMPLEWINDOW
#define XCreateWindow XCREATEWINDOW
#define XDefaultColormap XDEFAULTCOLORMAP
#define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN
#define XDefaultDepth XDEFAULTDEPTH
#define XDefaultDepthOfScreen XDEFAULTDEPTHOFSCREEN
#define XDefaultGC XDEFAULTGC
#define XDefaultRootWindow XDEFAULTROOTWINDOW
#define XDefaultScreen XDEFAULTSCREEN
#define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY
#define XDefaultVisual XDEFAULTVISUAL
#define XDefaultVisualOfScreen XDEFAULTVISUALOFSCREEN
#define XDefineCursor XDEFINECURSOR
#define XDeleteContext XDELETECONTEXT
#define XDeleteProperty XDELETEPROPERTY
#define XDestroyIC XDESTROYIC
#define XDestroyRegion XDESTROYREGION
#define XDestroySubwindows XDESTROYSUBWINDOWS
#define XDestroyWindow XDESTROYWINDOW
#define XDisableAccessControl XDISABLEACCESSCONTROL
#define XDisplayCells XDISPLAYCELLS
#define XDisplayHeight XDISPLAYHEIGHT
#define XDisplayKeycodes XDISPLAYKEYCODES
#define XDisplayName XDISPLAYNAME
#define XDisplayOfIM XDISPLAYOFIM
#define XDisplayOfScreen XDISPLAYOFSCREEN
#define XDisplayString XDISPLAYSTRING
#define XDisplayWidth XDISPLAYWIDTH
#define XDoesBackingStore XDOESBACKINGSTORE
#define XDrawArc XDRAWARC
#define XDrawArcs XDRAWARCS
#define XDrawImageString XDRAWIMAGESTRING
#define XDrawImageString16 XDRAWIMAGESTRING16
#define XDrawLine XDRAWLINE
#define XDrawLines XDRAWLINES
#define XDrawPoint XDRAWPOINT
#define XDrawPoints XDRAWPOINTS
#define XDrawRectangle XDRAWRECTANGLE
#define XDrawRectangles XDRAWRECTANGLES
#define XDrawSegments XDRAWSEGMENTS
#define XDrawString XDRAWSTRING
#define XDrawString16 XDRAWSTRING16
#define XDrawText XDRAWTEXT
#define XDrawText16 XDRAWTEXT16
#define XESetCloseDisplay XESETCLOSEDISPLAY
#define XEmptyRegion XEMPTYREGION
#define XEnableAccessControl XENABLEACCESSCONTROL
#define XEqualRegion XEQUALREGION
#define XEventsQueued XEVENTSQUEUED
#define XExtendedMaxRequestSize XEXTENDEDMAXREQUESTSIZE
#define XExtentsOfFontSet XEXTENTSOFFONTSET
#define XFetchBuffer XFETCHBUFFER
#define XFetchBytes XFETCHBYTES
#define XFetchName XFETCHNAME
#define XFillArc XFILLARC
#define XFillArcs XFILLARCS
#define XFillPolygon XFILLPOLYGON
#define XFillRectangle XFILLRECTANGLE
#define XFillRectangles XFILLRECTANGLES
#define XFilterEvent XFILTEREVENT
#define XFindContext XFINDCONTEXT
#define XFlush XFLUSH
#define XFontsOfFontSet XFONTSOFFONTSET
#define XForceScreenSaver XFORCESCREENSAVER
#define XFree XFREE
#define XFreeColormap XFREECOLORMAP
#define XFreeColors XFREECOLORS
#define XFreeCursor XFREECURSOR
#define XFreeDeviceList XFREEDEVICELIST
#define XFreeDeviceState XFREEDEVICESTATE
#define XFreeFont XFREEFONT
#define XFreeFontInfo XFREEFONTINFO
#define XFreeFontNames XFREEFONTNAMES
#define XFreeFontSet XFREEFONTSET
#define XFreeGC XFREEGC
#define XFreeModifiermap XFREEMODIFIERMAP
#define XFreePixmap XFREEPIXMAP
#define XFreeStringList XFREESTRINGLIST
#define XGContextFromGC XGCONTEXTFROMGC
#define XGeometry XGEOMETRY
#define XGetAtomName XGETATOMNAME
#define XGetCommand XGETCOMMAND
#define XGetDefault XGETDEFAULT
#define XGetErrorDatabaseText XGETERRORDATABASETEXT
#define XGetErrorText XGETERRORTEXT
#define XGetExtensionVersion XGETEXTENSIONVERSION
#define XGetFontProperty XGETFONTPROPERTY
#define XGetGCValues XGETGCVALUES
#define XGetGeometry XGETGEOMETRY
#define XGetICValues XGETICVALUES
#define XGetIMValues XGETIMVALUES
#define XGetIconName XGETICONNAME
#define XGetIconSizes XGETICONSIZES
#define XGetImage XGETIMAGE
#define XGetInputFocus XGETINPUTFOCUS
#define XGetKeyboardControl XGETKEYBOARDCONTROL
#define XGetKeyboardMapping XGETKEYBOARDMAPPING
#define XGetModifierMapping XGETMODIFIERMAPPING
#define XGetMotionEvents XGETMOTIONEVENTS
#define XGetNormalHints XGETNORMALHINTS
#define XGetPointerMapping XGETPOINTERMAPPING
#define XGetRGBColormaps XGETRGBCOLORMAPS
#define XGetScreenSaver XGETSCREENSAVER
#define XGetSelectionOwner XGETSELECTIONOWNER
#define XGetStandardColormap XGETSTANDARDCOLORMAP
#define XGetSubImage XGETSUBIMAGE
#define XGetTextProperty XGETTEXTPROPERTY
#define XGetVisualInfo XGETVISUALINFO
#define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS
#define XGetWMHints XGETWMHINTS
#define XGetWMIconName XGETWMICONNAME
#define XGetWMName XGETWMNAME
#define XGetWMNormalHints XGETWMNORMALHINTS
#define XGetWindowAttributes XGETWINDOWATTRIBUTES
#define XGetWindowProperty XGETWINDOWPROPERTY
#define XGrabButton XGRABBUTTON
#define XGrabKeyboard XGRABKEYBOARD
#define XGrabPointer XGRABPOINTER
#define XGrabServer XGRABSERVER
#define XHeightMMOfScreen XHEIGHTMMOFSCREEN
#define XHeightOfScreen XHEIGHTOFSCREEN
#define XIconifyWindow XICONIFYWINDOW
#define XIfEvent XIFEVENT
#define XInitExtension XINITEXTENSION
#define XInitImage XINITIMAGE
#define XInstallColormap XINSTALLCOLORMAP
#define XInternAtom XINTERNATOM
#define XInternAtoms XINTERNATOMS
#define XIntersectRegion XINTERSECTREGION
#define XKeycodeToKeysym XKEYCODETOKEYSYM
#define XKeysymToKeycode XKEYSYMTOKEYCODE
#define XKeysymToString XKEYSYMTOSTRING
#define XKillClient XKILLCLIENT
#define XListDepths XLISTDEPTHS
#define XListFonts XLISTFONTS
#define XListFontsWithInfo XLISTFONTSWITHINFO
#define XListHosts XLISTHOSTS
#define XListInputDevices XLISTINPUTDEVICES
#define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS
#define XListPixmapFormats XLISTPIXMAPFORMATS
#define XListProperties XLISTPROPERTIES
#define XLoadFont XLOADFONT
#define XLoadQueryFont XLOADQUERYFONT
#define XLookupColor XLOOKUPCOLOR
#define XLookupKeysym XLOOKUPKEYSYM
#define XLookupString XLOOKUPSTRING
#define XLowerWindow XLOWERWINDOW
#define XMapRaised XMAPRAISED
#define XMapSubwindows XMAPSUBWINDOWS
#define XMapWindow XMAPWINDOW
#define XMatchVisualInfo XMATCHVISUALINFO
#define XMaxRequestSize XMAXREQUESTSIZE
#define XMissingExtension XMISSINGEXTENSION
#define XMoveResizeWindow XMOVERESIZEWINDOW
#define XMoveWindow XMOVEWINDOW
#define XNextEvent XNEXTEVENT
#define XNextRequest XNEXTREQUEST
#define XNoOp XNOOP
#define XOffsetRegion XOFFSETREGION
#define XOpenDevice XOPENDEVICE
#define XOpenDisplay XOPENDISPLAY
#define XOpenIM XOPENIM
#define XParseColor XPARSECOLOR
#define XParseGeometry XPARSEGEOMETRY
#define XPeekEvent XPEEKEVENT
#define XPeekIfEvent XPEEKIFEVENT
#define XPending XPENDING
#define XPointInRegion XPOINTINREGION
#define XPolygonRegion XPOLYGONREGION
#define XPutBackEvent XPUTBACKEVENT
#define XPutImage XPUTIMAGE
#define XQLength XQLENGTH
#define XQueryBestCursor XQUERYBESTCURSOR
#define XQueryBestStipple XQUERYBESTSTIPPLE
#define XQueryColor XQUERYCOLOR
#define XQueryColors XQUERYCOLORS
#define XQueryDeviceState XQUERYDEVICESTATE
#define XQueryExtension XQUERYEXTENSION
#define XQueryFont XQUERYFONT
#define XQueryKeymap XQUERYKEYMAP
#define XQueryPointer XQUERYPOINTER
#define XQueryTree XQUERYTREE
#define XRaiseWindow XRAISEWINDOW
#define XReadBitmapFile XREADBITMAPFILE
#define XRecolorCursor XRECOLORCURSOR
#define XReconfigureWMWindow XRECONFIGUREWMWINDOW
#define XRectInRegion XRECTINREGION
#define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING
#define XRemoveHosts XREMOVEHOSTS
#define XReparentWindow XREPARENTWINDOW
#define XResetScreenSaver XRESETSCREENSAVER
#define XResizeWindow XRESIZEWINDOW
#define XResourceManagerString XRESOURCEMANAGERSTRING
#define XRestackWindows XRESTACKWINDOWS
#define XRotateBuffers XROTATEBUFFERS
#define XRootWindow XROOTWINDOW
#define XRootWindowOfScreen XROOTWINDOWOFSCREEN
#define XSaveContext XSAVECONTEXT
#define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN
#define XScreenOfDisplay XSCREENOFDISPLAY
#define XSelectAsyncEvent XSELECTASYNCEVENT
#define XSelectAsyncInput XSELECTASYNCINPUT
#define XSelectExtensionEvent XSELECTEXTENSIONEVENT
#define XSelectInput XSELECTINPUT
#define XSendEvent XSENDEVENT
#define XServerVendor XSERVERVENDOR
#define XSetArcMode XSETARCMODE
#define XSetBackground XSETBACKGROUND
#define XSetClassHint XSETCLASSHINT
#define XSetClipMask XSETCLIPMASK
#define XSetClipOrigin XSETCLIPORIGIN
#define XSetClipRectangles XSETCLIPRECTANGLES
#define XSetCloseDownMode XSETCLOSEDOWNMODE
#define XSetCommand XSETCOMMAND
#define XSetDashes XSETDASHES
#define XSetErrorHandler XSETERRORHANDLER
#define XSetFillRule XSETFILLRULE
#define XSetFillStyle XSETFILLSTYLE
#define XSetFont XSETFONT
#define XSetForeground XSETFOREGROUND
#define XSetFunction XSETFUNCTION
#define XSetGraphicsExposures XSETGRAPHICSEXPOSURES
#define XSetICFocus XSETICFOCUS
#define XSetICValues XSETICVALUES
#define XSetIOErrorHandler XSETIOERRORHANDLER
#define XSetIconName XSETICONNAME
#define XSetInputFocus XSETINPUTFOCUS
#define XSetLineAttributes XSETLINEATTRIBUTES
#define XSetLocaleModifiers XSETLOCALEMODIFIERS
#define XSetNormalHints XSETNORMALHINTS
#define XSetPlaneMask XSETPLANEMASK
#define XSetRegion XSETREGION
#define XSetRGBColormaps XSETRGBCOLORMAPS
#define XSetScreenSaver XSETSCREENSAVER
#define XSetSelectionOwner XSETSELECTIONOWNER
#define XSetStandardProperties XSETSTANDARDPROPERTIES
#define XSetState XSETSTATE
#define XSetStipple XSETSTIPPLE
#define XSetSubwindowMode XSETSUBWINDOWMODE
#define XSetTSOrigin XSETTSORIGIN
#define XSetTextProperty XSETTEXTPROPERTY
#define XSetTile XSETTILE
#define XSetTransientForHint XSETTRANSIENTFORHINT
#define XSetWMClientMachine XSETWMCLIENTMACHINE
#define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS
#define XSetWMHints XSETWMHINTS
#define XSetWMIconName XSETWMICONNAME
#define XSetWMName XSETWMNAME
#define XSetWMNormalHints XSETWMNORMALHINTS
#define XSetWMProperties XSETWMPROPERTIES
#define XSetWMProtocols XSETWMPROTOCOLS
#define XSetWMSizeHints XSETWMSIZEHINTS
#define XSetWindowBackground XSETWINDOWBACKGROUND
#define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP
#define XSetWindowBorder XSETWINDOWBORDER
#define XSetWindowBorderPixmap XSETWINDOWBORDERPIXMAP
#define XSetWindowBorderWidth XSETWINDOWBORDERWIDTH
#define XSetWindowColormap XSETWINDOWCOLORMAP
#define XShapeCombineMask XSHAPECOMBINEMASK
#define XShapeCombineRectangles XSHAPECOMBINERECTANGLES
#define XShapeGetRectangles XSHAPEGETRECTANGLES
#define XShapeQueryExtension XSHAPEQUERYEXTENSION
#define XShmAttach XSHMATTACH
#define XShmCreateImage XSHMCREATEIMAGE
#define XShmCreatePixmap XSHMCREATEPIXMAP
#define XShmDetach XSHMDETACH
#define XShmGetEventBase XSHMGETEVENTBASE
#define XShmPutImage XSHMPUTIMAGE
#define XShmQueryExtension XSHMQUERYEXTENSION
#define XShmQueryVersion XSHMQUERYVERSION
#define XShrinkRegion XSHRINKREGION
#define XStoreBuffer XSTOREBUFFER
#define XStoreBytes XSTOREBYTES
#define XStoreColor XSTORECOLOR
#define XStoreColors XSTORECOLORS
#define XStoreName XSTORENAME
#define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY
#define XStringToKeysym XSTRINGTOKEYSYM
#define XSubtractRegion XSUBTRACTREGION
#define XSupportsLocale XSUPPORTSLOCALE
#define XSync XSYNC
#define XSynchronize XSYNCHRONIZE
#define XTextExtents XTEXTEXTENTS
#define XTextExtents16 XTEXTEXTENTS16
#define XTextPropertyToStringList XTEXTPROPERTYTOSTRINGLIST
#define XTextWidth XTEXTWIDTH
#define XTextWidth16 XTEXTWIDTH16
#define XTranslateCoordinates XTRANSLATECOORDINATES
#define XUndefineCursor XUNDEFINECURSOR
#define XUngrabButton XUNGRABBUTTON
#define XUngrabKeyboard XUNGRABKEYBOARD
#define XUngrabPointer XUNGRABPOINTER
#define XUngrabServer XUNGRABSERVER
#define XUninstallColormap XUNINSTALLCOLORMAP
#define XUnionRectWithRegion XUNIONRECTWITHREGION
#define XUnionRegion XUNIONREGION
#define XUniqueContext XUNIQUECONTEXT
#define XUnmapWindow XUNMAPWINDOW
#define XUnsetICFocus XUNSETICFOCUS
#define XVaCreateNestedList XVACREATENESTEDLIST
#define XVisualIDFromVisual XVISUALIDFROMVISUAL
#define XWMGeometry XWMGEOMETRY
#define XWarpPointer XWARPPOINTER
#define XWhitePixel XWHITEPIXEL
#define XWhitePixelOfScreen XWHITEPIXELOFSCREEN
#define XWidthMMOfScreen XWIDTHMMOFSCREEN
#define XWidthOfScreen XWIDTHOFSCREEN
#define XWindowEvent XWINDOWEVENT
#define XWithdrawWindow XWITHDRAWWINDOW
#define XXorRegion XXORREGION
#define XcmsQueryColor XCMSQUERYCOLOR
#define XdbeAllocateBackBufferName XDBEALLOCATEBACKBUFFERNAME
#define XdbeFreeVisualInfo XDBEFREEVISUALINFO
#define XdbeGetVisualInfo XDBEGETVISUALINFO
#define XdbeQueryExtension XDBEQUERYEXTENSION
#define XdbeSwapBuffers XDBESWAPBUFFERS
#define XextAddDisplay XEXTADDDISPLAY
#define XextFindDisplay XEXTFINDDISPLAY
#define XextRemoveDisplay XEXTREMOVEDISPLAY
#define XkbSetDetectableAutoRepeat XKBSETDETECTABLEAUTOREPEAT
#define XmActivateProtocol XMACTIVATEPROTOCOL
#define XmAddProtocolCallback XMADDPROTOCOLCALLBACK
#define XmAddProtocols XMADDPROTOCOLS
#define XmChangeColor XMCHANGECOLOR
#define XmClipboardCopy XMCLIPBOARDCOPY
#define XmClipboardCopyByName XMCLIPBOARDCOPYBYNAME
#define XmClipboardEndCopy XMCLIPBOARDENDCOPY
#define XmClipboardEndRetrieve XMCLIPBOARDENDRETRIEVE
#define XmClipboardInquireCount XMCLIPBOARDINQUIRECOUNT
#define XmClipboardInquireFormat XMCLIPBOARDINQUIREFORMAT
#define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH
#define XmClipboardLock XMCLIPBOARDLOCK
#define XmClipboardRetrieve XMCLIPBOARDRETRIEVE
#define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY
#define XmClipboardStartRetrieve XMCLIPBOARDSTARTRETRIEVE
#define XmClipboardUnlock XMCLIPBOARDUNLOCK
#define XmCommandError XMCOMMANDERROR
#define XmCommandGetChild XMCOMMANDGETCHILD
#define XmCommandSetValue XMCOMMANDSETVALUE
#define XmCreateArrowButton XMCREATEARROWBUTTON
#define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET
#define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG
#define XmCreateCascadeButton XMCREATECASCADEBUTTON
#define XmCreateCascadeButtonGadget XMCREATECASCADEBUTTONGADGET
#define XmCreateDialogShell XMCREATEDIALOGSHELL
#define XmCreateDragIcon XMCREATEDRAGICON
#define XmCreateDrawingArea XMCREATEDRAWINGAREA
#define XmCreateDrawnButton XMCREATEDRAWNBUTTON
#define XmCreateErrorDialog XMCREATEERRORDIALOG
#define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX
#define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG
#define XmCreateForm XMCREATEFORM
#define XmCreateFormDialog XMCREATEFORMDIALOG
#define XmCreateFrame XMCREATEFRAME
#define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG
#define XmCreateLabel XMCREATELABEL
#define XmCreateLabelGadget XMCREATELABELGADGET
#define XmCreateList XMCREATELIST
#define XmCreateMainWindow XMCREATEMAINWINDOW
#define XmCreateMenuBar XMCREATEMENUBAR
#define XmCreateMessageBox XMCREATEMESSAGEBOX
#define XmCreateMessageDialog XMCREATEMESSAGEDIALOG
#define XmCreateOptionMenu XMCREATEOPTIONMENU
#define XmCreatePanedWindow XMCREATEPANEDWINDOW
#define XmCreatePopupMenu XMCREATEPOPUPMENU
#define XmCreatePromptDialog XMCREATEPROMPTDIALOG
#define XmCreatePulldownMenu XMCREATEPULLDOWNMENU
#define XmCreatePushButton XMCREATEPUSHBUTTON
#define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET
#define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG
#define XmCreateRadioBox XMCREATERADIOBOX
#define XmCreateRowColumn XMCREATEROWCOLUMN
#define XmCreateScale XMCREATESCALE
#define XmCreateScrollBar XMCREATESCROLLBAR
#define XmCreateScrolledList XMCREATESCROLLEDLIST
#define XmCreateScrolledText XMCREATESCROLLEDTEXT
#define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW
#define XmCreateSelectionDialog XMCREATESELECTIONDIALOG
#define XmCreateSeparator XMCREATESEPARATOR
#define XmCreateSeparatorGadget XMCREATESEPARATORGADGET
#define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG
#define XmCreateText XMCREATETEXT
#define XmCreateTextField XMCREATETEXTFIELD
#define XmCreateToggleButton XMCREATETOGGLEBUTTON
#define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET
#define XmCreateWarningDialog XMCREATEWARNINGDIALOG
#define XmCvtCTToXmString XMCVTCTTOXMSTRING
#define XmDestroyPixmap XMDESTROYPIXMAP
#define XmDragStart XMDRAGSTART
#define XmDropSiteRegister XMDROPSITEREGISTER
#define XmDropSiteUnregister XMDROPSITEUNREGISTER
#define XmDropSiteUpdate XMDROPSITEUPDATE
#define XmDropTransferStart XMDROPTRANSFERSTART
#define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD
#define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH
#define XmFontListAppendEntry XMFONTLISTAPPENDENTRY
#define XmFontListCopy XMFONTLISTCOPY
#define XmFontListCreate XMFONTLISTCREATE
#define XmFontListEntryCreate XMFONTLISTENTRYCREATE
#define XmFontListEntryFree XMFONTLISTENTRYFREE
#define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT
#define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG
#define XmFontListEntryLoad XMFONTLISTENTRYLOAD
#define XmFontListFree XMFONTLISTFREE
#define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT
#define XmFontListGetNextFont XMFONTLISTGETNEXTFONT
#define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT
#define XmFontListNextEntry XMFONTLISTNEXTENTRY
#define XmGetColors XMGETCOLORS
#define XmGetColorCalculation XMGETCOLORCALCULATION
#define XmGetFocusWidget XMGETFOCUSWIDGET
#define XmGetMenuCursor XMGETMENUCURSOR
#define XmGetPixmap XMGETPIXMAP
#define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH
#define XmGetTearOffControl XMGETTEAROFFCONTROL
#define XmGetXmDisplay XMGETXMDISPLAY
#define XmImMbLookupString XMIMMBLOOKUPSTRING
#define XmImRegister XMIMREGISTER
#define XmImSetFocusValues XMIMSETFOCUSVALUES
#define XmImSetValues XMIMSETVALUES
#define XmImUnregister XMIMUNREGISTER
#define XmImUnsetFocus XMIMUNSETFOCUS
#define XmInstallImage XMINSTALLIMAGE
#define XmInternAtom XMINTERNATOM
#define XmIsMotifWMRunning XMISMOTIFWMRUNNING
#define XmListAddItem XMLISTADDITEM
#define XmListAddItemUnselected XMLISTADDITEMUNSELECTED
#define XmListAddItems XMLISTADDITEMS
#define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED
#define XmListDeleteAllItems XMLISTDELETEALLITEMS
#define XmListDeleteItem XMLISTDELETEITEM
#define XmListDeleteItemsPos XMLISTDELETEITEMSPOS
#define XmListDeletePos XMLISTDELETEPOS
#define XmListDeselectAllItems XMLISTDESELECTALLITEMS
#define XmListDeselectPos XMLISTDESELECTPOS
#define XmListGetKbdItemPos XMLISTGETKBDITEMPOS
#define XmListGetMatchPos XMLISTGETMATCHPOS
#define XmListGetSelectedPos XMLISTGETSELECTEDPOS
#define XmListItemExists XMLISTITEMEXISTS
#define XmListItemPos XMLISTITEMPOS
#define XmListPosSelected XMLISTPOSSELECTED
#define XmListReplaceItems XMLISTREPLACEITEMS
#define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS
#define XmListSelectItem XMLISTSELECTITEM
#define XmListSelectPos XMLISTSELECTPOS
#define XmListSetBottomPos XMLISTSETBOTTOMPOS
#define XmListSetItem XMLISTSETITEM
#define XmListSetKbdItemPos XMLISTSETKBDITEMPOS
#define XmListSetPos XMLISTSETPOS
#define XmMainWindowSetAreas XMMAINWINDOWSETAREAS
#define XmMenuPosition XMMENUPOSITION
#define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD
#define XmOptionButtonGadget XMOPTIONBUTTONGADGET
#define XmOptionLabelGadget XMOPTIONLABELGADGET
#define XmProcessTraversal XMPROCESSTRAVERSAL
#define XmQmotif XMQMOTIF
#define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK
#define XmRemoveProtocols XMREMOVEPROTOCOLS
#define XmRemoveTabGroup XMREMOVETABGROUP
#define XmRepTypeGetId XMREPTYPEGETID
#define XmRepTypeGetRecord XMREPTYPEGETRECORD
#define XmRepTypeInstallTearOffModelCon XMREPTYPEINSTALLTEAROFFMODELCON
#define XmRepTypeRegister XMREPTYPEREGISTER
#define XmRepTypeValidValue XMREPTYPEVALIDVALUE
#define XmScrollBarGetValues XMSCROLLBARGETVALUES
#define XmScrollBarSetValues XMSCROLLBARSETVALUES
#define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS
#define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD
#define XmSetColorCalculation XMSETCOLORCALCULATION
#define XmStringByteCompare XMSTRINGBYTECOMPARE
#define XmStringCompare XMSTRINGCOMPARE
#define XmStringConcat XMSTRINGCONCAT
#define XmStringCopy XMSTRINGCOPY
#define XmStringCreate XMSTRINGCREATE
#define XmStringCreateLocalized XMSTRINGCREATELOCALIZED
#define XmStringCreateLtoR XMSTRINGCREATELTOR
#define XmStringCreateSimple XMSTRINGCREATESIMPLE
#define XmStringDraw XMSTRINGDRAW
#define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE
#define XmStringExtent XMSTRINGEXTENT
#define XmStringFree XMSTRINGFREE
#define XmStringFreeContext XMSTRINGFREECONTEXT
#define XmStringGetLtoR XMSTRINGGETLTOR
#define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT
#define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT
#define XmStringInitContext XMSTRINGINITCONTEXT
#define XmStringLength XMSTRINGLENGTH
#define XmStringLtoRCreate XMSTRINGLTORCREATE
#define XmStringNConcat XMSTRINGNCONCAT
#define XmStringSegmentCreate XMSTRINGSEGMENTCREATE
#define XmStringSeparatorCreate XMSTRINGSEPARATORCREATE
#define XmStringWidth XMSTRINGWIDTH
#define XmTextClearSelection XMTEXTCLEARSELECTION
#define XmTextCopy XMTEXTCOPY
#define XmTextCut XMTEXTCUT
#define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION
#define XmTextFieldCopy XMTEXTFIELDCOPY
#define XmTextFieldCut XMTEXTFIELDCUT
#define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE
#define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION
#define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION
#define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH
#define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION
#define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION
#define XmTextFieldGetString XMTEXTFIELDGETSTRING
#define XmTextFieldInsert XMTEXTFIELDINSERT
#define XmTextFieldPaste XMTEXTFIELDPASTE
#define XmTextFieldRemove XMTEXTFIELDREMOVE
#define XmTextFieldReplace XMTEXTFIELDREPLACE
#define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE
#define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT
#define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION
#define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH
#define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION
#define XmTextFieldSetString XMTEXTFIELDSETSTRING
#define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION
#define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION
#define XmTextGetEditable XMTEXTGETEDITABLE
#define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION
#define XmTextGetLastPosition XMTEXTGETLASTPOSITION
#define XmTextGetMaxLength XMTEXTGETMAXLENGTH
#define XmTextGetSelection XMTEXTGETSELECTION
#define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION
#define XmTextGetString XMTEXTGETSTRING
#define XmTextInsert XMTEXTINSERT
#define XmTextPaste XMTEXTPASTE
#define XmTextPosToXY XMTEXTPOSTOXY
#define XmTextRemove XMTEXTREMOVE
#define XmTextReplace XMTEXTREPLACE
#define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION
#define XmTextSetEditable XMTEXTSETEDITABLE
#define XmTextSetHighlight XMTEXTSETHIGHLIGHT
#define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION
#define XmTextSetSelection XMTEXTSETSELECTION
#define XmTextSetString XMTEXTSETSTRING
#define XmTextSetTopCharacter XMTEXTSETTOPCHARACTER
#define XmTextShowPosition XMTEXTSHOWPOSITION
#define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE
#define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE
#define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE
#define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE
#define XmUninstallImage XMUNINSTALLIMAGE
#define XmUpdateDisplay XMUPDATEDISPLAY
#define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX
#define XmbDrawString XMBDRAWSTRING
#define XmbLookupString XMBLOOKUPSTRING
#define XmbResetIC XMBRESETIC
#define XmbSetWMProperties XMBSETWMPROPERTIES
#define XmbTextEscapement XMBTEXTESCAPEMENT
#define XmbTextExtents XMBTEXTEXTENTS
#define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY
#define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST
#define XmbufCreateBuffers XMBUFCREATEBUFFERS
#define XmbufDestroyBuffers XMBUFDESTROYBUFFERS
#define XmbufDisplayBuffers XMBUFDISPLAYBUFFERS
#define XmbufQueryExtension XMBUFQUERYEXTENSION
#define Xmemory_free XMEMORY_FREE
#define Xmemory_malloc XMEMORY_MALLOC
#define XmuClientWindow XMUCLIENTWINDOW
#define XmuConvertStandardSelection XMUCONVERTSTANDARDSELECTION
#define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP
#define XmuInternAtom XMUINTERNATOM
#define XmuInternStrings XMUINTERNSTRINGS
#define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP
#define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE
#define XrmCombineDatabase XRMCOMBINEDATABASE
#define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE
#define XrmDestroyDatabase XRMDESTROYDATABASE
#define XrmGetDatabase XRMGETDATABASE
#define XrmGetFileDatabase XRMGETFILEDATABASE
#define XrmGetResource XRMGETRESOURCE
#define XrmGetStringDatabase XRMGETSTRINGDATABASE
#define XrmInitialize XRMINITIALIZE
#define XrmMergeDatabases XRMMERGEDATABASES
#define XrmParseCommand XRMPARSECOMMAND
#define XrmPermStringToQuark XRMPERMSTRINGTOQUARK
#define XrmPutFileDatabase XRMPUTFILEDATABASE
#define XrmPutLineResource XRMPUTLINERESOURCE
#define XrmPutStringResource XRMPUTSTRINGRESOURCE
#define XrmQGetResource XRMQGETRESOURCE
#define XrmQPutStringResource XRMQPUTSTRINGRESOURCE
#define XrmQuarkToString XRMQUARKTOSTRING
#define XrmSetDatabase XRMSETDATABASE
#define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST
#define XrmStringToQuark XRMSTRINGTOQUARK
#define XtAddCallback XTADDCALLBACK
#define XtAddCallbacks XTADDCALLBACKS
#define XtAddConverter XTADDCONVERTER
#define XtAddEventHandler XTADDEVENTHANDLER
#define XtAddExposureToRegion XTADDEXPOSURETOREGION
#define XtAddGrab XTADDGRAB
#define XtAddRawEventHandler XTADDRAWEVENTHANDLER
#define XtAllocateGC XTALLOCATEGC
#define XtAppAddActions XTAPPADDACTIONS
#define XtAppAddInput XTAPPADDINPUT
#define XtAppAddTimeOut XTAPPADDTIMEOUT
#define XtAppAddWorkProc XTAPPADDWORKPROC
#define XtAppCreateShell XTAPPCREATESHELL
#define XtAppError XTAPPERROR
#define XtAppErrorMsg XTAPPERRORMSG
#define XtAppInitialize XTAPPINITIALIZE
#define XtAppMainLoop XTAPPMAINLOOP
#define XtAppNextEvent XTAPPNEXTEVENT
#define XtAppPeekEvent XTAPPPEEKEVENT
#define XtAppPending XTAPPPENDING
#define XtAppProcessEvent XTAPPPROCESSEVENT
#define XtAppSetErrorHandler XTAPPSETERRORHANDLER
#define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES
#define XtAppSetTypeConverter XTAPPSETTYPECONVERTER
#define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER
#define XtAppWarningMsg XTAPPWARNINGMSG
#define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER
#define XtAppWarning XTAPPWARNING
#define XtAugmentTranslations XTAUGMENTTRANSLATIONS
#define XtCallActionProc XTCALLACTIONPROC
#define XtCallCallbackList XTCALLCALLBACKLIST
#define XtCallCallbacks XTCALLCALLBACKS
#define XtCallConverter XTCALLCONVERTER
#define XtCalloc XTCALLOC
#ifndef NOXTDISPLAY
#define XtClass XTCLASS
#endif
#define XtCloseDisplay XTCLOSEDISPLAY
#define XtConfigureWidget XTCONFIGUREWIDGET
#define XtConvert XTCONVERT
#define XtConvertAndStore XTCONVERTANDSTORE
#define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT
#define XtCreateManagedWidget XTCREATEMANAGEDWIDGET
#define XtCreatePopupShell XTCREATEPOPUPSHELL
#define XtCreateWidget XTCREATEWIDGET
#define XtCreateWindow XTCREATEWINDOW
#define XtCvtStringToFont XTCVTSTRINGTOFONT
#define XtDatabase XTDATABASE
#define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT
#define XtDestroyWidget XTDESTROYWIDGET
#define XtDisownSelection XTDISOWNSELECTION
#define XtDispatchEvent XTDISPATCHEVENT
#ifndef NOXTDISPLAY
#define XtDisplay XTDISPLAY
#endif
#define XtDisplayOfObject XTDISPLAYOFOBJECT
#define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING
#define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT
#define XtError XTERROR
#define XtErrorMsg XTERRORMSG
#define XtFree XTFREE
#define XtGetActionKeysym XTGETACTIONKEYSYM
#define XtGetActionList XTGETACTIONLIST
#define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS
#define XtGetApplicationResources XTGETAPPLICATIONRESOURCES
#define XtGetClassExtension XTGETCLASSEXTENSION
#define XtGetConstraintResourceList XTGETCONSTRAINTRESOURCELIST
#define XtGetGC XTGETGC
#define XtGetMultiClickTime XTGETMULTICLICKTIME
#define XtGetResourceList XTGETRESOURCELIST
#define XtGetSelectionValue XTGETSELECTIONVALUE
#define XtGetSelectionValues XTGETSELECTIONVALUES
#define XtGetSubresources XTGETSUBRESOURCES
#define XtGetValues XTGETVALUES
#define XtGrabButton XTGRABBUTTON
#define XtGrabKeyboard XTGRABKEYBOARD
#define XtGrabPointer XTGRABPOINTER
#define XtHasCallbacks XTHASCALLBACKS
#define XtInitialize XTINITIALIZE
#define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS
#define XtInsertEventHandler XTINSERTEVENTHANDLER
#define XtInsertRawEventHandler XTINSERTRAWEVENTHANDLER
#define XtInstallAccelerators XTINSTALLACCELERATORS
#define XtIsManaged XTISMANAGED
#define XtIsObject XTISOBJECT
#ifndef NOXTDISPLAY
#define XtIsRealized XTISREALIZED
#endif
#define XtIsSensitive XTISSENSITIVE
#define XtIsSubclass XTISSUBCLASS
#define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED
#define XtMainLoop XTMAINLOOP
#define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST
#define XtMakeResizeRequest XTMAKERESIZEREQUEST
#define XtMalloc XTMALLOC
#define XtManageChild XTMANAGECHILD
#define XtManageChildren XTMANAGECHILDREN
#define XtMergeArgLists XTMERGEARGLISTS
#define XtMoveWidget XTMOVEWIDGET
#define XtName XTNAME
#define XtNameToWidget XTNAMETOWIDGET
#define XtOpenApplication XTOPENAPPLICATION
#define XtOpenDisplay XTOPENDISPLAY
#define XtOverrideTranslations XTOVERRIDETRANSLATIONS
#define XtOwnSelection XTOWNSELECTION
#ifndef NOXTDISPLAY
#define XtParent XTPARENT
#endif
#define XtParseAcceleratorTable XTPARSEACCELERATORTABLE
#define XtParseTranslationTable XTPARSETRANSLATIONTABLE
#define XtPopdown XTPOPDOWN
#define XtPopup XTPOPUP
#define XtPopupSpringLoaded XTPOPUPSPRINGLOADED
#define XtQueryGeometry XTQUERYGEOMETRY
#define XtRealizeWidget XTREALIZEWIDGET
#define XtRealloc XTREALLOC
#define XtRegisterDrawable _XTREGISTERWINDOW
#define XtRegisterGrabAction XTREGISTERGRABACTION
#define XtReleaseGC XTRELEASEGC
#define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS
#define XtRemoveCallback XTREMOVECALLBACK
#define XtRemoveEventHandler XTREMOVEEVENTHANDLER
#define XtRemoveGrab XTREMOVEGRAB
#define XtRemoveInput XTREMOVEINPUT
#define XtRemoveTimeOut XTREMOVETIMEOUT
#define XtRemoveWorkProc XTREMOVEWORKPROC
#define XtResizeWidget XTRESIZEWIDGET
#define XtResolvePathname XTRESOLVEPATHNAME
#ifndef NOXTDISPLAY
#define XtScreen XTSCREEN
#endif
#define XtScreenDatabase XTSCREENDATABASE
#define XtScreenOfObject XTSCREENOFOBJECT
#define XtSessionReturnToken XTSESSIONRETURNTOKEN
#define XtSetErrorHandler XTSETERRORHANDLER
#define XtSetKeyboardFocus XTSETKEYBOARDFOCUS
#define XtSetLanguageProc XTSETLANGUAGEPROC
#define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED
#define XtSetSensitive XTSETSENSITIVE
#define XtSetTypeConverter XTSETTYPECONVERTER
#define XtSetValues XTSETVALUES
#define XtShellStrings XTSHELLSTRINGS
#define XtStringConversionWarning XTSTRINGCONVERSIONWARNING
#define XtStrings XTSTRINGS
#define XtToolkitInitialize XTTOOLKITINITIALIZE
#define XtTranslateCoords XTTRANSLATECOORDS
#define XtTranslateKeycode XTTRANSLATEKEYCODE
#define XtUngrabButton XTUNGRABBUTTON
#define XtUngrabKeyboard XTUNGRABKEYBOARD
#define XtUngrabPointer XTUNGRABPOINTER
#define XtUnmanageChild XTUNMANAGECHILD
#define XtUnmanageChildren XTUNMANAGECHILDREN
#define XtUnrealizeWidget XTUNREALIZEWIDGET
#define XtUnregisterDrawable _XTUNREGISTERWINDOW
#define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET
#define XtVaCreatePopupShell XTVACREATEPOPUPSHELL
#define XtVaCreateWidget XTVACREATEWIDGET
#define XtVaGetApplicationResources XTVAGETAPPLICATIONRESOURCES
#define XtVaGetValues XTVAGETVALUES
#define XtVaSetValues XTVASETVALUES
#define XtWarning XTWARNING
#define XtWarningMsg XTWARNINGMSG
#define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT
#ifndef NOXTDISPLAY
#define XtWindow XTWINDOW
#endif
#define XtWindowOfObject XTWINDOWOFOBJECT
#define XtWindowToWidget XTWINDOWTOWIDGET
#define XwcDrawImageString XWCDRAWIMAGESTRING
#define XwcDrawString XWCDRAWSTRING
#define XwcFreeStringList XWCFREESTRINGLIST
#define XwcTextEscapement XWCTEXTESCAPEMENT
#define XwcTextExtents XWCTEXTEXTENTS
#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY
#define XwcLookupString XWCLOOKUPSTRING
#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST
#define _XAllocTemp _XALLOCTEMP
#define _XDeqAsyncHandler _XDEQASYNCHANDLER
#define _XEatData _XEATDATA
#define _XFlush _XFLUSH
#define _XFreeTemp _XFREETEMP
#define _XGetAsyncReply _XGETASYNCREPLY
#define _XInitImageFuncPtrs _XINITIMAGEFUNCPTRS
#define _XRead _XREAD
#define _XReadPad _XREADPAD
#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE
#define _XReply _XREPLY
#define _XSend _XSEND
#define _XUnregisterFilter _XUNREGISTERFILTER
#define _XVIDtoVisual _XVIDTOVISUAL
#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT
#define _XmClearBorder _XMCLEARBORDER
#define _XmConfigureObject _XMCONFIGUREOBJECT
#define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK
#define _XmDrawArrow _XMDRAWARROW
#define _XmDrawShadows _XMDRAWSHADOWS
#define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT
#define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS
#define _XmFromVerticalPixels _XMFROMVERTICALPIXELS
#define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR
#define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST
#define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON
#define _XmGetWidgetExtData _XMGETWIDGETEXTDATA
#define _XmGrabKeyboard _XMGRABKEYBOARD
#define _XmGrabPointer _XMGRABPOINTER
#define _XmInheritClass _XMINHERITCLASS
#define _XmInputForGadget _XMINPUTFORGADGET
#define _XmInputInGadget _XMINPUTINGADGET
#define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST
#define _XmMenuPopDown _XMMENUPOPDOWN
#define _XmMoveObject _XMMOVEOBJECT
#define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED
#define _XmOSBuildFileList _XMOSBUILDFILELIST
#define _XmOSFileCompare _XMOSFILECOMPARE
#define _XmOSFindPatternPart _XMOSFINDPATTERNPART
#define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC
#define _XmPostPopupMenu _XMPOSTPOPUPMENU
#define _XmPrimitiveEnter _XMPRIMITIVEENTER
#define _XmPrimitiveLeave _XMPRIMITIVELEAVE
#define _XmRedisplayGadgets _XMREDISPLAYGADGETS
#define _XmShellIsExclusive _XMSHELLISEXCLUSIVE
#define _XmStringDraw _XMSTRINGDRAW
#define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT
#define _XmStrings _XMSTRINGS
#define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS
#define _XmToVerticalPixels _XMTOVERTICALPIXELS
#define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT
#define _Xm_fastPtr _XM_FASTPTR
#define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG
#define _XtCopyFromArg _XTCOPYFROMARG
#define _XtCountVaList _XTCOUNTVALIST
#define _XtInherit _XTINHERIT
#define _XtInheritTranslations _XTINHERITTRANSLATIONS
#define _XtIsSubclassOf _XTISSUBCLASSOF
#define _XtVaToArgList _XTVATOARGLIST
#define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS
#define cli$dcl_parse CLI$DCL_PARSE
#define cli$get_value CLI$GET_VALUE
#define cli$present CLI$PRESENT
#define compositeClassRec COMPOSITECLASSREC
#define compositeWidgetClass COMPOSITEWIDGETCLASS
#define constraintClassRec CONSTRAINTCLASSREC
#define constraintWidgetClass CONSTRAINTWIDGETCLASS
#define coreWidgetClass COREWIDGETCLASS
#define exe$getspi EXE$GETSPI
#define lbr$close LBR$CLOSE
#define lbr$get_header LBR$GET_HEADER
#define lbr$get_index LBR$GET_INDEX
#define lbr$get_record LBR$GET_RECORD
#define lbr$ini_control LBR$INI_CONTROL
#define lbr$lookup_key LBR$LOOKUP_KEY
#define lbr$open LBR$OPEN
#define lbr$output_help LBR$OUTPUT_HELP
#define lib$add_times LIB$ADD_TIMES
#define lib$addx LIB$ADDX
#define lib$create_dir LIB$CREATE_DIR
#define lib$create_vm_zone LIB$CREATE_VM_ZONE
#define lib$cvt_from_internal_time LIB$CVT_FROM_INTERNAL_TIME
#define lib$cvt_htb LIB$CVT_HTB
#define lib$cvt_vectim LIB$CVT_VECTIM
#define lib$day LIB$DAY
#define lib$day_of_week LIB$DAY_OF_WEEK
#define lib$delete_symbol LIB$DELETE_SYMBOL
#define lib$delete_vm_zone LIB$DELETE_VM_ZONE
#define lib$disable_ctrl LIB$DISABLE_CTRL
#define lib$ediv LIB$EDIV
#define lib$emul LIB$EMUL
#define lib$enable_ctrl LIB$ENABLE_CTRL
#define lib$find_vm_zone LIB$FIND_VM_ZONE
#define lib$format_date_time LIB$FORMAT_DATE_TIME
#define lib$free_timer LIB$FREE_TIMER
#define lib$free_vm LIB$FREE_VM
#define lib$get_ef LIB$GET_EF
#define lib$get_foreign LIB$GET_FOREIGN
#define lib$get_input LIB$GET_INPUT
#define lib$get_users_language LIB$GET_USERS_LANGUAGE
#define lib$get_vm LIB$GET_VM
#define lib$get_symbol LIB$GET_SYMBOL
#define lib$getdvi LIB$GETDVI
#define lib$init_date_time_context LIB$INIT_DATE_TIME_CONTEXT
#define lib$init_timer LIB$INIT_TIMER
#define lib$find_file LIB$FIND_FILE
#define lib$find_file_end LIB$FIND_FILE_END
#define lib$find_image_symbol LIB$FIND_IMAGE_SYMBOL
#define lib$mult_delta_time LIB$MULT_DELTA_TIME
#define lib$put_output LIB$PUT_OUTPUT
#define lib$rename_file LIB$RENAME_FILE
#define lib$reset_vm_zone LIB$RESET_VM_ZONE
#define lib$set_symbol LIB$SET_SYMBOL
#define lib$sfree1_dd LIB$SFREE1_DD
#define lib$show_vm LIB$SHOW_VM
#define lib$show_vm_zone LIB$SHOW_VM_ZONE
#define lib$spawn LIB$SPAWN
#define lib$stat_timer LIB$STAT_TIMER
#define lib$subx LIB$SUBX
#define lib$sub_times LIB$SUB_TIMES
#define lib$wait LIB$WAIT
#define mail$send_add_address MAIL$SEND_ADD_ADDRESS
#define mail$send_add_attribute MAIL$SEND_ADD_ATTRIBUTE
#define mail$send_add_bodypart MAIL$SEND_ADD_BODYPART
#define mail$send_begin MAIL$SEND_BEGIN
#define mail$send_end MAIL$SEND_END
#define mail$send_message MAIL$SEND_MESSAGE
#define ncs$convert NCS$CONVERT
#define ncs$get_cf NCS$GET_CF
#define objectClass OBJECTCLASS
#define objectClassRec OBJECTCLASSREC
#define overrideShellClassRec OVERRIDESHELLCLASSREC
#define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS
#define pthread_attr_create PTHREAD_ATTR_CREATE
#define pthread_attr_delete PTHREAD_ATTR_DELETE
#define pthread_attr_destroy PTHREAD_ATTR_DESTROY
#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP
#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP
#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED
#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO
#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED
#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM
#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY
#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE
#define pthread_attr_init PTHREAD_ATTR_INIT
#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP
#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE
#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP
#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED
#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO
#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED
#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM
#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY
#ifndef pthread_attr_setscope
# define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE
#endif
#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE
#define pthread_cancel PTHREAD_CANCEL
#define pthread_cancel_e PTHREAD_CANCEL_E
#define pthread_cond_broadcast PTHREAD_COND_BROADCAST
#define pthread_cond_destroy PTHREAD_COND_DESTROY
#define pthread_cond_init PTHREAD_COND_INIT
#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP
#define pthread_cond_signal PTHREAD_COND_SIGNAL
#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP
#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT
#define pthread_cond_wait PTHREAD_COND_WAIT
#define pthread_condattr_create PTHREAD_CONDATTR_CREATE
#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE
#define pthread_condattr_init PTHREAD_CONDATTR_INIT
#define pthread_create PTHREAD_CREATE
#define pthread_delay_np PTHREAD_DELAY_NP
#define pthread_detach PTHREAD_DETACH
#define pthread_equal PTHREAD_EQUAL
#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP
#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP
#define pthread_exc_matches_np PTHREAD_EXC_MATCHES_NP
#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP
#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP
#define pthread_exc_raise_np PTHREAD_EXC_RAISE_NP
#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP
#define pthread_exit PTHREAD_EXIT
#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP
#define pthread_getprio PTHREAD_GETPRIO
#define pthread_getschedparam PTHREAD_GETSCHEDPARAM
#define pthread_getscheduler PTHREAD_GETSCHEDULER
#define pthread_getspecific PTHREAD_GETSPECIFIC
#define pthread_getunique_np PTHREAD_GETUNIQUE_NP
#define pthread_join PTHREAD_JOIN
#define pthread_join32 PTHREAD_JOIN32
#define pthread_key_create PTHREAD_KEY_CREATE
#define pthread_key_delete PTHREAD_KEY_DELETE
#define pthread_keycreate PTHREAD_KEYCREATE
#define pthread_kill PTHREAD_KILL
#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP
#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY
#define pthread_mutex_init PTHREAD_MUTEX_INIT
#define pthread_mutex_lock PTHREAD_MUTEX_LOCK
#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK
#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK
#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE
#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE
#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY
#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP
#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT
#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP
#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP
#define pthread_once PTHREAD_ONCE
#define pthread_resume_np PTHREAD_RESUME_NP
#define pthread_self PTHREAD_SELF
#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL
#define pthread_setcancel PTHREAD_SETCANCEL
#define pthread_setcancelstate PTHREAD_SETCANCELSTATE
#define pthread_setcanceltype PTHREAD_SETCANCELTYPE
#define pthread_setprio PTHREAD_SETPRIO
#define pthread_setschedparam PTHREAD_SETSCHEDPARAM
#define pthread_setscheduler PTHREAD_SETSCHEDULER
#define pthread_setspecific PTHREAD_SETSPECIFIC
#define pthread_suspend_np PTHREAD_SUSPEND_NP
#define pthread_testcancel PTHREAD_TESTCANCEL
#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP
#define pthread_yield PTHREAD_YIELD
#define pthread_yield_np PTHREAD_YIELD_NP
#define rectObjClass RECTOBJCLASS
#define rectObjClassRec RECTOBJCLASSREC
#define sessionShellWidgetClass SESSIONSHELLWIDGETCLASS
#define shellWidgetClass SHELLWIDGETCLASS
#define shmat SHMAT
#define shmctl SHMCTL
#define shmdt SHMDT
#define shmget SHMGET
#define smg$create_key_table SMG$CREATE_KEY_TABLE
#define smg$create_virtual_keyboard SMG$CREATE_VIRTUAL_KEYBOARD
#define smg$read_composed_line SMG$READ_COMPOSED_LINE
#define sys$add_ident SYS$ADD_IDENT
#define sys$asctoid SYS$ASCTOID
#define sys$assign SYS$ASSIGN
#define sys$bintim SYS$BINTIM
#define sys$cancel SYS$CANCEL
#define sys$cantim SYS$CANTIM
#define sys$check_access SYS$CHECK_ACCESS
#define sys$close SYS$CLOSE
#define sys$connect SYS$CONNECT
#define sys$create SYS$CREATE
#define sys$create_user_profile SYS$CREATE_USER_PROFILE
#define sys$crembx SYS$CREMBX
#define sys$creprc SYS$CREPRC
#define sys$crmpsc SYS$CRMPSC
#define sys$dassgn SYS$DASSGN
#define sys$dclast SYS$DCLAST
#define sys$dclexh SYS$DCLEXH
#define sys$delprc SYS$DELPRC
#define sys$deq SYS$DEQ
#define sys$dgblsc SYS$DGBLSC
#define sys$display SYS$DISPLAY
#define sys$enq SYS$ENQ
#define sys$enqw SYS$ENQW
#define sys$erase SYS$ERASE
#define sys$fao SYS$FAO
#define sys$faol SYS$FAOL
#define sys$find_held SYS$FIND_HELD
#define sys$finish_rdb SYS$FINISH_RDB
#define sys$flush SYS$FLUSH
#define sys$forcex SYS$FORCEX
#define sys$get SYS$GET
#define sys$get_security SYS$GET_SECURITY
#define sys$getdviw SYS$GETDVIW
#define sys$getjpi SYS$GETJPI
#define sys$getjpiw SYS$GETJPIW
#define sys$getlkiw SYS$GETLKIW
#define sys$getmsg SYS$GETMSG
#define sys$getsyi SYS$GETSYI
#define sys$getsyiw SYS$GETSYIW
#define sys$gettim SYS$GETTIM
#define sys$getuai SYS$GETUAI
#define sys$grantid SYS$GRANTID
#define sys$hash_password SYS$HASH_PASSWORD
#define sys$hiber SYS$HIBER
#define sys$mgblsc SYS$MGBLSC
#define sys$numtim SYS$NUMTIM
#define sys$open SYS$OPEN
#define sys$parse SYS$PARSE
#define sys$parse_acl SYS$PARSE_ACL
#define sys$parse_acl SYS$PARSE_ACL
#define sys$persona_assume SYS$PERSONA_ASSUME
#define sys$persona_create SYS$PERSONA_CREATE
#define sys$persona_delete SYS$PERSONA_DELETE
#define sys$process_scan SYS$PROCESS_SCAN
#define sys$put SYS$PUT
#define sys$qio SYS$QIO
#define sys$qiow SYS$QIOW
#define sys$read SYS$READ
#define sys$resched SYS$RESCHED
#define sys$rewind SYS$REWIND
#define sys$search SYS$SEARCH
#define sys$set_security SYS$SET_SECURITY
#define sys$setast SYS$SETAST
#define sys$setef SYS$SETEF
#define sys$setimr SYS$SETIMR
#define sys$setpri SYS$SETPRI
#define sys$setprn SYS$SETPRN
#define sys$setprv SYS$SETPRV
#define sys$setswm SYS$SETSWM
#define sys$setuai SYS$SETUAI
#define sys$sndopr SYS$SNDOPR
#define sys$synch SYS$SYNCH
#define sys$trnlnm SYS$TRNLNM
#define sys$update SYS$UPDATE
#define sys$wake SYS$WAKE
#define sys$write SYS$WRITE
#define topLevelShellClassRec TOPLEVELSHELLCLASSREC
#define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS
#define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS
#define vendorShellClassRec VENDORSHELLCLASSREC
#define vendorShellWidgetClass VENDORSHELLWIDGETCLASS
#define widgetClass WIDGETCLASS
#define widgetClassRec WIDGETCLASSREC
#define wmShellClassRec WMSHELLCLASSREC
#define wmShellWidgetClass WMSHELLWIDGETCLASS
#define x$soft_ast_lib_lock X$SOFT_AST_LIB_LOCK
#define x$soft_ast_lock_depth X$SOFT_AST_LOCK_DEPTH
#define x$soft_reenable_asts X$SOFT_REENABLE_ASTS
#define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS
#define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS
#define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC
#define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS
#define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS
#define xmCommandWidgetClass XMCOMMANDWIDGETCLASS
#define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS
#define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS
#define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS
#define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS
#define xmFormWidgetClass XMFORMWIDGETCLASS
#define xmFrameWidgetClass XMFRAMEWIDGETCLASS
#define xmGadgetClass XMGADGETCLASS
#define xmLabelGadgetClass XMLABELGADGETCLASS
#define xmLabelWidgetClass XMLABELWIDGETCLASS
#define xmListWidgetClass XMLISTWIDGETCLASS
#define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS
#define xmManagerClassRec XMMANAGERCLASSREC
#define xmManagerWidgetClass XMMANAGERWIDGETCLASS
#define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS
#define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS
#define xmPrimitiveClassRec XMPRIMITIVECLASSREC
#define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS
#define xmPushButtonClassRec XMPUSHBUTTONCLASSREC
#define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS
#define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS
#define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS
#define xmSashWidgetClass XMSASHWIDGETCLASS
#define xmScaleWidgetClass XMSCALEWIDGETCLASS
#define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS
#define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC
#define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS
#define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS
#define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS
#define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS
#define xmTextWidgetClass XMTEXTWIDGETCLASS
#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS
#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS
#if (__VMS_VER < 80200000)
# define SetReqLen(req,n,badlen) \
if ((req->length + n) > (unsigned)65535) { \
n = badlen; \
req->length += n; \
} else \
req->length += n
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern void XtFree(char*);
#ifdef __cplusplus
}
#endif
#endif
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/hashmap.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/hashmap.h
// Purpose: wxHashMap class
// Author: Mattia Barbon
// Modified by:
// Created: 29/01/2002
// Copyright: (c) Mattia Barbon
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HASHMAP_H_
#define _WX_HASHMAP_H_
#include "wx/string.h"
#include "wx/wxcrt.h"
// In wxUSE_STD_CONTAINERS build we prefer to use the standard hash map class
// but it can be either in non-standard hash_map header (old g++ and some other
// STL implementations) or in C++0x standard unordered_map which can in turn be
// available either in std::tr1 or std namespace itself
//
// To summarize: if std::unordered_map is available use it, otherwise use tr1
// and finally fall back to non-standard hash_map
#if (defined(HAVE_EXT_HASH_MAP) || defined(HAVE_HASH_MAP)) \
&& (defined(HAVE_GNU_CXX_HASH_MAP) || defined(HAVE_STD_HASH_MAP))
#define HAVE_STL_HASH_MAP
#endif
#if wxUSE_STD_CONTAINERS && \
(defined(HAVE_STD_UNORDERED_MAP) || defined(HAVE_TR1_UNORDERED_MAP))
#if defined(HAVE_STD_UNORDERED_MAP)
#include <unordered_map>
#define WX_HASH_MAP_NAMESPACE std
#elif defined(HAVE_TR1_UNORDERED_MAP)
#include <tr1/unordered_map>
#define WX_HASH_MAP_NAMESPACE std::tr1
#endif
#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \
typedef WX_HASH_MAP_NAMESPACE::unordered_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME
#elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP)
#if defined(HAVE_EXT_HASH_MAP)
#include <ext/hash_map>
#elif defined(HAVE_HASH_MAP)
#include <hash_map>
#endif
#if defined(HAVE_GNU_CXX_HASH_MAP)
#define WX_HASH_MAP_NAMESPACE __gnu_cxx
#elif defined(HAVE_STD_HASH_MAP)
#define WX_HASH_MAP_NAMESPACE std
#endif
#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \
typedef WX_HASH_MAP_NAMESPACE::hash_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME
#else // !wxUSE_STD_CONTAINERS || no std::{hash,unordered}_map class available
#define wxNEEDS_WX_HASH_MAP
#include <stddef.h> // for ptrdiff_t
// private
struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase
{
_wxHashTable_NodeBase() : m_next(NULL) {}
_wxHashTable_NodeBase* m_next;
// Cannot do this:
// wxDECLARE_NO_COPY_CLASS(_wxHashTable_NodeBase);
// without rewriting the macros, which require a public copy constructor.
};
// private
class WXDLLIMPEXP_BASE _wxHashTableBase2
{
public:
typedef void (*NodeDtor)(_wxHashTable_NodeBase*);
typedef size_t (*BucketFromNode)(_wxHashTableBase2*,_wxHashTable_NodeBase*);
typedef _wxHashTable_NodeBase* (*ProcessNode)(_wxHashTable_NodeBase*);
protected:
static _wxHashTable_NodeBase* DummyProcessNode(_wxHashTable_NodeBase* node);
static void DeleteNodes( size_t buckets, _wxHashTable_NodeBase** table,
NodeDtor dtor );
static _wxHashTable_NodeBase* GetFirstNode( size_t buckets,
_wxHashTable_NodeBase** table )
{
for( size_t i = 0; i < buckets; ++i )
if( table[i] )
return table[i];
return NULL;
}
// as static const unsigned prime_count = 31 but works with all compilers
enum { prime_count = 31 };
static const unsigned long ms_primes[prime_count];
// returns the first prime in ms_primes greater than n
static unsigned long GetNextPrime( unsigned long n );
// returns the first prime in ms_primes smaller than n
// ( or ms_primes[0] if n is very small )
static unsigned long GetPreviousPrime( unsigned long n );
static void CopyHashTable( _wxHashTable_NodeBase** srcTable,
size_t srcBuckets, _wxHashTableBase2* dst,
_wxHashTable_NodeBase** dstTable,
BucketFromNode func, ProcessNode proc );
static void** AllocTable( size_t sz )
{
return (void **)calloc(sz, sizeof(void*));
}
static void FreeTable(void *table)
{
free(table);
}
};
#define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T,\
PTROPERATOR, CLASSNAME, CLASSEXP, \
SHOULD_GROW, SHOULD_SHRINK ) \
CLASSEXP CLASSNAME : protected _wxHashTableBase2 \
{ \
public: \
typedef KEY_T key_type; \
typedef VALUE_T value_type; \
typedef HASH_T hasher; \
typedef KEY_EQ_T key_equal; \
\
typedef size_t size_type; \
typedef ptrdiff_t difference_type; \
typedef value_type* pointer; \
typedef const value_type* const_pointer; \
typedef value_type& reference; \
typedef const value_type& const_reference; \
/* should these be protected? */ \
typedef const KEY_T const_key_type; \
typedef const VALUE_T const_mapped_type; \
public: \
typedef KEY_EX_T key_extractor; \
typedef CLASSNAME Self; \
protected: \
_wxHashTable_NodeBase** m_table; \
size_t m_tableBuckets; \
size_t m_items; \
hasher m_hasher; \
key_equal m_equals; \
key_extractor m_getKey; \
public: \
struct Node:public _wxHashTable_NodeBase \
{ \
public: \
Node( const value_type& value ) \
: m_value( value ) {} \
Node* next() { return static_cast<Node*>(m_next); } \
\
value_type m_value; \
}; \
\
protected: \
static void DeleteNode( _wxHashTable_NodeBase* node ) \
{ \
delete static_cast<Node*>(node); \
} \
public: \
/* */ \
/* forward iterator */ \
/* */ \
CLASSEXP Iterator \
{ \
public: \
Node* m_node; \
Self* m_ht; \
\
Iterator() : m_node(NULL), m_ht(NULL) {} \
Iterator( Node* node, const Self* ht ) \
: m_node(node), m_ht(const_cast<Self*>(ht)) {} \
bool operator ==( const Iterator& it ) const \
{ return m_node == it.m_node; } \
bool operator !=( const Iterator& it ) const \
{ return m_node != it.m_node; } \
protected: \
Node* GetNextNode() \
{ \
size_type bucket = GetBucketForNode(m_ht,m_node); \
for( size_type i = bucket + 1; i < m_ht->m_tableBuckets; ++i ) \
{ \
if( m_ht->m_table[i] ) \
return static_cast<Node*>(m_ht->m_table[i]); \
} \
return NULL; \
} \
\
void PlusPlus() \
{ \
Node* next = m_node->next(); \
m_node = next ? next : GetNextNode(); \
} \
}; \
friend class Iterator; \
\
public: \
CLASSEXP iterator : public Iterator \
{ \
public: \
iterator() : Iterator() {} \
iterator( Node* node, Self* ht ) : Iterator( node, ht ) {} \
iterator& operator++() { PlusPlus(); return *this; } \
iterator operator++(int) { iterator it=*this;PlusPlus();return it; } \
reference operator *() const { return m_node->m_value; } \
PTROPERATOR(pointer) \
}; \
\
CLASSEXP const_iterator : public Iterator \
{ \
public: \
const_iterator() : Iterator() {} \
const_iterator(iterator i) : Iterator(i) {} \
const_iterator( Node* node, const Self* ht ) \
: Iterator(node, const_cast<Self*>(ht)) {} \
const_iterator& operator++() { PlusPlus();return *this; } \
const_iterator operator++(int) { const_iterator it=*this;PlusPlus();return it; } \
const_reference operator *() const { return m_node->m_value; } \
PTROPERATOR(const_pointer) \
}; \
\
CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \
const key_equal& k_eq = key_equal(), \
const key_extractor& k_ex = key_extractor() ) \
: m_tableBuckets( GetNextPrime( (unsigned long) sz ) ), \
m_items( 0 ), \
m_hasher( hfun ), \
m_equals( k_eq ), \
m_getKey( k_ex ) \
{ \
m_table = (_wxHashTable_NodeBase**)AllocTable(m_tableBuckets); \
} \
\
CLASSNAME( const Self& ht ) \
: m_table(NULL), \
m_tableBuckets( 0 ), \
m_items( ht.m_items ), \
m_hasher( ht.m_hasher ), \
m_equals( ht.m_equals ), \
m_getKey( ht.m_getKey ) \
{ \
HashCopy( ht ); \
} \
\
const Self& operator=( const Self& ht ) \
{ \
if (&ht != this) \
{ \
clear(); \
m_hasher = ht.m_hasher; \
m_equals = ht.m_equals; \
m_getKey = ht.m_getKey; \
m_items = ht.m_items; \
HashCopy( ht ); \
} \
return *this; \
} \
\
~CLASSNAME() \
{ \
clear(); \
\
FreeTable(m_table); \
} \
\
hasher hash_funct() { return m_hasher; } \
key_equal key_eq() { return m_equals; } \
\
/* removes all elements from the hash table, but does not */ \
/* shrink it ( perhaps it should ) */ \
void clear() \
{ \
DeleteNodes(m_tableBuckets, m_table, DeleteNode); \
m_items = 0; \
} \
\
size_type size() const { return m_items; } \
size_type max_size() const { return size_type(-1); } \
bool empty() const { return size() == 0; } \
\
const_iterator end() const { return const_iterator(NULL, this); } \
iterator end() { return iterator(NULL, this); } \
const_iterator begin() const \
{ return const_iterator(static_cast<Node*>(GetFirstNode(m_tableBuckets, m_table)), this); } \
iterator begin() \
{ return iterator(static_cast<Node*>(GetFirstNode(m_tableBuckets, m_table)), this); } \
\
size_type erase( const const_key_type& key ) \
{ \
_wxHashTable_NodeBase** node = GetNodePtr(key); \
\
if( !node ) \
return 0; \
\
--m_items; \
_wxHashTable_NodeBase* temp = (*node)->m_next; \
delete static_cast<Node*>(*node); \
(*node) = temp; \
if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \
ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \
return 1; \
} \
\
protected: \
static size_type GetBucketForNode( Self* ht, Node* node ) \
{ \
return ht->m_hasher( ht->m_getKey( node->m_value ) ) \
% ht->m_tableBuckets; \
} \
static Node* CopyNode( Node* node ) { return new Node( *node ); } \
\
Node* GetOrCreateNode( const value_type& value, bool& created ) \
{ \
const const_key_type& key = m_getKey( value ); \
size_t bucket = m_hasher( key ) % m_tableBuckets; \
Node* node = static_cast<Node*>(m_table[bucket]); \
\
while( node ) \
{ \
if( m_equals( m_getKey( node->m_value ), key ) ) \
{ \
created = false; \
return node; \
} \
node = node->next(); \
} \
created = true; \
return CreateNode( value, bucket); \
}\
Node * CreateNode( const value_type& value, size_t bucket ) \
{\
Node* node = new Node( value ); \
node->m_next = m_table[bucket]; \
m_table[bucket] = node; \
\
/* must be after the node is inserted */ \
++m_items; \
if( SHOULD_GROW( m_tableBuckets, m_items ) ) \
ResizeTable( m_tableBuckets ); \
\
return node; \
} \
void CreateNode( const value_type& value ) \
{\
CreateNode(value, m_hasher( m_getKey(value) ) % m_tableBuckets ); \
}\
\
/* returns NULL if not found */ \
_wxHashTable_NodeBase** GetNodePtr(const const_key_type& key) const \
{ \
size_t bucket = m_hasher( key ) % m_tableBuckets; \
_wxHashTable_NodeBase** node = &m_table[bucket]; \
\
while( *node ) \
{ \
if (m_equals(m_getKey(static_cast<Node*>(*node)->m_value), key)) \
return node; \
node = &(*node)->m_next; \
} \
\
return NULL; \
} \
\
/* returns NULL if not found */ \
/* expressing it in terms of GetNodePtr is 5-8% slower :-( */ \
Node* GetNode( const const_key_type& key ) const \
{ \
size_t bucket = m_hasher( key ) % m_tableBuckets; \
Node* node = static_cast<Node*>(m_table[bucket]); \
\
while( node ) \
{ \
if( m_equals( m_getKey( node->m_value ), key ) ) \
return node; \
node = node->next(); \
} \
\
return NULL; \
} \
\
void ResizeTable( size_t newSize ) \
{ \
newSize = GetNextPrime( (unsigned long)newSize ); \
_wxHashTable_NodeBase** srcTable = m_table; \
size_t srcBuckets = m_tableBuckets; \
m_table = (_wxHashTable_NodeBase**)AllocTable( newSize ); \
m_tableBuckets = newSize; \
\
CopyHashTable( srcTable, srcBuckets, \
this, m_table, \
(BucketFromNode)GetBucketForNode,\
(ProcessNode)&DummyProcessNode ); \
FreeTable(srcTable); \
} \
\
/* this must be called _after_ m_table has been cleaned */ \
void HashCopy( const Self& ht ) \
{ \
ResizeTable( ht.size() ); \
CopyHashTable( ht.m_table, ht.m_tableBuckets, \
(_wxHashTableBase2*)this, \
m_table, \
(BucketFromNode)GetBucketForNode, \
(ProcessNode)CopyNode ); \
} \
};
// defines an STL-like pair class CLASSNAME storing two fields: first of type
// KEY_T and second of type VALUE_T
#define _WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME, CLASSEXP ) \
CLASSEXP CLASSNAME \
{ \
public: \
typedef KEY_T first_type; \
typedef VALUE_T second_type; \
typedef KEY_T t1; \
typedef VALUE_T t2; \
typedef const KEY_T const_t1; \
typedef const VALUE_T const_t2; \
\
CLASSNAME(const const_t1& f, const const_t2& s) \
: first(const_cast<t1&>(f)), second(const_cast<t2&>(s)) {} \
\
t1 first; \
t2 second; \
};
// defines the class CLASSNAME returning the key part (of type KEY_T) from a
// pair of type PAIR_T
#define _WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, PAIR_T, CLASSNAME, CLASSEXP ) \
CLASSEXP CLASSNAME \
{ \
typedef KEY_T key_type; \
typedef PAIR_T pair_type; \
typedef const key_type const_key_type; \
typedef const pair_type const_pair_type; \
typedef const_key_type& const_key_reference; \
typedef const_pair_type& const_pair_reference; \
public: \
CLASSNAME() { } \
const_key_reference operator()( const_pair_reference pair ) const { return pair.first; }\
\
/* the dummy assignment operator is needed to suppress compiler */ \
/* warnings from hash table class' operator=(): gcc complains about */ \
/* "statement with no effect" without it */ \
CLASSNAME& operator=(const CLASSNAME&) { return *this; } \
};
// grow/shrink predicates
inline bool never_grow( size_t, size_t ) { return false; }
inline bool never_shrink( size_t, size_t ) { return false; }
inline bool grow_lf70( size_t buckets, size_t items )
{
return float(items)/float(buckets) >= 0.85f;
}
#endif // various hash map implementations
// ----------------------------------------------------------------------------
// hashing and comparison functors
// ----------------------------------------------------------------------------
// NB: implementation detail: all of these classes must have dummy assignment
// operators to suppress warnings about "statement with no effect" from gcc
// in the hash table class assignment operator (where they're assigned)
#ifndef wxNEEDS_WX_HASH_MAP
// integer types
struct WXDLLIMPEXP_BASE wxIntegerHash
{
private:
WX_HASH_MAP_NAMESPACE::hash<long> longHash;
WX_HASH_MAP_NAMESPACE::hash<unsigned long> ulongHash;
WX_HASH_MAP_NAMESPACE::hash<int> intHash;
WX_HASH_MAP_NAMESPACE::hash<unsigned int> uintHash;
WX_HASH_MAP_NAMESPACE::hash<short> shortHash;
WX_HASH_MAP_NAMESPACE::hash<unsigned short> ushortHash;
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
// hash<wxLongLong_t> ought to work but doesn't on some compilers
#if (!defined SIZEOF_LONG_LONG && SIZEOF_LONG == 4) \
|| (defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG * 2)
size_t longlongHash( wxLongLong_t x ) const
{
return longHash( wx_truncate_cast(long, x) ) ^
longHash( wx_truncate_cast(long, x >> (sizeof(long) * 8)) );
}
#elif defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG
WX_HASH_MAP_NAMESPACE::hash<long> longlongHash;
#else
WX_HASH_MAP_NAMESPACE::hash<wxLongLong_t> longlongHash;
#endif
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
public:
wxIntegerHash() { }
size_t operator()( long x ) const { return longHash( x ); }
size_t operator()( unsigned long x ) const { return ulongHash( x ); }
size_t operator()( int x ) const { return intHash( x ); }
size_t operator()( unsigned int x ) const { return uintHash( x ); }
size_t operator()( short x ) const { return shortHash( x ); }
size_t operator()( unsigned short x ) const { return ushortHash( x ); }
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
size_t operator()( wxLongLong_t x ) const { return longlongHash(x); }
size_t operator()( wxULongLong_t x ) const { return longlongHash(x); }
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
wxIntegerHash& operator=(const wxIntegerHash&) { return *this; }
};
#else // wxNEEDS_WX_HASH_MAP
// integer types
struct WXDLLIMPEXP_BASE wxIntegerHash
{
wxIntegerHash() { }
unsigned long operator()( long x ) const { return (unsigned long)x; }
unsigned long operator()( unsigned long x ) const { return x; }
unsigned long operator()( int x ) const { return (unsigned long)x; }
unsigned long operator()( unsigned int x ) const { return x; }
unsigned long operator()( short x ) const { return (unsigned long)x; }
unsigned long operator()( unsigned short x ) const { return x; }
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
wxULongLong_t operator()( wxLongLong_t x ) const { return static_cast<wxULongLong_t>(x); }
wxULongLong_t operator()( wxULongLong_t x ) const { return x; }
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
wxIntegerHash& operator=(const wxIntegerHash&) { return *this; }
};
#endif // !wxNEEDS_WX_HASH_MAP/wxNEEDS_WX_HASH_MAP
struct WXDLLIMPEXP_BASE wxIntegerEqual
{
wxIntegerEqual() { }
bool operator()( long a, long b ) const { return a == b; }
bool operator()( unsigned long a, unsigned long b ) const { return a == b; }
bool operator()( int a, int b ) const { return a == b; }
bool operator()( unsigned int a, unsigned int b ) const { return a == b; }
bool operator()( short a, short b ) const { return a == b; }
bool operator()( unsigned short a, unsigned short b ) const { return a == b; }
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
bool operator()( wxLongLong_t a, wxLongLong_t b ) const { return a == b; }
bool operator()( wxULongLong_t a, wxULongLong_t b ) const { return a == b; }
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
wxIntegerEqual& operator=(const wxIntegerEqual&) { return *this; }
};
// pointers
struct WXDLLIMPEXP_BASE wxPointerHash
{
wxPointerHash() { }
#ifdef wxNEEDS_WX_HASH_MAP
wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); }
#else
size_t operator()( const void* k ) const { return (size_t)k; }
#endif
wxPointerHash& operator=(const wxPointerHash&) { return *this; }
};
struct WXDLLIMPEXP_BASE wxPointerEqual
{
wxPointerEqual() { }
bool operator()( const void* a, const void* b ) const { return a == b; }
wxPointerEqual& operator=(const wxPointerEqual&) { return *this; }
};
// wxString, char*, wchar_t*
struct WXDLLIMPEXP_BASE wxStringHash
{
wxStringHash() {}
unsigned long operator()( const wxString& x ) const
{ return stringHash( x.wx_str() ); }
unsigned long operator()( const wchar_t* x ) const
{ return stringHash( x ); }
unsigned long operator()( const char* x ) const
{ return stringHash( x ); }
#if WXWIN_COMPATIBILITY_2_8
static unsigned long wxCharStringHash( const wxChar* x )
{ return stringHash(x); }
#if wxUSE_UNICODE
static unsigned long charStringHash( const char* x )
{ return stringHash(x); }
#endif
#endif // WXWIN_COMPATIBILITY_2_8
static unsigned long stringHash( const wchar_t* );
static unsigned long stringHash( const char* );
wxStringHash& operator=(const wxStringHash&) { return *this; }
};
struct WXDLLIMPEXP_BASE wxStringEqual
{
wxStringEqual() {}
bool operator()( const wxString& a, const wxString& b ) const
{ return a == b; }
bool operator()( const wxChar* a, const wxChar* b ) const
{ return wxStrcmp( a, b ) == 0; }
#if wxUSE_UNICODE
bool operator()( const char* a, const char* b ) const
{ return strcmp( a, b ) == 0; }
#endif // wxUSE_UNICODE
wxStringEqual& operator=(const wxStringEqual&) { return *this; }
};
#ifdef wxNEEDS_WX_HASH_MAP
#define wxPTROP_NORMAL(pointer) \
pointer operator ->() const { return &(m_node->m_value); }
#define wxPTROP_NOP(pointer)
#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \
_WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME##_wxImplementation_Pair, CLASSEXP ) \
_WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_Pair, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \
_WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, \
CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, wxPTROP_NORMAL, \
CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \
CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \
{ \
public: \
typedef VALUE_T mapped_type; \
_WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \
\
explicit CLASSNAME( size_type hint = 100, hasher hf = hasher(), \
key_equal eq = key_equal() ) \
: CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \
CLASSNAME##_wxImplementation_KeyEx() ) {} \
\
mapped_type& operator[]( const const_key_type& key ) \
{ \
bool created; \
return GetOrCreateNode( \
CLASSNAME##_wxImplementation_Pair( key, mapped_type() ), \
created)->m_value.second; \
} \
\
const_iterator find( const const_key_type& key ) const \
{ \
return const_iterator( GetNode( key ), this ); \
} \
\
iterator find( const const_key_type& key ) \
{ \
return iterator( GetNode( key ), this ); \
} \
\
Insert_Result insert( const value_type& v ) \
{ \
bool created; \
Node *node = GetOrCreateNode( \
CLASSNAME##_wxImplementation_Pair( v.first, v.second ), \
created); \
return Insert_Result(iterator(node, this), created); \
} \
\
size_type erase( const key_type& k ) \
{ return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \
void erase( const iterator& it ) { erase( (*it).first ); } \
\
/* count() == 0 | 1 */ \
size_type count( const const_key_type& key ) \
{ \
return GetNode( key ) ? 1u : 0u; \
} \
}
#endif // wxNEEDS_WX_HASH_MAP
// these macros are to be used in the user code
#define WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \
_WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, class )
#define WX_DECLARE_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \
_WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \
CLASSNAME, class )
#define WX_DECLARE_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \
_WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \
CLASSNAME, class )
// and these do exactly the same thing but should be used inside the
// library
#define WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
_WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL )
#define WX_DECLARE_EXPORTED_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \
WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, \
CLASSNAME, class WXDLLIMPEXP_CORE )
#define WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \
_WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \
CLASSNAME, DECL )
#define WX_DECLARE_EXPORTED_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \
class WXDLLIMPEXP_CORE )
#define WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \
_WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \
CLASSNAME, DECL )
#define WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \
WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \
class WXDLLIMPEXP_CORE )
// delete all hash elements
//
// NB: the class declaration of the hash elements must be visible from the
// place where you use this macro, otherwise the proper destructor may not
// be called (a decent compiler should give a warning about it, but don't
// count on it)!
#define WX_CLEAR_HASH_MAP(type, hashmap) \
{ \
type::iterator it, en; \
for( it = (hashmap).begin(), en = (hashmap).end(); it != en; ++it ) \
delete it->second; \
(hashmap).clear(); \
}
//---------------------------------------------------------------------------
// Declarations of common hashmap classes
WX_DECLARE_HASH_MAP_WITH_DECL( long, long, wxIntegerHash, wxIntegerEqual,
wxLongToLongHashMap, class WXDLLIMPEXP_BASE );
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, wxStringToStringHashMap,
class WXDLLIMPEXP_BASE );
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxUIntPtr, wxStringToNumHashMap,
class WXDLLIMPEXP_BASE );
#endif // _WX_HASHMAP_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/fontdata.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/fontdata.h
// Author: Julian Smart
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FONTDATA_H_
#define _WX_FONTDATA_H_
#include "wx/font.h"
#include "wx/colour.h"
#include "wx/encinfo.h"
class WXDLLIMPEXP_CORE wxFontData : public wxObject
{
public:
wxFontData();
virtual ~wxFontData();
wxFontData(const wxFontData& data);
wxFontData& operator=(const wxFontData& data);
void SetAllowSymbols(bool flag) { m_allowSymbols = flag; }
bool GetAllowSymbols() const { return m_allowSymbols; }
void SetColour(const wxColour& colour) { m_fontColour = colour; }
const wxColour& GetColour() const { return m_fontColour; }
void SetShowHelp(bool flag) { m_showHelp = flag; }
bool GetShowHelp() const { return m_showHelp; }
void EnableEffects(bool flag) { m_enableEffects = flag; }
bool GetEnableEffects() const { return m_enableEffects; }
void SetInitialFont(const wxFont& font) { m_initialFont = font; }
wxFont GetInitialFont() const { return m_initialFont; }
void SetChosenFont(const wxFont& font) { m_chosenFont = font; }
wxFont GetChosenFont() const { return m_chosenFont; }
void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; }
// encoding info is split into 2 parts: the logical wxWin encoding
// (wxFontEncoding) and a structure containing the native parameters for
// it (wxNativeEncodingInfo)
wxFontEncoding GetEncoding() const { return m_encoding; }
void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; }
wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; }
// public for backwards compatibility only: don't use directly
wxColour m_fontColour;
bool m_showHelp;
bool m_allowSymbols;
bool m_enableEffects;
wxFont m_initialFont;
wxFont m_chosenFont;
int m_minSize;
int m_maxSize;
private:
wxFontEncoding m_encoding;
wxNativeEncodingInfo m_encodingInfo;
wxDECLARE_DYNAMIC_CLASS(wxFontData);
};
#endif // _WX_FONTDATA_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/peninfobase.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/peninfobase.h
// Purpose: Declaration of wxPenInfoBase class and related constants
// Author: Adrien Tétar, Vadim Zeitlin
// Created: 2017-09-10
// Copyright: (c) 2017 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PENINFOBASE_H_
#define _WX_PENINFOBASE_H_
#include "wx/bitmap.h"
#include "wx/colour.h"
#include "wx/gdicmn.h" // for wxDash
enum wxPenStyle
{
wxPENSTYLE_INVALID = -1,
wxPENSTYLE_SOLID = wxSOLID,
wxPENSTYLE_DOT = wxDOT,
wxPENSTYLE_LONG_DASH = wxLONG_DASH,
wxPENSTYLE_SHORT_DASH = wxSHORT_DASH,
wxPENSTYLE_DOT_DASH = wxDOT_DASH,
wxPENSTYLE_USER_DASH = wxUSER_DASH,
wxPENSTYLE_TRANSPARENT = wxTRANSPARENT,
wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
wxPENSTYLE_STIPPLE = wxSTIPPLE,
wxPENSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL,
wxPENSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG,
wxPENSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL,
wxPENSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS,
wxPENSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL,
wxPENSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL,
wxPENSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST,
wxPENSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST
};
enum wxPenJoin
{
wxJOIN_INVALID = -1,
wxJOIN_BEVEL = 120,
wxJOIN_MITER,
wxJOIN_ROUND
};
enum wxPenCap
{
wxCAP_INVALID = -1,
wxCAP_ROUND = 130,
wxCAP_PROJECTING,
wxCAP_BUTT
};
// ----------------------------------------------------------------------------
// wxPenInfoBase is a common base for wxPenInfo and wxGraphicsPenInfo
// ----------------------------------------------------------------------------
// This class uses CRTP, the template parameter is the derived class itself.
template <class T>
class wxPenInfoBase
{
public:
// Setters for the various attributes. All of them return the object itself
// so that the calls to them could be chained.
T& Colour(const wxColour& colour)
{ m_colour = colour; return This(); }
T& Style(wxPenStyle style)
{ m_style = style; return This(); }
T& Stipple(const wxBitmap& stipple)
{ m_stipple = stipple; m_style = wxPENSTYLE_STIPPLE; return This(); }
T& Dashes(int nb_dashes, const wxDash *dash)
{ m_nb_dashes = nb_dashes; m_dash = const_cast<wxDash*>(dash); return This(); }
T& Join(wxPenJoin join)
{ m_join = join; return This(); }
T& Cap(wxPenCap cap)
{ m_cap = cap; return This(); }
// Accessors are mostly meant to be used by wxWidgets itself.
wxColour GetColour() const { return m_colour; }
wxBitmap GetStipple() const { return m_stipple; }
wxPenStyle GetStyle() const { return m_style; }
wxPenJoin GetJoin() const { return m_join; }
wxPenCap GetCap() const { return m_cap; }
int GetDashes(wxDash **ptr) const { *ptr = m_dash; return m_nb_dashes; }
int GetDashCount() const { return m_nb_dashes; }
wxDash* GetDash() const { return m_dash; }
// Convenience
bool IsTransparent() const { return m_style == wxPENSTYLE_TRANSPARENT; }
protected:
wxPenInfoBase(const wxColour& colour, wxPenStyle style)
: m_colour(colour)
{
m_nb_dashes = 0;
m_dash = NULL;
m_join = wxJOIN_ROUND;
m_cap = wxCAP_ROUND;
m_style = style;
}
private:
// Helper to return this object itself cast to its real type T.
T& This() { return static_cast<T&>(*this); }
wxColour m_colour;
wxBitmap m_stipple;
wxPenStyle m_style;
wxPenJoin m_join;
wxPenCap m_cap;
int m_nb_dashes;
wxDash* m_dash;
};
#endif // _WX_PENINFOBASE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/versioninfo.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/versioninfo.h
// Purpose: declaration of wxVersionInfo class
// Author: Troels K
// Created: 2010-11-22
// Copyright: (c) 2010 wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_VERSIONINFO_H_
#define _WX_VERSIONINFO_H_
#include "wx/string.h"
// ----------------------------------------------------------------------------
// wxVersionInfo: represents version information
// ----------------------------------------------------------------------------
class wxVersionInfo
{
public:
wxVersionInfo(const wxString& name = wxString(),
int major = 0,
int minor = 0,
int micro = 0,
const wxString& description = wxString(),
const wxString& copyright = wxString())
{
m_name = name;
m_major = major;
m_minor = minor;
m_micro = micro;
m_description = description;
m_copyright = copyright;
}
// Default copy ctor, assignment operator and dtor are ok.
const wxString& GetName() const { return m_name; }
int GetMajor() const { return m_major; }
int GetMinor() const { return m_minor; }
int GetMicro() const { return m_micro; }
wxString ToString() const
{
return HasDescription() ? GetDescription() : GetVersionString();
}
wxString GetVersionString() const
{
wxString str;
str << m_name << ' ' << GetMajor() << '.' << GetMinor();
if ( GetMicro() )
str << '.' << GetMicro();
return str;
}
bool HasDescription() const { return !m_description.empty(); }
const wxString& GetDescription() const { return m_description; }
bool HasCopyright() const { return !m_copyright.empty(); }
const wxString& GetCopyright() const { return m_copyright; }
private:
wxString m_name,
m_description,
m_copyright;
int m_major,
m_minor,
m_micro;
};
#endif // _WX_VERSIONINFO_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/ptr_shrd.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/ptr_shrd.h
// Purpose: compatibility wrapper for wx/sharedptr.h
// Author: Vadim Zeitlin
// Created: 2009-02-03
// Copyright: (c) 2009 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// do not include this file in any new code, include wx/sharedptr.h instead
#include "wx/sharedptr.h"
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/log.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/log.h
// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs)
// Author: Vadim Zeitlin
// Modified by:
// Created: 29/01/98
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LOG_H_
#define _WX_LOG_H_
#include "wx/defs.h"
#include "wx/cpp.h"
// ----------------------------------------------------------------------------
// types
// ----------------------------------------------------------------------------
// NB: this is needed even if wxUSE_LOG == 0
typedef unsigned long wxLogLevel;
// the trace masks have been superseded by symbolic trace constants, they're
// for compatibility only and will be removed soon - do NOT use them
#if WXWIN_COMPATIBILITY_2_8
#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete)
#define wxTraceMessages 0x0002 // trace window messages/X callbacks
#define wxTraceResAlloc 0x0004 // trace GDI resource allocation
#define wxTraceRefCount 0x0008 // trace various ref counting operations
#ifdef __WINDOWS__
#define wxTraceOleCalls 0x0100 // OLE interface calls
#endif
typedef unsigned long wxTraceMask;
#endif // WXWIN_COMPATIBILITY_2_8
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/string.h"
#include "wx/strvararg.h"
// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_BASE wxObject;
#if wxUSE_GUI
class WXDLLIMPEXP_FWD_CORE wxFrame;
#endif // wxUSE_GUI
#if wxUSE_LOG
#include "wx/arrstr.h"
#include <time.h> // for time_t
#include "wx/dynarray.h"
#include "wx/hashmap.h"
#include "wx/msgout.h"
#if wxUSE_THREADS
#include "wx/thread.h"
#endif // wxUSE_THREADS
// wxUSE_LOG_DEBUG enables the debug log messages
#ifndef wxUSE_LOG_DEBUG
#if wxDEBUG_LEVEL
#define wxUSE_LOG_DEBUG 1
#else // !wxDEBUG_LEVEL
#define wxUSE_LOG_DEBUG 0
#endif
#endif
// wxUSE_LOG_TRACE enables the trace messages, they are disabled by default
#ifndef wxUSE_LOG_TRACE
#if wxDEBUG_LEVEL
#define wxUSE_LOG_TRACE 1
#else // !wxDEBUG_LEVEL
#define wxUSE_LOG_TRACE 0
#endif
#endif // wxUSE_LOG_TRACE
// wxLOG_COMPONENT identifies the component which generated the log record and
// can be #define'd to a user-defined value when compiling the user code to use
// component-based filtering (see wxLog::SetComponentLevel())
#ifndef wxLOG_COMPONENT
// this is a variable and not a macro in order to allow the user code to
// just #define wxLOG_COMPONENT without #undef'ining it first
extern WXDLLIMPEXP_DATA_BASE(const char *) wxLOG_COMPONENT;
#ifdef WXBUILDING
#define wxLOG_COMPONENT "wx"
#endif
#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// different standard log levels (you may also define your own)
enum wxLogLevelValues
{
wxLOG_FatalError, // program can't continue, abort immediately
wxLOG_Error, // a serious error, user must be informed about it
wxLOG_Warning, // user is normally informed about it but may be ignored
wxLOG_Message, // normal message (i.e. normal output of a non GUI app)
wxLOG_Status, // informational: might go to the status line of GUI app
wxLOG_Info, // informational message (a.k.a. 'Verbose')
wxLOG_Debug, // never shown to the user, disabled in release mode
wxLOG_Trace, // trace messages are also only enabled in debug mode
wxLOG_Progress, // used for progress indicator (not yet)
wxLOG_User = 100, // user defined levels start here
wxLOG_Max = 10000
};
// symbolic trace masks - wxLogTrace("foo", "some trace message...") will be
// discarded unless the string "foo" has been added to the list of allowed
// ones with AddTraceMask()
#define wxTRACE_MemAlloc wxT("memalloc") // trace memory allocation (new/delete)
#define wxTRACE_Messages wxT("messages") // trace window messages/X callbacks
#define wxTRACE_ResAlloc wxT("resalloc") // trace GDI resource allocation
#define wxTRACE_RefCount wxT("refcount") // trace various ref counting operations
#ifdef __WINDOWS__
#define wxTRACE_OleCalls wxT("ole") // OLE interface calls
#endif
#include "wx/iosfwrap.h"
// ----------------------------------------------------------------------------
// information about a log record, i.e. unit of log output
// ----------------------------------------------------------------------------
class wxLogRecordInfo
{
public:
// default ctor creates an uninitialized object
wxLogRecordInfo()
{
memset(this, 0, sizeof(*this));
}
// normal ctor, used by wxLogger specifies the location of the log
// statement; its time stamp and thread id are set up here
wxLogRecordInfo(const char *filename_,
int line_,
const char *func_,
const char *component_)
{
filename = filename_;
func = func_;
line = line_;
component = component_;
// don't initialize the timestamp yet, we might not need it at all if
// the message doesn't end up being logged and otherwise we'll fill it
// just before logging it, which won't change it by much and definitely
// less than a second resolution of the timestamp
timestamp = 0;
#if wxUSE_THREADS
threadId = wxThread::GetCurrentId();
#endif // wxUSE_THREADS
m_data = NULL;
}
// we need to define copy ctor and assignment operator because of m_data
wxLogRecordInfo(const wxLogRecordInfo& other)
{
Copy(other);
}
wxLogRecordInfo& operator=(const wxLogRecordInfo& other)
{
if ( &other != this )
{
delete m_data;
Copy(other);
}
return *this;
}
// dtor is non-virtual, this class is not meant to be derived from
~wxLogRecordInfo()
{
delete m_data;
}
// the file name and line number of the file where the log record was
// generated, if available or NULL and 0 otherwise
const char *filename;
int line;
// the name of the function where the log record was generated (may be NULL
// if the compiler doesn't support __FUNCTION__)
const char *func;
// the name of the component which generated this message, may be NULL if
// not set (i.e. wxLOG_COMPONENT not defined)
const char *component;
// time of record generation
time_t timestamp;
#if wxUSE_THREADS
// id of the thread which logged this record
wxThreadIdType threadId;
#endif // wxUSE_THREADS
// store an arbitrary value in this record context
//
// wxWidgets always uses keys starting with "wx.", e.g. "wx.sys_error"
void StoreValue(const wxString& key, wxUIntPtr val)
{
if ( !m_data )
m_data = new ExtraData;
m_data->numValues[key] = val;
}
void StoreValue(const wxString& key, const wxString& val)
{
if ( !m_data )
m_data = new ExtraData;
m_data->strValues[key] = val;
}
// these functions retrieve the value of either numeric or string key,
// return false if not found
bool GetNumValue(const wxString& key, wxUIntPtr *val) const
{
if ( !m_data )
return false;
const wxStringToNumHashMap::const_iterator it = m_data->numValues.find(key);
if ( it == m_data->numValues.end() )
return false;
*val = it->second;
return true;
}
bool GetStrValue(const wxString& key, wxString *val) const
{
if ( !m_data )
return false;
const wxStringToStringHashMap::const_iterator it = m_data->strValues.find(key);
if ( it == m_data->strValues.end() )
return false;
*val = it->second;
return true;
}
private:
void Copy(const wxLogRecordInfo& other)
{
memcpy(this, &other, sizeof(*this));
if ( other.m_data )
m_data = new ExtraData(*other.m_data);
}
// extra data associated with the log record: this is completely optional
// and can be used to pass information from the log function to the log
// sink (e.g. wxLogSysError() uses this to pass the error code)
struct ExtraData
{
wxStringToNumHashMap numValues;
wxStringToStringHashMap strValues;
};
// NULL if not used
ExtraData *m_data;
};
#define wxLOG_KEY_TRACE_MASK "wx.trace_mask"
// ----------------------------------------------------------------------------
// log record: a unit of log output
// ----------------------------------------------------------------------------
struct wxLogRecord
{
wxLogRecord(wxLogLevel level_,
const wxString& msg_,
const wxLogRecordInfo& info_)
: level(level_),
msg(msg_),
info(info_)
{
}
wxLogLevel level;
wxString msg;
wxLogRecordInfo info;
};
// ----------------------------------------------------------------------------
// Derive from this class to customize format of log messages.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxLogFormatter
{
public:
// Default constructor.
wxLogFormatter() { }
// Trivial but virtual destructor for the base class.
virtual ~wxLogFormatter() { }
// Override this method to implement custom formatting of the given log
// record. The default implementation simply prepends a level-dependent
// prefix to the message and optionally adds a time stamp.
virtual wxString Format(wxLogLevel level,
const wxString& msg,
const wxLogRecordInfo& info) const;
protected:
// Override this method to change just the time stamp formatting. It is
// called by default Format() implementation.
virtual wxString FormatTime(time_t t) const;
};
// ----------------------------------------------------------------------------
// derive from this class to redirect (or suppress, or ...) log messages
// normally, only a single instance of this class exists but it's not enforced
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxLog
{
public:
// ctor
wxLog() : m_formatter(new wxLogFormatter) { }
// make dtor virtual for all derived classes
virtual ~wxLog();
// log messages selection
// ----------------------
// these functions allow to completely disable all log messages or disable
// log messages at level less important than specified for the current
// thread
// is logging enabled at all now?
static bool IsEnabled()
{
#if wxUSE_THREADS
if ( !wxThread::IsMain() )
return IsThreadLoggingEnabled();
#endif // wxUSE_THREADS
return ms_doLog;
}
// change the flag state, return the previous one
static bool EnableLogging(bool enable = true)
{
#if wxUSE_THREADS
if ( !wxThread::IsMain() )
return EnableThreadLogging(enable);
#endif // wxUSE_THREADS
const bool doLogOld = ms_doLog;
ms_doLog = enable;
return doLogOld;
}
// return the current global log level
static wxLogLevel GetLogLevel() { return ms_logLevel; }
// set global log level: messages with level > logLevel will not be logged
static void SetLogLevel(wxLogLevel logLevel) { ms_logLevel = logLevel; }
// set the log level for the given component
static void SetComponentLevel(const wxString& component, wxLogLevel level);
// return the effective log level for this component, falling back to
// parent component and to the default global log level if necessary
//
// NB: component argument is passed by value and not const reference in an
// attempt to encourage compiler to avoid an extra copy: as we modify
// the component internally, we'd create one anyhow and like this it
// can be avoided if the string is a temporary anyhow
static wxLogLevel GetComponentLevel(wxString component);
// is logging of messages from this component enabled at this level?
//
// usually always called with wxLOG_COMPONENT as second argument
static bool IsLevelEnabled(wxLogLevel level, wxString component)
{
return IsEnabled() && level <= GetComponentLevel(component);
}
// enable/disable messages at wxLOG_Verbose level (only relevant if the
// current log level is greater or equal to it)
//
// notice that verbose mode can be activated by the standard command-line
// '--verbose' option
static void SetVerbose(bool bVerbose = true) { ms_bVerbose = bVerbose; }
// check if verbose messages are enabled
static bool GetVerbose() { return ms_bVerbose; }
// message buffering
// -----------------
// flush shows all messages if they're not logged immediately (FILE
// and iostream logs don't need it, but wxLogGui does to avoid showing
// 17 modal dialogs one after another)
virtual void Flush();
// flush the active target if any and also output any pending messages from
// background threads
static void FlushActive();
// only one sink is active at each moment get current log target, will call
// wxAppTraits::CreateLogTarget() to create one if none exists
static wxLog *GetActiveTarget();
// change log target, logger may be NULL
static wxLog *SetActiveTarget(wxLog *logger);
#if wxUSE_THREADS
// change log target for the current thread only, shouldn't be called from
// the main thread as it doesn't use thread-specific log target
static wxLog *SetThreadActiveTarget(wxLog *logger);
#endif // wxUSE_THREADS
// suspend the message flushing of the main target until the next call
// to Resume() - this is mainly for internal use (to prevent wxYield()
// from flashing the messages)
static void Suspend() { ms_suspendCount++; }
// must be called for each Suspend()!
static void Resume() { ms_suspendCount--; }
// should GetActiveTarget() try to create a new log object if the
// current is NULL?
static void DontCreateOnDemand();
// Make GetActiveTarget() create a new log object again.
static void DoCreateOnDemand();
// log the count of repeating messages instead of logging the messages
// multiple times
static void SetRepetitionCounting(bool bRepetCounting = true)
{ ms_bRepetCounting = bRepetCounting; }
// gets duplicate counting status
static bool GetRepetitionCounting() { return ms_bRepetCounting; }
// add string trace mask
static void AddTraceMask(const wxString& str);
// add string trace mask
static void RemoveTraceMask(const wxString& str);
// remove all string trace masks
static void ClearTraceMasks();
// get string trace masks: note that this is MT-unsafe if other threads can
// call AddTraceMask() concurrently
static const wxArrayString& GetTraceMasks();
// is this trace mask in the list?
static bool IsAllowedTraceMask(const wxString& mask);
// log formatting
// -----------------
// Change wxLogFormatter object used by wxLog to format the log messages.
//
// wxLog takes ownership of the pointer passed in but the caller is
// responsible for deleting the returned pointer.
wxLogFormatter* SetFormatter(wxLogFormatter* formatter);
// All the time stamp related functions below only work when the default
// wxLogFormatter is being used. Defining a custom formatter overrides them
// as it could use its own time stamp format or format messages without
// using time stamp at all.
// sets the time stamp string format: this is used as strftime() format
// string for the log targets which add time stamps to the messages; set
// it to empty string to disable time stamping completely.
static void SetTimestamp(const wxString& ts) { ms_timestamp = ts; }
// disable time stamping of log messages
static void DisableTimestamp() { SetTimestamp(wxEmptyString); }
// get the current timestamp format string (maybe empty)
static const wxString& GetTimestamp() { return ms_timestamp; }
// helpers: all functions in this section are mostly for internal use only,
// don't call them from your code even if they are not formally deprecated
// put the time stamp into the string if ms_timestamp is not empty (don't
// change it otherwise); the first overload uses the current time.
static void TimeStamp(wxString *str);
static void TimeStamp(wxString *str, time_t t);
// these methods should only be called from derived classes DoLogRecord(),
// DoLogTextAtLevel() and DoLogText() implementations respectively and
// shouldn't be called directly, use logging functions instead
void LogRecord(wxLogLevel level,
const wxString& msg,
const wxLogRecordInfo& info)
{
DoLogRecord(level, msg, info);
}
void LogTextAtLevel(wxLogLevel level, const wxString& msg)
{
DoLogTextAtLevel(level, msg);
}
void LogText(const wxString& msg)
{
DoLogText(msg);
}
// this is a helper used by wxLogXXX() functions, don't call it directly
// and see DoLog() for function to overload in the derived classes
static void OnLog(wxLogLevel level,
const wxString& msg,
const wxLogRecordInfo& info);
// version called when no information about the location of the log record
// generation is available (but the time stamp is), it mainly exists for
// backwards compatibility, don't use it in new code
static void OnLog(wxLogLevel level, const wxString& msg, time_t t);
// a helper calling the above overload with current time
static void OnLog(wxLogLevel level, const wxString& msg)
{
OnLog(level, msg, time(NULL));
}
// this method exists for backwards compatibility only, don't use
bool HasPendingMessages() const { return true; }
// don't use integer masks any more, use string trace masks instead
#if WXWIN_COMPATIBILITY_2_8
static wxDEPRECATED_INLINE( void SetTraceMask(wxTraceMask ulMask),
ms_ulTraceMask = ulMask; )
// this one can't be marked deprecated as it's used in our own wxLogger
// below but it still is deprecated and shouldn't be used
static wxTraceMask GetTraceMask() { return ms_ulTraceMask; }
#endif // WXWIN_COMPATIBILITY_2_8
protected:
// the logging functions that can be overridden: DoLogRecord() is called
// for every "record", i.e. a unit of log output, to be logged and by
// default formats the message and passes it to DoLogTextAtLevel() which in
// turn passes it to DoLogText() by default
// override this method if you want to change message formatting or do
// dynamic filtering
virtual void DoLogRecord(wxLogLevel level,
const wxString& msg,
const wxLogRecordInfo& info);
// override this method to redirect output to different channels depending
// on its level only; if even the level doesn't matter, override
// DoLogText() instead
virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg);
// this function is not pure virtual as it might not be needed if you do
// the logging in overridden DoLogRecord() or DoLogTextAtLevel() directly
// but if you do not override them in your derived class you must override
// this one as the default implementation of it simply asserts
virtual void DoLogText(const wxString& msg);
// the rest of the functions are for backwards compatibility only, don't
// use them in new code; if you're updating your existing code you need to
// switch to overriding DoLogRecord/Text() above (although as long as these
// functions exist, log classes using them will continue to work)
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED_BUT_USED_INTERNALLY(
virtual void DoLog(wxLogLevel level, const char *szString, time_t t)
);
wxDEPRECATED_BUT_USED_INTERNALLY(
virtual void DoLog(wxLogLevel level, const wchar_t *wzString, time_t t)
);
// these shouldn't be used by new code
wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
virtual void DoLogString(const char *WXUNUSED(szString),
time_t WXUNUSED(t)),
wxEMPTY_PARAMETER_VALUE
)
wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
virtual void DoLogString(const wchar_t *WXUNUSED(wzString),
time_t WXUNUSED(t)),
wxEMPTY_PARAMETER_VALUE
)
#endif // WXWIN_COMPATIBILITY_2_8
// log a message indicating the number of times the previous message was
// repeated if previous repetition counter is strictly positive, does
// nothing otherwise; return the old value of repetition counter
unsigned LogLastRepeatIfNeeded();
private:
#if wxUSE_THREADS
// called from FlushActive() to really log any buffered messages logged
// from the other threads
void FlushThreadMessages();
// these functions are called for non-main thread only by IsEnabled() and
// EnableLogging() respectively
static bool IsThreadLoggingEnabled();
static bool EnableThreadLogging(bool enable = true);
#endif // wxUSE_THREADS
// get the active log target for the main thread, auto-creating it if
// necessary
//
// this is called from GetActiveTarget() and OnLog() when they're called
// from the main thread
static wxLog *GetMainThreadActiveTarget();
// called from OnLog() if it's called from the main thread or if we have a
// (presumably MT-safe) thread-specific logger and by FlushThreadMessages()
// when it plays back the buffered messages logged from the other threads
void CallDoLogNow(wxLogLevel level,
const wxString& msg,
const wxLogRecordInfo& info);
// variables
// ----------------
wxLogFormatter *m_formatter; // We own this pointer.
// static variables
// ----------------
// if true, don't log the same message multiple times, only log it once
// with the number of times it was repeated
static bool ms_bRepetCounting;
static wxLog *ms_pLogger; // currently active log sink
static bool ms_doLog; // false => all logging disabled
static bool ms_bAutoCreate; // create new log targets on demand?
static bool ms_bVerbose; // false => ignore LogInfo messages
static wxLogLevel ms_logLevel; // limit logging to levels <= ms_logLevel
static size_t ms_suspendCount; // if positive, logs are not flushed
// format string for strftime(), if empty, time stamping log messages is
// disabled
static wxString ms_timestamp;
#if WXWIN_COMPATIBILITY_2_8
static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour
#endif // WXWIN_COMPATIBILITY_2_8
};
// ----------------------------------------------------------------------------
// "trivial" derivations of wxLog
// ----------------------------------------------------------------------------
// log everything except for the debug/trace messages (which are passed to
// wxMessageOutputDebug) to a buffer
class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog
{
public:
wxLogBuffer() { }
// get the string contents with all messages logged
const wxString& GetBuffer() const { return m_str; }
// show the buffer contents to the user in the best possible way (this uses
// wxMessageOutputMessageBox) and clear it
virtual void Flush() wxOVERRIDE;
protected:
virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg) wxOVERRIDE;
private:
wxString m_str;
wxDECLARE_NO_COPY_CLASS(wxLogBuffer);
};
// log everything to a "FILE *", stderr by default
class WXDLLIMPEXP_BASE wxLogStderr : public wxLog,
protected wxMessageOutputStderr
{
public:
// redirect log output to a FILE
wxLogStderr(FILE *fp = NULL,
const wxMBConv &conv = wxConvWhateverWorks);
protected:
// implement sink function
virtual void DoLogText(const wxString& msg) wxOVERRIDE;
wxDECLARE_NO_COPY_CLASS(wxLogStderr);
};
#if wxUSE_STD_IOSTREAM
// log everything to an "ostream", cerr by default
class WXDLLIMPEXP_BASE wxLogStream : public wxLog,
private wxMessageOutputWithConv
{
public:
// redirect log output to an ostream
wxLogStream(wxSTD ostream *ostr = (wxSTD ostream *) NULL,
const wxMBConv& conv = wxConvWhateverWorks);
protected:
// implement sink function
virtual void DoLogText(const wxString& msg) wxOVERRIDE;
// using ptr here to avoid including <iostream.h> from this file
wxSTD ostream *m_ostr;
wxDECLARE_NO_COPY_CLASS(wxLogStream);
};
#endif // wxUSE_STD_IOSTREAM
// ----------------------------------------------------------------------------
// /dev/null log target: suppress logging until this object goes out of scope
// ----------------------------------------------------------------------------
// example of usage:
/*
void Foo()
{
wxFile file;
// wxFile.Open() normally complains if file can't be opened, we don't
// want it
wxLogNull logNo;
if ( !file.Open("bar") )
... process error ourselves ...
// ~wxLogNull called, old log sink restored
}
*/
class WXDLLIMPEXP_BASE wxLogNull
{
public:
wxLogNull() : m_flagOld(wxLog::EnableLogging(false)) { }
~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); }
private:
bool m_flagOld; // the previous value of the wxLog::ms_doLog
};
// ----------------------------------------------------------------------------
// chaining log target: installs itself as a log target and passes all
// messages to the real log target given to it in the ctor but also forwards
// them to the previously active one
//
// note that you don't have to call SetActiveTarget() with this class, it
// does it itself in its ctor
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxLogChain : public wxLog
{
public:
wxLogChain(wxLog *logger);
virtual ~wxLogChain();
// change the new log target
void SetLog(wxLog *logger);
// this can be used to temporarily disable (and then reenable) passing
// messages to the old logger (by default we do pass them)
void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
// are we passing the messages to the previous log target?
bool IsPassingMessages() const { return m_bPassMessages; }
// return the previous log target (may be NULL)
wxLog *GetOldLog() const { return m_logOld; }
// override base class version to flush the old logger as well
virtual void Flush() wxOVERRIDE;
// call to avoid destroying the old log target
void DetachOldLog() { m_logOld = NULL; }
protected:
// pass the record to the old logger if needed
virtual void DoLogRecord(wxLogLevel level,
const wxString& msg,
const wxLogRecordInfo& info) wxOVERRIDE;
private:
// the current log target
wxLog *m_logNew;
// the previous log target
wxLog *m_logOld;
// do we pass the messages to the old logger?
bool m_bPassMessages;
wxDECLARE_NO_COPY_CLASS(wxLogChain);
};
// a chain log target which uses itself as the new logger
#define wxLogPassThrough wxLogInterposer
class WXDLLIMPEXP_BASE wxLogInterposer : public wxLogChain
{
public:
wxLogInterposer();
private:
wxDECLARE_NO_COPY_CLASS(wxLogInterposer);
};
// a temporary interposer which doesn't destroy the old log target
// (calls DetachOldLog)
class WXDLLIMPEXP_BASE wxLogInterposerTemp : public wxLogChain
{
public:
wxLogInterposerTemp();
private:
wxDECLARE_NO_COPY_CLASS(wxLogInterposerTemp);
};
#if wxUSE_GUI
// include GUI log targets:
#include "wx/generic/logg.h"
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// wxLogger
// ----------------------------------------------------------------------------
// wxLogger is a helper class used by wxLogXXX() functions implementation,
// don't use it directly as it's experimental and subject to change (OTOH it
// might become public in the future if it's deemed to be useful enough)
// contains information about the context from which a log message originates
// and provides Log() vararg method which forwards to wxLog::OnLog() and passes
// this context to it
class wxLogger
{
public:
// ctor takes the basic information about the log record
wxLogger(wxLogLevel level,
const char *filename,
int line,
const char *func,
const char *component)
: m_level(level),
m_info(filename, line, func, component)
{
}
// store extra data in our log record and return this object itself (so
// that further calls to its functions could be chained)
template <typename T>
wxLogger& Store(const wxString& key, T val)
{
m_info.StoreValue(key, val);
return *this;
}
// hack for "overloaded" wxLogXXX() functions: calling this method
// indicates that we may have an extra first argument preceding the format
// string and that if we do have it, we should store it in m_info using the
// given key (while by default 0 value will be used)
wxLogger& MaybeStore(const wxString& key, wxUIntPtr value = 0)
{
wxASSERT_MSG( m_optKey.empty(), "can only have one optional value" );
m_optKey = key;
m_info.StoreValue(key, value);
return *this;
}
// non-vararg function used by wxVLogXXX():
// log the message at the level specified in the ctor if this log message
// is enabled
void LogV(const wxString& format, va_list argptr)
{
// remember that fatal errors can't be disabled
if ( m_level == wxLOG_FatalError ||
wxLog::IsLevelEnabled(m_level, m_info.component) )
DoCallOnLog(format, argptr);
}
// overloads used by functions with optional leading arguments (whose
// values are stored in the key passed to MaybeStore())
void LogV(long num, const wxString& format, va_list argptr)
{
Store(m_optKey, num);
LogV(format, argptr);
}
void LogV(void *ptr, const wxString& format, va_list argptr)
{
Store(m_optKey, wxPtrToUInt(ptr));
LogV(format, argptr);
}
void LogVTrace(const wxString& mask, const wxString& format, va_list argptr)
{
if ( !wxLog::IsAllowedTraceMask(mask) )
return;
Store(wxLOG_KEY_TRACE_MASK, mask);
LogV(format, argptr);
}
// vararg functions used by wxLogXXX():
// will log the message at the level specified in the ctor
//
// notice that this function supposes that the caller already checked that
// the level was enabled and does no checks itself
WX_DEFINE_VARARG_FUNC_VOID
(
Log,
1, (const wxFormatString&),
DoLog, DoLogUtf8
)
// same as Log() but with an extra numeric or pointer parameters: this is
// used to pass an optional value by storing it in m_info under the name
// passed to MaybeStore() and is required to support "overloaded" versions
// of wxLogStatus() and wxLogSysError()
WX_DEFINE_VARARG_FUNC_VOID
(
Log,
2, (long, const wxFormatString&),
DoLogWithNum, DoLogWithNumUtf8
)
// unfortunately we can't use "void *" here as we get overload ambiguities
// with Log(wxFormatString, ...) when the first argument is a "char *" or
// "wchar_t *" then -- so we only allow passing wxObject here, which is
// ugly but fine in practice as this overload is only used by wxLogStatus()
// whose first argument is a wxFrame
WX_DEFINE_VARARG_FUNC_VOID
(
Log,
2, (wxObject *, const wxFormatString&),
DoLogWithPtr, DoLogWithPtrUtf8
)
// log the message at the level specified as its first argument
//
// as the macros don't have access to the level argument in this case, this
// function does check that the level is enabled itself
WX_DEFINE_VARARG_FUNC_VOID
(
LogAtLevel,
2, (wxLogLevel, const wxFormatString&),
DoLogAtLevel, DoLogAtLevelUtf8
)
// special versions for wxLogTrace() which is passed either string or
// integer mask as first argument determining whether the message should be
// logged or not
WX_DEFINE_VARARG_FUNC_VOID
(
LogTrace,
2, (const wxString&, const wxFormatString&),
DoLogTrace, DoLogTraceUtf8
)
#if WXWIN_COMPATIBILITY_2_8
WX_DEFINE_VARARG_FUNC_VOID
(
LogTrace,
2, (wxTraceMask, const wxFormatString&),
DoLogTraceMask, DoLogTraceMaskUtf8
)
#endif // WXWIN_COMPATIBILITY_2_8
private:
#if !wxUSE_UTF8_LOCALE_ONLY
void DoLog(const wxChar *format, ...)
{
va_list argptr;
va_start(argptr, format);
DoCallOnLog(format, argptr);
va_end(argptr);
}
void DoLogWithNum(long num, const wxChar *format, ...)
{
Store(m_optKey, num);
va_list argptr;
va_start(argptr, format);
DoCallOnLog(format, argptr);
va_end(argptr);
}
void DoLogWithPtr(void *ptr, const wxChar *format, ...)
{
Store(m_optKey, wxPtrToUInt(ptr));
va_list argptr;
va_start(argptr, format);
DoCallOnLog(format, argptr);
va_end(argptr);
}
void DoLogAtLevel(wxLogLevel level, const wxChar *format, ...)
{
if ( !wxLog::IsLevelEnabled(level, m_info.component) )
return;
va_list argptr;
va_start(argptr, format);
DoCallOnLog(level, format, argptr);
va_end(argptr);
}
void DoLogTrace(const wxString& mask, const wxChar *format, ...)
{
if ( !wxLog::IsAllowedTraceMask(mask) )
return;
Store(wxLOG_KEY_TRACE_MASK, mask);
va_list argptr;
va_start(argptr, format);
DoCallOnLog(format, argptr);
va_end(argptr);
}
#if WXWIN_COMPATIBILITY_2_8
void DoLogTraceMask(wxTraceMask mask, const wxChar *format, ...)
{
if ( (wxLog::GetTraceMask() & mask) != mask )
return;
Store(wxLOG_KEY_TRACE_MASK, mask);
va_list argptr;
va_start(argptr, format);
DoCallOnLog(format, argptr);
va_end(argptr);
}
#endif // WXWIN_COMPATIBILITY_2_8
#endif // !wxUSE_UTF8_LOCALE_ONLY
#if wxUSE_UNICODE_UTF8
void DoLogUtf8(const char *format, ...)
{
va_list argptr;
va_start(argptr, format);
DoCallOnLog(format, argptr);
va_end(argptr);
}
void DoLogWithNumUtf8(long num, const char *format, ...)
{
Store(m_optKey, num);
va_list argptr;
va_start(argptr, format);
DoCallOnLog(format, argptr);
va_end(argptr);
}
void DoLogWithPtrUtf8(void *ptr, const char *format, ...)
{
Store(m_optKey, wxPtrToUInt(ptr));
va_list argptr;
va_start(argptr, format);
DoCallOnLog(format, argptr);
va_end(argptr);
}
void DoLogAtLevelUtf8(wxLogLevel level, const char *format, ...)
{
if ( !wxLog::IsLevelEnabled(level, m_info.component) )
return;
va_list argptr;
va_start(argptr, format);
DoCallOnLog(level, format, argptr);
va_end(argptr);
}
void DoLogTraceUtf8(const wxString& mask, const char *format, ...)
{
if ( !wxLog::IsAllowedTraceMask(mask) )
return;
Store(wxLOG_KEY_TRACE_MASK, mask);
va_list argptr;
va_start(argptr, format);
DoCallOnLog(format, argptr);
va_end(argptr);
}
#if WXWIN_COMPATIBILITY_2_8
void DoLogTraceMaskUtf8(wxTraceMask mask, const char *format, ...)
{
if ( (wxLog::GetTraceMask() & mask) != mask )
return;
Store(wxLOG_KEY_TRACE_MASK, mask);
va_list argptr;
va_start(argptr, format);
DoCallOnLog(format, argptr);
va_end(argptr);
}
#endif // WXWIN_COMPATIBILITY_2_8
#endif // wxUSE_UNICODE_UTF8
void DoCallOnLog(wxLogLevel level, const wxString& format, va_list argptr)
{
// As explained in wxLogRecordInfo ctor, we don't initialize its
// timestamp to avoid calling time() unnecessary, but now that we are
// about to log the message, we do need to do it.
m_info.timestamp = time(NULL);
wxLog::OnLog(level, wxString::FormatV(format, argptr), m_info);
}
void DoCallOnLog(const wxString& format, va_list argptr)
{
DoCallOnLog(m_level, format, argptr);
}
const wxLogLevel m_level;
wxLogRecordInfo m_info;
wxString m_optKey;
wxDECLARE_NO_COPY_CLASS(wxLogger);
};
// ============================================================================
// global functions
// ============================================================================
// ----------------------------------------------------------------------------
// get error code/error message from system in a portable way
// ----------------------------------------------------------------------------
// return the last system error code
WXDLLIMPEXP_BASE unsigned long wxSysErrorCode();
// return the error message for given (or last if 0) error code
WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0);
// return the error message for given (or last if 0) error code
WXDLLIMPEXP_BASE wxString wxSysErrorMsgStr(unsigned long nErrCode = 0);
// ----------------------------------------------------------------------------
// define wxLog<level>() functions which can be used by application instead of
// stdio, iostream &c for log messages for easy redirection
// ----------------------------------------------------------------------------
/*
The code below is unreadable because it (unfortunately unavoidably)
contains a lot of macro magic but all it does is to define wxLogXXX() such
that you can call them as vararg functions to log a message at the
corresponding level.
More precisely, it defines:
- wxLog{FatalError,Error,Warning,Message,Verbose,Debug}() functions
taking the format string and additional vararg arguments if needed.
- wxLogGeneric(wxLogLevel level, const wxString& format, ...) which
takes the log level explicitly.
- wxLogSysError(const wxString& format, ...) and wxLogSysError(long
err, const wxString& format, ...) which log a wxLOG_Error severity
message with the error message corresponding to the system error code
err or the last error.
- wxLogStatus(const wxString& format, ...) which logs the message into
the status bar of the main application window and its overload
wxLogStatus(wxFrame *frame, const wxString& format, ...) which logs it
into the status bar of the specified frame.
- wxLogTrace(Mask mask, const wxString& format, ...) which only logs
the message is the specified mask is enabled. This comes in two kinds:
Mask can be a wxString or a long. Both are deprecated.
In addition, wxVLogXXX() versions of all the functions above are also
defined. They take a va_list argument instead of "...".
*/
// creates wxLogger object for the current location
#define wxMAKE_LOGGER(level) \
wxLogger(wxLOG_##level, __FILE__, __LINE__, __WXFUNCTION__, wxLOG_COMPONENT)
// this macro generates the expression which logs whatever follows it in
// parentheses at the level specified as argument
#define wxDO_LOG(level) wxMAKE_LOGGER(level).Log
// this is the non-vararg equivalent
#define wxDO_LOGV(level, format, argptr) \
wxMAKE_LOGGER(level).LogV(format, argptr)
// this macro declares wxLog<level>() macro which logs whatever follows it if
// logging at specified level is enabled (notice that if it is false, the
// following arguments are not even evaluated which is good as it avoids
// unnecessary overhead)
//
// Note: the strange (because executing at most once) for() loop because we
// must arrange for wxDO_LOG() to be at the end of the macro and using a
// more natural "if (IsLevelEnabled()) wxDO_LOG()" would result in wrong
// behaviour for the following code ("else" would bind to the wrong "if"):
//
// if ( cond )
// wxLogError("!!!");
// else
// ...
//
// See also #11829 for the problems with other simpler approaches,
// notably the need for two macros due to buggy __LINE__ in MSVC.
#define wxDO_LOG_IF_ENABLED_HELPER(level, loopvar) \
for ( bool loopvar = false; \
!loopvar && wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT); \
loopvar = true ) \
wxDO_LOG(level)
#define wxDO_LOG_IF_ENABLED(level) \
wxDO_LOG_IF_ENABLED_HELPER(level, wxMAKE_UNIQUE_NAME(wxlogcheck))
// wxLogFatalError() is special as it can't be disabled
#define wxLogFatalError wxDO_LOG(FatalError)
#define wxVLogFatalError(format, argptr) wxDO_LOGV(FatalError, format, argptr)
#define wxLogError wxDO_LOG_IF_ENABLED(Error)
#define wxVLogError(format, argptr) wxDO_LOGV(Error, format, argptr)
#define wxLogWarning wxDO_LOG_IF_ENABLED(Warning)
#define wxVLogWarning(format, argptr) wxDO_LOGV(Warning, format, argptr)
#define wxLogMessage wxDO_LOG_IF_ENABLED(Message)
#define wxVLogMessage(format, argptr) wxDO_LOGV(Message, format, argptr)
#define wxLogInfo wxDO_LOG_IF_ENABLED(Info)
#define wxVLogInfo(format, argptr) wxDO_LOGV(Info, format, argptr)
// this one is special as it only logs if we're in verbose mode
#define wxLogVerbose \
if ( !(wxLog::IsLevelEnabled(wxLOG_Info, wxLOG_COMPONENT) && \
wxLog::GetVerbose()) ) \
{} \
else \
wxDO_LOG(Info)
#define wxVLogVerbose(format, argptr) \
if ( !(wxLog::IsLevelEnabled(wxLOG_Info, wxLOG_COMPONENT) && \
wxLog::GetVerbose()) ) \
{} \
else \
wxDO_LOGV(Info, format, argptr)
// another special case: the level is passed as first argument of the function
// and so is not available to the macro
//
// notice that because of this, arguments of wxLogGeneric() are currently
// always evaluated, unlike for the other log functions
#define wxLogGeneric wxMAKE_LOGGER(Max).LogAtLevel
#define wxVLogGeneric(level, format, argptr) \
if ( !wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT) ) \
{} \
else \
wxDO_LOGV(level, format, argptr)
// wxLogSysError() needs to stash the error code value in the log record info
// so it needs special handling too; additional complications arise because the
// error code may or not be present as the first argument
//
// notice that we unfortunately can't avoid the call to wxSysErrorCode() even
// though it may be unneeded if an explicit error code is passed to us because
// the message might not be logged immediately (e.g. it could be queued for
// logging from the main thread later) and so we can't to wait until it is
// logged to determine whether we have last error or not as it will be too late
// and it will have changed already by then (in fact it even changes when
// wxString::Format() is called because of vsnprintf() inside it so it can
// change even much sooner)
#define wxLOG_KEY_SYS_ERROR_CODE "wx.sys_error"
#define wxLogSysError \
if ( !wxLog::IsLevelEnabled(wxLOG_Error, wxLOG_COMPONENT) ) \
{} \
else \
wxMAKE_LOGGER(Error).MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \
wxSysErrorCode()).Log
// unfortunately we can't have overloaded macros so we can't define versions
// both with and without error code argument and have to rely on LogV()
// overloads in wxLogger to select between them
#define wxVLogSysError \
wxMAKE_LOGGER(Error).MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \
wxSysErrorCode()).LogV
#if wxUSE_GUI
// wxLogStatus() is similar to wxLogSysError() as it allows to optionally
// specify the frame to which the message should go
#define wxLOG_KEY_FRAME "wx.frame"
#define wxLogStatus \
if ( !wxLog::IsLevelEnabled(wxLOG_Status, wxLOG_COMPONENT) ) \
{} \
else \
wxMAKE_LOGGER(Status).MaybeStore(wxLOG_KEY_FRAME).Log
#define wxVLogStatus \
wxMAKE_LOGGER(Status).MaybeStore(wxLOG_KEY_FRAME).LogV
#endif // wxUSE_GUI
#else // !wxUSE_LOG
#undef wxUSE_LOG_DEBUG
#define wxUSE_LOG_DEBUG 0
#undef wxUSE_LOG_TRACE
#define wxUSE_LOG_TRACE 0
// define macros for defining log functions which do nothing at all
#define wxDEFINE_EMPTY_LOG_FUNCTION(level) \
WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxFormatString&)) \
inline void wxVLog##level(const wxFormatString& WXUNUSED(format), \
va_list WXUNUSED(argptr)) { } \
#define wxDEFINE_EMPTY_LOG_FUNCTION2(level, argclass) \
WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxFormatString&)) \
inline void wxVLog##level(argclass WXUNUSED(arg), \
const wxFormatString& WXUNUSED(format), \
va_list WXUNUSED(argptr)) {}
wxDEFINE_EMPTY_LOG_FUNCTION(FatalError);
wxDEFINE_EMPTY_LOG_FUNCTION(Error);
wxDEFINE_EMPTY_LOG_FUNCTION(SysError);
wxDEFINE_EMPTY_LOG_FUNCTION2(SysError, long);
wxDEFINE_EMPTY_LOG_FUNCTION(Warning);
wxDEFINE_EMPTY_LOG_FUNCTION(Message);
wxDEFINE_EMPTY_LOG_FUNCTION(Info);
wxDEFINE_EMPTY_LOG_FUNCTION(Verbose);
wxDEFINE_EMPTY_LOG_FUNCTION2(Generic, wxLogLevel);
#if wxUSE_GUI
wxDEFINE_EMPTY_LOG_FUNCTION(Status);
wxDEFINE_EMPTY_LOG_FUNCTION2(Status, wxFrame *);
#endif // wxUSE_GUI
// Empty Class to fake wxLogNull
class WXDLLIMPEXP_BASE wxLogNull
{
public:
wxLogNull() { }
};
// Dummy macros to replace some functions.
#define wxSysErrorCode() (unsigned long)0
#define wxSysErrorMsg( X ) (const wxChar*)NULL
#define wxSysErrorMsgStr( X ) wxEmptyString
// Fake symbolic trace masks... for those that are used frequently
#define wxTRACE_OleCalls wxEmptyString // OLE interface calls
#endif // wxUSE_LOG/!wxUSE_LOG
// debug functions can be completely disabled in optimized builds
// if these log functions are disabled, we prefer to define them as (empty)
// variadic macros as this completely removes them and their argument
// evaluation from the object code but if this is not supported by compiler we
// use empty inline functions instead (defining them as nothing would result in
// compiler warnings)
//
// note that making wxVLogDebug/Trace() themselves (empty inline) functions is
// a bad idea as some compilers are stupid enough to not inline even empty
// functions if their parameters are complicated enough, but by defining them
// as an empty inline function we ensure that even dumbest compilers optimise
// them away
#ifdef __BORLANDC__
// but Borland gives "W8019: Code has no effect" for wxLogNop() so we need
// to define it differently for it to avoid these warnings (same problem as
// with wxUnusedVar())
#define wxLogNop() { }
#else
inline void wxLogNop() { }
#endif
#if wxUSE_LOG_DEBUG
#define wxLogDebug wxDO_LOG_IF_ENABLED(Debug)
#define wxVLogDebug(format, argptr) wxDO_LOGV(Debug, format, argptr)
#else // !wxUSE_LOG_DEBUG
#define wxVLogDebug(fmt, valist) wxLogNop()
#ifdef HAVE_VARIADIC_MACROS
#define wxLogDebug(fmt, ...) wxLogNop()
#else // !HAVE_VARIADIC_MACROS
WX_DEFINE_VARARG_FUNC_NOP(wxLogDebug, 1, (const wxFormatString&))
#endif
#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG
#if wxUSE_LOG_TRACE
#define wxLogTrace \
if ( !wxLog::IsLevelEnabled(wxLOG_Trace, wxLOG_COMPONENT) ) \
{} \
else \
wxMAKE_LOGGER(Trace).LogTrace
#define wxVLogTrace \
if ( !wxLog::IsLevelEnabled(wxLOG_Trace, wxLOG_COMPONENT) ) \
{} \
else \
wxMAKE_LOGGER(Trace).LogVTrace
#else // !wxUSE_LOG_TRACE
#define wxVLogTrace(mask, fmt, valist) wxLogNop()
#ifdef HAVE_VARIADIC_MACROS
#define wxLogTrace(mask, fmt, ...) wxLogNop()
#else // !HAVE_VARIADIC_MACROS
#if WXWIN_COMPATIBILITY_2_8
WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (wxTraceMask, const wxFormatString&))
#endif
WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wxString&, const wxFormatString&))
#endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS
#endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE
// wxLogFatalError helper: show the (fatal) error to the user in a safe way,
// i.e. without using wxMessageBox() for example because it could crash
void WXDLLIMPEXP_BASE
wxSafeShowMessage(const wxString& title, const wxString& text);
// ----------------------------------------------------------------------------
// debug only logging functions: use them with API name and error code
// ----------------------------------------------------------------------------
#if wxUSE_LOG_DEBUG
// make life easier for people using VC++ IDE: clicking on the message
// will take us immediately to the place of the failed API
#ifdef __VISUALC__
#define wxLogApiError(api, rc) \
wxLogDebug(wxT("%s(%d): '%s' failed with error 0x%08lx (%s)."), \
__FILE__, __LINE__, api, \
(long)rc, wxSysErrorMsgStr(rc))
#else // !VC++
#define wxLogApiError(api, rc) \
wxLogDebug(wxT("In file %s at line %d: '%s' failed with ") \
wxT("error 0x%08lx (%s)."), \
__FILE__, __LINE__, api, \
(long)rc, wxSysErrorMsgStr(rc))
#endif // VC++/!VC++
#define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode())
#else // !wxUSE_LOG_DEBUG
#define wxLogApiError(api, err) wxLogNop()
#define wxLogLastError(api) wxLogNop()
#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG
// macro which disables debug logging in release builds: this is done by
// default by wxIMPLEMENT_APP() so usually it doesn't need to be used explicitly
#if defined(NDEBUG) && wxUSE_LOG_DEBUG
#define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() \
wxLog::SetLogLevel(wxLOG_Info)
#else // !NDEBUG
#define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()
#endif // NDEBUG/!NDEBUG
#endif // _WX_LOG_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/ioswrap.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/ioswrap.h
// Purpose: includes the correct iostream headers for current compiler
// Author: Vadim Zeitlin
// Modified by:
// Created: 03.02.99
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#if wxUSE_STD_IOSTREAM
#include "wx/beforestd.h"
#if wxUSE_IOSTREAMH
# include <iostream.h>
#else
# include <iostream>
#endif
#include "wx/afterstd.h"
#ifdef __WINDOWS__
# include "wx/msw/winundef.h"
#endif
#endif
// wxUSE_STD_IOSTREAM
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/bmpcbox.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/bmpcbox.h
// Purpose: wxBitmapComboBox base header
// Author: Jaakko Salli
// Modified by:
// Created: Aug-31-2006
// Copyright: (c) Jaakko Salli
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BMPCBOX_H_BASE_
#define _WX_BMPCBOX_H_BASE_
#include "wx/defs.h"
#if wxUSE_BITMAPCOMBOBOX
#include "wx/bitmap.h"
#include "wx/dynarray.h"
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxItemContainer;
// Define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED for platforms which
// wxBitmapComboBox implementation utilizes ownerdrawn combobox
// (either native or generic).
#if !defined(__WXGTK20__) || defined(__WXUNIVERSAL__)
#define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
class WXDLLIMPEXP_FWD_CORE wxDC;
#endif
extern WXDLLIMPEXP_DATA_CORE(const char) wxBitmapComboBoxNameStr[];
class WXDLLIMPEXP_CORE wxBitmapComboBoxBase
{
public:
// ctors and such
wxBitmapComboBoxBase() { Init(); }
virtual ~wxBitmapComboBoxBase() { }
// Sets the image for the given item.
virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0;
#if !defined(wxBITMAPCOMBOBOX_OWNERDRAWN_BASED)
// Returns the image of the item with the given index.
virtual wxBitmap GetItemBitmap(unsigned int n) const = 0;
// Returns size of the image used in list
virtual wxSize GetBitmapSize() const = 0;
private:
void Init() {}
#else // wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
// Returns the image of the item with the given index.
virtual wxBitmap GetItemBitmap(unsigned int n) const;
// Returns size of the image used in list
virtual wxSize GetBitmapSize() const
{
return m_usedImgSize;
}
protected:
// Returns pointer to the combobox item container
virtual wxItemContainer* GetItemContainer() = 0;
// Return pointer to the owner-drawn combobox control
virtual wxWindow* GetControl() = 0;
// wxItemContainer functions
void BCBDoClear();
void BCBDoDeleteOneItem(unsigned int n);
void DoSetItemBitmap(unsigned int n, const wxBitmap& bitmap);
void DrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const;
void DrawItem(wxDC& dc, const wxRect& rect, int item, const wxString& text,
int flags) const;
wxCoord MeasureItem(size_t item) const;
// Returns true if image size was affected
virtual bool OnAddBitmap(const wxBitmap& bitmap);
// Recalculates amount of empty space needed in front of text
// in control itself. Returns number that can be passed to
// wxOwnerDrawnComboBox::SetCustomPaintWidth() and similar
// functions.
virtual int DetermineIndent();
void UpdateInternals();
wxArrayPtrVoid m_bitmaps; // Images associated with items
wxSize m_usedImgSize; // Size of bitmaps
int m_imgAreaWidth; // Width and height of area next to text field
int m_fontHeight;
int m_indent;
private:
void Init();
#endif // !wxBITMAPCOMBOBOX_OWNERDRAWN_BASED/wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
};
#if defined(__WXUNIVERSAL__)
#include "wx/generic/bmpcbox.h"
#elif defined(__WXMSW__)
#include "wx/msw/bmpcbox.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/bmpcbox.h"
#else
#include "wx/generic/bmpcbox.h"
#endif
#endif // wxUSE_BITMAPCOMBOBOX
#endif // _WX_BMPCBOX_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/dataobj.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/dataobj.h
// Purpose: common data object classes
// Author: Vadim Zeitlin, Robert Roebling
// Modified by:
// Created: 26.05.99
// Copyright: (c) wxWidgets Team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DATAOBJ_H_BASE_
#define _WX_DATAOBJ_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_DATAOBJ
#include "wx/string.h"
#include "wx/bitmap.h"
#include "wx/list.h"
#include "wx/arrstr.h"
// ============================================================================
/*
Generic data transfer related classes. The class hierarchy is as follows:
- wxDataObject-
/ \
/ \
wxDataObjectSimple wxDataObjectComposite
/ | \
/ | \
wxTextDataObject | wxBitmapDataObject
|
wxCustomDataObject
*/
// ============================================================================
// ----------------------------------------------------------------------------
// wxDataFormat class is declared in platform-specific headers: it represents
// a format for data which may be either one of the standard ones (text,
// bitmap, ...) or a custom one which is then identified by a unique string.
// ----------------------------------------------------------------------------
/* the class interface looks like this (pseudo code):
class wxDataFormat
{
public:
typedef <integral type> NativeFormat;
wxDataFormat(NativeFormat format = wxDF_INVALID);
wxDataFormat(const wxString& format);
wxDataFormat& operator=(NativeFormat format);
wxDataFormat& operator=(const wxDataFormat& format);
bool operator==(NativeFormat format) const;
bool operator!=(NativeFormat format) const;
void SetType(NativeFormat format);
NativeFormat GetType() const;
wxString GetId() const;
void SetId(const wxString& format);
};
*/
#if defined(__WXMSW__)
#include "wx/msw/ole/dataform.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/dataform.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/dataform.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/dataform.h"
#elif defined(__WXX11__)
#include "wx/x11/dataform.h"
#elif defined(__WXMAC__)
#include "wx/osx/dataform.h"
#elif defined(__WXQT__)
#include "wx/qt/dataform.h"
#endif
// the value for default argument to some functions (corresponds to
// wxDF_INVALID)
extern WXDLLIMPEXP_CORE const wxDataFormat& wxFormatInvalid;
// ----------------------------------------------------------------------------
// wxDataObject represents a piece of data which knows which formats it
// supports and knows how to render itself in each of them - GetDataHere(),
// and how to restore data from the buffer (SetData()).
//
// Although this class may be used directly (i.e. custom classes may be
// derived from it), in many cases it might be simpler to use either
// wxDataObjectSimple or wxDataObjectComposite classes.
//
// A data object may be "read only", i.e. support only GetData() functions or
// "read-write", i.e. support both GetData() and SetData() (in principle, it
// might be "write only" too, but this is rare). Moreover, it doesn't have to
// support the same formats in Get() and Set() directions: for example, a data
// object containing JPEG image might accept BMPs in GetData() because JPEG
// image may be easily transformed into BMP but not in SetData(). Accordingly,
// all methods dealing with formats take an additional "direction" argument
// which is either SET or GET and which tells the function if the format needs
// to be supported by SetData() or GetDataHere().
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataObjectBase
{
public:
enum Direction
{
Get = 0x01, // format is supported by GetDataHere()
Set = 0x02, // format is supported by SetData()
Both = 0x03 // format is supported by both (unused currently)
};
// this class is polymorphic, hence it needs a virtual dtor
virtual ~wxDataObjectBase();
// get the best suited format for rendering our data
virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const = 0;
// get the number of formats we support
virtual size_t GetFormatCount(Direction dir = Get) const = 0;
// return all formats in the provided array (of size GetFormatCount())
virtual void GetAllFormats(wxDataFormat *formats,
Direction dir = Get) const = 0;
// get the (total) size of data for the given format
virtual size_t GetDataSize(const wxDataFormat& format) const = 0;
// copy raw data (in the specified format) to the provided buffer, return
// true if data copied successfully, false otherwise
virtual bool GetDataHere(const wxDataFormat& format, void *buf) const = 0;
// get data from the buffer of specified length (in the given format),
// return true if the data was read successfully, false otherwise
virtual bool SetData(const wxDataFormat& WXUNUSED(format),
size_t WXUNUSED(len), const void * WXUNUSED(buf))
{
return false;
}
// returns true if this format is supported
bool IsSupported(const wxDataFormat& format, Direction dir = Get) const;
};
// ----------------------------------------------------------------------------
// include the platform-specific declarations of wxDataObject
// ----------------------------------------------------------------------------
#if defined(__WXMSW__)
#include "wx/msw/ole/dataobj.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/dataobj.h"
#elif defined(__WXX11__)
#include "wx/x11/dataobj.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/dataobj.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/dataobj.h"
#elif defined(__WXMAC__)
#include "wx/osx/dataobj.h"
#elif defined(__WXQT__)
#include "wx/qt/dataobj.h"
#endif
// ----------------------------------------------------------------------------
// wxDataObjectSimple is a wxDataObject which only supports one format (in
// both Get and Set directions, but you may return false from GetDataHere() or
// SetData() if one of them is not supported). This is the simplest possible
// wxDataObject implementation.
//
// This is still an "abstract base class" (although it doesn't have any pure
// virtual functions), to use it you should derive from it and implement
// GetDataSize(), GetDataHere() and SetData() functions because the base class
// versions don't do anything - they just return "not implemented".
//
// This class should be used when you provide data in only one format (no
// conversion to/from other formats), either a standard or a custom one.
// Otherwise, you should use wxDataObjectComposite or wxDataObject directly.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataObjectSimple : public wxDataObject
{
public:
// ctor takes the format we support, but it can also be set later with
// SetFormat()
wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid)
: m_format(format)
{
}
// get/set the format we support
const wxDataFormat& GetFormat() const { return m_format; }
void SetFormat(const wxDataFormat& format) { m_format = format; }
// virtual functions to override in derived class (the base class versions
// just return "not implemented")
// -----------------------------------------------------------------------
// get the size of our data
virtual size_t GetDataSize() const
{ return 0; }
// copy our data to the buffer
virtual bool GetDataHere(void *WXUNUSED(buf)) const
{ return false; }
// copy data from buffer to our data
virtual bool SetData(size_t WXUNUSED(len), const void *WXUNUSED(buf))
{ return false; }
// implement base class pure virtuals
// ----------------------------------
virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE
{ return m_format; }
virtual size_t GetFormatCount(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE
{ return 1; }
virtual void GetAllFormats(wxDataFormat *formats,
wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE
{ *formats = m_format; }
virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const wxOVERRIDE
{ return GetDataSize(); }
virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format),
void *buf) const wxOVERRIDE
{ return GetDataHere(buf); }
virtual bool SetData(const wxDataFormat& WXUNUSED(format),
size_t len, const void *buf) wxOVERRIDE
{ return SetData(len, buf); }
private:
// the one and only format we support
wxDataFormat m_format;
wxDECLARE_NO_COPY_CLASS(wxDataObjectSimple);
};
// ----------------------------------------------------------------------------
// wxDataObjectComposite is the simplest way to implement wxDataObject
// supporting multiple formats. It contains several wxDataObjectSimple and
// supports all formats supported by any of them.
//
// This class shouldn't be (normally) derived from, but may be used directly.
// If you need more flexibility than what it provides, you should probably use
// wxDataObject directly.
// ----------------------------------------------------------------------------
WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList);
class WXDLLIMPEXP_CORE wxDataObjectComposite : public wxDataObject
{
public:
// ctor
wxDataObjectComposite();
virtual ~wxDataObjectComposite();
// add data object (it will be deleted by wxDataObjectComposite, hence it
// must be allocated on the heap) whose format will become the preferred
// one if preferred == true
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
// the clipboard or the DnD operation. You can use this method to find
// out what kind of data object was received.
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 wxOVERRIDE;
virtual size_t GetFormatCount(wxDataObjectBase::Direction dir = Get) const wxOVERRIDE;
virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir = Get) const wxOVERRIDE;
virtual size_t GetDataSize(const wxDataFormat& format) const wxOVERRIDE;
virtual bool GetDataHere(const wxDataFormat& format, void *buf) const wxOVERRIDE;
virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf) wxOVERRIDE;
#if defined(__WXMSW__)
virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size,
const wxDataFormat& format ) wxOVERRIDE;
virtual void* SetSizeInBuffer( void* buffer, size_t size,
const wxDataFormat& format ) wxOVERRIDE;
virtual size_t GetBufferOffset( const wxDataFormat& format ) wxOVERRIDE;
#endif
private:
// the list of all (simple) data objects whose formats we support
wxSimpleDataObjectList m_dataObjects;
// the index of the preferred one (0 initially, so by default the first
// one is the preferred)
size_t m_preferred;
wxDataFormat m_receivedFormat;
wxDECLARE_NO_COPY_CLASS(wxDataObjectComposite);
};
// ============================================================================
// Standard implementations of wxDataObjectSimple which can be used directly
// (i.e. without having to derive from them) for standard data type transfers.
//
// Note that although all of them can work with provided data, you can also
// override their virtual GetXXX() functions to only provide data on demand.
// ============================================================================
// ----------------------------------------------------------------------------
// wxTextDataObject contains text data
// ----------------------------------------------------------------------------
#if wxUSE_UNICODE
#if defined(__WXGTK20__) || defined(__WXX11__)
#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 wxOVERRIDE;
virtual bool GetDataHere(void *buf) const wxOVERRIDE;
virtual bool SetData(size_t len, const void *buf) wxOVERRIDE;
// Must provide overloads to avoid hiding them (and warnings about it)
virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE
{
return GetDataSize();
}
virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE
{
return GetDataHere(buf);
}
virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE
{
return SetData(len, buf);
}
private:
wxString m_html;
};
class WXDLLIMPEXP_CORE wxTextDataObject : public wxDataObjectSimple
{
public:
// ctor: you can specify the text here or in SetText(), or override
// GetText()
wxTextDataObject(const wxString& text = wxEmptyString)
: wxDataObjectSimple(
#if wxUSE_UNICODE
wxDF_UNICODETEXT
#else
wxDF_TEXT
#endif
),
m_text(text)
{
}
// 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 GetTextLength() const { return m_text.Len() + 1; }
virtual wxString GetText() const { return m_text; }
virtual void SetText(const wxString& text) { m_text = text; }
// implement base class pure virtuals
// ----------------------------------
// some platforms have 2 and not 1 format for text data
#if defined(wxNEEDS_UTF8_FOR_TEXT_DATAOBJ) || defined(wxNEEDS_UTF16_FOR_TEXT_DATAOBJ)
virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const wxOVERRIDE { return 2; }
virtual void GetAllFormats(wxDataFormat *formats,
wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE;
virtual size_t GetDataSize() const wxOVERRIDE { return GetDataSize(GetPreferredFormat()); }
virtual bool GetDataHere(void *buf) const wxOVERRIDE { return GetDataHere(GetPreferredFormat(), buf); }
virtual bool SetData(size_t len, const void *buf) wxOVERRIDE { return SetData(GetPreferredFormat(), len, buf); }
size_t GetDataSize(const wxDataFormat& format) const wxOVERRIDE;
bool GetDataHere(const wxDataFormat& format, void *pBuf) const wxOVERRIDE;
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf) wxOVERRIDE;
#else // !wxNEEDS_UTF{8,16}_FOR_TEXT_DATAOBJ
virtual size_t GetDataSize() const wxOVERRIDE;
virtual bool GetDataHere(void *buf) const wxOVERRIDE;
virtual bool SetData(size_t len, const void *buf) wxOVERRIDE;
// Must provide overloads to avoid hiding them (and warnings about it)
virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE
{
return GetDataSize();
}
virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE
{
return GetDataHere(buf);
}
virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE
{
return SetData(len, buf);
}
#endif // different wxTextDataObject implementations
private:
wxString m_text;
wxDECLARE_NO_COPY_CLASS(wxTextDataObject);
};
// ----------------------------------------------------------------------------
// wxBitmapDataObject contains a bitmap
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapDataObjectBase : public wxDataObjectSimple
{
public:
// ctor: you can specify the bitmap here or in SetBitmap(), or override
// GetBitmap()
wxBitmapDataObjectBase(const wxBitmap& bitmap = wxNullBitmap)
: wxDataObjectSimple(wxDF_BITMAP), m_bitmap(bitmap)
{
}
// virtual functions which you may override if you want to provide data on
// demand only - otherwise, the trivial default versions will be used
virtual wxBitmap GetBitmap() const { return m_bitmap; }
virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
protected:
wxBitmap m_bitmap;
wxDECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase);
};
// ----------------------------------------------------------------------------
// wxFileDataObject contains a list of filenames
//
// NB: notice that this is a "write only" object, it can only be filled with
// data from drag and drop operation.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFileDataObjectBase : public wxDataObjectSimple
{
public:
// ctor: use AddFile() later to fill the array
wxFileDataObjectBase() : wxDataObjectSimple(wxDF_FILENAME) { }
// get a reference to our array
const wxArrayString& GetFilenames() const { return m_filenames; }
protected:
wxArrayString m_filenames;
wxDECLARE_NO_COPY_CLASS(wxFileDataObjectBase);
};
// ----------------------------------------------------------------------------
// wxCustomDataObject contains arbitrary untyped user data.
//
// It is understood that this data can be copied bitwise.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCustomDataObject : public wxDataObjectSimple
{
public:
// if you don't specify the format in the ctor, you can still use
// SetFormat() later
wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid);
// the dtor calls Free()
virtual ~wxCustomDataObject();
// you can call SetData() to set m_data: it will make a copy of the data
// you pass - or you can use TakeData() which won't copy anything, but
// will take ownership of data (i.e. will call Free() on it later)
void TakeData(size_t size, void *data);
// this function is called to allocate "size" bytes of memory from
// SetData(). The default version uses operator new[].
virtual void *Alloc(size_t size);
// this function is called when the data is freed, you may override it to
// anything you want (or may be nothing at all). The default version calls
// operator delete[] on m_data
virtual void Free();
// get data: you may override these functions if you wish to provide data
// only when it's requested
virtual size_t GetSize() const { return m_size; }
virtual void *GetData() const { return m_data; }
// implement base class pure virtuals
// ----------------------------------
virtual size_t GetDataSize() const wxOVERRIDE;
virtual bool GetDataHere(void *buf) const wxOVERRIDE;
virtual bool SetData(size_t size, const void *buf) wxOVERRIDE;
// Must provide overloads to avoid hiding them (and warnings about it)
virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE
{
return GetDataSize();
}
virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE
{
return GetDataHere(buf);
}
virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE
{
return SetData(len, buf);
}
private:
size_t m_size;
void *m_data;
wxDECLARE_NO_COPY_CLASS(wxCustomDataObject);
};
// ----------------------------------------------------------------------------
// include platform-specific declarations of wxXXXBase classes
// ----------------------------------------------------------------------------
#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 gtk/dataobj2.h
#else
#if 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"
#elif defined(__WXQT__)
#include "wx/qt/dataobj2.h"
#endif
// wxURLDataObject is simply wxTextDataObject with a different name
class WXDLLIMPEXP_CORE wxURLDataObject : public wxTextDataObject
{
public:
wxURLDataObject(const wxString& url = wxEmptyString)
: wxTextDataObject(url)
{
}
wxString GetURL() const { return GetText(); }
void SetURL(const wxString& url) { SetText(url); }
};
#endif
#endif // wxUSE_DATAOBJ
#endif // _WX_DATAOBJ_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/power.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/power.h
// Purpose: functions and classes for system power management
// Author: Vadim Zeitlin
// Modified by:
// Created: 2006-05-27
// Copyright: (c) 2006 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_POWER_H_
#define _WX_POWER_H_
#include "wx/event.h"
// ----------------------------------------------------------------------------
// power management constants
// ----------------------------------------------------------------------------
enum wxPowerType
{
wxPOWER_SOCKET,
wxPOWER_BATTERY,
wxPOWER_UNKNOWN
};
enum wxBatteryState
{
wxBATTERY_NORMAL_STATE, // system is fully usable
wxBATTERY_LOW_STATE, // start to worry
wxBATTERY_CRITICAL_STATE, // save quickly
wxBATTERY_SHUTDOWN_STATE, // too late
wxBATTERY_UNKNOWN_STATE
};
// ----------------------------------------------------------------------------
// wxPowerEvent is generated when the system online status changes
// ----------------------------------------------------------------------------
// currently the power events are only available under Windows, to avoid
// compiling in the code for handling them which is never going to be invoked
// under the other platforms, we define wxHAS_POWER_EVENTS symbol if this event
// is available, it should be used to guard all code using wxPowerEvent
#ifdef __WINDOWS__
#define wxHAS_POWER_EVENTS
class WXDLLIMPEXP_BASE wxPowerEvent : public wxEvent
{
public:
wxPowerEvent() // just for use by wxRTTI
: m_veto(false) { }
wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType)
{
m_veto = false;
}
// Veto the operation (only makes sense with EVT_POWER_SUSPENDING)
void Veto() { m_veto = true; }
bool IsVetoed() const { return m_veto; }
// default copy ctor, assignment operator and dtor are ok
virtual wxEvent *Clone() const wxOVERRIDE { return new wxPowerEvent(*this); }
private:
bool m_veto;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPowerEvent);
};
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDING, wxPowerEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDED, wxPowerEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPEND_CANCEL, wxPowerEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_RESUME, wxPowerEvent );
typedef void (wxEvtHandler::*wxPowerEventFunction)(wxPowerEvent&);
#define wxPowerEventHandler(func) \
wxEVENT_HANDLER_CAST(wxPowerEventFunction, func)
#define EVT_POWER_SUSPENDING(func) \
wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDING, wxPowerEventHandler(func))
#define EVT_POWER_SUSPENDED(func) \
wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDED, wxPowerEventHandler(func))
#define EVT_POWER_SUSPEND_CANCEL(func) \
wx__DECLARE_EVT0(wxEVT_POWER_SUSPEND_CANCEL, wxPowerEventHandler(func))
#define EVT_POWER_RESUME(func) \
wx__DECLARE_EVT0(wxEVT_POWER_RESUME, wxPowerEventHandler(func))
#else // no support for power events
#undef wxHAS_POWER_EVENTS
#endif // support for power events/no support
// ----------------------------------------------------------------------------
// wxPowerResourceBlocker
// ----------------------------------------------------------------------------
enum wxPowerResourceKind
{
wxPOWER_RESOURCE_SCREEN,
wxPOWER_RESOURCE_SYSTEM
};
class WXDLLIMPEXP_BASE wxPowerResource
{
public:
static bool Acquire(wxPowerResourceKind kind,
const wxString& reason = wxString());
static void Release(wxPowerResourceKind kind);
};
class wxPowerResourceBlocker
{
public:
explicit wxPowerResourceBlocker(wxPowerResourceKind kind,
const wxString& reason = wxString())
: m_kind(kind),
m_acquired(wxPowerResource::Acquire(kind, reason))
{
}
bool IsInEffect() const { return m_acquired; }
~wxPowerResourceBlocker()
{
if ( m_acquired )
wxPowerResource::Release(m_kind);
}
private:
const wxPowerResourceKind m_kind;
const bool m_acquired;
wxDECLARE_NO_COPY_CLASS(wxPowerResourceBlocker);
};
// ----------------------------------------------------------------------------
// power management functions
// ----------------------------------------------------------------------------
// return the current system power state: online or offline
WXDLLIMPEXP_BASE wxPowerType wxGetPowerType();
// return approximate battery state
WXDLLIMPEXP_BASE wxBatteryState wxGetBatteryState();
#endif // _WX_POWER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/statbox.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/statbox.h
// Purpose: wxStaticBox base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATBOX_H_BASE_
#define _WX_STATBOX_H_BASE_
#include "wx/defs.h"
#if wxUSE_STATBOX
#include "wx/control.h"
#include "wx/containr.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBoxNameStr[];
// ----------------------------------------------------------------------------
// wxStaticBox: a grouping box with a label
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxStaticBoxBase : public wxNavigationEnabled<wxControl>
{
public:
wxStaticBoxBase();
// overridden base class virtuals
virtual bool HasTransparentBackground() wxOVERRIDE { return true; }
virtual bool Enable(bool enable = true) wxOVERRIDE;
// implementation only: this is used by wxStaticBoxSizer to account for the
// need for extra space taken by the static box
//
// the top border is the margin at the top (where the title is),
// borderOther is the margin on all other sides
virtual void GetBordersForSizer(int *borderTop, int *borderOther) const;
// This is an internal function currently used by wxStaticBoxSizer only.
//
// Reparent all children of the static box under its parent and destroy the
// box itself.
void WXDestroyWithoutChildren();
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
// If non-null, the window used as our label. This window is owned by the
// static box and will be deleted when it is.
wxWindow* m_labelWin;
// For boxes with window label this member variable is used instead of
// m_isEnabled to remember the last value passed to Enable(). It is
// required because the box itself doesn't get disabled by Enable(false) in
// this case (see comments in Enable() implementation), and m_isEnabled
// must correspond to its real state.
bool m_areChildrenEnabled;
wxDECLARE_NO_COPY_CLASS(wxStaticBoxBase);
};
#if defined(__WXUNIVERSAL__)
#include "wx/univ/statbox.h"
#elif defined(__WXMSW__)
#include "wx/msw/statbox.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/statbox.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/statbox.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/statbox.h"
#elif defined(__WXMAC__)
#include "wx/osx/statbox.h"
#elif defined(__WXQT__)
#include "wx/qt/statbox.h"
#endif
#endif // wxUSE_STATBOX
#endif
// _WX_STATBOX_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/arrimpl.cpp | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/arrimpl.cpp
// Purpose: helper file for implementation of dynamic lists
// Author: Vadim Zeitlin
// Modified by:
// Created: 16.10.97
// Copyright: (c) 1997 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/*****************************************************************************
* Purpose: implements helper functions used by the template class used by *
* DECLARE_OBJARRAY macro and which couldn't be implemented inline *
* (because they need the full definition of type T in scope) *
* *
* Usage: 1) #include dynarray.h *
* 2) WX_DECLARE_OBJARRAY *
* 3) #include arrimpl.cpp *
* 4) WX_DEFINE_OBJARRAY *
*****************************************************************************/
#undef WX_DEFINE_OBJARRAY
#define WX_DEFINE_OBJARRAY(name) \
name::value_type* \
wxObjectArrayTraitsFor##name::Clone(const name::value_type& item) \
{ \
return new name::value_type(item); \
} \
\
void wxObjectArrayTraitsFor##name::Free(name::value_type* p) \
{ \
delete p; \
}
| cpp |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/utils.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/utils.h
// Purpose: Miscellaneous utilities
// Author: Julian Smart
// Modified by:
// Created: 29/01/98
// Copyright: (c) 1998 Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UTILS_H_
#define _WX_UTILS_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/object.h"
#include "wx/list.h"
#include "wx/filefn.h"
#include "wx/hashmap.h"
#include "wx/versioninfo.h"
#include "wx/meta/implicitconversion.h"
#if wxUSE_GUI
#include "wx/gdicmn.h"
#include "wx/mousestate.h"
#endif
class WXDLLIMPEXP_FWD_BASE wxArrayString;
class WXDLLIMPEXP_FWD_BASE wxArrayInt;
// need this for wxGetDiskSpace() as we can't, unfortunately, forward declare
// wxLongLong
#include "wx/longlong.h"
// needed for wxOperatingSystemId, wxLinuxDistributionInfo
#include "wx/platinfo.h"
#if defined(__X__)
#include <dirent.h>
#include <unistd.h>
#endif
#include <stdio.h>
// ----------------------------------------------------------------------------
// Forward declaration
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_BASE wxProcess;
class WXDLLIMPEXP_FWD_CORE wxFrame;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class wxWindowList;
class WXDLLIMPEXP_FWD_CORE wxEventLoop;
// ----------------------------------------------------------------------------
// Arithmetic functions
// ----------------------------------------------------------------------------
template<typename T1, typename T2>
inline typename wxImplicitConversionType<T1,T2>::value
wxMax(T1 a, T2 b)
{
typedef typename wxImplicitConversionType<T1,T2>::value ResultType;
// Cast both operands to the same type before comparing them to avoid
// warnings about signed/unsigned comparisons from some compilers:
return static_cast<ResultType>(a) > static_cast<ResultType>(b) ? a : b;
}
template<typename T1, typename T2>
inline typename wxImplicitConversionType<T1,T2>::value
wxMin(T1 a, T2 b)
{
typedef typename wxImplicitConversionType<T1,T2>::value ResultType;
return static_cast<ResultType>(a) < static_cast<ResultType>(b) ? a : b;
}
template<typename T1, typename T2, typename T3>
inline typename wxImplicitConversionType3<T1,T2,T3>::value
wxClip(T1 a, T2 b, T3 c)
{
typedef typename wxImplicitConversionType3<T1,T2,T3>::value ResultType;
if ( static_cast<ResultType>(a) < static_cast<ResultType>(b) )
return b;
if ( static_cast<ResultType>(a) > static_cast<ResultType>(c) )
return c;
return a;
}
// ----------------------------------------------------------------------------
// wxMemorySize
// ----------------------------------------------------------------------------
// wxGetFreeMemory can return huge amount of memory on 32-bit platforms as well
// so to always use long long for its result type on all platforms which
// support it
#if wxUSE_LONGLONG
typedef wxLongLong wxMemorySize;
#else
typedef long wxMemorySize;
#endif
// ----------------------------------------------------------------------------
// String functions (deprecated, use wxString)
// ----------------------------------------------------------------------------
#if WXWIN_COMPATIBILITY_2_8
// A shorter way of using strcmp
wxDEPRECATED_INLINE(inline bool wxStringEq(const char *s1, const char *s2),
return wxCRT_StrcmpA(s1, s2) == 0; )
#if wxUSE_UNICODE
wxDEPRECATED_INLINE(inline bool wxStringEq(const wchar_t *s1, const wchar_t *s2),
return wxCRT_StrcmpW(s1, s2) == 0; )
#endif // wxUSE_UNICODE
#endif // WXWIN_COMPATIBILITY_2_8
// ----------------------------------------------------------------------------
// Miscellaneous functions
// ----------------------------------------------------------------------------
// Sound the bell
WXDLLIMPEXP_CORE void wxBell();
#if wxUSE_MSGDLG
// Show wxWidgets information
WXDLLIMPEXP_CORE void wxInfoMessageBox(wxWindow* parent);
#endif // wxUSE_MSGDLG
WXDLLIMPEXP_CORE wxVersionInfo wxGetLibraryVersionInfo();
// Get OS description as a user-readable string
WXDLLIMPEXP_BASE wxString wxGetOsDescription();
// Get OS version
WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *verMaj = NULL,
int *verMin = NULL,
int *verMicro = NULL);
// Check is OS version is at least the specified major and minor version
WXDLLIMPEXP_BASE bool wxCheckOsVersion(int majorVsn, int minorVsn = 0, int microVsn = 0);
// Get platform endianness
WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian();
// Get platform architecture
WXDLLIMPEXP_BASE bool wxIsPlatform64Bit();
#ifdef __LINUX__
// Get linux-distro informations
WXDLLIMPEXP_BASE wxLinuxDistributionInfo wxGetLinuxDistributionInfo();
#endif
// Return a string with the current date/time
WXDLLIMPEXP_BASE wxString wxNow();
// Return path where wxWidgets is installed (mostly useful in Unices)
WXDLLIMPEXP_BASE const wxChar *wxGetInstallPrefix();
// Return path to wxWin data (/usr/share/wx/%{version}) (Unices)
WXDLLIMPEXP_BASE wxString wxGetDataDir();
#if wxUSE_GUI
// Get the state of a key (true if pressed, false if not)
// This is generally most useful getting the state of
// the modifier or toggle keys.
WXDLLIMPEXP_CORE bool wxGetKeyState(wxKeyCode key);
// Don't synthesize KeyUp events holding down a key and producing
// KeyDown events with autorepeat. On by default and always on
// in wxMSW.
WXDLLIMPEXP_CORE bool wxSetDetectableAutoRepeat( bool flag );
// Returns the current state of the mouse position, buttons and modifers
WXDLLIMPEXP_CORE wxMouseState wxGetMouseState();
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// wxPlatform
// ----------------------------------------------------------------------------
/*
* Class to make it easier to specify platform-dependent values
*
* Examples:
* long val = wxPlatform::If(wxMac, 1).ElseIf(wxGTK, 2).ElseIf(stPDA, 5).Else(3);
* wxString strVal = wxPlatform::If(wxMac, wxT("Mac")).ElseIf(wxMSW, wxT("MSW")).Else(wxT("Other"));
*
* A custom platform symbol:
*
* #define stPDA 100
* #ifdef __WXMSW__
* wxPlatform::AddPlatform(stPDA);
* #endif
*
* long windowStyle = wxCAPTION | (long) wxPlatform::IfNot(stPDA, wxRESIZE_BORDER);
*
*/
class WXDLLIMPEXP_BASE wxPlatform
{
public:
wxPlatform() { Init(); }
wxPlatform(const wxPlatform& platform) { Copy(platform); }
void operator = (const wxPlatform& platform) { if (&platform != this) Copy(platform); }
void Copy(const wxPlatform& platform);
// Specify an optional default value
wxPlatform(int defValue) { Init(); m_longValue = (long)defValue; }
wxPlatform(long defValue) { Init(); m_longValue = defValue; }
wxPlatform(const wxString& defValue) { Init(); m_stringValue = defValue; }
wxPlatform(double defValue) { Init(); m_doubleValue = defValue; }
static wxPlatform If(int platform, long value);
static wxPlatform IfNot(int platform, long value);
wxPlatform& ElseIf(int platform, long value);
wxPlatform& ElseIfNot(int platform, long value);
wxPlatform& Else(long value);
static wxPlatform If(int platform, int value) { return If(platform, (long)value); }
static wxPlatform IfNot(int platform, int value) { return IfNot(platform, (long)value); }
wxPlatform& ElseIf(int platform, int value) { return ElseIf(platform, (long) value); }
wxPlatform& ElseIfNot(int platform, int value) { return ElseIfNot(platform, (long) value); }
wxPlatform& Else(int value) { return Else((long) value); }
static wxPlatform If(int platform, double value);
static wxPlatform IfNot(int platform, double value);
wxPlatform& ElseIf(int platform, double value);
wxPlatform& ElseIfNot(int platform, double value);
wxPlatform& Else(double value);
static wxPlatform If(int platform, const wxString& value);
static wxPlatform IfNot(int platform, const wxString& value);
wxPlatform& ElseIf(int platform, const wxString& value);
wxPlatform& ElseIfNot(int platform, const wxString& value);
wxPlatform& Else(const wxString& value);
long GetInteger() const { return m_longValue; }
const wxString& GetString() const { return m_stringValue; }
double GetDouble() const { return m_doubleValue; }
operator int() const { return (int) GetInteger(); }
operator long() const { return GetInteger(); }
operator double() const { return GetDouble(); }
operator const wxString&() const { return GetString(); }
static void AddPlatform(int platform);
static bool Is(int platform);
static void ClearPlatforms();
private:
void Init() { m_longValue = 0; m_doubleValue = 0.0; }
long m_longValue;
double m_doubleValue;
wxString m_stringValue;
static wxArrayInt* sm_customPlatforms;
};
/// Function for testing current platform
inline bool wxPlatformIs(int platform) { return wxPlatform::Is(platform); }
// ----------------------------------------------------------------------------
// Window ID management
// ----------------------------------------------------------------------------
// Ensure subsequent IDs don't clash with this one
WXDLLIMPEXP_BASE void wxRegisterId(int id);
// Return the current ID
WXDLLIMPEXP_BASE int wxGetCurrentId();
// Generate a unique ID
WXDLLIMPEXP_BASE int wxNewId();
// ----------------------------------------------------------------------------
// Various conversions
// ----------------------------------------------------------------------------
// Convert 2-digit hex number to decimal
WXDLLIMPEXP_BASE int wxHexToDec(const wxString& buf);
// Convert 2-digit hex number to decimal
inline int wxHexToDec(const char* buf)
{
int firstDigit, secondDigit;
if (buf[0] >= 'A')
firstDigit = buf[0] - 'A' + 10;
else if (buf[0] >= '0')
firstDigit = buf[0] - '0';
else
firstDigit = -1;
wxCHECK_MSG( firstDigit >= 0 && firstDigit <= 15, -1, wxS("Invalid argument") );
if (buf[1] >= 'A')
secondDigit = buf[1] - 'A' + 10;
else if (buf[1] >= '0')
secondDigit = buf[1] - '0';
else
secondDigit = -1;
wxCHECK_MSG( secondDigit >= 0 && secondDigit <= 15, -1, wxS("Invalid argument") );
return firstDigit * 16 + secondDigit;
}
// Convert decimal integer to 2-character hex string
WXDLLIMPEXP_BASE void wxDecToHex(unsigned char dec, wxChar *buf);
WXDLLIMPEXP_BASE void wxDecToHex(unsigned char dec, char* ch1, char* ch2);
WXDLLIMPEXP_BASE wxString wxDecToHex(unsigned char dec);
// ----------------------------------------------------------------------------
// Process management
// ----------------------------------------------------------------------------
// NB: for backwards compatibility reasons the values of wxEXEC_[A]SYNC *must*
// be 0 and 1, don't change!
enum
{
// execute the process asynchronously
wxEXEC_ASYNC = 0,
// execute it synchronously, i.e. wait until it finishes
wxEXEC_SYNC = 1,
// under Windows, don't hide the child even if it's IO is redirected (this
// is done by default)
wxEXEC_SHOW_CONSOLE = 2,
// deprecated synonym for wxEXEC_SHOW_CONSOLE, use the new name as it's
// more clear
wxEXEC_NOHIDE = wxEXEC_SHOW_CONSOLE,
// under Unix, if the process is the group leader then passing wxKILL_CHILDREN to wxKill
// kills all children as well as pid
// under Windows (NT family only), sets the CREATE_NEW_PROCESS_GROUP flag,
// which allows to target Ctrl-Break signal to the spawned process.
// applies to console processes only.
wxEXEC_MAKE_GROUP_LEADER = 4,
// by default synchronous execution disables all program windows to avoid
// that the user interacts with the program while the child process is
// running, you can use this flag to prevent this from happening
wxEXEC_NODISABLE = 8,
// by default, the event loop is run while waiting for synchronous execution
// to complete and this flag can be used to simply block the main process
// until the child process finishes
wxEXEC_NOEVENTS = 16,
// under Windows, hide the console of the child process if it has one, even
// if its IO is not redirected
wxEXEC_HIDE_CONSOLE = 32,
// convenient synonym for flags given system()-like behaviour
wxEXEC_BLOCK = wxEXEC_SYNC | wxEXEC_NOEVENTS
};
// Map storing environment variables.
typedef wxStringToStringHashMap wxEnvVariableHashMap;
// Used to pass additional parameters for child process to wxExecute(). Could
// be extended with other fields later.
struct wxExecuteEnv
{
wxString cwd; // If empty, CWD is not changed.
wxEnvVariableHashMap env; // If empty, environment is unchanged.
};
// Execute another program.
//
// If flags contain wxEXEC_SYNC, return -1 on failure and the exit code of the
// process if everything was ok. Otherwise (i.e. if wxEXEC_ASYNC), return 0 on
// failure and the PID of the launched process if ok.
WXDLLIMPEXP_BASE long wxExecute(const wxString& command,
int flags = wxEXEC_ASYNC,
wxProcess *process = NULL,
const wxExecuteEnv *env = NULL);
WXDLLIMPEXP_BASE long wxExecute(const char* const* argv,
int flags = wxEXEC_ASYNC,
wxProcess *process = NULL,
const wxExecuteEnv *env = NULL);
#if wxUSE_UNICODE
WXDLLIMPEXP_BASE long wxExecute(const wchar_t* const* argv,
int flags = wxEXEC_ASYNC,
wxProcess *process = NULL,
const wxExecuteEnv *env = NULL);
#endif // wxUSE_UNICODE
// execute the command capturing its output into an array line by line, this is
// always synchronous
WXDLLIMPEXP_BASE long wxExecute(const wxString& command,
wxArrayString& output,
int flags = 0,
const wxExecuteEnv *env = NULL);
// also capture stderr (also synchronous)
WXDLLIMPEXP_BASE long wxExecute(const wxString& command,
wxArrayString& output,
wxArrayString& error,
int flags = 0,
const wxExecuteEnv *env = NULL);
#if defined(__WINDOWS__) && wxUSE_IPC
// ask a DDE server to execute the DDE request with given parameters
WXDLLIMPEXP_BASE bool wxExecuteDDE(const wxString& ddeServer,
const wxString& ddeTopic,
const wxString& ddeCommand);
#endif // __WINDOWS__ && wxUSE_IPC
enum wxSignal
{
wxSIGNONE = 0, // verify if the process exists under Unix
wxSIGHUP,
wxSIGINT,
wxSIGQUIT,
wxSIGILL,
wxSIGTRAP,
wxSIGABRT,
wxSIGIOT = wxSIGABRT, // another name
wxSIGEMT,
wxSIGFPE,
wxSIGKILL,
wxSIGBUS,
wxSIGSEGV,
wxSIGSYS,
wxSIGPIPE,
wxSIGALRM,
wxSIGTERM
// further signals are different in meaning between different Unix systems
};
enum wxKillError
{
wxKILL_OK, // no error
wxKILL_BAD_SIGNAL, // no such signal
wxKILL_ACCESS_DENIED, // permission denied
wxKILL_NO_PROCESS, // no such process
wxKILL_ERROR // another, unspecified error
};
enum wxKillFlags
{
wxKILL_NOCHILDREN = 0, // don't kill children
wxKILL_CHILDREN = 1 // kill children
};
enum wxShutdownFlags
{
wxSHUTDOWN_FORCE = 1,// can be combined with other flags (MSW-only)
wxSHUTDOWN_POWEROFF = 2,// power off the computer
wxSHUTDOWN_REBOOT = 4,// shutdown and reboot
wxSHUTDOWN_LOGOFF = 8 // close session (currently MSW-only)
};
// Shutdown or reboot the PC
WXDLLIMPEXP_BASE bool wxShutdown(int flags = wxSHUTDOWN_POWEROFF);
// send the given signal to the process (only NONE and KILL are supported under
// Windows, all others mean TERM), return 0 if ok and -1 on error
//
// return detailed error in rc if not NULL
WXDLLIMPEXP_BASE int wxKill(long pid,
wxSignal sig = wxSIGTERM,
wxKillError *rc = NULL,
int flags = wxKILL_NOCHILDREN);
// Execute a command in an interactive shell window (always synchronously)
// If no command then just the shell
WXDLLIMPEXP_BASE bool wxShell(const wxString& command = wxEmptyString);
// As wxShell(), but must give a (non interactive) command and its output will
// be returned in output array
WXDLLIMPEXP_BASE bool wxShell(const wxString& command, wxArrayString& output);
// Sleep for nSecs seconds
WXDLLIMPEXP_BASE void wxSleep(int nSecs);
// Sleep for a given amount of milliseconds
WXDLLIMPEXP_BASE void wxMilliSleep(unsigned long milliseconds);
// Sleep for a given amount of microseconds
WXDLLIMPEXP_BASE void wxMicroSleep(unsigned long microseconds);
#if WXWIN_COMPATIBILITY_2_8
// Sleep for a given amount of milliseconds (old, bad name), use wxMilliSleep
wxDEPRECATED( WXDLLIMPEXP_BASE void wxUsleep(unsigned long milliseconds) );
#endif
// Get the process id of the current process
WXDLLIMPEXP_BASE unsigned long wxGetProcessId();
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
WXDLLIMPEXP_BASE wxMemorySize wxGetFreeMemory();
#if wxUSE_ON_FATAL_EXCEPTION
// should wxApp::OnFatalException() be called?
WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true);
#endif // wxUSE_ON_FATAL_EXCEPTION
// ----------------------------------------------------------------------------
// Environment variables
// ----------------------------------------------------------------------------
// returns true if variable exists (value may be NULL if you just want to check
// for this)
WXDLLIMPEXP_BASE bool wxGetEnv(const wxString& var, wxString *value);
// set the env var name to the given value, return true on success
WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxString& value);
// remove the env var from environment
WXDLLIMPEXP_BASE bool wxUnsetEnv(const wxString& var);
#if WXWIN_COMPATIBILITY_2_8
inline bool wxSetEnv(const wxString& var, const char *value)
{ return wxSetEnv(var, wxString(value)); }
inline bool wxSetEnv(const wxString& var, const wchar_t *value)
{ return wxSetEnv(var, wxString(value)); }
template<typename T>
inline bool wxSetEnv(const wxString& var, const wxScopedCharTypeBuffer<T>& value)
{ return wxSetEnv(var, wxString(value)); }
inline bool wxSetEnv(const wxString& var, const wxCStrData& value)
{ return wxSetEnv(var, wxString(value)); }
// this one is for passing NULL directly - don't use it, use wxUnsetEnv instead
wxDEPRECATED( inline bool wxSetEnv(const wxString& var, int value) );
inline bool wxSetEnv(const wxString& var, int value)
{
wxASSERT_MSG( value == 0, "using non-NULL integer as string?" );
wxUnusedVar(value); // fix unused parameter warning in release build
return wxUnsetEnv(var);
}
#endif // WXWIN_COMPATIBILITY_2_8
// Retrieve the complete environment by filling specified map.
// Returns true on success or false if an error occurred.
WXDLLIMPEXP_BASE bool wxGetEnvMap(wxEnvVariableHashMap *map);
// ----------------------------------------------------------------------------
// Network and username functions.
// ----------------------------------------------------------------------------
// NB: "char *" functions are deprecated, use wxString ones!
// Get eMail address
WXDLLIMPEXP_BASE bool wxGetEmailAddress(wxChar *buf, int maxSize);
WXDLLIMPEXP_BASE wxString wxGetEmailAddress();
// Get hostname.
WXDLLIMPEXP_BASE bool wxGetHostName(wxChar *buf, int maxSize);
WXDLLIMPEXP_BASE wxString wxGetHostName();
// Get FQDN
WXDLLIMPEXP_BASE wxString wxGetFullHostName();
WXDLLIMPEXP_BASE bool wxGetFullHostName(wxChar *buf, int maxSize);
// Get user ID e.g. jacs (this is known as login name under Unix)
WXDLLIMPEXP_BASE bool wxGetUserId(wxChar *buf, int maxSize);
WXDLLIMPEXP_BASE wxString wxGetUserId();
// Get user name e.g. Julian Smart
WXDLLIMPEXP_BASE bool wxGetUserName(wxChar *buf, int maxSize);
WXDLLIMPEXP_BASE wxString wxGetUserName();
// Get current Home dir and copy to dest (returns pstr->c_str())
WXDLLIMPEXP_BASE wxString wxGetHomeDir();
WXDLLIMPEXP_BASE const wxChar* wxGetHomeDir(wxString *pstr);
// Get the user's (by default use the current user name) home dir,
// return empty string on error
WXDLLIMPEXP_BASE wxString wxGetUserHome(const wxString& user = wxEmptyString);
#if wxUSE_LONGLONG
typedef wxLongLong wxDiskspaceSize_t;
#else
typedef long wxDiskspaceSize_t;
#endif
// get number of total/free bytes on the disk where path belongs
WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path,
wxDiskspaceSize_t *pTotal = NULL,
wxDiskspaceSize_t *pFree = NULL);
typedef int (*wxSortCallback)(const void* pItem1,
const void* pItem2,
const void* user_data);
WXDLLIMPEXP_BASE void wxQsort(void* pbase, size_t total_elems,
size_t size, wxSortCallback cmp,
const void* user_data);
#if wxUSE_GUI // GUI only things from now on
// ----------------------------------------------------------------------------
// Launch default browser
// ----------------------------------------------------------------------------
// flags for wxLaunchDefaultBrowser
enum
{
wxBROWSER_NEW_WINDOW = 0x01,
wxBROWSER_NOBUSYCURSOR = 0x02
};
// Launch url in the user's default internet browser
WXDLLIMPEXP_CORE bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0);
// Launch document in the user's default application
WXDLLIMPEXP_CORE bool wxLaunchDefaultApplication(const wxString& path, int flags = 0);
// ----------------------------------------------------------------------------
// Menu accelerators related things
// ----------------------------------------------------------------------------
// flags for wxStripMenuCodes
enum
{
// strip '&' characters
wxStrip_Mnemonics = 1,
// strip everything after '\t'
wxStrip_Accel = 2,
// strip everything (this is the default)
wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel
};
// strip mnemonics and/or accelerators from the label
WXDLLIMPEXP_CORE wxString
wxStripMenuCodes(const wxString& str, int flags = wxStrip_All);
// ----------------------------------------------------------------------------
// Window search
// ----------------------------------------------------------------------------
// Returns menu item id or wxNOT_FOUND if none.
WXDLLIMPEXP_CORE int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString);
// Find the wxWindow at the given point. wxGenericFindWindowAtPoint
// is always present but may be less reliable than a native version.
WXDLLIMPEXP_CORE wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
// NB: this function is obsolete, use wxWindow::FindWindowByLabel() instead
//
// Find the window/widget with the given title or label.
// Pass a parent to begin the search from, or NULL to look through
// all windows.
WXDLLIMPEXP_CORE wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = NULL);
// NB: this function is obsolete, use wxWindow::FindWindowByName() instead
//
// Find window by name, and if that fails, by label.
WXDLLIMPEXP_CORE wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = NULL);
// ----------------------------------------------------------------------------
// Message/event queue helpers
// ----------------------------------------------------------------------------
// Yield to other apps/messages and disable user input
WXDLLIMPEXP_CORE bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = false);
// Enable or disable input to all top level windows
WXDLLIMPEXP_CORE void wxEnableTopLevelWindows(bool enable = true);
// Check whether this window wants to process messages, e.g. Stop button
// in long calculations.
WXDLLIMPEXP_CORE bool wxCheckForInterrupt(wxWindow *wnd);
// Consume all events until no more left
WXDLLIMPEXP_CORE void wxFlushEvents();
// a class which disables all windows (except, may be, the given one) in its
// ctor and enables them back in its dtor
class WXDLLIMPEXP_CORE wxWindowDisabler
{
public:
// this ctor conditionally disables all windows: if the argument is false,
// it doesn't do anything
wxWindowDisabler(bool disable = true);
// ctor disables all windows except winToSkip
wxWindowDisabler(wxWindow *winToSkip);
// dtor enables back all windows disabled by the ctor
~wxWindowDisabler();
private:
// disable all windows except the given one (used by both ctors)
void DoDisable(wxWindow *winToSkip = NULL);
#if defined(__WXOSX__) && wxOSX_USE_COCOA
wxEventLoop* m_modalEventLoop;
#endif
wxWindowList *m_winDisabled;
bool m_disabled;
wxDECLARE_NO_COPY_CLASS(wxWindowDisabler);
};
// ----------------------------------------------------------------------------
// Cursors
// ----------------------------------------------------------------------------
// Set the cursor to the busy cursor for all windows
WXDLLIMPEXP_CORE void wxBeginBusyCursor(const wxCursor *cursor = wxHOURGLASS_CURSOR);
// Restore cursor to normal
WXDLLIMPEXP_CORE void wxEndBusyCursor();
// true if we're between the above two calls
WXDLLIMPEXP_CORE bool wxIsBusy();
// Convenience class so we can just create a wxBusyCursor object on the stack
class WXDLLIMPEXP_CORE wxBusyCursor
{
public:
wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR)
{ wxBeginBusyCursor(cursor); }
~wxBusyCursor()
{ wxEndBusyCursor(); }
// FIXME: These two methods are currently only implemented (and needed?)
// in wxGTK. BusyCursor handling should probably be moved to
// common code since the wxGTK and wxMSW implementations are very
// similar except for wxMSW using HCURSOR directly instead of
// wxCursor.. -- RL.
static const wxCursor &GetStoredCursor();
static const wxCursor GetBusyCursor();
};
void WXDLLIMPEXP_CORE wxGetMousePosition( int* x, int* y );
// ----------------------------------------------------------------------------
// X11 Display access
// ----------------------------------------------------------------------------
#if defined(__X__) || defined(__WXGTK__)
#ifdef __WXGTK__
WXDLLIMPEXP_CORE void *wxGetDisplay();
#endif
#ifdef __X__
WXDLLIMPEXP_CORE WXDisplay *wxGetDisplay();
WXDLLIMPEXP_CORE bool wxSetDisplay(const wxString& display_name);
WXDLLIMPEXP_CORE wxString wxGetDisplayName();
#endif // X or GTK+
// use this function instead of the functions above in implementation code
inline struct _XDisplay *wxGetX11Display()
{
return (_XDisplay *)wxGetDisplay();
}
#endif // X11 || wxGTK
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// wxYield(): these functions are obsolete, please use wxApp methods instead!
// ----------------------------------------------------------------------------
// avoid redeclaring this function here if it had been already declated by
// wx/app.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();
#endif // wx_YIELD_DECLARED
// Like wxYield, but fails silently if the yield is recursive.
WXDLLIMPEXP_CORE bool wxYieldIfNeeded();
// ----------------------------------------------------------------------------
// Windows resources access
// ----------------------------------------------------------------------------
// Windows only: get user-defined resource from the .res file.
#ifdef __WINDOWS__
// default resource type for wxLoadUserResource()
extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxUserResourceStr;
// Return the pointer to the resource data. This pointer is read-only, use
// the overload below if you need to modify the data.
//
// Notice that the resource type can be either a real string or an integer
// produced by MAKEINTRESOURCE(). In particular, any standard resource type,
// i.e any RT_XXX constant, could be passed here.
//
// Returns true on success, false on failure. Doesn't log an error message
// if the resource is not found (because this could be expected) but does
// log one if any other error occurs.
WXDLLIMPEXP_BASE bool
wxLoadUserResource(const void **outData,
size_t *outLen,
const wxString& resourceName,
const wxChar* resourceType = wxUserResourceStr,
WXHINSTANCE module = 0);
// This function allocates a new buffer and makes a copy of the resource
// data, remember to delete[] the buffer. And avoid using it entirely if
// the overload above can be used.
//
// Returns NULL on failure.
WXDLLIMPEXP_BASE char*
wxLoadUserResource(const wxString& resourceName,
const wxChar* resourceType = wxUserResourceStr,
int* pLen = NULL,
WXHINSTANCE module = 0);
#endif // __WINDOWS__
#endif
// _WX_UTILSH__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/testing.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/testing.h
// Purpose: helpers for GUI testing
// Author: Vaclav Slavik
// Created: 2012-08-28
// Copyright: (c) 2012 Vaclav Slavik
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TESTING_H_
#define _WX_TESTING_H_
#include "wx/debug.h"
#include "wx/string.h"
#include "wx/modalhook.h"
class WXDLLIMPEXP_FWD_CORE wxMessageDialogBase;
class WXDLLIMPEXP_FWD_CORE wxFileDialogBase;
// ----------------------------------------------------------------------------
// testing API
// ----------------------------------------------------------------------------
// Don't include this code when building the library itself
#ifndef WXBUILDING
#include "wx/beforestd.h"
#include <algorithm>
#include <iterator>
#include <queue>
#include "wx/afterstd.h"
#include "wx/cpp.h"
#include "wx/dialog.h"
#include "wx/msgdlg.h"
#include "wx/filedlg.h"
#include <typeinfo>
class wxTestingModalHook;
// This helper is used to construct the best possible name for the dialog of
// the given type using wxRTTI for this type, if any, and the C++ RTTI for
// either the type T statically or the dynamic type of "dlg" if it's non-null.
template <class T>
wxString wxGetDialogClassDescription(const wxClassInfo *ci, T* dlg = NULL)
{
// We prefer to use the name from wxRTTI as it's guaranteed to be readable,
// unlike the name returned by type_info::name() which may need to be
// demangled, but if wxRTTI macros were not used for this object, it's
// better to return a not-very-readable-but-informative mangled name rather
// than a readable but useless "wxDialog".
if ( ci == wxCLASSINFO(wxDialog) )
{
return wxString::Format("dialog of type \"%s\"",
(dlg ? typeid(*dlg) : typeid(T)).name());
}
// We consider that an unmangled name is clear enough to be used on its own.
return ci->GetClassName();
}
// Non-template base class for wxExpectModal<T> (via wxExpectModalBase).
// Only used internally.
class wxModalExpectation
{
public:
wxModalExpectation() : m_isOptional(false) {}
virtual ~wxModalExpectation() {}
wxString GetDescription() const
{
return m_description.empty() ? GetDefaultDescription() : m_description;
}
bool IsOptional() const { return m_isOptional; }
virtual int Invoke(wxDialog *dlg) const = 0;
protected:
// Override to return the default description of the expected dialog used
// if no specific description for this particular expectation is given.
virtual wxString GetDefaultDescription() const = 0;
// User-provided description of the dialog, may be empty.
wxString m_description;
// Is this dialog optional, i.e. not required to be shown?
bool m_isOptional;
};
// This template is specialized for some of the standard dialog classes and can
// also be specialized outside of the library for the custom dialogs.
//
// All specializations must derive from wxExpectModalBase<T>.
template<class T> class wxExpectModal;
/**
Base class for the expectation of a dialog of the given type T.
Test code can derive ad hoc classes from this class directly and implement
its OnInvoked() to perform the necessary actions or derive wxExpectModal<T>
and implement it once if the implementation of OnInvoked() is always the
same, i.e. depends just on the type T.
T must be a class derived from wxDialog and E is the derived class type,
i.e. this is an example of using CRTP. The default value of E is fine in
case you're using this class as a base for your wxExpectModal<>
specialization anyhow but also if you don't use neither Optional() nor
Describe() methods, as the derived class type is only needed for them.
*/
template<class T, class E = wxExpectModal<T> >
class wxExpectModalBase : public wxModalExpectation
{
public:
typedef T DialogType;
typedef E ExpectationType;
// A note about these "modifier" methods: they return copies of this object
// and not a reference to the object itself (after modifying it) because
// this object is likely to be temporary and will be destroyed soon, while
// the new temporary created by these objects is bound to a const reference
// inside WX_TEST_IMPL_ADD_EXPECTATION() macro ensuring that its lifetime
// is prolonged until we can check if the expectations were met.
//
// This is also the reason these methods must be in this class and use
// CRTP: a copy of this object can't be created in the base class, which is
// abstract, and the copy must have the same type as the derived object to
// avoid slicing.
//
// Make sure you understand this comment in its entirety before considering
// modifying this code.
/**
Returns a copy of the expectation where the expected dialog is marked
as optional.
Optional dialogs aren't required to appear, it's not an error if they
don't.
*/
ExpectationType Optional() const
{
ExpectationType e(*static_cast<const ExpectationType*>(this));
e.m_isOptional = true;
return e;
}
/**
Sets a description shown in the error message if the expectation fails.
Using this method with unique descriptions for the different dialogs is
recommended to make it easier to find out which one of the expected
dialogs exactly was not shown.
*/
ExpectationType Describe(const wxString& description) const
{
ExpectationType e(*static_cast<const ExpectationType*>(this));
e.m_description = description;
return e;
}
protected:
virtual int Invoke(wxDialog *dlg) const wxOVERRIDE
{
DialogType *t = dynamic_cast<DialogType*>(dlg);
if ( t )
return OnInvoked(t);
else
return wxID_NONE; // not handled
}
/// Returns description of the expected dialog (by default, its class).
virtual wxString GetDefaultDescription() const wxOVERRIDE
{
return wxGetDialogClassDescription<T>(wxCLASSINFO(T));
}
/**
This method is called when ShowModal() was invoked on a dialog of type T.
@return Return value is used as ShowModal()'s return value.
*/
virtual int OnInvoked(DialogType *dlg) const = 0;
};
// wxExpectModal<T> specializations for common dialogs:
template<class T>
class wxExpectDismissableModal
: public wxExpectModalBase<T, wxExpectDismissableModal<T> >
{
public:
explicit wxExpectDismissableModal(int id)
{
switch ( id )
{
case wxYES:
m_id = wxID_YES;
break;
case wxNO:
m_id = wxID_NO;
break;
case wxCANCEL:
m_id = wxID_CANCEL;
break;
case wxOK:
m_id = wxID_OK;
break;
case wxHELP:
m_id = wxID_HELP;
break;
default:
m_id = id;
break;
}
}
protected:
virtual int OnInvoked(T *WXUNUSED(dlg)) const wxOVERRIDE
{
return m_id;
}
int m_id;
};
template<>
class wxExpectModal<wxMessageDialog>
: public wxExpectDismissableModal<wxMessageDialog>
{
public:
explicit wxExpectModal(int id)
: wxExpectDismissableModal<wxMessageDialog>(id)
{
}
protected:
virtual wxString GetDefaultDescription() const wxOVERRIDE
{
// It can be useful to show which buttons the expected message box was
// supposed to have, in case there could have been several of them.
wxString details;
switch ( m_id )
{
case wxID_YES:
case wxID_NO:
details = "wxYES_NO style";
break;
case wxID_CANCEL:
details = "wxCANCEL style";
break;
case wxID_OK:
details = "wxOK style";
break;
default:
details.Printf("a button with ID=%d", m_id);
break;
}
return "wxMessageDialog with " + details;
}
};
class wxExpectAny : public wxExpectDismissableModal<wxDialog>
{
public:
explicit wxExpectAny(int id)
: wxExpectDismissableModal<wxDialog>(id)
{
}
};
#if wxUSE_FILEDLG
template<>
class wxExpectModal<wxFileDialog> : public wxExpectModalBase<wxFileDialog>
{
public:
wxExpectModal(const wxString& path, int id = wxID_OK)
: m_path(path), m_id(id)
{
}
protected:
virtual int OnInvoked(wxFileDialog *dlg) const wxOVERRIDE
{
dlg->SetPath(m_path);
return m_id;
}
wxString m_path;
int m_id;
};
#endif
// Implementation of wxModalDialogHook for use in testing, with
// wxExpectModal<T> and the wxTEST_DIALOG() macro. It is not intended for
// direct use, use the macro instead.
class wxTestingModalHook : public wxModalDialogHook
{
public:
// This object is created with the location of the macro containing it by
// wxTEST_DIALOG macro, otherwise it falls back to the location of this
// line itself, which is not very useful, so normally you should provide
// your own values.
wxTestingModalHook(const char* file = NULL,
int line = 0,
const char* func = NULL)
: m_file(file), m_line(line), m_func(func)
{
Register();
}
// Called to verify that all expectations were met. This cannot be done in
// the destructor, because ReportFailure() may throw (either because it's
// overriden or because wx's assertions handling is, globally). And
// throwing from the destructor would introduce all sort of problems,
// including messing up the order of errors in some cases.
void CheckUnmetExpectations()
{
while ( !m_expectations.empty() )
{
const wxModalExpectation *expect = m_expectations.front();
m_expectations.pop();
if ( expect->IsOptional() )
continue;
ReportFailure
(
wxString::Format
(
"Expected %s was not shown.",
expect->GetDescription()
)
);
break;
}
}
void AddExpectation(const wxModalExpectation& e)
{
m_expectations.push(&e);
}
protected:
virtual int Enter(wxDialog *dlg) wxOVERRIDE
{
while ( !m_expectations.empty() )
{
const wxModalExpectation *expect = m_expectations.front();
m_expectations.pop();
int ret = expect->Invoke(dlg);
if ( ret != wxID_NONE )
return ret; // dialog shown as expected
// not showing an optional dialog is OK, but showing an unexpected
// one definitely isn't:
if ( !expect->IsOptional() )
{
ReportFailure
(
wxString::Format
(
"%s was shown unexpectedly, expected %s.",
DescribeUnexpectedDialog(dlg),
expect->GetDescription()
)
);
return wxID_NONE;
}
// else: try the next expectation in the chain
}
ReportFailure
(
wxString::Format
(
"%s was shown unexpectedly.",
DescribeUnexpectedDialog(dlg)
)
);
return wxID_NONE;
}
protected:
// This method may be overridden to provide a better description of
// (unexpected) dialogs, e.g. add knowledge of custom dialogs used by the
// program here.
virtual wxString DescribeUnexpectedDialog(wxDialog* dlg) const
{
// Message boxes are handled specially here just because they are so
// ubiquitous.
if ( wxMessageDialog *msgdlg = dynamic_cast<wxMessageDialog*>(dlg) )
{
return wxString::Format
(
"A message box \"%s\"",
msgdlg->GetMessage()
);
}
return wxString::Format
(
"A %s with title \"%s\"",
wxGetDialogClassDescription(dlg->GetClassInfo(), dlg),
dlg->GetTitle()
);
}
// This method may be overridden to change the way test failures are
// handled. By default they result in an assertion failure which, of
// course, can itself be customized.
virtual void ReportFailure(const wxString& msg)
{
wxFAIL_MSG_AT( msg,
m_file ? m_file : __FILE__,
m_line ? m_line : __LINE__,
m_func ? m_func : __WXFUNCTION__ );
}
private:
const char* const m_file;
const int m_line;
const char* const m_func;
std::queue<const wxModalExpectation*> m_expectations;
wxDECLARE_NO_COPY_CLASS(wxTestingModalHook);
};
// Redefining this value makes it possible to customize the hook class,
// including e.g. its error reporting.
#ifndef wxTEST_DIALOG_HOOK_CLASS
#define wxTEST_DIALOG_HOOK_CLASS wxTestingModalHook
#endif
#define WX_TEST_IMPL_ADD_EXPECTATION(pos, expect) \
const wxModalExpectation& wx_exp##pos = expect; \
wx_hook.AddExpectation(wx_exp##pos);
/**
Runs given code with all modal dialogs redirected to wxExpectModal<T>
hooks, instead of being shown to the user.
The first argument is any valid expression, typically a function call. The
remaining arguments are wxExpectModal<T> instances defining the dialogs
that are expected to be shown, in order of appearance.
Some typical examples:
@code
wxTEST_DIALOG
(
rc = dlg.ShowModal(),
wxExpectModal<wxFileDialog>(wxGetCwd() + "/test.txt")
);
@endcode
Sometimes, the code may show more than one dialog:
@code
wxTEST_DIALOG
(
RunSomeFunction(),
wxExpectModal<wxMessageDialog>(wxNO),
wxExpectModal<MyConfirmationDialog>(wxYES),
wxExpectModal<wxFileDialog>(wxGetCwd() + "/test.txt")
);
@endcode
Notice that wxExpectModal<T> has some convenience methods for further
tweaking the expectations. For example, it's possible to mark an expected
dialog as @em optional for situations when a dialog may be shown, but isn't
required to, by calling the Optional() method:
@code
wxTEST_DIALOG
(
RunSomeFunction(),
wxExpectModal<wxMessageDialog>(wxNO),
wxExpectModal<wxFileDialog>(wxGetCwd() + "/test.txt").Optional()
);
@endcode
@note By default, errors are reported with wxFAIL_MSG(). You may customize this by
implementing a class derived from wxTestingModalHook, overriding its
ReportFailure() method and redefining the wxTEST_DIALOG_HOOK_CLASS
macro to be the name of this class.
@note Custom dialogs are supported too. All you have to do is to specialize
wxExpectModal<> for your dialog type and implement its OnInvoked()
method.
*/
#ifdef HAVE_VARIADIC_MACROS
// See wx/cpp.h for the explanations of this hack.
#if defined(__GNUC__) && __GNUC__ == 3
#pragma GCC system_header
#endif /* gcc-3.x */
#define wxTEST_DIALOG(codeToRun, ...) \
{ \
wxTEST_DIALOG_HOOK_CLASS wx_hook(__FILE__, __LINE__, __WXFUNCTION__); \
wxCALL_FOR_EACH(WX_TEST_IMPL_ADD_EXPECTATION, __VA_ARGS__) \
codeToRun; \
wx_hook.CheckUnmetExpectations(); \
}
#endif /* HAVE_VARIADIC_MACROS */
#endif // !WXBUILDING
#endif // _WX_TESTING_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/richmsgdlg.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/richmsgdlg.h
// Purpose: wxRichMessageDialogBase
// Author: Rickard Westerlund
// Created: 2010-07-03
// Copyright: (c) 2010 wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHMSGDLG_H_BASE_
#define _WX_RICHMSGDLG_H_BASE_
#include "wx/defs.h"
#if wxUSE_RICHMSGDLG
#include "wx/msgdlg.h"
// Extends a message dialog with an optional checkbox and user-expandable
// detailed text.
class WXDLLIMPEXP_CORE wxRichMessageDialogBase : public wxGenericMessageDialog
{
public:
wxRichMessageDialogBase( wxWindow *parent,
const wxString& message,
const wxString& caption,
long style )
: wxGenericMessageDialog( parent, message, caption, style ),
m_detailsExpanderCollapsedLabel( wxGetTranslation("&See details") ),
m_detailsExpanderExpandedLabel( wxGetTranslation("&Hide details") ),
m_checkBoxValue( false ),
m_footerIcon( 0 )
{ }
void ShowCheckBox(const wxString& checkBoxText, bool checked = false)
{
m_checkBoxText = checkBoxText;
m_checkBoxValue = checked;
}
wxString GetCheckBoxText() const { return m_checkBoxText; }
void ShowDetailedText(const wxString& detailedText)
{ m_detailedText = detailedText; }
wxString GetDetailedText() const { return m_detailedText; }
virtual bool IsCheckBoxChecked() const { return m_checkBoxValue; }
void SetFooterText(const wxString& footerText)
{ m_footerText = footerText; }
wxString GetFooterText() const { return m_footerText; }
void SetFooterIcon(int icon)
{ m_footerIcon = icon; }
int GetFooterIcon() const { return m_footerIcon; }
protected:
const wxString m_detailsExpanderCollapsedLabel;
const wxString m_detailsExpanderExpandedLabel;
wxString m_checkBoxText;
bool m_checkBoxValue;
wxString m_detailedText;
wxString m_footerText;
int m_footerIcon;
private:
void ShowDetails(bool shown);
wxDECLARE_NO_COPY_CLASS(wxRichMessageDialogBase);
};
// Always include the generic version as it's currently used as the base class
// by the MSW native implementation too.
#include "wx/generic/richmsgdlgg.h"
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/richmsgdlg.h"
#else
class WXDLLIMPEXP_CORE wxRichMessageDialog
: public wxGenericRichMessageDialog
{
public:
wxRichMessageDialog( wxWindow *parent,
const wxString& message,
const wxString& caption = wxMessageBoxCaptionStr,
long style = wxOK | wxCENTRE )
: wxGenericRichMessageDialog( parent, message, caption, style )
{ }
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRichMessageDialog);
};
#endif
#endif // wxUSE_RICHMSGDLG
#endif // _WX_RICHMSGDLG_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/tbarbase.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/tbarbase.h
// Purpose: Base class for toolbar classes
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TBARBASE_H_
#define _WX_TBARBASE_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_TOOLBAR
#include "wx/bitmap.h"
#include "wx/list.h"
#include "wx/control.h"
class WXDLLIMPEXP_FWD_CORE wxToolBarBase;
class WXDLLIMPEXP_FWD_CORE wxToolBarToolBase;
class WXDLLIMPEXP_FWD_CORE wxImage;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize;
extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition;
enum wxToolBarToolStyle
{
wxTOOL_STYLE_BUTTON = 1,
wxTOOL_STYLE_SEPARATOR = 2,
wxTOOL_STYLE_CONTROL
};
// ----------------------------------------------------------------------------
// wxToolBarTool is a toolbar element.
//
// It has a unique id (except for the separators which always have id wxID_ANY), the
// style (telling whether it is a normal button, separator or a control), the
// state (toggled or not, enabled or not) and short and long help strings. The
// default implementations use the short help string for the tooltip text which
// is popped up when the mouse pointer enters the tool and the long help string
// for the applications status bar.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxToolBarToolBase : public wxObject
{
public:
// ctors & dtor
// ------------
// generic ctor for any kind of tool
wxToolBarToolBase(wxToolBarBase *tbar = NULL,
int toolid = wxID_SEPARATOR,
const wxString& label = wxEmptyString,
const wxBitmap& bmpNormal = wxNullBitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = NULL,
const wxString& shortHelpString = wxEmptyString,
const wxString& longHelpString = wxEmptyString)
: m_label(label),
m_shortHelpString(shortHelpString),
m_longHelpString(longHelpString)
{
Init
(
tbar,
toolid == wxID_SEPARATOR ? wxTOOL_STYLE_SEPARATOR
: wxTOOL_STYLE_BUTTON,
toolid == wxID_ANY ? wxWindow::NewControlId()
: toolid,
kind
);
m_clientData = clientData;
m_bmpNormal = bmpNormal;
m_bmpDisabled = bmpDisabled;
}
// ctor for controls only
wxToolBarToolBase(wxToolBarBase *tbar,
wxControl *control,
const wxString& label)
: m_label(label)
{
Init(tbar, wxTOOL_STYLE_CONTROL, control->GetId(), wxITEM_MAX);
m_control = control;
}
virtual ~wxToolBarToolBase();
// accessors
// ---------
// general
int GetId() const { return m_id; }
wxControl *GetControl() const
{
wxASSERT_MSG( IsControl(), wxT("this toolbar tool is not a control") );
return m_control;
}
wxToolBarBase *GetToolBar() const { return m_tbar; }
// style/kind
bool IsStretchable() const { return m_stretchable; }
bool IsButton() const { return m_toolStyle == wxTOOL_STYLE_BUTTON; }
bool IsControl() const { return m_toolStyle == wxTOOL_STYLE_CONTROL; }
bool IsSeparator() const { return m_toolStyle == wxTOOL_STYLE_SEPARATOR; }
bool IsStretchableSpace() const { return IsSeparator() && IsStretchable(); }
int GetStyle() const { return m_toolStyle; }
wxItemKind GetKind() const
{
wxASSERT_MSG( IsButton(), wxT("only makes sense for buttons") );
return m_kind;
}
void MakeStretchable()
{
wxASSERT_MSG( IsSeparator(), "only separators can be stretchable" );
m_stretchable = true;
}
// state
bool IsEnabled() const { return m_enabled; }
bool IsToggled() const { return m_toggled; }
bool CanBeToggled() const
{ return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; }
// attributes
const wxBitmap& GetNormalBitmap() const { return m_bmpNormal; }
const wxBitmap& GetDisabledBitmap() const { return m_bmpDisabled; }
const wxBitmap& GetBitmap() const
{ return IsEnabled() ? GetNormalBitmap() : GetDisabledBitmap(); }
const wxString& GetLabel() const { return m_label; }
const wxString& GetShortHelp() const { return m_shortHelpString; }
const wxString& GetLongHelp() const { return m_longHelpString; }
wxObject *GetClientData() const
{
if ( m_toolStyle == wxTOOL_STYLE_CONTROL )
{
return (wxObject*)m_control->GetClientData();
}
else
{
return m_clientData;
}
}
// modifiers: return true if the state really changed
virtual bool Enable(bool enable);
virtual bool Toggle(bool toggle);
virtual bool SetToggle(bool toggle);
virtual bool SetShortHelp(const wxString& help);
virtual bool SetLongHelp(const wxString& help);
void Toggle() { Toggle(!IsToggled()); }
void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; }
void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; }
virtual void SetLabel(const wxString& label) { m_label = label; }
void SetClientData(wxObject *clientData)
{
if ( m_toolStyle == wxTOOL_STYLE_CONTROL )
{
m_control->SetClientData(clientData);
}
else
{
m_clientData = clientData;
}
}
// add tool to/remove it from a toolbar
virtual void Detach() { m_tbar = NULL; }
virtual void Attach(wxToolBarBase *tbar) { m_tbar = tbar; }
#if wxUSE_MENUS
// these methods are only for tools of wxITEM_DROPDOWN kind (but even such
// tools can have a NULL associated menu)
virtual void SetDropdownMenu(wxMenu *menu);
wxMenu *GetDropdownMenu() const { return m_dropdownMenu; }
#endif
protected:
// common part of all ctors
void Init(wxToolBarBase *tbar,
wxToolBarToolStyle style,
int toolid,
wxItemKind kind)
{
m_tbar = tbar;
m_toolStyle = style;
m_id = toolid;
m_kind = kind;
m_clientData = NULL;
m_stretchable = false;
m_toggled = false;
m_enabled = true;
#if wxUSE_MENUS
m_dropdownMenu = NULL;
#endif
}
wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL)
// tool parameters
wxToolBarToolStyle m_toolStyle;
wxWindowIDRef m_id; // the tool id, wxID_SEPARATOR for separator
wxItemKind m_kind; // for normal buttons may be wxITEM_NORMAL/CHECK/RADIO
// as controls have their own client data, no need to waste memory
union
{
wxObject *m_clientData;
wxControl *m_control;
};
// true if this tool is stretchable: currently is only value for separators
bool m_stretchable;
// tool state
bool m_toggled;
bool m_enabled;
// normal and disabled bitmaps for the tool, both can be invalid
wxBitmap m_bmpNormal;
wxBitmap m_bmpDisabled;
// the button label
wxString m_label;
// short and long help strings
wxString m_shortHelpString;
wxString m_longHelpString;
#if wxUSE_MENUS
wxMenu *m_dropdownMenu;
#endif
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarToolBase);
};
// a list of toolbar tools
WX_DECLARE_EXPORTED_LIST(wxToolBarToolBase, wxToolBarToolsList);
// ----------------------------------------------------------------------------
// the base class for all toolbars
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxToolBarBase : public wxControl
{
public:
wxToolBarBase();
virtual ~wxToolBarBase();
// toolbar construction
// --------------------
// the full AddTool() function
//
// If bmpDisabled is wxNullBitmap, a shadowed version of the normal bitmap
// is created and used as the disabled image.
wxToolBarToolBase *AddTool(int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled,
wxItemKind kind = wxITEM_NORMAL,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
wxObject *data = NULL)
{
return DoAddTool(toolid, label, bitmap, bmpDisabled, kind,
shortHelp, longHelp, data);
}
// the most common AddTool() version
wxToolBarToolBase *AddTool(int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxString& shortHelp = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL)
{
return AddTool(toolid, label, bitmap, wxNullBitmap, kind, shortHelp);
}
// add a check tool, i.e. a tool which can be toggled
wxToolBarToolBase *AddCheckTool(int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
wxObject *data = NULL)
{
return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_CHECK,
shortHelp, longHelp, data);
}
// add a radio tool, i.e. a tool which can be toggled and releases any
// other toggled radio tools in the same group when it happens
wxToolBarToolBase *AddRadioTool(int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
wxObject *data = NULL)
{
return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_RADIO,
shortHelp, longHelp, data);
}
// insert the new tool at the given position, if pos == GetToolsCount(), it
// is equivalent to AddTool()
virtual wxToolBarToolBase *InsertTool
(
size_t pos,
int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
wxObject *clientData = NULL
);
virtual wxToolBarToolBase *AddTool (wxToolBarToolBase *tool);
virtual wxToolBarToolBase *InsertTool (size_t pos, wxToolBarToolBase *tool);
// add an arbitrary control to the toolbar (notice that the control will be
// deleted by the toolbar and that it will also adjust its position/size)
//
// the label is optional and, if specified, will be shown near the control
// NB: the control should have toolbar as its parent
virtual wxToolBarToolBase *
AddControl(wxControl *control, const wxString& label = wxEmptyString);
virtual wxToolBarToolBase *
InsertControl(size_t pos, wxControl *control,
const wxString& label = wxEmptyString);
// get the control with the given id or return NULL
virtual wxControl *FindControl( int toolid );
// add a separator to the toolbar
virtual wxToolBarToolBase *AddSeparator();
virtual wxToolBarToolBase *InsertSeparator(size_t pos);
// add a stretchable space to the toolbar: this is similar to a separator
// except that it's always blank and that all the extra space the toolbar
// has is [equally] distributed among the stretchable spaces in it
virtual wxToolBarToolBase *AddStretchableSpace();
virtual wxToolBarToolBase *InsertStretchableSpace(size_t pos);
// remove the tool from the toolbar: the caller is responsible for actually
// deleting the pointer
virtual wxToolBarToolBase *RemoveTool(int toolid);
// delete tool either by index or by position
virtual bool DeleteToolByPos(size_t pos);
virtual bool DeleteTool(int toolid);
// delete all tools
virtual void ClearTools();
// must be called after all buttons have been created to finish toolbar
// initialisation
//
// derived class versions should call the base one first, before doing
// platform-specific stuff
virtual bool Realize();
// tools state
// -----------
virtual void EnableTool(int toolid, bool enable);
virtual void ToggleTool(int toolid, bool toggle);
// Set this to be togglable (or not)
virtual void SetToggle(int toolid, bool toggle);
// set/get tools client data (not for controls)
virtual wxObject *GetToolClientData(int toolid) const;
virtual void SetToolClientData(int toolid, wxObject *clientData);
// returns tool pos, or wxNOT_FOUND if tool isn't found
virtual int GetToolPos(int id) const;
// return true if the tool is toggled
virtual bool GetToolState(int toolid) const;
virtual bool GetToolEnabled(int toolid) const;
virtual void SetToolShortHelp(int toolid, const wxString& helpString);
virtual wxString GetToolShortHelp(int toolid) const;
virtual void SetToolLongHelp(int toolid, const wxString& helpString);
virtual wxString GetToolLongHelp(int toolid) const;
virtual void SetToolNormalBitmap(int WXUNUSED(id),
const wxBitmap& WXUNUSED(bitmap)) {}
virtual void SetToolDisabledBitmap(int WXUNUSED(id),
const wxBitmap& WXUNUSED(bitmap)) {}
// margins/packing/separation
// --------------------------
virtual void SetMargins(int x, int y);
void SetMargins(const wxSize& size)
{ SetMargins((int) size.x, (int) size.y); }
virtual void SetToolPacking(int packing)
{ m_toolPacking = packing; }
virtual void SetToolSeparation(int separation)
{ m_toolSeparation = separation; }
virtual wxSize GetToolMargins() const { return wxSize(m_xMargin, m_yMargin); }
virtual int GetToolPacking() const { return m_toolPacking; }
virtual int GetToolSeparation() const { return m_toolSeparation; }
// toolbar geometry
// ----------------
// set the number of toolbar rows
virtual void SetRows(int nRows);
// the toolbar can wrap - limit the number of columns or rows it may take
void SetMaxRowsCols(int rows, int cols)
{ m_maxRows = rows; m_maxCols = cols; }
int GetMaxRows() const { return m_maxRows; }
int GetMaxCols() const { return m_maxCols; }
// get/set the size of the bitmaps used by the toolbar: should be called
// before adding any tools to the toolbar
virtual void SetToolBitmapSize(const wxSize& size)
{ m_defaultWidth = size.x; m_defaultHeight = size.y; }
virtual wxSize GetToolBitmapSize() const
{ return wxSize(m_defaultWidth, m_defaultHeight); }
// the button size in some implementations is bigger than the bitmap size:
// get the total button size (by default the same as bitmap size)
virtual wxSize GetToolSize() const
{ return GetToolBitmapSize(); }
// returns a (non separator) tool containing the point (x, y) or NULL if
// there is no tool at this point (coordinates are client)
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x,
wxCoord y) const = 0;
// find the tool by id
wxToolBarToolBase *FindById(int toolid) const;
// return true if this is a vertical toolbar, otherwise false
bool IsVertical() const;
// these methods allow to access tools by their index in the toolbar
size_t GetToolsCount() const { return m_tools.GetCount(); }
wxToolBarToolBase *GetToolByPos(int pos) { return m_tools[pos]; }
const wxToolBarToolBase *GetToolByPos(int pos) const { return m_tools[pos]; }
#if WXWIN_COMPATIBILITY_2_8
// the old versions of the various methods kept for compatibility
// don't use in the new code!
// --------------------------------------------------------------
wxDEPRECATED_INLINE(
wxToolBarToolBase *AddTool(int toolid,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled,
bool toggle = false,
wxObject *clientData = NULL,
const wxString& shortHelpString = wxEmptyString,
const wxString& longHelpString = wxEmptyString)
,
return AddTool(toolid, wxEmptyString,
bitmap, bmpDisabled,
toggle ? wxITEM_CHECK : wxITEM_NORMAL,
shortHelpString, longHelpString, clientData);
)
wxDEPRECATED_INLINE(
wxToolBarToolBase *AddTool(int toolid,
const wxBitmap& bitmap,
const wxString& shortHelpString = wxEmptyString,
const wxString& longHelpString = wxEmptyString)
,
return AddTool(toolid, wxEmptyString,
bitmap, wxNullBitmap, wxITEM_NORMAL,
shortHelpString, longHelpString, NULL);
)
wxDEPRECATED_INLINE(
wxToolBarToolBase *AddTool(int toolid,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled,
bool toggle,
wxCoord xPos,
wxCoord yPos = wxDefaultCoord,
wxObject *clientData = NULL,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString)
,
return DoAddTool(toolid, wxEmptyString, bitmap, bmpDisabled,
toggle ? wxITEM_CHECK : wxITEM_NORMAL,
shortHelp, longHelp, clientData, xPos, yPos);
)
wxDEPRECATED_INLINE(
wxToolBarToolBase *InsertTool(size_t pos,
int toolid,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled = wxNullBitmap,
bool toggle = false,
wxObject *clientData = NULL,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString)
,
return InsertTool(pos, toolid, wxEmptyString, bitmap, bmpDisabled,
toggle ? wxITEM_CHECK : wxITEM_NORMAL,
shortHelp, longHelp, clientData);
)
#endif // WXWIN_COMPATIBILITY_2_8
// event handlers
// --------------
// NB: these functions are deprecated, use EVT_TOOL_XXX() instead!
// Only allow toggle if returns true. Call when left button up.
virtual bool OnLeftClick(int toolid, bool toggleDown);
// Call when right button down.
virtual void OnRightClick(int toolid, long x, long y);
// Called when the mouse cursor enters a tool bitmap.
// Argument is wxID_ANY if mouse is exiting the toolbar.
virtual void OnMouseEnter(int toolid);
// more deprecated functions
// -------------------------
// use GetToolMargins() instead
wxSize GetMargins() const { return GetToolMargins(); }
// Tool factories,
// helper functions to create toolbar tools
// -------------------------
virtual wxToolBarToolBase *CreateTool(int toolid,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = NULL,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString) = 0;
virtual wxToolBarToolBase *CreateTool(wxControl *control,
const wxString& label) = 0;
// this one is not virtual but just a simple helper/wrapper around
// CreateTool() for separators
wxToolBarToolBase *CreateSeparator()
{
return CreateTool(wxID_SEPARATOR,
wxEmptyString,
wxNullBitmap, wxNullBitmap,
wxITEM_SEPARATOR, NULL,
wxEmptyString, wxEmptyString);
}
// implementation only from now on
// -------------------------------
// Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) wxOVERRIDE ;
// don't want toolbars to accept the focus
virtual bool AcceptsFocus() const wxOVERRIDE { return false; }
#if wxUSE_MENUS
// Set dropdown menu
bool SetDropdownMenu(int toolid, wxMenu *menu);
#endif
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
// to implement in derived classes
// -------------------------------
// create a new toolbar tool and add it to the toolbar, this is typically
// implemented by just calling InsertTool()
virtual wxToolBarToolBase *DoAddTool
(
int toolid,
const wxString& label,
const wxBitmap& bitmap,
const wxBitmap& bmpDisabled,
wxItemKind kind,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
wxObject *clientData = NULL,
wxCoord xPos = wxDefaultCoord,
wxCoord yPos = wxDefaultCoord
);
// the tool is not yet inserted into m_tools list when this function is
// called and will only be added to it if this function succeeds
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) = 0;
// the tool is still in m_tools list when this function is called, it will
// only be deleted from it if it succeeds
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) = 0;
// called when the tools enabled flag changes
virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) = 0;
// called when the tool is toggled
virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) = 0;
// called when the tools "can be toggled" flag changes
virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) = 0;
// helper functions
// ----------------
// call this from derived class ctor/Create() to ensure that we have either
// wxTB_HORIZONTAL or wxTB_VERTICAL style, there is a lot of existing code
// which randomly checks either one or the other of them and gets confused
// if neither is set (and making one of them 0 is not an option neither as
// then the existing tests would break down)
void FixupStyle();
// un-toggle all buttons in the same radio group
void UnToggleRadioGroup(wxToolBarToolBase *tool);
// make the size of the buttons big enough to fit the largest bitmap size
void AdjustToolBitmapSize();
// calls InsertTool() and deletes the tool if inserting it failed
wxToolBarToolBase *DoInsertNewTool(size_t pos, wxToolBarToolBase *tool)
{
if ( !InsertTool(pos, tool) )
{
delete tool;
return NULL;
}
return tool;
}
// the list of all our tools
wxToolBarToolsList m_tools;
// the offset of the first tool
int m_xMargin;
int m_yMargin;
// the maximum number of toolbar rows/columns
int m_maxRows;
int m_maxCols;
// the tool packing and separation
int m_toolPacking,
m_toolSeparation;
// the size of the toolbar bitmaps
wxCoord m_defaultWidth, m_defaultHeight;
private:
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxToolBarBase);
};
// deprecated function for creating the image for disabled buttons, use
// wxImage::ConvertToGreyscale() instead
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( bool wxCreateGreyedImage(const wxImage& in, wxImage& out) );
#endif // WXWIN_COMPATIBILITY_2_8
#endif // wxUSE_TOOLBAR
#endif
// _WX_TBARBASE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/control.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/control.h
// Purpose: wxControl common interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 26.07.99
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CONTROL_H_BASE_
#define _WX_CONTROL_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_CONTROLS
#include "wx/window.h" // base class
#include "wx/gdicmn.h" // wxEllipsize...
extern WXDLLIMPEXP_DATA_CORE(const char) wxControlNameStr[];
// ----------------------------------------------------------------------------
// wxControl is the base class for all controls
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxControlBase : public wxWindow
{
public:
wxControlBase() { }
virtual ~wxControlBase();
// Create() function adds the validator parameter
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxControlNameStr);
// 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) wxOVERRIDE
{
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 wxOVERRIDE { return m_labelOrig; }
// set label text (mnemonics will be escaped)
virtual void SetLabelText(const wxString& text)
{
SetLabel(EscapeMnemonics(text));
}
// 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 "<" and so on, a bare '<' in the input will
// likely result in an error. As an exception, a bare '&' is allowed and
// indicates that the next character is a mnemonic. To insert a literal '&'
// in the control you need to use "&" in the input string.
//
// Returns true if the label was set, even if the markup in it was ignored.
// False is only returned if we failed to parse the label.
bool SetLabelMarkup(const wxString& markup)
{
return DoSetLabelMarkup(markup);
}
#endif // wxUSE_MARKUP
// controls by default inherit the colours of their parents, if a
// particular control class doesn't want to do it, it can override
// ShouldInheritColours() to return false
virtual bool ShouldInheritColours() const wxOVERRIDE { return true; }
// WARNING: this doesn't work for all controls nor all platforms!
//
// simulates the event of given type (i.e. wxButton::Command() is just as
// if the button was clicked)
virtual void Command(wxCommandEvent &event);
virtual bool SetFont(const wxFont& font) wxOVERRIDE;
// wxControl-specific processing after processing the update event
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE;
wxSize GetSizeFromTextSize(int xlen, int ylen = -1) const
{ return DoGetSizeFromTextSize(xlen, ylen); }
wxSize GetSizeFromTextSize(const wxSize& tsize) const
{ return DoGetSizeFromTextSize(tsize.x, tsize.y); }
// 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 wxOVERRIDE;
// creates the control (calls wxWindowBase::CreateBase inside) and adds it
// to the list of parents children
bool CreateControl(wxWindowBase *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
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
// override this to return the total control's size from a string size
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
// 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);
};
// ----------------------------------------------------------------------------
// include platform-dependent wxControl declarations
// ----------------------------------------------------------------------------
#if defined(__WXUNIVERSAL__)
#include "wx/univ/control.h"
#elif defined(__WXMSW__)
#include "wx/msw/control.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/control.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/control.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/control.h"
#elif defined(__WXMAC__)
#include "wx/osx/control.h"
#elif defined(__WXQT__)
#include "wx/qt/control.h"
#endif
#endif // wxUSE_CONTROLS
#endif
// _WX_CONTROL_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/time.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/time.h
// Purpose: Miscellaneous time-related functions.
// Author: Vadim Zeitlin
// Created: 2011-11-26
// Copyright: (c) 2011 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TIME_H_
#define _WX_TIME_H_
#include "wx/longlong.h"
// Returns the difference between UTC and local time in seconds.
WXDLLIMPEXP_BASE int wxGetTimeZone();
// Get number of seconds since local time 00:00:00 Jan 1st 1970.
extern long WXDLLIMPEXP_BASE wxGetLocalTime();
// Get number of seconds since GMT 00:00:00, Jan 1st 1970.
extern long WXDLLIMPEXP_BASE wxGetUTCTime();
#if wxUSE_LONGLONG
typedef wxLongLong wxMilliClock_t;
inline long wxMilliClockToLong(wxLongLong ll) { return ll.ToLong(); }
#else
typedef double wxMilliClock_t;
inline long wxMilliClockToLong(double d) { return wx_truncate_cast(long, d); }
#endif // wxUSE_LONGLONG
// Get number of milliseconds since local time 00:00:00 Jan 1st 1970
extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis();
#if wxUSE_LONGLONG
// Get the number of milliseconds or microseconds since the Epoch.
wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeMillis();
wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeUSec();
#endif // wxUSE_LONGLONG
#define wxGetCurrentTime() wxGetLocalTime()
// on some really old systems gettimeofday() doesn't have the second argument,
// define wxGetTimeOfDay() to hide this difference
#ifdef HAVE_GETTIMEOFDAY
#ifdef WX_GETTIMEOFDAY_NO_TZ
#define wxGetTimeOfDay(tv) gettimeofday(tv)
#else
#define wxGetTimeOfDay(tv) gettimeofday((tv), NULL)
#endif
#endif // HAVE_GETTIMEOFDAY
/* Two wrapper functions for thread safety */
#ifdef HAVE_LOCALTIME_R
#define wxLocaltime_r localtime_r
#else
WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*);
#if wxUSE_THREADS && !defined(__WINDOWS__)
// 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__)
// On Windows, gmtime _is_ threadsafe!
#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r
#endif
#endif
#endif // _WX_TIME_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/fdrepdlg.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/fdrepdlg.h
// Purpose: wxFindReplaceDialog class
// Author: Markus Greither and Vadim Zeitlin
// Modified by:
// Created: 23/03/2001
// Copyright: (c) Markus Greither
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FINDREPLACEDLG_H_
#define _WX_FINDREPLACEDLG_H_
#include "wx/defs.h"
#if wxUSE_FINDREPLDLG
#include "wx/dialog.h"
class WXDLLIMPEXP_FWD_CORE wxFindDialogEvent;
class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialog;
class WXDLLIMPEXP_FWD_CORE wxFindReplaceData;
class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialogImpl;
// ----------------------------------------------------------------------------
// Flags for wxFindReplaceData.Flags
// ----------------------------------------------------------------------------
// flages used by wxFindDialogEvent::GetFlags()
enum wxFindReplaceFlags
{
// downward search/replace selected (otherwise - upwards)
wxFR_DOWN = 1,
// whole word search/replace selected
wxFR_WHOLEWORD = 2,
// case sensitive search/replace selected (otherwise - case insensitive)
wxFR_MATCHCASE = 4
};
// these flags can be specified in wxFindReplaceDialog ctor or Create()
enum wxFindReplaceDialogStyles
{
// replace dialog (otherwise find dialog)
wxFR_REPLACEDIALOG = 1,
// don't allow changing the search direction
wxFR_NOUPDOWN = 2,
// don't allow case sensitive searching
wxFR_NOMATCHCASE = 4,
// don't allow whole word searching
wxFR_NOWHOLEWORD = 8
};
// ----------------------------------------------------------------------------
// wxFindReplaceData: holds Setup Data/Feedback Data for wxFindReplaceDialog
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFindReplaceData : public wxObject
{
public:
wxFindReplaceData() { Init(); }
wxFindReplaceData(wxUint32 flags) { Init(); SetFlags(flags); }
// accessors
const wxString& GetFindString() const { return m_FindWhat; }
const wxString& GetReplaceString() const { return m_ReplaceWith; }
int GetFlags() const { return m_Flags; }
// setters: may only be called before showing the dialog, no effect later
void SetFlags(wxUint32 flags) { m_Flags = flags; }
void SetFindString(const wxString& str) { m_FindWhat = str; }
void SetReplaceString(const wxString& str) { m_ReplaceWith = str; }
protected:
void Init();
private:
wxUint32 m_Flags;
wxString m_FindWhat,
m_ReplaceWith;
friend class wxFindReplaceDialogBase;
};
// ----------------------------------------------------------------------------
// wxFindReplaceDialogBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFindReplaceDialogBase : public wxDialog
{
public:
// ctors and such
wxFindReplaceDialogBase() { m_FindReplaceData = NULL; }
wxFindReplaceDialogBase(wxWindow * WXUNUSED(parent),
wxFindReplaceData *data,
const wxString& WXUNUSED(title),
int WXUNUSED(style) = 0)
{
m_FindReplaceData = data;
}
virtual ~wxFindReplaceDialogBase();
// find dialog data access
const wxFindReplaceData *GetData() const { return m_FindReplaceData; }
void SetData(wxFindReplaceData *data) { m_FindReplaceData = data; }
// implementation only, don't use
void Send(wxFindDialogEvent& event);
protected:
wxFindReplaceData *m_FindReplaceData;
// the last string we searched for
wxString m_lastSearch;
wxDECLARE_NO_COPY_CLASS(wxFindReplaceDialogBase);
};
// include wxFindReplaceDialog declaration
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/fdrepdlg.h"
#else
#define wxGenericFindReplaceDialog wxFindReplaceDialog
#include "wx/generic/fdrepdlg.h"
#endif
// ----------------------------------------------------------------------------
// wxFindReplaceDialog events
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE 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(); }
const wxString& GetReplaceString() const { return m_strReplace; }
wxFindReplaceDialog *GetDialog() const
{ return wxStaticCast(GetEventObject(), wxFindReplaceDialog); }
// implementation only
void SetFlags(int flags) { SetInt(flags); }
void SetFindString(const wxString& str) { SetString(str); }
void SetReplaceString(const wxString& str) { m_strReplace = str; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxFindDialogEvent(*this); }
private:
wxString m_strReplace;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFindDialogEvent);
};
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND, wxFindDialogEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_NEXT, wxFindDialogEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_REPLACE, wxFindDialogEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_REPLACE_ALL, wxFindDialogEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_CLOSE, wxFindDialogEvent );
typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&);
#define wxFindDialogEventHandler(func) \
wxEVENT_HANDLER_CAST(wxFindDialogEventFunction, func)
#define EVT_FIND(id, fn) \
wx__DECLARE_EVT1(wxEVT_FIND, id, wxFindDialogEventHandler(fn))
#define EVT_FIND_NEXT(id, fn) \
wx__DECLARE_EVT1(wxEVT_FIND_NEXT, id, wxFindDialogEventHandler(fn))
#define EVT_FIND_REPLACE(id, fn) \
wx__DECLARE_EVT1(wxEVT_FIND_REPLACE, id, wxFindDialogEventHandler(fn))
#define EVT_FIND_REPLACE_ALL(id, fn) \
wx__DECLARE_EVT1(wxEVT_FIND_REPLACE_ALL, id, wxFindDialogEventHandler(fn))
#define EVT_FIND_CLOSE(id, fn) \
wx__DECLARE_EVT1(wxEVT_FIND_CLOSE, id, wxFindDialogEventHandler(fn))
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_FIND wxEVT_FIND
#define wxEVT_COMMAND_FIND_NEXT wxEVT_FIND_NEXT
#define wxEVT_COMMAND_FIND_REPLACE wxEVT_FIND_REPLACE
#define wxEVT_COMMAND_FIND_REPLACE_ALL wxEVT_FIND_REPLACE_ALL
#define wxEVT_COMMAND_FIND_CLOSE wxEVT_FIND_CLOSE
#endif // wxUSE_FINDREPLDLG
#endif
// _WX_FDREPDLG_H
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/chkconf.h | /*
* Name: wx/chkconf.h
* Purpose: check the config settings for consistency
* Author: Vadim Zeitlin
* Modified by:
* Created: 09.08.00
* Copyright: (c) 2000 Vadim Zeitlin <[email protected]>
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_CHKCONF_H_
#define _WX_CHKCONF_H_
/*
**************************************************
PLEASE READ THIS IF YOU GET AN ERROR IN THIS FILE!
**************************************************
If you get an error saying "wxUSE_FOO must be defined", it means that you
are not using the correct up-to-date version of setup.h. This happens most
often when using git or snapshots and a new symbol was added to setup0.h
and you haven't updated your local setup.h to reflect it. If this is the
case, you need to propagate the changes from setup0.h to your setup.h and,
if using makefiles under MSW, also remove setup.h under the build directory
(lib/$(COMPILER)_{lib,dll}/msw[u][d][dll]/wx) so that the new setup.h is
copied there.
If you get an error of the form "wxFoo requires wxBar", then the settings
in your setup.h are inconsistent. You have the choice between correcting
them manually or commenting out #define wxABORT_ON_CONFIG_ERROR below to
try to correct the problems automatically (not really recommended but
might work).
*/
/*
This file has the following sections:
1. checks that all wxUSE_XXX symbols we use are defined
a) first the non-GUI ones
b) then the GUI-only ones
2. platform-specific checks done in the platform headers
3. generic consistency checks
a) first the non-GUI ones
b) then the GUI-only ones
*/
/*
this global setting determines what should we do if the setting FOO
requires BAR and BAR is not set: we can either silently unset FOO as well
(do this if you're trying to build the smallest possible library) or give an
error and abort (default as leads to least surprising behaviour)
*/
#define wxABORT_ON_CONFIG_ERROR
/*
global features
*/
/*
If we're compiling without support for threads/exceptions we have to
disable the corresponding features.
*/
#ifdef wxNO_THREADS
# undef wxUSE_THREADS
# define wxUSE_THREADS 0
#endif /* wxNO_THREADS */
#ifdef wxNO_EXCEPTIONS
# undef wxUSE_EXCEPTIONS
# define wxUSE_EXCEPTIONS 0
#endif /* wxNO_EXCEPTIONS */
/* we also must disable exceptions if compiler doesn't support them */
#if defined(_MSC_VER) && !defined(_CPPUNWIND)
# undef wxUSE_EXCEPTIONS
# define wxUSE_EXCEPTIONS 0
#endif /* VC++ without exceptions support */
/*
Section 1a: tests for non GUI features.
please keep the options in alphabetical order!
*/
#ifndef wxUSE_ANY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ANY must be defined, please read comment near the top of this file."
# else
# define wxUSE_ANY 0
# endif
#endif /* wxUSE_ANY */
#ifndef wxUSE_COMPILER_TLS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_COMPILER_TLS must be defined, please read comment near the top of this file."
# else
# define wxUSE_COMPILER_TLS 0
# endif
#endif /* !defined(wxUSE_COMPILER_TLS) */
#ifndef wxUSE_CONSOLE_EVENTLOOP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CONSOLE_EVENTLOOP must be defined, please read comment near the top of this file."
# else
# define wxUSE_CONSOLE_EVENTLOOP 0
# endif
#endif /* !defined(wxUSE_CONSOLE_EVENTLOOP) */
#ifndef wxUSE_DYNLIB_CLASS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DYNLIB_CLASS must be defined, please read comment near the top of this file."
# else
# define wxUSE_DYNLIB_CLASS 0
# endif
#endif /* !defined(wxUSE_DYNLIB_CLASS) */
#ifndef wxUSE_EXCEPTIONS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_EXCEPTIONS must be defined, please read comment near the top of this file."
# else
# define wxUSE_EXCEPTIONS 0
# endif
#endif /* !defined(wxUSE_EXCEPTIONS) */
#ifndef wxUSE_FILE_HISTORY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FILE_HISTORY must be defined, please read comment near the top of this file."
# else
# define wxUSE_FILE_HISTORY 0
# endif
#endif /* !defined(wxUSE_FILE_HISTORY) */
#ifndef wxUSE_FILESYSTEM
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FILESYSTEM must be defined, please read comment near the top of this file."
# else
# define wxUSE_FILESYSTEM 0
# endif
#endif /* !defined(wxUSE_FILESYSTEM) */
#ifndef wxUSE_FS_ARCHIVE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FS_ARCHIVE must be defined, please read comment near the top of this file."
# else
# define wxUSE_FS_ARCHIVE 0
# endif
#endif /* !defined(wxUSE_FS_ARCHIVE) */
#ifndef wxUSE_FSVOLUME
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FSVOLUME must be defined, please read comment near the top of this file."
# else
# define wxUSE_FSVOLUME 0
# endif
#endif /* !defined(wxUSE_FSVOLUME) */
#ifndef wxUSE_FSWATCHER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FSWATCHER must be defined, please read comment near the top of this file."
# else
# define wxUSE_FSWATCHER 0
# endif
#endif /* !defined(wxUSE_FSWATCHER) */
#ifndef wxUSE_DYNAMIC_LOADER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DYNAMIC_LOADER must be defined, please read comment near the top of this file."
# else
# define wxUSE_DYNAMIC_LOADER 0
# endif
#endif /* !defined(wxUSE_DYNAMIC_LOADER) */
#ifndef wxUSE_INTL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_INTL must be defined, please read comment near the top of this file."
# else
# define wxUSE_INTL 0
# endif
#endif /* !defined(wxUSE_INTL) */
#ifndef wxUSE_IPV6
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_IPV6 must be defined, please read comment near the top of this file."
# else
# define wxUSE_IPV6 0
# endif
#endif /* !defined(wxUSE_IPV6) */
#ifndef wxUSE_LOG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LOG must be defined, please read comment near the top of this file."
# else
# define wxUSE_LOG 0
# endif
#endif /* !defined(wxUSE_LOG) */
#ifndef wxUSE_LONGLONG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LONGLONG must be defined, please read comment near the top of this file."
# else
# define wxUSE_LONGLONG 0
# endif
#endif /* !defined(wxUSE_LONGLONG) */
#ifndef wxUSE_MIMETYPE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MIMETYPE must be defined, please read comment near the top of this file."
# else
# define wxUSE_MIMETYPE 0
# endif
#endif /* !defined(wxUSE_MIMETYPE) */
#ifndef wxUSE_ON_FATAL_EXCEPTION
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ON_FATAL_EXCEPTION must be defined, please read comment near the top of this file."
# else
# define wxUSE_ON_FATAL_EXCEPTION 0
# endif
#endif /* !defined(wxUSE_ON_FATAL_EXCEPTION) */
#ifndef wxUSE_PRINTF_POS_PARAMS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PRINTF_POS_PARAMS must be defined, please read comment near the top of this file."
# else
# define wxUSE_PRINTF_POS_PARAMS 0
# endif
#endif /* !defined(wxUSE_PRINTF_POS_PARAMS) */
#ifndef wxUSE_PROTOCOL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PROTOCOL must be defined, please read comment near the top of this file."
# else
# define wxUSE_PROTOCOL 0
# endif
#endif /* !defined(wxUSE_PROTOCOL) */
/* we may not define wxUSE_PROTOCOL_XXX if wxUSE_PROTOCOL is set to 0 */
#if !wxUSE_PROTOCOL
# undef wxUSE_PROTOCOL_HTTP
# undef wxUSE_PROTOCOL_FTP
# undef wxUSE_PROTOCOL_FILE
# define wxUSE_PROTOCOL_HTTP 0
# define wxUSE_PROTOCOL_FTP 0
# define wxUSE_PROTOCOL_FILE 0
#endif /* wxUSE_PROTOCOL */
#ifndef wxUSE_PROTOCOL_HTTP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PROTOCOL_HTTP must be defined, please read comment near the top of this file."
# else
# define wxUSE_PROTOCOL_HTTP 0
# endif
#endif /* !defined(wxUSE_PROTOCOL_HTTP) */
#ifndef wxUSE_PROTOCOL_FTP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PROTOCOL_FTP must be defined, please read comment near the top of this file."
# else
# define wxUSE_PROTOCOL_FTP 0
# endif
#endif /* !defined(wxUSE_PROTOCOL_FTP) */
#ifndef wxUSE_PROTOCOL_FILE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PROTOCOL_FILE must be defined, please read comment near the top of this file."
# else
# define wxUSE_PROTOCOL_FILE 0
# endif
#endif /* !defined(wxUSE_PROTOCOL_FILE) */
#ifndef wxUSE_REGEX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_REGEX must be defined, please read comment near the top of this file."
# else
# define wxUSE_REGEX 0
# endif
#endif /* !defined(wxUSE_REGEX) */
#ifndef wxUSE_SECRETSTORE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SECRETSTORE must be defined, please read comment near the top of this file."
# else
# define wxUSE_SECRETSTORE 1
# endif
#endif /* !defined(wxUSE_SECRETSTORE) */
#ifndef wxUSE_STDPATHS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STDPATHS must be defined, please read comment near the top of this file."
# else
# define wxUSE_STDPATHS 1
# endif
#endif /* !defined(wxUSE_STDPATHS) */
#ifndef wxUSE_XML
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_XML must be defined, please read comment near the top of this file."
# else
# define wxUSE_XML 0
# endif
#endif /* !defined(wxUSE_XML) */
#ifndef wxUSE_SOCKETS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SOCKETS must be defined, please read comment near the top of this file."
# else
# define wxUSE_SOCKETS 0
# endif
#endif /* !defined(wxUSE_SOCKETS) */
#ifndef wxUSE_STD_CONTAINERS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STD_CONTAINERS must be defined, please read comment near the top of this file."
# else
# define wxUSE_STD_CONTAINERS 0
# endif
#endif /* !defined(wxUSE_STD_CONTAINERS) */
#ifndef wxUSE_STD_CONTAINERS_COMPATIBLY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STD_CONTAINERS_COMPATIBLY must be defined, please read comment near the top of this file."
# else
# define wxUSE_STD_CONTAINERS_COMPATIBLY 0
# endif
#endif /* !defined(wxUSE_STD_CONTAINERS_COMPATIBLY) */
#ifndef wxUSE_STD_STRING_CONV_IN_WXSTRING
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STD_STRING_CONV_IN_WXSTRING must be defined, please read comment near the top of this file."
# else
# define wxUSE_STD_STRING_CONV_IN_WXSTRING 0
# endif
#endif /* !defined(wxUSE_STD_STRING_CONV_IN_WXSTRING) */
#ifndef wxUSE_STREAMS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STREAMS must be defined, please read comment near the top of this file."
# else
# define wxUSE_STREAMS 0
# endif
#endif /* !defined(wxUSE_STREAMS) */
#ifndef wxUSE_STOPWATCH
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STOPWATCH must be defined, please read comment near the top of this file."
# else
# define wxUSE_STOPWATCH 0
# endif
#endif /* !defined(wxUSE_STOPWATCH) */
#ifndef wxUSE_TEXTBUFFER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TEXTBUFFER must be defined, please read comment near the top of this file."
# else
# define wxUSE_TEXTBUFFER 0
# endif
#endif /* !defined(wxUSE_TEXTBUFFER) */
#ifndef wxUSE_TEXTFILE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TEXTFILE must be defined, please read comment near the top of this file."
# else
# define wxUSE_TEXTFILE 0
# endif
#endif /* !defined(wxUSE_TEXTFILE) */
#ifndef wxUSE_UNICODE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_UNICODE must be defined, please read comment near the top of this file."
# else
# define wxUSE_UNICODE 0
# endif
#endif /* !defined(wxUSE_UNICODE) */
#ifndef wxUSE_UNSAFE_WXSTRING_CONV
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_UNSAFE_WXSTRING_CONV must be defined, please read comment near the top of this file."
# else
# define wxUSE_UNSAFE_WXSTRING_CONV 0
# endif
#endif /* !defined(wxUSE_UNSAFE_WXSTRING_CONV) */
#ifndef wxUSE_URL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_URL must be defined, please read comment near the top of this file."
# else
# define wxUSE_URL 0
# endif
#endif /* !defined(wxUSE_URL) */
#ifndef wxUSE_VARIANT
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_VARIANT must be defined, please read comment near the top of this file."
# else
# define wxUSE_VARIANT 0
# endif
#endif /* wxUSE_VARIANT */
#ifndef wxUSE_XLOCALE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_XLOCALE must be defined, please read comment near the top of this file."
# else
# define wxUSE_XLOCALE 0
# endif
#endif /* !defined(wxUSE_XLOCALE) */
/*
Section 1b: all these tests are for GUI only.
please keep the options in alphabetical order!
*/
#if wxUSE_GUI
/*
all of the settings tested below must be defined or we'd get an error from
preprocessor about invalid integer expression
*/
#ifndef wxUSE_ABOUTDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ABOUTDLG must be defined, please read comment near the top of this file."
# else
# define wxUSE_ABOUTDLG 0
# endif
#endif /* !defined(wxUSE_ABOUTDLG) */
#ifndef wxUSE_ACCEL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ACCEL must be defined, please read comment near the top of this file."
# else
# define wxUSE_ACCEL 0
# endif
#endif /* !defined(wxUSE_ACCEL) */
#ifndef wxUSE_ACCESSIBILITY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ACCESSIBILITY must be defined, please read comment near the top of this file."
# else
# define wxUSE_ACCESSIBILITY 0
# endif
#endif /* !defined(wxUSE_ACCESSIBILITY) */
#ifndef wxUSE_ADDREMOVECTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ADDREMOVECTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_ADDREMOVECTRL 0
# endif
#endif /* !defined(wxUSE_ADDREMOVECTRL) */
#ifndef wxUSE_ACTIVITYINDICATOR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ACTIVITYINDICATOR must be defined, please read comment near the top of this file."
# else
# define wxUSE_ACTIVITYINDICATOR 0
# endif
#endif /* !defined(wxUSE_ACTIVITYINDICATOR) */
#ifndef wxUSE_ANIMATIONCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ANIMATIONCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_ANIMATIONCTRL 0
# endif
#endif /* !defined(wxUSE_ANIMATIONCTRL) */
#ifndef wxUSE_ARTPROVIDER_STD
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ARTPROVIDER_STD must be defined, please read comment near the top of this file."
# else
# define wxUSE_ARTPROVIDER_STD 0
# endif
#endif /* !defined(wxUSE_ARTPROVIDER_STD) */
#ifndef wxUSE_ARTPROVIDER_TANGO
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ARTPROVIDER_TANGO must be defined, please read comment near the top of this file."
# else
# define wxUSE_ARTPROVIDER_TANGO 0
# endif
#endif /* !defined(wxUSE_ARTPROVIDER_TANGO) */
#ifndef wxUSE_AUTOID_MANAGEMENT
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_AUTOID_MANAGEMENT must be defined, please read comment near the top of this file."
# else
# define wxUSE_AUTOID_MANAGEMENT 0
# endif
#endif /* !defined(wxUSE_AUTOID_MANAGEMENT) */
#ifndef wxUSE_BITMAPCOMBOBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_BITMAPCOMBOBOX must be defined, please read comment near the top of this file."
# else
# define wxUSE_BITMAPCOMBOBOX 0
# endif
#endif /* !defined(wxUSE_BITMAPCOMBOBOX) */
#ifndef wxUSE_BMPBUTTON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_BMPBUTTON must be defined, please read comment near the top of this file."
# else
# define wxUSE_BMPBUTTON 0
# endif
#endif /* !defined(wxUSE_BMPBUTTON) */
#ifndef wxUSE_BUTTON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_BUTTON must be defined, please read comment near the top of this file."
# else
# define wxUSE_BUTTON 0
# endif
#endif /* !defined(wxUSE_BUTTON) */
#ifndef wxUSE_CAIRO
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CAIRO must be defined, please read comment near the top of this file."
# else
# define wxUSE_CAIRO 0
# endif
#endif /* !defined(wxUSE_CAIRO) */
#ifndef wxUSE_CALENDARCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CALENDARCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_CALENDARCTRL 0
# endif
#endif /* !defined(wxUSE_CALENDARCTRL) */
#ifndef wxUSE_CARET
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CARET must be defined, please read comment near the top of this file."
# else
# define wxUSE_CARET 0
# endif
#endif /* !defined(wxUSE_CARET) */
#ifndef wxUSE_CHECKBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CHECKBOX must be defined, please read comment near the top of this file."
# else
# define wxUSE_CHECKBOX 0
# endif
#endif /* !defined(wxUSE_CHECKBOX) */
#ifndef wxUSE_CHECKLISTBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CHECKLISTBOX must be defined, please read comment near the top of this file."
# else
# define wxUSE_CHECKLISTBOX 0
# endif
#endif /* !defined(wxUSE_CHECKLISTBOX) */
#ifndef wxUSE_CHOICE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CHOICE must be defined, please read comment near the top of this file."
# else
# define wxUSE_CHOICE 0
# endif
#endif /* !defined(wxUSE_CHOICE) */
#ifndef wxUSE_CHOICEBOOK
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CHOICEBOOK must be defined, please read comment near the top of this file."
# else
# define wxUSE_CHOICEBOOK 0
# endif
#endif /* !defined(wxUSE_CHOICEBOOK) */
#ifndef wxUSE_CHOICEDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CHOICEDLG must be defined, please read comment near the top of this file."
# else
# define wxUSE_CHOICEDLG 0
# endif
#endif /* !defined(wxUSE_CHOICEDLG) */
#ifndef wxUSE_CLIPBOARD
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CLIPBOARD must be defined, please read comment near the top of this file."
# else
# define wxUSE_CLIPBOARD 0
# endif
#endif /* !defined(wxUSE_CLIPBOARD) */
#ifndef wxUSE_COLLPANE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_COLLPANE must be defined, please read comment near the top of this file."
# else
# define wxUSE_COLLPANE 0
# endif
#endif /* !defined(wxUSE_COLLPANE) */
#ifndef wxUSE_COLOURDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_COLOURDLG must be defined, please read comment near the top of this file."
# else
# define wxUSE_COLOURDLG 0
# endif
#endif /* !defined(wxUSE_COLOURDLG) */
#ifndef wxUSE_COLOURPICKERCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_COLOURPICKERCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_COLOURPICKERCTRL 0
# endif
#endif /* !defined(wxUSE_COLOURPICKERCTRL) */
#ifndef wxUSE_COMBOBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_COMBOBOX must be defined, please read comment near the top of this file."
# else
# define wxUSE_COMBOBOX 0
# endif
#endif /* !defined(wxUSE_COMBOBOX) */
#ifndef wxUSE_COMMANDLINKBUTTON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_COMMANDLINKBUTTON must be defined, please read comment near the top of this file."
# else
# define wxUSE_COMMANDLINKBUTTON 0
# endif
#endif /* !defined(wxUSE_COMMANDLINKBUTTON) */
#ifndef wxUSE_COMBOCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_COMBOCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_COMBOCTRL 0
# endif
#endif /* !defined(wxUSE_COMBOCTRL) */
#ifndef wxUSE_DATAOBJ
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DATAOBJ must be defined, please read comment near the top of this file."
# else
# define wxUSE_DATAOBJ 0
# endif
#endif /* !defined(wxUSE_DATAOBJ) */
#ifndef wxUSE_DATAVIEWCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DATAVIEWCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_DATAVIEWCTRL 0
# endif
#endif /* !defined(wxUSE_DATAVIEWCTRL) */
#ifndef wxUSE_DATEPICKCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DATEPICKCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_DATEPICKCTRL 0
# endif
#endif /* !defined(wxUSE_DATEPICKCTRL) */
#ifndef wxUSE_DC_TRANSFORM_MATRIX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DC_TRANSFORM_MATRIX must be defined, please read comment near the top of this file."
# else
# define wxUSE_DC_TRANSFORM_MATRIX 1
# endif
#endif /* wxUSE_DC_TRANSFORM_MATRIX */
#ifndef wxUSE_DIRPICKERCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DIRPICKERCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_DIRPICKERCTRL 0
# endif
#endif /* !defined(wxUSE_DIRPICKERCTRL) */
#ifndef wxUSE_DISPLAY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DISPLAY must be defined, please read comment near the top of this file."
# else
# define wxUSE_DISPLAY 0
# endif
#endif /* !defined(wxUSE_DISPLAY) */
#ifndef wxUSE_DOC_VIEW_ARCHITECTURE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined, please read comment near the top of this file."
# else
# define wxUSE_DOC_VIEW_ARCHITECTURE 0
# endif
#endif /* !defined(wxUSE_DOC_VIEW_ARCHITECTURE) */
#ifndef wxUSE_FILECTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FILECTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_FILECTRL 0
# endif
#endif /* !defined(wxUSE_FILECTRL) */
#ifndef wxUSE_FILEDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FILEDLG must be defined, please read comment near the top of this file."
# else
# define wxUSE_FILEDLG 0
# endif
#endif /* !defined(wxUSE_FILEDLG) */
#ifndef wxUSE_FILEPICKERCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FILEPICKERCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_FILEPICKERCTRL 0
# endif
#endif /* !defined(wxUSE_FILEPICKERCTRL) */
#ifndef wxUSE_FONTDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FONTDLG must be defined, please read comment near the top of this file."
# else
# define wxUSE_FONTDLG 0
# endif
#endif /* !defined(wxUSE_FONTDLG) */
#ifndef wxUSE_FONTMAP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FONTMAP must be defined, please read comment near the top of this file."
# else
# define wxUSE_FONTMAP 0
# endif
#endif /* !defined(wxUSE_FONTMAP) */
#ifndef wxUSE_FONTPICKERCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FONTPICKERCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_FONTPICKERCTRL 0
# endif
#endif /* !defined(wxUSE_FONTPICKERCTRL) */
#ifndef wxUSE_GAUGE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_GAUGE must be defined, please read comment near the top of this file."
# else
# define wxUSE_GAUGE 0
# endif
#endif /* !defined(wxUSE_GAUGE) */
#ifndef wxUSE_GRAPHICS_CONTEXT
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_GRAPHICS_CONTEXT must be defined, please read comment near the top of this file."
# else
# define wxUSE_GRAPHICS_CONTEXT 0
# endif
#endif /* !defined(wxUSE_GRAPHICS_CONTEXT) */
#ifndef wxUSE_GRID
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_GRID must be defined, please read comment near the top of this file."
# else
# define wxUSE_GRID 0
# endif
#endif /* !defined(wxUSE_GRID) */
#ifndef wxUSE_HEADERCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_HEADERCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_HEADERCTRL 0
# endif
#endif /* !defined(wxUSE_HEADERCTRL) */
#ifndef wxUSE_HELP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_HELP must be defined, please read comment near the top of this file."
# else
# define wxUSE_HELP 0
# endif
#endif /* !defined(wxUSE_HELP) */
#ifndef wxUSE_HYPERLINKCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_HYPERLINKCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_HYPERLINKCTRL 0
# endif
#endif /* !defined(wxUSE_HYPERLINKCTRL) */
#ifndef wxUSE_HTML
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_HTML must be defined, please read comment near the top of this file."
# else
# define wxUSE_HTML 0
# endif
#endif /* !defined(wxUSE_HTML) */
#ifndef wxUSE_LIBMSPACK
# if !defined(__UNIX__)
/* set to 0 on platforms that don't have libmspack */
# define wxUSE_LIBMSPACK 0
# else
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LIBMSPACK must be defined, please read comment near the top of this file."
# else
# define wxUSE_LIBMSPACK 0
# endif
# endif
#endif /* !defined(wxUSE_LIBMSPACK) */
#ifndef wxUSE_ICO_CUR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ICO_CUR must be defined, please read comment near the top of this file."
# else
# define wxUSE_ICO_CUR 0
# endif
#endif /* !defined(wxUSE_ICO_CUR) */
#ifndef wxUSE_IFF
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_IFF must be defined, please read comment near the top of this file."
# else
# define wxUSE_IFF 0
# endif
#endif /* !defined(wxUSE_IFF) */
#ifndef wxUSE_IMAGLIST
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_IMAGLIST must be defined, please read comment near the top of this file."
# else
# define wxUSE_IMAGLIST 0
# endif
#endif /* !defined(wxUSE_IMAGLIST) */
#ifndef wxUSE_INFOBAR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_INFOBAR must be defined, please read comment near the top of this file."
# else
# define wxUSE_INFOBAR 0
# endif
#endif /* !defined(wxUSE_INFOBAR) */
#ifndef wxUSE_JOYSTICK
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_JOYSTICK must be defined, please read comment near the top of this file."
# else
# define wxUSE_JOYSTICK 0
# endif
#endif /* !defined(wxUSE_JOYSTICK) */
#ifndef wxUSE_LISTBOOK
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LISTBOOK must be defined, please read comment near the top of this file."
# else
# define wxUSE_LISTBOOK 0
# endif
#endif /* !defined(wxUSE_LISTBOOK) */
#ifndef wxUSE_LISTBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LISTBOX must be defined, please read comment near the top of this file."
# else
# define wxUSE_LISTBOX 0
# endif
#endif /* !defined(wxUSE_LISTBOX) */
#ifndef wxUSE_LISTCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LISTCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_LISTCTRL 0
# endif
#endif /* !defined(wxUSE_LISTCTRL) */
#ifndef wxUSE_LOGGUI
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LOGGUI must be defined, please read comment near the top of this file."
# else
# define wxUSE_LOGGUI 0
# endif
#endif /* !defined(wxUSE_LOGGUI) */
#ifndef wxUSE_LOGWINDOW
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LOGWINDOW must be defined, please read comment near the top of this file."
# else
# define wxUSE_LOGWINDOW 0
# endif
#endif /* !defined(wxUSE_LOGWINDOW) */
#ifndef wxUSE_LOG_DIALOG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LOG_DIALOG must be defined, please read comment near the top of this file."
# else
# define wxUSE_LOG_DIALOG 0
# endif
#endif /* !defined(wxUSE_LOG_DIALOG) */
#ifndef wxUSE_MARKUP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MARKUP must be defined, please read comment near the top of this file."
# else
# define wxUSE_MARKUP 0
# endif
#endif /* !defined(wxUSE_MARKUP) */
#ifndef wxUSE_MDI
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MDI must be defined, please read comment near the top of this file."
# else
# define wxUSE_MDI 0
# endif
#endif /* !defined(wxUSE_MDI) */
#ifndef wxUSE_MDI_ARCHITECTURE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MDI_ARCHITECTURE must be defined, please read comment near the top of this file."
# else
# define wxUSE_MDI_ARCHITECTURE 0
# endif
#endif /* !defined(wxUSE_MDI_ARCHITECTURE) */
#ifndef wxUSE_MENUS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MENUS must be defined, please read comment near the top of this file."
# else
# define wxUSE_MENUS 0
# endif
#endif /* !defined(wxUSE_MENUS) */
#ifndef wxUSE_MSGDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MSGDLG must be defined, please read comment near the top of this file."
# else
# define wxUSE_MSGDLG 0
# endif
#endif /* !defined(wxUSE_MSGDLG) */
#ifndef wxUSE_NOTEBOOK
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_NOTEBOOK must be defined, please read comment near the top of this file."
# else
# define wxUSE_NOTEBOOK 0
# endif
#endif /* !defined(wxUSE_NOTEBOOK) */
#ifndef wxUSE_NOTIFICATION_MESSAGE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_NOTIFICATION_MESSAGE must be defined, please read comment near the top of this file."
# else
# define wxUSE_NOTIFICATION_MESSAGE 0
# endif
#endif /* !defined(wxUSE_NOTIFICATION_MESSAGE) */
#ifndef wxUSE_ODCOMBOBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ODCOMBOBOX must be defined, please read comment near the top of this file."
# else
# define wxUSE_ODCOMBOBOX 0
# endif
#endif /* !defined(wxUSE_ODCOMBOBOX) */
#ifndef wxUSE_PALETTE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PALETTE must be defined, please read comment near the top of this file."
# else
# define wxUSE_PALETTE 0
# endif
#endif /* !defined(wxUSE_PALETTE) */
#ifndef wxUSE_POPUPWIN
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_POPUPWIN must be defined, please read comment near the top of this file."
# else
# define wxUSE_POPUPWIN 0
# endif
#endif /* !defined(wxUSE_POPUPWIN) */
#ifndef wxUSE_PREFERENCES_EDITOR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PREFERENCES_EDITOR must be defined, please read comment near the top of this file."
# else
# define wxUSE_PREFERENCES_EDITOR 0
# endif
#endif /* !defined(wxUSE_PREFERENCES_EDITOR) */
#ifndef wxUSE_PRIVATE_FONTS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PRIVATE_FONTS must be defined, please read comment near the top of this file."
# else
# define wxUSE_PRIVATE_FONTS 0
# endif
#endif /* !defined(wxUSE_PRIVATE_FONTS) */
#ifndef wxUSE_PRINTING_ARCHITECTURE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PRINTING_ARCHITECTURE must be defined, please read comment near the top of this file."
# else
# define wxUSE_PRINTING_ARCHITECTURE 0
# endif
#endif /* !defined(wxUSE_PRINTING_ARCHITECTURE) */
#ifndef wxUSE_RADIOBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_RADIOBOX must be defined, please read comment near the top of this file."
# else
# define wxUSE_RADIOBOX 0
# endif
#endif /* !defined(wxUSE_RADIOBOX) */
#ifndef wxUSE_RADIOBTN
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_RADIOBTN must be defined, please read comment near the top of this file."
# else
# define wxUSE_RADIOBTN 0
# endif
#endif /* !defined(wxUSE_RADIOBTN) */
#ifndef wxUSE_REARRANGECTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_REARRANGECTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_REARRANGECTRL 0
# endif
#endif /* !defined(wxUSE_REARRANGECTRL) */
#ifndef wxUSE_RIBBON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_RIBBON must be defined, please read comment near the top of this file."
# else
# define wxUSE_RIBBON 0
# endif
#endif /* !defined(wxUSE_RIBBON) */
#ifndef wxUSE_RICHMSGDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_RICHMSGDLG must be defined, please read comment near the top of this file."
# else
# define wxUSE_RICHMSGDLG 0
# endif
#endif /* !defined(wxUSE_RICHMSGDLG) */
#ifndef wxUSE_RICHTOOLTIP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_RICHTOOLTIP must be defined, please read comment near the top of this file."
# else
# define wxUSE_RICHTOOLTIP 0
# endif
#endif /* !defined(wxUSE_RICHTOOLTIP) */
#ifndef wxUSE_SASH
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SASH must be defined, please read comment near the top of this file."
# else
# define wxUSE_SASH 0
# endif
#endif /* !defined(wxUSE_SASH) */
#ifndef wxUSE_SCROLLBAR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SCROLLBAR must be defined, please read comment near the top of this file."
# else
# define wxUSE_SCROLLBAR 0
# endif
#endif /* !defined(wxUSE_SCROLLBAR) */
#ifndef wxUSE_SLIDER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SLIDER must be defined, please read comment near the top of this file."
# else
# define wxUSE_SLIDER 0
# endif
#endif /* !defined(wxUSE_SLIDER) */
#ifndef wxUSE_SOUND
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SOUND must be defined, please read comment near the top of this file."
# else
# define wxUSE_SOUND 0
# endif
#endif /* !defined(wxUSE_SOUND) */
#ifndef wxUSE_SPINBTN
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SPINBTN must be defined, please read comment near the top of this file."
# else
# define wxUSE_SPINBTN 0
# endif
#endif /* !defined(wxUSE_SPINBTN) */
#ifndef wxUSE_SPINCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SPINCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_SPINCTRL 0
# endif
#endif /* !defined(wxUSE_SPINCTRL) */
#ifndef wxUSE_SPLASH
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SPLASH must be defined, please read comment near the top of this file."
# else
# define wxUSE_SPLASH 0
# endif
#endif /* !defined(wxUSE_SPLASH) */
#ifndef wxUSE_SPLITTER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SPLITTER must be defined, please read comment near the top of this file."
# else
# define wxUSE_SPLITTER 0
# endif
#endif /* !defined(wxUSE_SPLITTER) */
#ifndef wxUSE_STATBMP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STATBMP must be defined, please read comment near the top of this file."
# else
# define wxUSE_STATBMP 0
# endif
#endif /* !defined(wxUSE_STATBMP) */
#ifndef wxUSE_STATBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STATBOX must be defined, please read comment near the top of this file."
# else
# define wxUSE_STATBOX 0
# endif
#endif /* !defined(wxUSE_STATBOX) */
#ifndef wxUSE_STATLINE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STATLINE must be defined, please read comment near the top of this file."
# else
# define wxUSE_STATLINE 0
# endif
#endif /* !defined(wxUSE_STATLINE) */
#ifndef wxUSE_STATTEXT
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STATTEXT must be defined, please read comment near the top of this file."
# else
# define wxUSE_STATTEXT 0
# endif
#endif /* !defined(wxUSE_STATTEXT) */
#ifndef wxUSE_STATUSBAR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STATUSBAR must be defined, please read comment near the top of this file."
# else
# define wxUSE_STATUSBAR 0
# endif
#endif /* !defined(wxUSE_STATUSBAR) */
#ifndef wxUSE_TASKBARICON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TASKBARICON must be defined, please read comment near the top of this file."
# else
# define wxUSE_TASKBARICON 0
# endif
#endif /* !defined(wxUSE_TASKBARICON) */
#ifndef wxUSE_TEXTCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TEXTCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_TEXTCTRL 0
# endif
#endif /* !defined(wxUSE_TEXTCTRL) */
#ifndef wxUSE_TIMEPICKCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TIMEPICKCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_TIMEPICKCTRL 0
# endif
#endif /* !defined(wxUSE_TIMEPICKCTRL) */
#ifndef wxUSE_TIPWINDOW
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TIPWINDOW must be defined, please read comment near the top of this file."
# else
# define wxUSE_TIPWINDOW 0
# endif
#endif /* !defined(wxUSE_TIPWINDOW) */
#ifndef wxUSE_TOOLBAR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TOOLBAR must be defined, please read comment near the top of this file."
# else
# define wxUSE_TOOLBAR 0
# endif
#endif /* !defined(wxUSE_TOOLBAR) */
#ifndef wxUSE_TOOLTIPS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TOOLTIPS must be defined, please read comment near the top of this file."
# else
# define wxUSE_TOOLTIPS 0
# endif
#endif /* !defined(wxUSE_TOOLTIPS) */
#ifndef wxUSE_TREECTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TREECTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_TREECTRL 0
# endif
#endif /* !defined(wxUSE_TREECTRL) */
#ifndef wxUSE_TREELISTCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TREELISTCTRL must be defined, please read comment near the top of this file."
# else
# define wxUSE_TREELISTCTRL 0
# endif
#endif /* !defined(wxUSE_TREELISTCTRL) */
#ifndef wxUSE_UIACTIONSIMULATOR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_UIACTIONSIMULATOR must be defined, please read comment near the top of this file."
# else
# define wxUSE_UIACTIONSIMULATOR 0
# endif
#endif /* !defined(wxUSE_UIACTIONSIMULATOR) */
#ifndef wxUSE_VALIDATORS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_VALIDATORS must be defined, please read comment near the top of this file."
# else
# define wxUSE_VALIDATORS 0
# endif
#endif /* !defined(wxUSE_VALIDATORS) */
#ifndef wxUSE_WEBVIEW
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_WEBVIEW must be defined, please read comment near the top of this file."
# else
# define wxUSE_WEBVIEW 0
# endif
#endif /* !defined(wxUSE_WEBVIEW) */
#ifndef wxUSE_WXHTML_HELP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_WXHTML_HELP must be defined, please read comment near the top of this file."
# else
# define wxUSE_WXHTML_HELP 0
# endif
#endif /* !defined(wxUSE_WXHTML_HELP) */
#ifndef wxUSE_XRC
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_XRC must be defined, please read comment near the top of this file."
# else
# define wxUSE_XRC 0
# endif
#endif /* !defined(wxUSE_XRC) */
#endif /* wxUSE_GUI */
/*
Section 2: platform-specific checks.
This must be done after checking that everything is defined as the platform
checks use wxUSE_XXX symbols in #if tests.
*/
#if defined(__WINDOWS__)
# include "wx/msw/chkconf.h"
# if defined(__WXGTK__)
# include "wx/gtk/chkconf.h"
# endif
#elif defined(__WXGTK__)
# include "wx/gtk/chkconf.h"
#elif defined(__WXMAC__)
# include "wx/osx/chkconf.h"
#elif defined(__WXDFB__)
# include "wx/dfb/chkconf.h"
#elif defined(__WXMOTIF__)
# include "wx/motif/chkconf.h"
#elif defined(__WXX11__)
# include "wx/x11/chkconf.h"
#elif defined(__WXANDROID__)
# include "wx/android/chkconf.h"
#endif
/*
__UNIX__ is also defined under Cygwin but we shouldn't perform these checks
there if we're building Windows ports.
*/
#if defined(__UNIX__) && !defined(__WINDOWS__)
# include "wx/unix/chkconf.h"
#endif
#ifdef __WXUNIVERSAL__
# include "wx/univ/chkconf.h"
#endif
/*
Section 3a: check consistency of the non-GUI settings.
*/
#if WXWIN_COMPATIBILITY_2_8
# if !WXWIN_COMPATIBILITY_3_0
# ifdef wxABORT_ON_CONFIG_ERROR
# error "2.8.X compatibility requires 3.0.X compatibility"
# else
# undef WXWIN_COMPATIBILITY_3_0
# define WXWIN_COMPATIBILITY_3_0 1
# endif
# endif
#endif /* WXWIN_COMPATIBILITY_2_8 */
#if wxUSE_ARCHIVE_STREAMS
# if !wxUSE_DATETIME
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxArchive requires wxUSE_DATETIME"
# else
# undef wxUSE_ARCHIVE_STREAMS
# define wxUSE_ARCHIVE_STREAMS 0
# endif
# endif
#endif /* wxUSE_ARCHIVE_STREAMS */
#if wxUSE_PROTOCOL_FILE || wxUSE_PROTOCOL_FTP || wxUSE_PROTOCOL_HTTP
# if !wxUSE_PROTOCOL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PROTOCOL_XXX requires wxUSE_PROTOCOL"
# else
# undef wxUSE_PROTOCOL
# define wxUSE_PROTOCOL 1
# endif
# endif
#endif /* wxUSE_PROTOCOL_XXX */
#if wxUSE_URL
# if !wxUSE_PROTOCOL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_URL requires wxUSE_PROTOCOL"
# else
# undef wxUSE_PROTOCOL
# define wxUSE_PROTOCOL 1
# endif
# endif
#endif /* wxUSE_URL */
#if wxUSE_PROTOCOL
# if !wxUSE_SOCKETS
# if wxUSE_PROTOCOL_HTTP || wxUSE_PROTOCOL_FTP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PROTOCOL_FTP/HTTP requires wxUSE_SOCKETS"
# else
# undef wxUSE_SOCKETS
# define wxUSE_SOCKETS 1
# endif
# endif
# endif
# if !wxUSE_STREAMS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PROTOCOL requires wxUSE_STREAMS"
# else
# undef wxUSE_STREAMS
# define wxUSE_STREAMS 1
# endif
# endif
#endif /* wxUSE_PROTOCOL */
/* have to test for wxUSE_HTML before wxUSE_FILESYSTEM */
#if wxUSE_HTML
# if !wxUSE_FILESYSTEM
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxHTML requires wxFileSystem"
# else
# undef wxUSE_FILESYSTEM
# define wxUSE_FILESYSTEM 1
# endif
# endif
#endif /* wxUSE_HTML */
#if wxUSE_FS_ARCHIVE
# if !wxUSE_FILESYSTEM
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxArchiveFSHandler requires wxFileSystem"
# else
# undef wxUSE_FILESYSTEM
# define wxUSE_FILESYSTEM 1
# endif
# endif
# if !wxUSE_ARCHIVE_STREAMS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxArchiveFSHandler requires wxArchive"
# else
# undef wxUSE_ARCHIVE_STREAMS
# define wxUSE_ARCHIVE_STREAMS 1
# endif
# endif
#endif /* wxUSE_FS_ARCHIVE */
#if wxUSE_FILESYSTEM
# if !wxUSE_STREAMS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FILESYSTEM requires wxUSE_STREAMS"
# else
# undef wxUSE_STREAMS
# define wxUSE_STREAMS 1
# endif
# endif
# if !wxUSE_FILE && !wxUSE_FFILE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FILESYSTEM requires either wxUSE_FILE or wxUSE_FFILE"
# else
# undef wxUSE_FILE
# define wxUSE_FILE 1
# undef wxUSE_FFILE
# define wxUSE_FFILE 1
# endif
# endif
#endif /* wxUSE_FILESYSTEM */
#if wxUSE_FS_INET
# if !wxUSE_PROTOCOL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FS_INET requires wxUSE_PROTOCOL"
# else
# undef wxUSE_PROTOCOL
# define wxUSE_PROTOCOL 1
# endif
# endif
#endif /* wxUSE_FS_INET */
#if wxUSE_STOPWATCH || wxUSE_DATETIME
# if !wxUSE_LONGLONG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STOPWATCH and wxUSE_DATETIME require wxUSE_LONGLONG"
# else
# undef wxUSE_LONGLONG
# define wxUSE_LONGLONG 1
# endif
# endif
#endif /* wxUSE_STOPWATCH */
#if wxUSE_MIMETYPE && !wxUSE_TEXTFILE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MIMETYPE requires wxUSE_TEXTFILE"
# else
# undef wxUSE_TEXTFILE
# define wxUSE_TEXTFILE 1
# endif
#endif /* wxUSE_MIMETYPE */
#if wxUSE_TEXTFILE && !wxUSE_TEXTBUFFER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TEXTFILE requires wxUSE_TEXTBUFFER"
# else
# undef wxUSE_TEXTBUFFER
# define wxUSE_TEXTBUFFER 1
# endif
#endif /* wxUSE_TEXTFILE */
#if wxUSE_TEXTFILE && !wxUSE_FILE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TEXTFILE requires wxUSE_FILE"
# else
# undef wxUSE_FILE
# define wxUSE_FILE 1
# endif
#endif /* wxUSE_TEXTFILE */
#if !wxUSE_DYNLIB_CLASS
# if wxUSE_DYNAMIC_LOADER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DYNAMIC_LOADER requires wxUSE_DYNLIB_CLASS."
# else
# define wxUSE_DYNLIB_CLASS 1
# endif
# endif
#endif /* wxUSE_DYNLIB_CLASS */
#if wxUSE_ZIPSTREAM
# if !wxUSE_ZLIB
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxZip requires wxZlib"
# else
# undef wxUSE_ZLIB
# define wxUSE_ZLIB 1
# endif
# endif
# if !wxUSE_ARCHIVE_STREAMS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxZip requires wxArchive"
# else
# undef wxUSE_ARCHIVE_STREAMS
# define wxUSE_ARCHIVE_STREAMS 1
# endif
# endif
#endif /* wxUSE_ZIPSTREAM */
#if wxUSE_TARSTREAM
# if !wxUSE_ARCHIVE_STREAMS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxTar requires wxArchive"
# else
# undef wxUSE_ARCHIVE_STREAMS
# define wxUSE_ARCHIVE_STREAMS 1
# endif
# endif
#endif /* wxUSE_TARSTREAM */
/*
Section 3b: the tests for the GUI settings only.
*/
#if wxUSE_GUI
#if wxUSE_ACCESSIBILITY && !defined(__WXMSW__)
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ACCESSIBILITY is currently only supported under wxMSW"
# else
# undef wxUSE_ACCESSIBILITY
# define wxUSE_ACCESSIBILITY 0
# endif
#endif /* wxUSE_ACCESSIBILITY */
#if wxUSE_BUTTON || \
wxUSE_CALENDARCTRL || \
wxUSE_CARET || \
wxUSE_COMBOBOX || \
wxUSE_BMPBUTTON || \
wxUSE_CHECKBOX || \
wxUSE_CHECKLISTBOX || \
wxUSE_CHOICE || \
wxUSE_GAUGE || \
wxUSE_GRID || \
wxUSE_HEADERCTRL || \
wxUSE_LISTBOX || \
wxUSE_LISTCTRL || \
wxUSE_NOTEBOOK || \
wxUSE_RADIOBOX || \
wxUSE_RADIOBTN || \
wxUSE_REARRANGECTRL || \
wxUSE_SCROLLBAR || \
wxUSE_SLIDER || \
wxUSE_SPINBTN || \
wxUSE_SPINCTRL || \
wxUSE_STATBMP || \
wxUSE_STATBOX || \
wxUSE_STATLINE || \
wxUSE_STATTEXT || \
wxUSE_STATUSBAR || \
wxUSE_TEXTCTRL || \
wxUSE_TOOLBAR || \
wxUSE_TREECTRL || \
wxUSE_TREELISTCTRL
# if !wxUSE_CONTROLS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CONTROLS unset but some controls used"
# else
# undef wxUSE_CONTROLS
# define wxUSE_CONTROLS 1
# endif
# endif
#endif /* controls */
#if wxUSE_ADDREMOVECTRL
# if !wxUSE_BMPBUTTON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ADDREMOVECTRL requires wxUSE_BMPBUTTON"
# else
# undef wxUSE_ADDREMOVECTRL
# define wxUSE_ADDREMOVECTRL 0
# endif
# endif
#endif /* wxUSE_ADDREMOVECTRL */
#if wxUSE_ANIMATIONCTRL
# if !wxUSE_STREAMS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ANIMATIONCTRL requires wxUSE_STREAMS"
# else
# undef wxUSE_ANIMATIONCTRL
# define wxUSE_ANIMATIONCTRL 0
# endif
# endif
#endif /* wxUSE_ANIMATIONCTRL */
#if wxUSE_BMPBUTTON
# if !wxUSE_BUTTON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_BMPBUTTON requires wxUSE_BUTTON"
# else
# undef wxUSE_BUTTON
# define wxUSE_BUTTON 1
# endif
# endif
#endif /* wxUSE_BMPBUTTON */
#if wxUSE_COMMANDLINKBUTTON
# if !wxUSE_BUTTON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_COMMANDLINKBUTTON requires wxUSE_BUTTON"
# else
# undef wxUSE_BUTTON
# define wxUSE_BUTTON 1
# endif
# endif
#endif /* wxUSE_COMMANDLINKBUTTON */
/*
wxUSE_BOOKCTRL should be only used if any of the controls deriving from it
are used
*/
#ifdef wxUSE_BOOKCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_BOOKCTRL is defined automatically, don't define it"
# else
# undef wxUSE_BOOKCTRL
# endif
#endif
#define wxUSE_BOOKCTRL (wxUSE_AUI || \
wxUSE_NOTEBOOK || \
wxUSE_LISTBOOK || \
wxUSE_CHOICEBOOK || \
wxUSE_TOOLBOOK || \
wxUSE_TREEBOOK)
#if wxUSE_COLLPANE
# if !wxUSE_BUTTON || !wxUSE_STATLINE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_COLLPANE requires wxUSE_BUTTON and wxUSE_STATLINE"
# else
# undef wxUSE_COLLPANE
# define wxUSE_COLLPANE 0
# endif
# endif
#endif /* wxUSE_COLLPANE */
#if wxUSE_LISTBOOK
# if !wxUSE_LISTCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxListbook requires wxListCtrl"
# else
# undef wxUSE_LISTCTRL
# define wxUSE_LISTCTRL 1
# endif
# endif
#endif /* wxUSE_LISTBOOK */
#if wxUSE_CHOICEBOOK
# if !wxUSE_CHOICE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxChoicebook requires wxChoice"
# else
# undef wxUSE_CHOICE
# define wxUSE_CHOICE 1
# endif
# endif
#endif /* wxUSE_CHOICEBOOK */
#if wxUSE_TOOLBOOK
# if !wxUSE_TOOLBAR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxToolbook requires wxToolBar"
# else
# undef wxUSE_TOOLBAR
# define wxUSE_TOOLBAR 1
# endif
# endif
#endif /* wxUSE_TOOLBOOK */
#if !wxUSE_ODCOMBOBOX
# if wxUSE_BITMAPCOMBOBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxBitmapComboBox requires wxOwnerDrawnComboBox"
# else
# undef wxUSE_BITMAPCOMBOBOX
# define wxUSE_BITMAPCOMBOBOX 0
# endif
# endif
#endif /* !wxUSE_ODCOMBOBOX */
#if !wxUSE_HEADERCTRL
# if wxUSE_DATAVIEWCTRL || wxUSE_GRID
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxDataViewCtrl and wxGrid require wxHeaderCtrl"
# else
# undef wxUSE_HEADERCTRL
# define wxUSE_HEADERCTRL 1
# endif
# endif
#endif /* !wxUSE_HEADERCTRL */
#if wxUSE_REARRANGECTRL
# if !wxUSE_CHECKLISTBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxRearrangeCtrl requires wxCheckListBox"
# else
# undef wxUSE_REARRANGECTRL
# define wxUSE_REARRANGECTRL 0
# endif
# endif
#endif /* wxUSE_REARRANGECTRL */
#if wxUSE_RICHMSGDLG
# if !wxUSE_MSGDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_RICHMSGDLG requires wxUSE_MSGDLG"
# else
# undef wxUSE_MSGDLG
# define wxUSE_MSGDLG 1
# endif
# endif
#endif /* wxUSE_RICHMSGDLG */
/* don't attempt to use native status bar on the platforms not having it */
#ifndef wxUSE_NATIVE_STATUSBAR
# define wxUSE_NATIVE_STATUSBAR 0
#elif wxUSE_NATIVE_STATUSBAR
# if defined(__WXUNIVERSAL__) || !(defined(__WXMSW__) || defined(__WXMAC__))
# undef wxUSE_NATIVE_STATUSBAR
# define wxUSE_NATIVE_STATUSBAR 0
# endif
#endif
#if wxUSE_ACTIVITYINDICATOR && !wxUSE_GRAPHICS_CONTEXT
# undef wxUSE_ACTIVITYINDICATOR
# define wxUSE_ACTIVITYINDICATOR 0
#endif /* wxUSE_ACTIVITYINDICATOR */
#if wxUSE_GRAPHICS_CONTEXT && !wxUSE_GEOMETRY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_GRAPHICS_CONTEXT requires wxUSE_GEOMETRY"
# else
# undef wxUSE_GRAPHICS_CONTEXT
# define wxUSE_GRAPHICS_CONTEXT 0
# endif
#endif /* wxUSE_GRAPHICS_CONTEXT */
#if wxUSE_DC_TRANSFORM_MATRIX && !wxUSE_GEOMETRY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DC_TRANSFORM_MATRIX requires wxUSE_GEOMETRY"
# else
# undef wxUSE_DC_TRANSFORM_MATRIX
# define wxUSE_DC_TRANSFORM_MATRIX 0
# endif
#endif /* wxUSE_DC_TRANSFORM_MATRIX */
/* generic controls dependencies */
#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__)
# if wxUSE_FONTDLG || wxUSE_FILEDLG || wxUSE_CHOICEDLG
/* all common controls are needed by these dialogs */
# if !defined(wxUSE_CHOICE) || \
!defined(wxUSE_TEXTCTRL) || \
!defined(wxUSE_BUTTON) || \
!defined(wxUSE_CHECKBOX) || \
!defined(wxUSE_STATTEXT)
# ifdef wxABORT_ON_CONFIG_ERROR
# error "These common controls are needed by common dialogs"
# else
# undef wxUSE_CHOICE
# define wxUSE_CHOICE 1
# undef wxUSE_TEXTCTRL
# define wxUSE_TEXTCTRL 1
# undef wxUSE_BUTTON
# define wxUSE_BUTTON 1
# undef wxUSE_CHECKBOX
# define wxUSE_CHECKBOX 1
# undef wxUSE_STATTEXT
# define wxUSE_STATTEXT 1
# endif
# endif
# endif
#endif /* !wxMSW || wxUniv */
/* generic file dialog depends on (generic) file control */
#if wxUSE_FILEDLG && !wxUSE_FILECTRL && \
(defined(__WXUNIVERSAL__) || defined(__WXGTK__))
# ifdef wxABORT_ON_CONFIG_ERROR
# error "Generic wxFileDialog requires wxFileCtrl"
# else
# undef wxUSE_FILECTRL
# define wxUSE_FILECTRL 1
# endif
#endif /* wxUSE_FILEDLG */
/* common dependencies */
#if wxUSE_ARTPROVIDER_TANGO
# if !(wxUSE_STREAMS && wxUSE_IMAGE && wxUSE_LIBPNG)
# ifdef wxABORT_ON_CONFIG_ERROR
# error "Tango art provider requires wxImage with streams and PNG support"
# else
# undef wxUSE_ARTPROVIDER_TANGO
# define wxUSE_ARTPROVIDER_TANGO 0
# endif
# endif
#endif /* wxUSE_ARTPROVIDER_TANGO */
#if wxUSE_CALENDARCTRL
# if !(wxUSE_SPINBTN && wxUSE_COMBOBOX)
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxCalendarCtrl requires wxSpinButton and wxComboBox"
# else
# undef wxUSE_SPINBTN
# undef wxUSE_COMBOBOX
# define wxUSE_SPINBTN 1
# define wxUSE_COMBOBOX 1
# endif
# endif
# if !wxUSE_DATETIME
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxCalendarCtrl requires wxUSE_DATETIME"
# else
# undef wxUSE_DATETIME
# define wxUSE_DATETIME 1
# endif
# endif
#endif /* wxUSE_CALENDARCTRL */
#if wxUSE_DATEPICKCTRL
/* Only the generic implementation, not used under MSW and OSX, needs
* wxComboCtrl. */
# if !wxUSE_COMBOCTRL && (defined(__WXUNIVERSAL__) || \
!(defined(__WXMSW__) || defined(__WXOSX_COCOA__)))
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxDatePickerCtrl requires wxUSE_COMBOCTRL"
# else
# undef wxUSE_COMBOCTRL
# define wxUSE_COMBOCTRL 1
# endif
# endif
#endif /* wxUSE_DATEPICKCTRL */
#if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL
# if !wxUSE_DATETIME
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxDatePickerCtrl and wxTimePickerCtrl requires wxUSE_DATETIME"
# else
# undef wxUSE_DATETIME
# define wxUSE_DATETIME 1
# endif
# endif
#endif /* wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL */
#if wxUSE_CHECKLISTBOX
# if !wxUSE_LISTBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxCheckListBox requires wxListBox"
# else
# undef wxUSE_LISTBOX
# define wxUSE_LISTBOX 1
# endif
# endif
#endif /* wxUSE_CHECKLISTBOX */
#if wxUSE_CHOICEDLG
# if !wxUSE_LISTBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "Choice dialogs requires wxListBox"
# else
# undef wxUSE_LISTBOX
# define wxUSE_LISTBOX 1
# endif
# endif
#endif /* wxUSE_CHOICEDLG */
#if wxUSE_FILECTRL
# if !wxUSE_DATETIME
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxFileCtrl requires wxDateTime"
# else
# undef wxUSE_DATETIME
# define wxUSE_DATETIME 1
# endif
# endif
#endif /* wxUSE_FILECTRL */
#if wxUSE_HELP
# if !wxUSE_BMPBUTTON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_HELP requires wxUSE_BMPBUTTON"
# else
# undef wxUSE_BMPBUTTON
# define wxUSE_BMPBUTTON 1
# endif
# endif
# if !wxUSE_CHOICEDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_HELP requires wxUSE_CHOICEDLG"
# else
# undef wxUSE_CHOICEDLG
# define wxUSE_CHOICEDLG 1
# endif
# endif
#endif /* wxUSE_HELP */
#if wxUSE_MS_HTML_HELP
/*
this doesn't make sense for platforms other than MSW but we still
define it in wx/setup_inc.h so don't complain if it happens to be
defined under another platform but just silently fix it.
*/
# ifndef __WXMSW__
# undef wxUSE_MS_HTML_HELP
# define wxUSE_MS_HTML_HELP 0
# endif
#endif /* wxUSE_MS_HTML_HELP */
#if wxUSE_WXHTML_HELP
# if !wxUSE_HELP || !wxUSE_HTML || !wxUSE_COMBOBOX || !wxUSE_NOTEBOOK || !wxUSE_SPINCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "Built in help controller can't be compiled"
# else
# undef wxUSE_HELP
# define wxUSE_HELP 1
# undef wxUSE_HTML
# define wxUSE_HTML 1
# undef wxUSE_COMBOBOX
# define wxUSE_COMBOBOX 1
# undef wxUSE_NOTEBOOK
# define wxUSE_NOTEBOOK 1
# undef wxUSE_SPINCTRL
# define wxUSE_SPINCTRL 1
# endif
# endif
#endif /* wxUSE_WXHTML_HELP */
#if !wxUSE_IMAGE
/*
The default wxUSE_IMAGE setting is 1, so if it's set to 0 we assume the
user explicitly wants this and disable all other features that require
wxUSE_IMAGE.
*/
# if wxUSE_DRAGIMAGE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DRAGIMAGE requires wxUSE_IMAGE"
# else
# undef wxUSE_DRAGIMAGE
# define wxUSE_DRAGIMAGE 0
# endif
# endif
# if wxUSE_LIBPNG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LIBPNG requires wxUSE_IMAGE"
# else
# undef wxUSE_LIBPNG
# define wxUSE_LIBPNG 0
# endif
# endif
# if wxUSE_LIBJPEG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LIBJPEG requires wxUSE_IMAGE"
# else
# undef wxUSE_LIBJPEG
# define wxUSE_LIBJPEG 0
# endif
# endif
# if wxUSE_LIBTIFF
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LIBTIFF requires wxUSE_IMAGE"
# else
# undef wxUSE_LIBTIFF
# define wxUSE_LIBTIFF 0
# endif
# endif
# if wxUSE_GIF
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_GIF requires wxUSE_IMAGE"
# else
# undef wxUSE_GIF
# define wxUSE_GIF 0
# endif
# endif
# if wxUSE_PNM
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PNM requires wxUSE_IMAGE"
# else
# undef wxUSE_PNM
# define wxUSE_PNM 0
# endif
# endif
# if wxUSE_PCX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PCX requires wxUSE_IMAGE"
# else
# undef wxUSE_PCX
# define wxUSE_PCX 0
# endif
# endif
# if wxUSE_IFF
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_IFF requires wxUSE_IMAGE"
# else
# undef wxUSE_IFF
# define wxUSE_IFF 0
# endif
# endif
# if wxUSE_TOOLBAR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TOOLBAR requires wxUSE_IMAGE"
# else
# undef wxUSE_TOOLBAR
# define wxUSE_TOOLBAR 0
# endif
# endif
# if wxUSE_XPM
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_XPM requires wxUSE_IMAGE"
# else
# undef wxUSE_XPM
# define wxUSE_XPM 0
# endif
# endif
#endif /* !wxUSE_IMAGE */
#if wxUSE_DOC_VIEW_ARCHITECTURE
# if !wxUSE_MENUS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "DocView requires wxUSE_MENUS"
# else
# undef wxUSE_MENUS
# define wxUSE_MENUS 1
# endif
# endif
# if !wxUSE_CHOICEDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "DocView requires wxUSE_CHOICEDLG"
# else
# undef wxUSE_CHOICEDLG
# define wxUSE_CHOICEDLG 1
# endif
# endif
# if !wxUSE_STREAMS && !wxUSE_STD_IOSTREAM
# ifdef wxABORT_ON_CONFIG_ERROR
# error "DocView requires wxUSE_STREAMS or wxUSE_STD_IOSTREAM"
# else
# undef wxUSE_STREAMS
# define wxUSE_STREAMS 1
# endif
# endif
# if !wxUSE_FILE_HISTORY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "DocView requires wxUSE_FILE_HISTORY"
# else
# undef wxUSE_FILE_HISTORY
# define wxUSE_FILE_HISTORY 1
# endif
# endif
#endif /* wxUSE_DOC_VIEW_ARCHITECTURE */
#if wxUSE_PRINTING_ARCHITECTURE
# if !wxUSE_COMBOBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "Print dialog requires wxUSE_COMBOBOX"
# else
# undef wxUSE_COMBOBOX
# define wxUSE_COMBOBOX 1
# endif
# endif
#endif /* wxUSE_PRINTING_ARCHITECTURE */
#if wxUSE_MDI_ARCHITECTURE
# if !wxUSE_MDI
# ifdef wxABORT_ON_CONFIG_ERROR
# error "MDI requires wxUSE_MDI"
# else
# undef wxUSE_MDI
# define wxUSE_MDI 1
# endif
# endif
# if !wxUSE_DOC_VIEW_ARCHITECTURE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MDI_ARCHITECTURE requires wxUSE_DOC_VIEW_ARCHITECTURE"
# else
# undef wxUSE_DOC_VIEW_ARCHITECTURE
# define wxUSE_DOC_VIEW_ARCHITECTURE 1
# endif
# endif
#endif /* wxUSE_MDI_ARCHITECTURE */
#if !wxUSE_FILEDLG
# if wxUSE_DOC_VIEW_ARCHITECTURE || wxUSE_WXHTML_HELP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_FILEDLG is required by wxUSE_DOC_VIEW_ARCHITECTURE and wxUSE_WXHTML_HELP!"
# else
# undef wxUSE_FILEDLG
# define wxUSE_FILEDLG 1
# endif
# endif
#endif /* wxUSE_FILEDLG */
#if !wxUSE_GAUGE || !wxUSE_BUTTON
# if wxUSE_PROGRESSDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "Generic progress dialog requires wxUSE_GAUGE and wxUSE_BUTTON"
# else
# undef wxUSE_GAUGE
# undef wxUSE_BUTTON
# define wxUSE_GAUGE 1
# define wxUSE_BUTTON 1
# endif
# endif
#endif /* !wxUSE_GAUGE */
#if !wxUSE_BUTTON
# if wxUSE_FONTDLG || \
wxUSE_FILEDLG || \
wxUSE_CHOICEDLG || \
wxUSE_NUMBERDLG || \
wxUSE_TEXTDLG || \
wxUSE_DIRDLG || \
wxUSE_STARTUP_TIPS || \
wxUSE_WIZARDDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "Common and generic dialogs require wxUSE_BUTTON"
# else
# undef wxUSE_BUTTON
# define wxUSE_BUTTON 1
# endif
# endif
#endif /* !wxUSE_BUTTON */
#if !wxUSE_TOOLBAR
# if wxUSE_TOOLBAR_NATIVE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TOOLBAR is set to 0 but wxUSE_TOOLBAR_NATIVE is set to 1"
# else
# undef wxUSE_TOOLBAR_NATIVE
# define wxUSE_TOOLBAR_NATIVE 0
# endif
# endif
#endif
#if !wxUSE_IMAGLIST
# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL || wxUSE_TREELISTCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxImageList must be compiled as well"
# else
# undef wxUSE_IMAGLIST
# define wxUSE_IMAGLIST 1
# endif
# endif
#endif /* !wxUSE_IMAGLIST */
#if wxUSE_RADIOBOX
# if !wxUSE_RADIOBTN
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_RADIOBOX requires wxUSE_RADIOBTN"
# else
# undef wxUSE_RADIOBTN
# define wxUSE_RADIOBTN 1
# endif
# endif
# if !wxUSE_STATBOX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_RADIOBOX requires wxUSE_STATBOX"
# else
# undef wxUSE_STATBOX
# define wxUSE_STATBOX 1
# endif
# endif
#endif /* wxUSE_RADIOBOX */
#if wxUSE_LOGWINDOW
# if !wxUSE_TEXTCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LOGWINDOW requires wxUSE_TEXTCTRL"
# else
# undef wxUSE_TEXTCTRL
# define wxUSE_TEXTCTRL 1
# endif
# endif
#endif /* wxUSE_LOGWINDOW */
#if wxUSE_LOG_DIALOG
# if !wxUSE_LISTCTRL || !wxUSE_BUTTON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_LOG_DIALOG requires wxUSE_LISTCTRL and wxUSE_BUTTON"
# else
# undef wxUSE_LISTCTRL
# define wxUSE_LISTCTRL 1
# undef wxUSE_BUTTON
# define wxUSE_BUTTON 1
# endif
# endif
#endif /* wxUSE_LOG_DIALOG */
#if wxUSE_CLIPBOARD && !wxUSE_DATAOBJ
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxClipboard requires wxDataObject"
# else
# undef wxUSE_DATAOBJ
# define wxUSE_DATAOBJ 1
# endif
#endif /* wxUSE_CLIPBOARD */
#if wxUSE_XRC && !wxUSE_XML
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_XRC requires wxUSE_XML"
# else
# undef wxUSE_XRC
# define wxUSE_XRC 0
# endif
#endif /* wxUSE_XRC */
#if wxUSE_SOCKETS && !wxUSE_STOPWATCH
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SOCKETS requires wxUSE_STOPWATCH"
# else
# undef wxUSE_SOCKETS
# define wxUSE_SOCKETS 0
# endif
#endif /* wxUSE_SOCKETS */
#if wxUSE_SVG && !wxUSE_STREAMS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SVG requires wxUSE_STREAMS"
# else
# undef wxUSE_SVG
# define wxUSE_SVG 0
# endif
#endif /* wxUSE_SVG */
#if wxUSE_SVG && !wxUSE_IMAGE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SVG requires wxUSE_IMAGE"
# else
# undef wxUSE_SVG
# define wxUSE_SVG 0
# endif
#endif /* wxUSE_SVG */
#if wxUSE_SVG && !wxUSE_LIBPNG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SVG requires wxUSE_LIBPNG"
# else
# undef wxUSE_SVG
# define wxUSE_SVG 0
# endif
#endif /* wxUSE_SVG */
#if wxUSE_TASKBARICON && !wxUSE_MENUS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TASKBARICON requires wxUSE_MENUS"
# else
# undef wxUSE_TASKBARICON
# define wxUSE_TASKBARICON 0
# endif
#endif /* wxUSE_TASKBARICON */
#if !wxUSE_VARIANT
# if wxUSE_DATAVIEWCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxDataViewCtrl requires wxVariant"
# else
# undef wxUSE_DATAVIEWCTRL
# define wxUSE_DATAVIEWCTRL 0
# endif
# endif
#endif /* wxUSE_VARIANT */
#if wxUSE_TREELISTCTRL && !wxUSE_DATAVIEWCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TREELISTCTRL requires wxDataViewCtrl"
# else
# undef wxUSE_TREELISTCTRL
# define wxUSE_TREELISTCTRL 0
# endif
#endif /* wxUSE_TREELISTCTRL */
#if wxUSE_WEBVIEW && !(wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2 || wxUSE_WEBVIEW_IE)
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_WEBVIEW requires at least one backend"
# else
# undef wxUSE_WEBVIEW
# define wxUSE_WEBVIEW 0
# endif
#endif /* wxUSE_WEBVIEW && !any web view backend */
#if wxUSE_PREFERENCES_EDITOR
/*
We can use either a generic implementation, using wxNotebook, or a
native one under wxOSX/Cocoa but then we must be using the native
toolbar.
*/
# if !wxUSE_NOTEBOOK
# ifdef __WXOSX_COCOA__
# if !wxUSE_TOOLBAR || !wxOSX_USE_NATIVE_TOOLBAR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PREFERENCES_EDITOR requires native toolbar in wxOSX"
# else
# undef wxUSE_PREFERENCES_EDITOR
# define wxUSE_PREFERENCES_EDITOR 0
# endif
# endif
# else
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PREFERENCES_EDITOR requires wxNotebook"
# else
# undef wxUSE_PREFERENCES_EDITOR
# define wxUSE_PREFERENCES_EDITOR 0
# endif
# endif
# endif
#endif /* wxUSE_PREFERENCES_EDITOR */
#if wxUSE_PRIVATE_FONTS
# if !defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXOSX__)
# undef wxUSE_PRIVATE_FONTS
# define wxUSE_PRIVATE_FONTS 0
# endif
#endif /* wxUSE_PRIVATE_FONTS */
#if wxUSE_MEDIACTRL
# if !wxUSE_LONGLONG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxMediaCtrl requires wxUSE_LONLONG"
# else
# undef wxUSE_LONLONG
# define wxUSE_LONLONG 1
# endif
# endif
#endif /* wxUSE_MEDIACTRL */
#if wxUSE_STC
# if !wxUSE_STOPWATCH
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxStyledTextCtrl requires wxUSE_STOPWATCH"
# else
# undef wxUSE_STC
# define wxUSE_STC 0
# endif
# endif
# if !wxUSE_SCROLLBAR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxStyledTextCtrl requires wxUSE_SCROLLBAR"
# else
# undef wxUSE_STC
# define wxUSE_STC 0
# endif
# endif
#endif /* wxUSE_STC */
#if wxUSE_RICHTEXT
# if !wxUSE_HTML
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxRichTextCtrl requires wxUSE_HTML"
# else
# undef wxUSE_RICHTEXT
# define wxUSE_RICHTEXT 0
# endif
# endif
# if !wxUSE_LONGLONG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxRichTextCtrl requires wxUSE_LONLONG"
# else
# undef wxUSE_LONLONG
# define wxUSE_LONLONG 1
# endif
# endif
#endif /* wxUSE_RICHTEXT */
#endif /* wxUSE_GUI */
#endif /* _WX_CHKCONF_H_ */
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/xtistrm.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/xtistrm.h
// Purpose: streaming runtime metadata information (extended class info)
// Author: Stefan Csomor
// Modified by:
// Created: 27/07/03
// Copyright: (c) 2003 Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XTISTRMH__
#define _WX_XTISTRMH__
#include "wx/defs.h"
#if wxUSE_EXTENDED_RTTI
#include "wx/object.h"
const int wxInvalidObjectID = -2;
const int wxNullObjectID = -3;
// Filer contains the interfaces for streaming objects in and out of XML,
// rendering them either to objects in memory, or to code. Note: We
// consider the process of generating code to be one of *depersisting* the
// object from xml, *not* of persisting the object to code from an object
// in memory. This distinction can be confusing, and should be kept
// in mind when looking at the property streamers and callback interfaces
// listed below.
// ----------------------------------------------------------------------------
// wxObjectWriterCallback
//
// This class will be asked during the streaming-out process about every single
// property or object instance. It can veto streaming out by returning false
// or modify the value before it is streamed-out.
// ----------------------------------------------------------------------------
/*
class WXDLLIMPEXP_BASE wxClassInfo;
class WXDLLIMPEXP_BASE wxAnyList;
class WXDLLIMPEXP_BASE wxPropertyInfo;
class WXDLLIMPEXP_BASE wxAny;
class WXDLLIMPEXP_BASE wxHandlerInfo;
*/
class WXDLLIMPEXP_BASE wxObjectWriter;
class WXDLLIMPEXP_BASE wxObjectReader;
class WXDLLIMPEXP_BASE wxObjectWriterCallback
{
public:
virtual ~wxObjectWriterCallback() {}
// will be called before an object is written, may veto by returning false
virtual bool BeforeWriteObject( wxObjectWriter *WXUNUSED(writer),
const wxObject *WXUNUSED(object),
const wxClassInfo *WXUNUSED(classInfo),
const wxStringToAnyHashMap &WXUNUSED(metadata))
{ return true; }
// will be called after this object has been written, may be
// needed for adjusting stacks
virtual void AfterWriteObject( wxObjectWriter *WXUNUSED(writer),
const wxObject *WXUNUSED(object),
const wxClassInfo *WXUNUSED(classInfo) )
{}
// will be called before a property gets written, may change the value,
// eg replace a concrete wxSize by wxSize( wxDefaultCoord, wxDefaultCoord )
// or veto writing that property at all by returning false
virtual bool BeforeWriteProperty( wxObjectWriter *WXUNUSED(writer),
const wxObject *WXUNUSED(object),
const wxPropertyInfo *WXUNUSED(propInfo),
const wxAny &WXUNUSED(value) )
{ return true; }
// will be called before a property gets written, may change the value,
// eg replace a concrete wxSize by wxSize( wxDefaultCoord, wxDefaultCoord )
// or veto writing that property at all by returning false
virtual bool BeforeWriteProperty( wxObjectWriter *WXUNUSED(writer),
const wxObject *WXUNUSED(object),
const wxPropertyInfo *WXUNUSED(propInfo),
const wxAnyList &WXUNUSED(value) )
{ return true; }
// will be called after a property has been written out, may be needed
// for adjusting stacks
virtual void AfterWriteProperty( wxObjectWriter *WXUNUSED(writer),
const wxPropertyInfo *WXUNUSED(propInfo) )
{}
// will be called before this delegate gets written
virtual bool BeforeWriteDelegate( wxObjectWriter *WXUNUSED(writer),
const wxObject *WXUNUSED(object),
const wxClassInfo* WXUNUSED(classInfo),
const wxPropertyInfo *WXUNUSED(propInfo),
const wxObject *&WXUNUSED(eventSink),
const wxHandlerInfo* &WXUNUSED(handlerInfo) )
{ return true; }
virtual void AfterWriteDelegate( wxObjectWriter *WXUNUSED(writer),
const wxObject *WXUNUSED(object),
const wxClassInfo* WXUNUSED(classInfo),
const wxPropertyInfo *WXUNUSED(propInfo),
const wxObject *&WXUNUSED(eventSink),
const wxHandlerInfo* &WXUNUSED(handlerInfo) )
{ }
};
class WXDLLIMPEXP_BASE wxObjectWriterFunctor: public wxObjectFunctor
{
};
class WXDLLIMPEXP_BASE wxObjectWriter: public wxObject
{
friend class wxObjectWriterFunctor;
public:
wxObjectWriter();
virtual ~wxObjectWriter();
// with this call you start writing out a new top-level object
void WriteObject(const wxObject *object, const wxClassInfo *classInfo,
wxObjectWriterCallback *writercallback, const wxString &name,
const wxStringToAnyHashMap &metadata);
// Managing the object identity table a.k.a context
//
// these methods make sure that no object gets written twice,
// because sometimes multiple calls to the WriteObject will be
// made without wanting to have duplicate objects written, the
// object identity table will be reset manually
virtual void ClearObjectContext();
// gets the object Id for a passed in object in the context
int GetObjectID(const wxObject *obj);
// returns true if this object has already been written in this context
bool IsObjectKnown( const wxObject *obj );
//
// streaming callbacks
//
// these callbacks really write out the values in the stream format
// begins writing out a new toplevel entry which has the indicated unique name
virtual void DoBeginWriteTopLevelEntry( const wxString &name ) = 0;
// ends writing out a new toplevel entry which has the indicated unique name
virtual void DoEndWriteTopLevelEntry( const wxString &name ) = 0;
// start of writing an object having the passed in ID
virtual void DoBeginWriteObject(const wxObject *object, const wxClassInfo *classInfo,
int objectID, const wxStringToAnyHashMap &metadata ) = 0;
// end of writing an toplevel object name param is used for unique
// identification within the container
virtual void DoEndWriteObject(const wxObject *object,
const wxClassInfo *classInfo, int objectID ) = 0;
// writes a simple property in the stream format
virtual void DoWriteSimpleType( const wxAny &value ) = 0;
// start of writing a complex property into the stream (
virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ) = 0;
// end of writing a complex property into the stream
virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ) = 0;
virtual void DoBeginWriteElement() = 0;
virtual void DoEndWriteElement() = 0;
// insert an object reference to an already written object
virtual void DoWriteRepeatedObject( int objectID ) = 0;
// insert a null reference
virtual void DoWriteNullObject() = 0;
// writes a delegate in the stream format
virtual void DoWriteDelegate( const wxObject *object, const wxClassInfo* classInfo,
const wxPropertyInfo *propInfo, const wxObject *eventSink,
int sinkObjectID, const wxClassInfo* eventSinkClassInfo,
const wxHandlerInfo* handlerIndo ) = 0;
void WriteObject(const wxObject *object, const wxClassInfo *classInfo,
wxObjectWriterCallback *writercallback, bool isEmbedded, const wxStringToAnyHashMap &metadata );
protected:
struct wxObjectWriterInternal;
wxObjectWriterInternal* m_data;
struct wxObjectWriterInternalPropertiesData;
void WriteAllProperties( const wxObject * obj, const wxClassInfo* ci,
wxObjectWriterCallback *writercallback,
wxObjectWriterInternalPropertiesData * data );
void WriteOneProperty( const wxObject *obj, const wxClassInfo* ci,
const wxPropertyInfo* pi, wxObjectWriterCallback *writercallback,
wxObjectWriterInternalPropertiesData *data );
void FindConnectEntry(const wxEvtHandler * evSource,
const wxEventSourceTypeInfo* dti, const wxObject* &sink,
const wxHandlerInfo *&handler);
};
/*
Streaming callbacks for depersisting XML to code, or running objects
*/
class WXDLLIMPEXP_BASE wxObjectReaderCallback;
/*
wxObjectReader handles streaming in a class from a arbitrary format.
While walking through it issues calls out to interfaces to readercallback
the guts from the underlying storage format.
*/
class WXDLLIMPEXP_BASE wxObjectReader: public wxObject
{
public:
wxObjectReader();
virtual ~wxObjectReader();
// the only thing wxObjectReader knows about is the class info by object ID
wxClassInfo *GetObjectClassInfo(int objectID);
bool HasObjectClassInfo( int objectID );
void SetObjectClassInfo(int objectID, wxClassInfo* classInfo);
// Reads the component the reader is pointed at from the underlying format.
// The return value is the root object ID, which can
// then be used to ask the depersister about that object
// if there was a problem you will get back wxInvalidObjectID and the current
// error log will carry the problems encoutered
virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback ) = 0;
private:
struct wxObjectReaderInternal;
wxObjectReaderInternal *m_data;
};
// This abstract class matches the allocate-init/create model of creation of objects.
// At runtime, these will create actual instances, and manipulate them.
// When generating code, these will just create statements of C++
// code to create the objects.
class WXDLLIMPEXP_BASE wxObjectReaderCallback
{
public:
virtual ~wxObjectReaderCallback() {}
// allocate the new object on the heap, that object will have the passed in ID
virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
wxStringToAnyHashMap &metadata) = 0;
// initialize the already allocated object having the ID objectID with the Create method
// creation parameters which are objects are having their Ids passed in objectIDValues
// having objectId <> wxInvalidObjectID
virtual void CreateObject(int objectID,
const wxClassInfo *classInfo,
int paramCount,
wxAny *VariantValues,
int *objectIDValues,
const wxClassInfo **objectClassInfos,
wxStringToAnyHashMap &metadata) = 0;
// construct the new object on the heap, that object will have the passed in ID
// (for objects that don't support allocate-create type of creation)
// creation parameters which are objects are having their Ids passed in
// objectIDValues having objectId <> wxInvalidObjectID
virtual void ConstructObject(int objectID,
const wxClassInfo *classInfo,
int paramCount,
wxAny *VariantValues,
int *objectIDValues,
const wxClassInfo **objectClassInfos,
wxStringToAnyHashMap &metadata) = 0;
// destroy the heap-allocated object having the ID objectID, this may be used
// if an object is embedded in another object and set via value semantics,
// so the intermediate object can be destroyed after safely
virtual void DestroyObject(int objectID, wxClassInfo *classInfo) = 0;
// set the corresponding property
virtual void SetProperty(int objectID,
const wxClassInfo *classInfo,
const wxPropertyInfo* propertyInfo,
const wxAny &VariantValue) = 0;
// sets the corresponding property (value is an object)
virtual void SetPropertyAsObject(int objectID,
const wxClassInfo *classInfo,
const wxPropertyInfo* propertyInfo,
int valueObjectId) = 0;
// adds an element to a property collection
virtual void AddToPropertyCollection( int objectID,
const wxClassInfo *classInfo,
const wxPropertyInfo* propertyInfo,
const wxAny &VariantValue) = 0;
// sets the corresponding property (value is an object)
virtual void AddToPropertyCollectionAsObject(int objectID,
const wxClassInfo *classInfo,
const wxPropertyInfo* propertyInfo,
int valueObjectId) = 0;
// sets the corresponding event handler
virtual void SetConnect(int EventSourceObjectID,
const wxClassInfo *EventSourceClassInfo,
const wxPropertyInfo *delegateInfo,
const wxClassInfo *EventSinkClassInfo,
const wxHandlerInfo* handlerInfo,
int EventSinkObjectID ) = 0;
};
/*
wxObjectRuntimeReaderCallback implements the callbacks that will bring back
an object into a life memory instance
*/
class WXDLLIMPEXP_BASE wxObjectRuntimeReaderCallback: public wxObjectReaderCallback
{
struct wxObjectRuntimeReaderCallbackInternal;
wxObjectRuntimeReaderCallbackInternal * m_data;
public:
wxObjectRuntimeReaderCallback();
virtual ~wxObjectRuntimeReaderCallback();
// returns the object having the corresponding ID fully constructed
wxObject *GetObject(int objectID);
// allocate the new object on the heap, that object will have the passed in ID
virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
wxStringToAnyHashMap &metadata);
// initialize the already allocated object having the ID objectID with
// the Create method creation parameters which are objects are having
// their Ids passed in objectIDValues having objectId <> wxInvalidObjectID
virtual void CreateObject(int objectID,
const wxClassInfo *classInfo,
int paramCount,
wxAny *VariantValues,
int *objectIDValues,
const wxClassInfo **objectClassInfos,
wxStringToAnyHashMap &metadata
);
// construct the new object on the heap, that object will have the
// passed in ID (for objects that don't support allocate-create type of
// creation) creation parameters which are objects are having their Ids
// passed in objectIDValues having objectId <> wxInvalidObjectID
virtual void ConstructObject(int objectID,
const wxClassInfo *classInfo,
int paramCount,
wxAny *VariantValues,
int *objectIDValues,
const wxClassInfo **objectClassInfos,
wxStringToAnyHashMap &metadata);
// destroy the heap-allocated object having the ID objectID, this may be
// used if an object is embedded in another object and set via value semantics,
// so the intermediate object can be destroyed after safely
virtual void DestroyObject(int objectID, wxClassInfo *classInfo);
// set the corresponding property
virtual void SetProperty(int objectID,
const wxClassInfo *classInfo,
const wxPropertyInfo* propertyInfo,
const wxAny &variantValue);
// sets the corresponding property (value is an object)
virtual void SetPropertyAsObject(int objectId,
const wxClassInfo *classInfo,
const wxPropertyInfo* propertyInfo,
int valueObjectId);
// adds an element to a property collection
virtual void AddToPropertyCollection( int objectID,
const wxClassInfo *classInfo,
const wxPropertyInfo* propertyInfo,
const wxAny &VariantValue);
// sets the corresponding property (value is an object)
virtual void AddToPropertyCollectionAsObject(int objectID,
const wxClassInfo *classInfo,
const wxPropertyInfo* propertyInfo,
int valueObjectId);
// sets the corresponding event handler
virtual void SetConnect(int eventSourceObjectID,
const wxClassInfo *eventSourceClassInfo,
const wxPropertyInfo *delegateInfo,
const wxClassInfo *eventSinkClassInfo,
const wxHandlerInfo* handlerInfo,
int eventSinkObjectID );
};
#endif // wxUSE_EXTENDED_RTTI
#endif
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/dcprint.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/dcprint.h
// Purpose: wxPrinterDC base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCPRINT_H_BASE_
#define _WX_DCPRINT_H_BASE_
#include "wx/defs.h"
#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 wxOVERRIDE;
protected:
wxPrinterDC(wxDCImpl *impl) : wxDC(impl) { }
private:
wxDECLARE_DYNAMIC_CLASS(wxPrinterDC);
};
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif // _WX_DCPRINT_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/printdlg.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/printdlg.h
// Purpose: Base header and class for print dialogs
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRINTDLG_H_BASE_
#define _WX_PRINTDLG_H_BASE_
#include "wx/defs.h"
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/event.h"
#include "wx/dialog.h"
#include "wx/intl.h"
#include "wx/cmndata.h"
// ---------------------------------------------------------------------------
// wxPrintDialogBase: interface for the dialog for printing
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPrintDialogBase : public wxDialog
{
public:
wxPrintDialogBase() { }
wxPrintDialogBase(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString &title = wxEmptyString,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
virtual wxPrintDialogData& GetPrintDialogData() = 0;
virtual wxPrintData& GetPrintData() = 0;
virtual wxDC *GetPrintDC() = 0;
private:
wxDECLARE_ABSTRACT_CLASS(wxPrintDialogBase);
wxDECLARE_NO_COPY_CLASS(wxPrintDialogBase);
};
// ---------------------------------------------------------------------------
// wxPrintDialog: the dialog for printing.
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPrintDialog : public wxObject
{
public:
wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
wxPrintDialog(wxWindow *parent, wxPrintData* data);
virtual ~wxPrintDialog();
virtual int ShowModal();
virtual wxPrintDialogData& GetPrintDialogData();
virtual wxPrintData& GetPrintData();
virtual wxDC *GetPrintDC();
private:
wxPrintDialogBase *m_pimpl;
private:
wxDECLARE_DYNAMIC_CLASS(wxPrintDialog);
wxDECLARE_NO_COPY_CLASS(wxPrintDialog);
};
// ---------------------------------------------------------------------------
// wxPageSetupDialogBase: interface for the page setup dialog
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPageSetupDialogBase: public wxDialog
{
public:
wxPageSetupDialogBase() { }
wxPageSetupDialogBase(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString &title = wxEmptyString,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
virtual wxPageSetupDialogData& GetPageSetupDialogData() = 0;
private:
wxDECLARE_ABSTRACT_CLASS(wxPageSetupDialogBase);
wxDECLARE_NO_COPY_CLASS(wxPageSetupDialogBase);
};
// ---------------------------------------------------------------------------
// wxPageSetupDialog: the page setup dialog
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPageSetupDialog: public wxObject
{
public:
wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL);
virtual ~wxPageSetupDialog();
int ShowModal();
wxPageSetupDialogData& GetPageSetupDialogData();
// old name
wxPageSetupDialogData& GetPageSetupData();
private:
wxPageSetupDialogBase *m_pimpl;
private:
wxDECLARE_DYNAMIC_CLASS(wxPageSetupDialog);
wxDECLARE_NO_COPY_CLASS(wxPageSetupDialog);
};
#endif
#endif
// _WX_PRINTDLG_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/fs_inet.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/fs_inet.h
// Purpose: HTTP and FTP file system
// Author: Vaclav Slavik
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FS_INET_H_
#define _WX_FS_INET_H_
#include "wx/defs.h"
#if wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS
#include "wx/filesys.h"
// ----------------------------------------------------------------------------
// wxInternetFSHandler
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_NET wxInternetFSHandler : public wxFileSystemHandler
{
public:
virtual bool CanOpen(const wxString& location) wxOVERRIDE;
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE;
};
#endif
// wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS
#endif // _WX_FS_INET_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/config.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/config.h
// Purpose: wxConfig base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CONFIG_H_BASE_
#define _WX_CONFIG_H_BASE_
#include "wx/confbase.h"
#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
#else // either we're under Unix or wish to always use config files
#include "wx/fileconf.h"
#define wxConfig wxFileConfig
#endif
#endif // wxUSE_CONFIG
#endif // _WX_CONFIG_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/confbase.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/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)
// Copyright: (c) 1997 Karsten Ballueder [email protected]
// Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#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;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
/// shall we be case sensitive in parsing variable names?
#ifndef wxCONFIG_CASE_SENSITIVE
#define wxCONFIG_CASE_SENSITIVE 0
#endif
/// separates group and entry names (probably shouldn't be changed)
#ifndef wxCONFIG_PATH_SEPARATOR
#define wxCONFIG_PATH_SEPARATOR wxT('/')
#endif
/// introduces immutable entries
// (i.e. the ones which can't be changed from the local config file)
#ifndef wxCONFIG_IMMUTABLE_PREFIX
#define wxCONFIG_IMMUTABLE_PREFIX wxT('!')
#endif
#if wxUSE_CONFIG
/// 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))
#ifndef wxUSE_CONFIG_NATIVE
#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( __VMS ) && \
!(defined(__HP_aCC) && defined(__hppa))
#define wxHAS_CONFIG_TEMPLATE_RW
#endif
// Style flags for constructor style parameter
enum
{
wxCONFIG_USE_LOCAL_FILE = 1,
wxCONFIG_USE_GLOBAL_FILE = 2,
wxCONFIG_USE_RELATIVE_PATH = 4,
wxCONFIG_USE_NO_ESCAPE_CHARACTERS = 8,
wxCONFIG_USE_SUBDIR = 16
};
// ----------------------------------------------------------------------------
// abstract base class wxConfigBase which defines the interface for derived
// classes
//
// wxConfig organizes the items in a tree-like structure (modelled after the
// Unix/Dos filesystem). There are groups (directories) and keys (files).
// There is always one current group given by the current path.
//
// Keys are pairs "key_name = value" where value may be of string or integer
// (long) type (TODO doubles and other types such as wxDate coming soon).
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxConfigBase : public wxObject
{
public:
// constants
// the type of an entry
enum EntryType
{
Type_Unknown,
Type_String,
Type_Boolean,
Type_Integer, // use Read(long *)
Type_Float // use Read(double *)
};
// static functions
// sets the config object, returns the previous pointer
static wxConfigBase *Set(wxConfigBase *pConfig);
// get the config object, creates it on demand unless DontCreateOnDemand
// was called
static wxConfigBase *Get(bool createOnDemand = true)
{ if ( createOnDemand && (!ms_pConfig) ) Create(); return ms_pConfig; }
// create a new config object: this function will create the "best"
// implementation of wxConfig available for the current platform, see
// comments near definition wxUSE_CONFIG_NATIVE for details. It returns
// the created object and also sets it as ms_pConfig.
static wxConfigBase *Create();
// should Get() try to create a new log object if the current one is NULL?
static void DontCreateOnDemand() { ms_bAutoCreate = false; }
// ctor & virtual dtor
// ctor (can be used as default ctor too)
//
// Not all args will always be used by derived classes, but including
// them all in each class ensures compatibility. If appName is empty,
// uses wxApp name
wxConfigBase(const wxString& appName = wxEmptyString,
const wxString& vendorName = wxEmptyString,
const wxString& localFilename = wxEmptyString,
const wxString& globalFilename = wxEmptyString,
long style = 0);
// empty but ensures that dtor of all derived classes is virtual
virtual ~wxConfigBase();
// path management
// set current path: if the first character is '/', it's the absolute path,
// otherwise it's a relative path. '..' is supported. If the strPath
// doesn't exist it is created.
virtual void SetPath(const wxString& strPath) = 0;
// retrieve the current path (always as absolute path)
virtual const wxString& GetPath() const = 0;
// enumeration: all functions here return false when there are no more items.
// you must pass the same lIndex to GetNext and GetFirst (don't modify it)
// enumerate subgroups
virtual bool GetFirstGroup(wxString& str, long& lIndex) const = 0;
virtual bool GetNextGroup (wxString& str, long& lIndex) const = 0;
// enumerate entries
virtual bool GetFirstEntry(wxString& str, long& lIndex) const = 0;
virtual bool GetNextEntry (wxString& str, long& lIndex) const = 0;
// get number of entries/subgroups in the current group, with or without
// it's subgroups
virtual size_t GetNumberOfEntries(bool bRecursive = false) const = 0;
virtual size_t GetNumberOfGroups(bool bRecursive = false) const = 0;
// tests of existence
// returns true if the group by this name exists
virtual bool HasGroup(const wxString& strName) const = 0;
// same as above, but for an entry
virtual bool HasEntry(const wxString& strName) const = 0;
// returns true if either a group or an entry with a given name exist
bool Exists(const wxString& strName) const
{ return HasGroup(strName) || HasEntry(strName); }
// get the entry type
virtual EntryType GetEntryType(const wxString& name) const
{
// by default all entries are strings
return HasEntry(name) ? Type_String : Type_Unknown;
}
// key access: returns true if value was really read, false if default used
// (and if the key is not found the default value is returned.)
// read a string from the key
bool Read(const wxString& key, wxString *pStr) const;
bool Read(const wxString& key, wxString *pStr, const wxString& defVal) const;
// read a number (long)
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)
bool Read(const wxString& key, int *pi) const;
bool Read(const wxString& key, int *pi, int defVal) const;
// read a double
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
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 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)
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, 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)
{ 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 under OpenVMS
#if !defined( __VMS )
// 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;
// renaming, all functions return false on failure (probably because the new
// name is already taken by an existing entry)
// rename an entry
virtual bool RenameEntry(const wxString& oldName,
const wxString& newName) = 0;
// rename a group
virtual bool RenameGroup(const wxString& oldName,
const wxString& newName) = 0;
// delete entries/groups
// deletes the specified entry and the group it belongs to if
// it was the last key in it and the second parameter is true
virtual bool DeleteEntry(const wxString& key,
bool bDeleteGroupIfEmpty = true) = 0;
// delete the group (with all subgroups)
virtual bool DeleteGroup(const wxString& key) = 0;
// delete the whole underlying object (disk file, registry key, ...)
// primarily for use by uninstallation routine.
virtual bool DeleteAll() = 0;
// options
// we can automatically expand environment variables in the config entries
// (this option is on by default, you can turn it on/off at any time)
bool IsExpandingEnvVars() const { return m_bExpandEnvVars; }
void SetExpandEnvVars(bool bDoIt = true) { m_bExpandEnvVars = bDoIt; }
// recording of default values
void SetRecordDefaults(bool bDoIt = true) { m_bRecordDefaults = bDoIt; }
bool IsRecordingDefaults() const { return m_bRecordDefaults; }
// does expansion only if needed
wxString ExpandEnvVars(const wxString& str) const;
// misc accessors
wxString GetAppName() const { return m_appName; }
wxString GetVendorName() const { return m_vendorName; }
// Used wxIniConfig to set members in constructor
void SetAppName(const wxString& appName) { m_appName = appName; }
void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
void SetStyle(long style) { m_style = style; }
long GetStyle() const { return m_style; }
protected:
static bool IsImmutable(const wxString& key)
{ return !key.IsEmpty() && key[0] == wxCONFIG_IMMUTABLE_PREFIX; }
// return the path without trailing separator, if any: this should be called
// to sanitize paths referring to the group names before passing them to
// wxConfigPathChanger as "/foo/bar/" should be the same as "/foo/bar" and it
// isn't interpreted in the same way by it (and this can't be changed there
// as it's not the same for the entries names)
static wxString RemoveTrailingSeparator(const wxString& key);
// 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 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 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?
bool m_bExpandEnvVars;
// do we record default values?
bool m_bRecordDefaults;
// static variables
static wxConfigBase *ms_pConfig;
static bool ms_bAutoCreate;
// Application name and organisation name
wxString m_appName;
wxString m_vendorName;
// Style flag
long m_style;
wxDECLARE_ABSTRACT_CLASS(wxConfigBase);
};
// a handy little class which changes current path to the path of given entry
// and restores it in dtor: so if you declare a local variable of this type,
// you work in the entry directory and the path is automatically restored
// when the function returns
// Taken out of wxConfig since not all compilers can cope with nested classes.
class WXDLLIMPEXP_BASE wxConfigPathChanger
{
public:
// ctor/dtor do path changing/restoring of the path
wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry);
~wxConfigPathChanger();
// get the key name
const wxString& Name() const { return m_strName; }
// this method must be called if the original path (i.e. the current path at
// the moment of creation of this object) could have been deleted to prevent
// us from restoring the not existing (any more) path
//
// if the original path doesn't exist any more, the path will be restored to
// the deepest still existing component of the old path
void UpdateIfDeleted();
private:
wxConfigBase *m_pContainer; // object we live in
wxString m_strName, // name of entry (i.e. name only)
m_strOldPath; // saved path
bool m_bChanged; // was the path changed?
wxDECLARE_NO_COPY_CLASS(wxConfigPathChanger);
};
#endif // wxUSE_CONFIG
/*
Replace environment variables ($SOMETHING) with their values. The format is
$VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and
'_' only. '$' must be escaped ('\$') in order to be taken literally.
*/
WXDLLIMPEXP_BASE wxString wxExpandEnvVars(const wxString &sz);
/*
Split path into parts removing '..' in progress
*/
WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxString& path);
#endif // _WX_CONFBASE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/pickerbase.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/pickerbase.h
// Purpose: wxPickerBase definition
// Author: Francesco Montorsi (based on Vadim Zeitlin's code)
// Modified by:
// Created: 14/4/2006
// Copyright: (c) Vadim Zeitlin, Francesco Montorsi
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PICKERBASE_H_BASE_
#define _WX_PICKERBASE_H_BASE_
#include "wx/control.h"
#include "wx/sizer.h"
#include "wx/containr.h"
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
class WXDLLIMPEXP_FWD_CORE wxToolTip;
extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[];
// ----------------------------------------------------------------------------
// wxPickerBase is the base class for the picker controls which support
// a wxPB_USE_TEXTCTRL style; i.e. for those pickers which can use an auxiliary
// text control next to the 'real' picker.
//
// The wxTextPickerHelper class manages enabled/disabled state of the text control,
// its sizing and positioning.
// ----------------------------------------------------------------------------
#define wxPB_USE_TEXTCTRL 0x0002
#define wxPB_SMALL 0x8000
class WXDLLIMPEXP_CORE wxPickerBase : public wxNavigationEnabled<wxControl>
{
public:
// ctor: text is the associated text control
wxPickerBase() : m_text(NULL), m_picker(NULL), m_sizer(NULL)
{ }
virtual ~wxPickerBase() {}
// if present, intercepts wxPB_USE_TEXTCTRL style and creates the text control
// The 3rd argument is the initial wxString to display in the text control
bool CreateBase(wxWindow *parent,
wxWindowID id,
const wxString& text = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
public: // public API
// margin between the text control and the picker
void SetInternalMargin(int newmargin)
{ GetTextCtrlItem()->SetBorder(newmargin); m_sizer->Layout(); }
int GetInternalMargin() const
{ return GetTextCtrlItem()->GetBorder(); }
// proportion of the text control
void SetTextCtrlProportion(int prop)
{ GetTextCtrlItem()->SetProportion(prop); m_sizer->Layout(); }
int GetTextCtrlProportion() const
{ return GetTextCtrlItem()->GetProportion(); }
// proportion of the picker control
void SetPickerCtrlProportion(int prop)
{ GetPickerCtrlItem()->SetProportion(prop); m_sizer->Layout(); }
int GetPickerCtrlProportion() const
{ return GetPickerCtrlItem()->GetProportion(); }
bool IsTextCtrlGrowable() const
{ return (GetTextCtrlItem()->GetFlag() & wxGROW) != 0; }
void SetTextCtrlGrowable(bool grow = true)
{
DoSetGrowableFlagFor(GetTextCtrlItem(), grow);
}
bool IsPickerCtrlGrowable() const
{ return (GetPickerCtrlItem()->GetFlag() & wxGROW) != 0; }
void SetPickerCtrlGrowable(bool grow = true)
{
DoSetGrowableFlagFor(GetPickerCtrlItem(), grow);
}
bool HasTextCtrl() const
{ return m_text != NULL; }
wxTextCtrl *GetTextCtrl()
{ return m_text; }
wxControl *GetPickerCtrl()
{ return m_picker; }
void SetTextCtrl(wxTextCtrl* text)
{ m_text = text; }
void SetPickerCtrl(wxControl* picker)
{ m_picker = picker; }
// methods that derived class must/may override
virtual void UpdatePickerFromTextCtrl() = 0;
virtual void UpdateTextCtrlFromPicker() = 0;
protected:
// overridden base class methods
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip(wxToolTip *tip) wxOVERRIDE;
#endif // wxUSE_TOOLTIPS
// event handlers
void OnTextCtrlDelete(wxWindowDestroyEvent &);
void OnTextCtrlUpdate(wxCommandEvent &);
void OnTextCtrlKillFocus(wxFocusEvent &);
// returns the set of styles for the attached wxTextCtrl
// from given wxPickerBase's styles
virtual long GetTextCtrlStyle(long style) const
{ return (style & wxWINDOW_STYLE_MASK); }
// returns the set of styles for the m_picker
virtual long GetPickerStyle(long style) const
{ return (style & wxWINDOW_STYLE_MASK); }
wxSizerItem *GetPickerCtrlItem() const
{
if (this->HasTextCtrl())
return m_sizer->GetItem((size_t)1);
return m_sizer->GetItem((size_t)0);
}
wxSizerItem *GetTextCtrlItem() const
{
wxASSERT(this->HasTextCtrl());
return m_sizer->GetItem((size_t)0);
}
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED_MSG("useless and will be removed in the future")
int GetDefaultPickerCtrlFlag() const
{
return wxALIGN_CENTER_VERTICAL;
}
wxDEPRECATED_MSG("useless and will be removed in the future")
int GetDefaultTextCtrlFlag() const
{
return wxALIGN_CENTER_VERTICAL | wxRIGHT;
}
#endif // WXWIN_COMPATIBILITY_3_0
void PostCreation();
protected:
wxTextCtrl *m_text; // can be NULL
wxControl *m_picker;
wxBoxSizer *m_sizer;
private:
// Common implementation of Set{Text,Picker}CtrlGrowable().
void DoSetGrowableFlagFor(wxSizerItem* item, bool grow);
wxDECLARE_ABSTRACT_CLASS(wxPickerBase);
};
#endif
// _WX_PICKERBASE_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/mimetype.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/mimetype.h
// Purpose: classes and functions to manage MIME types
// Author: Vadim Zeitlin
// Modified by:
// Chris Elliott ([email protected]) 5 Dec 00: write support for Win32
// Created: 23.09.98
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence (part of wxExtra library)
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MIMETYPE_H_
#define _WX_MIMETYPE_H_
// ----------------------------------------------------------------------------
// headers and such
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_MIMETYPE
// the things we really need
#include "wx/string.h"
#include "wx/dynarray.h"
#include "wx/arrstr.h"
#include <stdarg.h>
// fwd decls
class WXDLLIMPEXP_FWD_BASE wxIconLocation;
class WXDLLIMPEXP_FWD_BASE wxFileTypeImpl;
class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl;
// these constants define the MIME informations source under UNIX and are used
// by wxMimeTypesManager::Initialize()
enum wxMailcapStyle
{
wxMAILCAP_STANDARD = 1,
wxMAILCAP_NETSCAPE = 2,
wxMAILCAP_KDE = 4,
wxMAILCAP_GNOME = 8,
wxMAILCAP_ALL = 15
};
/*
TODO: would it be more convenient to have this class?
class WXDLLIMPEXP_BASE wxMimeType : public wxString
{
public:
// all string ctors here
wxString GetType() const { return BeforeFirst(wxT('/')); }
wxString GetSubType() const { return AfterFirst(wxT('/')); }
void SetSubType(const wxString& subtype)
{
*this = GetType() + wxT('/') + subtype;
}
bool Matches(const wxMimeType& wildcard)
{
// implement using wxMimeTypesManager::IsOfType()
}
};
*/
// wxMimeTypeCommands stores the verbs defined for the given MIME type with
// their values
class WXDLLIMPEXP_BASE wxMimeTypeCommands
{
public:
wxMimeTypeCommands() {}
wxMimeTypeCommands(const wxArrayString& verbs,
const wxArrayString& commands)
: m_verbs(verbs),
m_commands(commands)
{
}
// add a new verb with the command or replace the old value
void AddOrReplaceVerb(const wxString& verb, const wxString& cmd);
void Add(const wxString& s)
{
m_verbs.Add(s.BeforeFirst(wxT('=')));
m_commands.Add(s.AfterFirst(wxT('=')));
}
// access the commands
size_t GetCount() const { return m_verbs.GetCount(); }
const wxString& GetVerb(size_t n) const { return m_verbs[n]; }
const wxString& GetCmd(size_t n) const { return m_commands[n]; }
bool HasVerb(const wxString& verb) const
{ return m_verbs.Index(verb) != wxNOT_FOUND; }
// returns empty string and wxNOT_FOUND in idx if no such verb
wxString GetCommandForVerb(const wxString& verb, size_t *idx = NULL) const;
// get a "verb=command" string
wxString GetVerbCmd(size_t n) const;
private:
wxArrayString m_verbs;
wxArrayString m_commands;
};
// ----------------------------------------------------------------------------
// wxFileTypeInfo: static container of information accessed via wxFileType.
//
// This class is used with wxMimeTypesManager::AddFallbacks() and Associate()
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxFileTypeInfo
{
private:
void DoVarArgInit(const wxString& mimeType,
const wxString& openCmd,
const wxString& printCmd,
const wxString& desc,
va_list argptr);
void VarArgInit(const wxString *mimeType,
const wxString *openCmd,
const wxString *printCmd,
const wxString *desc,
// the other parameters form a NULL terminated list of
// extensions
...);
public:
// NB: This is a helper to get implicit conversion of variadic ctor's
// fixed arguments into something that can be passed to VarArgInit().
// Do not use, it's used by the ctor only.
struct CtorString
{
CtorString(const char *str) : m_str(str) {}
CtorString(const wchar_t *str) : m_str(str) {}
CtorString(const wxString& str) : m_str(str) {}
CtorString(const wxCStrData& str) : m_str(str) {}
CtorString(const wxScopedCharBuffer& str) : m_str(str) {}
CtorString(const wxScopedWCharBuffer& str) : m_str(str) {}
operator const wxString*() const { return &m_str; }
wxString m_str;
};
// ctors
// Ctor specifying just the MIME type (which is mandatory), the other
// fields can be set later if needed.
wxFileTypeInfo(const wxString& mimeType)
: m_mimeType(mimeType)
{
}
// Ctor allowing to specify the values of all fields at once:
//
// wxFileTypeInfo(const wxString& mimeType,
// const wxString& openCmd,
// const wxString& printCmd,
// const wxString& desc,
// // the other parameters form a list of extensions for this
// // file type and should be terminated with wxNullPtr (not
// // just NULL!)
// ...);
WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo,
4, (const CtorString&,
const CtorString&,
const CtorString&,
const CtorString&),
VarArgInit, VarArgInit)
// the array elements correspond to the parameters of the ctor above in
// the same order
wxFileTypeInfo(const wxArrayString& sArray);
// invalid item - use this to terminate the array passed to
// wxMimeTypesManager::AddFallbacks
wxFileTypeInfo() { }
// test if this object can be used
bool IsValid() const { return !m_mimeType.empty(); }
// setters
// set the open/print commands
void SetOpenCommand(const wxString& command) { m_openCmd = command; }
void SetPrintCommand(const wxString& command) { m_printCmd = command; }
// set the description
void SetDescription(const wxString& desc) { m_desc = desc; }
// add another extension corresponding to this file type
void AddExtension(const wxString& ext) { m_exts.push_back(ext); }
// set the icon info
void SetIcon(const wxString& iconFile, int iconIndex = 0)
{
m_iconFile = iconFile;
m_iconIndex = iconIndex;
}
// set the short desc
void SetShortDesc(const wxString& shortDesc) { m_shortDesc = shortDesc; }
// accessors
// get the MIME type
const wxString& GetMimeType() const { return m_mimeType; }
// get the open command
const wxString& GetOpenCommand() const { return m_openCmd; }
// get the print command
const wxString& GetPrintCommand() const { return m_printCmd; }
// get the short description (only used under Win32 so far)
const wxString& GetShortDesc() const { return m_shortDesc; }
// get the long, user visible description
const wxString& GetDescription() const { return m_desc; }
// get the array of all extensions
const wxArrayString& GetExtensions() const { return m_exts; }
size_t GetExtensionsCount() const {return m_exts.GetCount(); }
// get the icon info
const wxString& GetIconFile() const { return m_iconFile; }
int GetIconIndex() const { return m_iconIndex; }
private:
wxString m_mimeType, // the MIME type in "type/subtype" form
m_openCmd, // command to use for opening the file (%s allowed)
m_printCmd, // command to use for printing the file (%s allowed)
m_shortDesc, // a short string used in the registry
m_desc; // a free form description of this file type
// icon stuff
wxString m_iconFile; // the file containing the icon
int m_iconIndex; // icon index in this file
wxArrayString m_exts; // the extensions which are mapped on this filetype
#if 0 // TODO
// the additional (except "open" and "print") command names and values
wxArrayString m_commandNames,
m_commandValues;
#endif // 0
};
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxFileTypeInfo, wxArrayFileTypeInfo,
WXDLLIMPEXP_BASE);
// ----------------------------------------------------------------------------
// wxFileType: gives access to all information about the files of given type.
//
// This class holds information about a given "file type". File type is the
// same as MIME type under Unix, but under Windows it corresponds more to an
// extension than to MIME type (in fact, several extensions may correspond to a
// file type). This object may be created in many different ways and depending
// on how it was created some fields may be unknown so the return value of all
// the accessors *must* be checked!
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxFileType
{
friend class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl; // it has access to m_impl
public:
// An object of this class must be passed to Get{Open|Print}Command. The
// default implementation is trivial and doesn't know anything at all about
// parameters, only filename and MIME type are used (so it's probably ok for
// Windows where %{param} is not used anyhow)
class MessageParameters
{
public:
// ctors
MessageParameters() { }
MessageParameters(const wxString& filename,
const wxString& mimetype = wxEmptyString)
: m_filename(filename), m_mimetype(mimetype) { }
// accessors (called by GetOpenCommand)
// filename
const wxString& GetFileName() const { return m_filename; }
// mime type
const wxString& GetMimeType() const { return m_mimetype; }
// override this function in derived class
virtual wxString GetParamValue(const wxString& WXUNUSED(name)) const
{ return wxEmptyString; }
// virtual dtor as in any base class
virtual ~MessageParameters() { }
protected:
wxString m_filename, m_mimetype;
};
// ctor from static data
wxFileType(const wxFileTypeInfo& ftInfo);
// accessors: all of them return true if the corresponding information
// could be retrieved/found, false otherwise (and in this case all [out]
// parameters are unchanged)
// return the MIME type for this file type
bool GetMimeType(wxString *mimeType) const;
bool GetMimeTypes(wxArrayString& mimeTypes) const;
// fill passed in array with all extensions associated with this file
// type
bool GetExtensions(wxArrayString& extensions);
// get the icon corresponding to this file type and of the given size
bool GetIcon(wxIconLocation *iconloc) const;
bool GetIcon(wxIconLocation *iconloc,
const MessageParameters& params) const;
// get a brief file type description ("*.txt" => "text document")
bool GetDescription(wxString *desc) const;
// get the command to be used to open/print the given file.
// get the command to execute the file of given type
bool GetOpenCommand(wxString *openCmd,
const MessageParameters& params) const;
// a simpler to use version of GetOpenCommand() -- it only takes the
// filename and returns an empty string on failure
wxString GetOpenCommand(const wxString& filename) const;
// get the command to print the file of given type
bool GetPrintCommand(wxString *printCmd,
const MessageParameters& params) const;
// return the number of commands defined for this file type, 0 if none
size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands,
const wxFileType::MessageParameters& params) const;
// set an arbitrary command, ask confirmation if it already exists and
// overwriteprompt is true
bool SetCommand(const wxString& cmd, const wxString& verb,
bool overwriteprompt = true);
bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0);
// remove the association for this filetype from the system MIME database:
// notice that it will only work if the association is defined in the user
// file/registry part, we will never modify the system-wide settings
bool Unassociate();
// operations
// expand a string in the format of GetOpenCommand (which may contain
// '%s' and '%t' format specifiers for the file name and mime type
// and %{param} constructions).
static wxString ExpandCommand(const wxString& command,
const MessageParameters& params);
// dtor (not virtual, shouldn't be derived from)
~wxFileType();
wxString
GetExpandedCommand(const wxString& verb,
const wxFileType::MessageParameters& params) const;
private:
// default ctor is private because the user code never creates us
wxFileType();
// no copy ctor/assignment operator
wxFileType(const wxFileType&);
wxFileType& operator=(const wxFileType&);
// the static container of wxFileType data: if it's not NULL, it means that
// this object is used as fallback only
const wxFileTypeInfo *m_info;
// the object which implements the real stuff like reading and writing
// to/from system MIME database
wxFileTypeImpl *m_impl;
};
//----------------------------------------------------------------------------
// wxMimeTypesManagerFactory
//----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMimeTypesManagerFactory
{
public:
wxMimeTypesManagerFactory() {}
virtual ~wxMimeTypesManagerFactory() {}
virtual wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl();
static void Set( wxMimeTypesManagerFactory *factory );
static wxMimeTypesManagerFactory *Get();
private:
static wxMimeTypesManagerFactory *m_factory;
};
// ----------------------------------------------------------------------------
// wxMimeTypesManager: interface to system MIME database.
//
// This class accesses the information about all known MIME types and allows
// the application to retrieve information (including how to handle data of
// given type) about them.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMimeTypesManager
{
public:
// static helper functions
// -----------------------
// check if the given MIME type is the same as the other one: the
// second argument may contain wildcards ('*'), but not the first. If
// the types are equal or if the mimeType matches wildcard the function
// returns true, otherwise it returns false
static bool IsOfType(const wxString& mimeType, const wxString& wildcard);
// ctor
wxMimeTypesManager();
// NB: the following 2 functions are for Unix only and don't do anything
// elsewhere
// loads data from standard files according to the mailcap styles
// specified: this is a bitwise OR of wxMailcapStyle values
//
// use the extraDir parameter if you want to look for files in another
// directory
void Initialize(int mailcapStyle = wxMAILCAP_ALL,
const wxString& extraDir = wxEmptyString);
// and this function clears all the data from the manager
void ClearData();
// Database lookup: all functions return a pointer to wxFileType object
// whose methods may be used to query it for the information you're
// interested in. If the return value is !NULL, caller is responsible for
// deleting it.
// get file type from file extension
wxFileType *GetFileTypeFromExtension(const wxString& ext);
// get file type from MIME type (in format <category>/<format>)
wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
// enumerate all known MIME types
//
// returns the number of retrieved file types
size_t EnumAllFileTypes(wxArrayString& mimetypes);
// these functions can be used to provide default values for some of the
// MIME types inside the program itself
//
// The filetypes array should be terminated by either NULL entry or an
// invalid wxFileTypeInfo (i.e. the one created with default ctor)
void AddFallbacks(const wxFileTypeInfo *filetypes);
void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
// create or remove associations
// create a new association using the fields of wxFileTypeInfo (at least
// the MIME type and the extension should be set)
// if the other fields are empty, the existing values should be left alone
wxFileType *Associate(const wxFileTypeInfo& ftInfo);
// undo Associate()
bool Unassociate(wxFileType *ft) ;
// dtor (not virtual, shouldn't be derived from)
~wxMimeTypesManager();
private:
// no copy ctor/assignment operator
wxMimeTypesManager(const wxMimeTypesManager&);
wxMimeTypesManager& operator=(const wxMimeTypesManager&);
// the fallback info which is used if the information is not found in the
// real system database
wxArrayFileTypeInfo m_fallbacks;
// the object working with the system MIME database
wxMimeTypesManagerImpl *m_impl;
// if m_impl is NULL, create one
void EnsureImpl();
friend class wxMimeTypeCmnModule;
};
// ----------------------------------------------------------------------------
// global variables
// ----------------------------------------------------------------------------
// the default mime manager for wxWidgets programs
extern WXDLLIMPEXP_DATA_BASE(wxMimeTypesManager *) wxTheMimeTypesManager;
#endif // wxUSE_MIMETYPE
#endif
//_WX_MIMETYPE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/colordlg.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/colordlg.h
// Purpose: wxColourDialog
// Author: Vadim Zeitlin
// Modified by:
// Created: 01/02/97
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLORDLG_H_BASE_
#define _WX_COLORDLG_H_BASE_
#include "wx/defs.h"
#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"
#elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/colordlg.h"
#elif defined(__WXQT__)
#include "wx/qt/colordlg.h"
#else
#include "wx/generic/colrdlgg.h"
#define wxColourDialog wxGenericColourDialog
#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);
#endif // wxUSE_COLOURDLG
#endif
// _WX_COLORDLG_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/button.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/button.h
// Purpose: wxButtonBase class
// Author: Vadim Zeitlin
// Modified by:
// Created: 15.08.00
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BUTTON_H_BASE_
#define _WX_BUTTON_H_BASE_
#include "wx/defs.h"
#if wxUSE_BUTTON
#include "wx/anybutton.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[];
// ----------------------------------------------------------------------------
// wxButton: a push button
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxButtonBase : public wxAnyButton
{
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(); }
// make this button the default button in its top level window
//
// returns the old default item (possibly NULL)
virtual wxWindow *SetDefault();
// returns the default button size for this platform
static wxSize GetDefaultSize();
protected:
wxDECLARE_NO_COPY_CLASS(wxButtonBase);
};
#if defined(__WXUNIVERSAL__)
#include "wx/univ/button.h"
#elif defined(__WXMSW__)
#include "wx/msw/button.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/button.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/button.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/button.h"
#elif defined(__WXMAC__)
#include "wx/osx/button.h"
#elif defined(__WXQT__)
#include "wx/qt/button.h"
#endif
#endif // wxUSE_BUTTON
#endif // _WX_BUTTON_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/scopedptr.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/scopedptr.h
// Purpose: scoped smart pointer class
// Author: Jesse Lovelace <[email protected]>
// Created: 06/01/02
// Copyright: (c) Jesse Lovelace and original Boost authors (see below)
// (c) 2009 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// This class closely follows the implementation of the boost
// library scoped_ptr and is an adaptation for c++ macro's in
// the wxWidgets project. The original authors of the boost
// scoped_ptr are given below with their respective copyrights.
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
// Copyright (c) 2001, 2002 Peter Dimov
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
// See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation.
//
#ifndef _WX_SCOPED_PTR_H_
#define _WX_SCOPED_PTR_H_
#include "wx/defs.h"
#include "wx/checkeddelete.h"
// ----------------------------------------------------------------------------
// wxScopedPtr: A scoped pointer
// ----------------------------------------------------------------------------
template <class T>
class wxScopedPtr
{
public:
typedef T element_type;
explicit wxScopedPtr(T * ptr = NULL) : m_ptr(ptr) { }
~wxScopedPtr() { wxCHECKED_DELETE(m_ptr); }
// test for pointer validity: defining conversion to unspecified_bool_type
// and not more obvious bool to avoid implicit conversions to integer types
#ifdef __BORLANDC__
// this compiler is too dumb to use unspecified_bool_type operator in tests
// of the form "if ( !ptr )"
typedef bool unspecified_bool_type;
#else
typedef T *(wxScopedPtr<T>::*unspecified_bool_type)() const;
#endif // __BORLANDC__
operator unspecified_bool_type() const
{
return m_ptr ? &wxScopedPtr<T>::get : NULL;
}
void reset(T * ptr = NULL)
{
if ( ptr != m_ptr )
{
wxCHECKED_DELETE(m_ptr);
m_ptr = ptr;
}
}
T *release()
{
T *ptr = m_ptr;
m_ptr = NULL;
return ptr;
}
T & operator*() const
{
wxASSERT(m_ptr != NULL);
return *m_ptr;
}
T * operator->() const
{
wxASSERT(m_ptr != NULL);
return m_ptr;
}
T * get() const
{
return m_ptr;
}
void swap(wxScopedPtr& other)
{
T * const tmp = other.m_ptr;
other.m_ptr = m_ptr;
m_ptr = tmp;
}
private:
T * m_ptr;
wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedPtr, T);
};
// ----------------------------------------------------------------------------
// old macro based implementation
// ----------------------------------------------------------------------------
/* The type being used *must* be complete at the time
that wxDEFINE_SCOPED_* is called or a compiler error will result.
This is because the class checks for the completeness of the type
being used. */
#define wxDECLARE_SCOPED_PTR(T, name) \
class name \
{ \
private: \
T * m_ptr; \
\
name(name const &); \
name & operator=(name const &); \
\
public: \
explicit name(T * ptr = NULL) \
: m_ptr(ptr) { } \
\
~name(); \
\
void reset(T * ptr = NULL); \
\
T *release() \
{ \
T *ptr = m_ptr; \
m_ptr = NULL; \
return ptr; \
} \
\
T & operator*() const \
{ \
wxASSERT(m_ptr != NULL); \
return *m_ptr; \
} \
\
T * operator->() const \
{ \
wxASSERT(m_ptr != NULL); \
return m_ptr; \
} \
\
T * get() const \
{ \
return m_ptr; \
} \
\
void swap(name & ot) \
{ \
T * tmp = ot.m_ptr; \
ot.m_ptr = m_ptr; \
m_ptr = tmp; \
} \
};
#define wxDEFINE_SCOPED_PTR(T, name)\
void name::reset(T * ptr) \
{ \
if (m_ptr != ptr) \
{ \
wxCHECKED_DELETE(m_ptr); \
m_ptr = ptr; \
} \
} \
name::~name() \
{ \
wxCHECKED_DELETE(m_ptr); \
}
// this macro can be used for the most common case when you want to declare and
// define the scoped pointer at the same time and want to use the standard
// naming convention: auto pointer to Foo is called FooPtr
#define wxDEFINE_SCOPED_PTR_TYPE(T) \
wxDECLARE_SCOPED_PTR(T, T ## Ptr) \
wxDEFINE_SCOPED_PTR(T, T ## Ptr)
// ----------------------------------------------------------------------------
// "Tied" scoped pointer: same as normal one but also sets the value of
// some other variable to the pointer value
// ----------------------------------------------------------------------------
#define wxDEFINE_TIED_SCOPED_PTR_TYPE(T) \
wxDEFINE_SCOPED_PTR_TYPE(T) \
class T ## TiedPtr : public T ## Ptr \
{ \
public: \
T ## TiedPtr(T **pp, T *p) \
: T ## Ptr(p), m_pp(pp) \
{ \
m_pOld = *pp; \
*pp = p; \
} \
\
~ T ## TiedPtr() \
{ \
*m_pp = m_pOld; \
} \
\
private: \
T **m_pp; \
T *m_pOld; \
};
#endif // _WX_SCOPED_PTR_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/treectrl.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/treectrl.h
// Purpose: wxTreeCtrl base header
// Author: Karsten Ballueder
// Modified by:
// Created:
// Copyright: (c) Karsten Ballueder
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TREECTRL_H_BASE_
#define _WX_TREECTRL_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_TREECTRL
#include "wx/control.h"
#include "wx/treebase.h"
#include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through wxCLASSINFO macro
#include "wx/systhemectrl.h"
class WXDLLIMPEXP_FWD_CORE wxImageList;
#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__)
#define wxHAS_GENERIC_TREECTRL
#endif
// ----------------------------------------------------------------------------
// wxTreeCtrlBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTreeCtrlBase : public wxSystemThemedControl<wxControl>
{
public:
wxTreeCtrlBase();
virtual ~wxTreeCtrlBase();
// accessors
// ---------
// get the total number of items in the control
virtual unsigned int GetCount() const = 0;
// indent is the number of pixels the children are indented relative to
// the parents position. SetIndent() also redraws the control
// immediately.
virtual unsigned int GetIndent() const = 0;
virtual void SetIndent(unsigned int indent) = 0;
// spacing is the number of pixels between the start and the Text
// (has no effect under wxMSW)
unsigned int GetSpacing() const { return m_spacing; }
void SetSpacing(unsigned int spacing) { m_spacing = spacing; }
// image list: these functions allow to associate an image list with
// the control and retrieve it. Note that the control does _not_ delete
// the associated image list when it's deleted in order to allow image
// lists to be shared between different controls.
//
// The normal image list is for the icons which correspond to the
// normal tree item state (whether it is selected or not).
// Additionally, the application might choose to show a state icon
// which corresponds to an app-defined item state (for example,
// checked/unchecked) which are taken from the state image list.
wxImageList *GetImageList() const { return m_imageListNormal; }
wxImageList *GetStateImageList() const { return m_imageListState; }
virtual void SetImageList(wxImageList *imageList) = 0;
virtual void SetStateImageList(wxImageList *imageList) = 0;
void AssignImageList(wxImageList *imageList)
{
SetImageList(imageList);
m_ownsImageListNormal = true;
}
void AssignStateImageList(wxImageList *imageList)
{
SetStateImageList(imageList);
m_ownsImageListState = true;
}
// Functions to work with tree ctrl items. Unfortunately, they can _not_ be
// member functions of wxTreeItem because they must know the tree the item
// belongs to for Windows implementation and storing the pointer to
// wxTreeCtrl in each wxTreeItem is just too much waste.
// accessors
// ---------
// retrieve items label
virtual wxString GetItemText(const wxTreeItemId& item) const = 0;
// get one of the images associated with the item (normal by default)
virtual int GetItemImage(const wxTreeItemId& item,
wxTreeItemIcon which = wxTreeItemIcon_Normal) const = 0;
// get the data associated with the item
virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const = 0;
// get the item's text colour
virtual wxColour GetItemTextColour(const wxTreeItemId& item) const = 0;
// get the item's background colour
virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const = 0;
// get the item's font
virtual wxFont GetItemFont(const wxTreeItemId& item) const = 0;
// get the items state
int GetItemState(const wxTreeItemId& item) const
{
return DoGetItemState(item);
}
// modifiers
// ---------
// set items label
virtual void SetItemText(const wxTreeItemId& item, const wxString& text) = 0;
// set one of the images associated with the item (normal by default)
virtual void SetItemImage(const wxTreeItemId& item,
int image,
wxTreeItemIcon which = wxTreeItemIcon_Normal) = 0;
// associate some data with the item
virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) = 0;
// force appearance of [+] button near the item. This is useful to
// allow the user to expand the items which don't have any children now
// - but instead add them only when needed, thus minimizing memory
// usage and loading time.
virtual void SetItemHasChildren(const wxTreeItemId& item,
bool has = true) = 0;
// the item will be shown in bold
virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) = 0;
// the item will be shown with a drop highlight
virtual void SetItemDropHighlight(const wxTreeItemId& item,
bool highlight = true) = 0;
// set the items text colour
virtual void SetItemTextColour(const wxTreeItemId& item,
const wxColour& col) = 0;
// set the items background colour
virtual void SetItemBackgroundColour(const wxTreeItemId& item,
const wxColour& col) = 0;
// set the items font (should be of the same height for all items)
virtual void SetItemFont(const wxTreeItemId& item,
const wxFont& font) = 0;
// set the items state (special state values: wxTREE_ITEMSTATE_NONE/NEXT/PREV)
void SetItemState(const wxTreeItemId& item, int state);
// item status inquiries
// ---------------------
// is the item visible (it might be outside the view or not expanded)?
virtual bool IsVisible(const wxTreeItemId& item) const = 0;
// does the item has any children?
virtual bool ItemHasChildren(const wxTreeItemId& item) const = 0;
// same as above
bool HasChildren(const wxTreeItemId& item) const
{ return ItemHasChildren(item); }
// is the item expanded (only makes sense if HasChildren())?
virtual bool IsExpanded(const wxTreeItemId& item) const = 0;
// is this item currently selected (the same as has focus)?
virtual bool IsSelected(const wxTreeItemId& item) const = 0;
// is item text in bold font?
virtual bool IsBold(const wxTreeItemId& item) const = 0;
// is the control empty?
bool IsEmpty() const;
// number of children
// ------------------
// if 'recursively' is false, only immediate children count, otherwise
// the returned number is the number of all items in this branch
virtual size_t GetChildrenCount(const wxTreeItemId& item,
bool recursively = true) const = 0;
// navigation
// ----------
// wxTreeItemId.IsOk() will return false if there is no such item
// get the root tree item
virtual wxTreeItemId GetRootItem() const = 0;
// get the item currently selected (may return NULL if no selection)
virtual wxTreeItemId GetSelection() const = 0;
// get the items currently selected, return the number of such item
//
// NB: this operation is expensive and can take a long time for a
// control with a lot of items (~ O(number of items)).
virtual size_t GetSelections(wxArrayTreeItemIds& selections) const = 0;
// get the last item to be clicked when the control has wxTR_MULTIPLE
// equivalent to GetSelection() if not wxTR_MULTIPLE
virtual wxTreeItemId GetFocusedItem() const = 0;
// Clears the currently focused item
virtual void ClearFocusedItem() = 0;
// Sets the currently focused item. Item should be valid
virtual void SetFocusedItem(const wxTreeItemId& item) = 0;
// get the parent of this item (may return NULL if root)
virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const = 0;
// for this enumeration function you must pass in a "cookie" parameter
// which is opaque for the application but is necessary for the library
// to make these functions reentrant (i.e. allow more than one
// enumeration on one and the same object simultaneously). Of course,
// the "cookie" passed to GetFirstChild() and GetNextChild() should be
// the same!
// get the first child of this item
virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item,
wxTreeItemIdValue& cookie) const = 0;
// get the next child
virtual wxTreeItemId GetNextChild(const wxTreeItemId& item,
wxTreeItemIdValue& cookie) const = 0;
// get the last child of this item - this method doesn't use cookies
virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const = 0;
// get the next sibling of this item
virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const = 0;
// get the previous sibling
virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const = 0;
// get first visible item
virtual wxTreeItemId GetFirstVisibleItem() const = 0;
// get the next visible item: item must be visible itself!
// see IsVisible() and wxTreeCtrl::GetFirstVisibleItem()
virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const = 0;
// get the previous visible item: item must be visible itself!
virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const = 0;
// operations
// ----------
// add the root node to the tree
virtual wxTreeItemId AddRoot(const wxString& text,
int image = -1, int selImage = -1,
wxTreeItemData *data = NULL) = 0;
// insert a new item in as the first child of the parent
wxTreeItemId PrependItem(const wxTreeItemId& parent,
const wxString& text,
int image = -1, int selImage = -1,
wxTreeItemData *data = NULL)
{
return DoInsertItem(parent, 0u, text, image, selImage, data);
}
// insert a new item after a given one
wxTreeItemId InsertItem(const wxTreeItemId& parent,
const wxTreeItemId& idPrevious,
const wxString& text,
int image = -1, int selImage = -1,
wxTreeItemData *data = NULL)
{
return DoInsertAfter(parent, idPrevious, text, image, selImage, data);
}
// insert a new item before the one with the given index
wxTreeItemId InsertItem(const wxTreeItemId& parent,
size_t pos,
const wxString& text,
int image = -1, int selImage = -1,
wxTreeItemData *data = NULL)
{
return DoInsertItem(parent, pos, text, image, selImage, data);
}
// insert a new item in as the last child of the parent
wxTreeItemId AppendItem(const wxTreeItemId& parent,
const wxString& text,
int image = -1, int selImage = -1,
wxTreeItemData *data = NULL)
{
return DoInsertItem(parent, (size_t)-1, text, image, selImage, data);
}
// delete this item and associated data if any
virtual void Delete(const wxTreeItemId& item) = 0;
// delete all children (but don't delete the item itself)
// NB: this won't send wxEVT_TREE_ITEM_DELETED events
virtual void DeleteChildren(const wxTreeItemId& item) = 0;
// delete all items from the tree
// NB: this won't send wxEVT_TREE_ITEM_DELETED events
virtual void DeleteAllItems() = 0;
// expand this item
virtual void Expand(const wxTreeItemId& item) = 0;
// expand the item and all its children recursively
void ExpandAllChildren(const wxTreeItemId& item);
// expand all items
void ExpandAll();
// collapse the item without removing its children
virtual void Collapse(const wxTreeItemId& item) = 0;
// collapse the item and all its children
void CollapseAllChildren(const wxTreeItemId& item);
// collapse all items
void CollapseAll();
// collapse the item and remove all children
virtual void CollapseAndReset(const wxTreeItemId& item) = 0;
// toggles the current state
virtual void Toggle(const wxTreeItemId& item) = 0;
// remove the selection from currently selected item (if any)
virtual void Unselect() = 0;
// unselect all items (only makes sense for multiple selection control)
virtual void UnselectAll() = 0;
// select this item
virtual void SelectItem(const wxTreeItemId& item, bool select = true) = 0;
// selects all (direct) children for given parent (only for
// multiselection controls)
virtual void SelectChildren(const wxTreeItemId& parent) = 0;
// unselect this item
void UnselectItem(const wxTreeItemId& item) { SelectItem(item, false); }
// toggle item selection
void ToggleItemSelection(const wxTreeItemId& item)
{
SelectItem(item, !IsSelected(item));
}
// make sure this item is visible (expanding the parent item and/or
// scrolling to this item if necessary)
virtual void EnsureVisible(const wxTreeItemId& item) = 0;
// scroll to this item (but don't expand its parent)
virtual void ScrollTo(const wxTreeItemId& item) = 0;
// start editing the item label: this (temporarily) replaces the item
// with a one line edit control. The item will be selected if it hadn't
// been before. textCtrlClass parameter allows you to create an edit
// control of arbitrary user-defined class deriving from wxTextCtrl.
virtual wxTextCtrl *EditLabel(const wxTreeItemId& item,
wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)) = 0;
// returns the same pointer as StartEdit() if the item is being edited,
// NULL otherwise (it's assumed that no more than one item may be
// edited simultaneously)
virtual wxTextCtrl *GetEditControl() const = 0;
// end editing and accept or discard the changes to item label
virtual void EndEditLabel(const wxTreeItemId& item,
bool discardChanges = false) = 0;
// Enable or disable beep when incremental match doesn't find any item.
// Only implemented in the generic version currently.
virtual void EnableBellOnNoMatch(bool WXUNUSED(on) = true) { }
// sorting
// -------
// this function is called to compare 2 items and should return -1, 0
// or +1 if the first item is less than, equal to or greater than the
// second one. The base class version performs alphabetic comparison
// of item labels (GetText)
virtual int OnCompareItems(const wxTreeItemId& item1,
const wxTreeItemId& item2)
{
return wxStrcmp(GetItemText(item1), GetItemText(item2));
}
// sort the children of this item using OnCompareItems
//
// NB: this function is not reentrant and not MT-safe (FIXME)!
virtual void SortChildren(const wxTreeItemId& item) = 0;
// items geometry
// --------------
// determine to which item (if any) belongs the given point (the
// coordinates specified are relative to the client area of tree ctrl)
// and, in the second variant, fill the flags parameter with a bitmask
// of wxTREE_HITTEST_xxx constants.
wxTreeItemId HitTest(const wxPoint& point) const
{ int dummy; return DoTreeHitTest(point, dummy); }
wxTreeItemId HitTest(const wxPoint& point, int& flags) const
{ return DoTreeHitTest(point, flags); }
// get the bounding rectangle of the item (or of its label only)
virtual bool GetBoundingRect(const wxTreeItemId& item,
wxRect& rect,
bool textOnly = false) const = 0;
// implementation
// --------------
virtual bool ShouldInheritColours() const wxOVERRIDE { return false; }
// hint whether to calculate best size quickly or accurately
void SetQuickBestSize(bool q) { m_quickBestSize = q; }
bool GetQuickBestSize() const { return m_quickBestSize; }
protected:
virtual wxSize DoGetBestSize() const wxOVERRIDE;
// common part of Get/SetItemState()
virtual int DoGetItemState(const wxTreeItemId& item) const = 0;
virtual void DoSetItemState(const wxTreeItemId& item, int state) = 0;
// common part of Append/Prepend/InsertItem()
//
// pos is the position at which to insert the item or (size_t)-1 to append
// it to the end
virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent,
size_t pos,
const wxString& text,
int image, int selImage,
wxTreeItemData *data) = 0;
// and this function implements overloaded InsertItem() taking wxTreeItemId
// (it can't be called InsertItem() as we'd have virtual function hiding
// problem in derived classes then)
virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent,
const wxTreeItemId& idPrevious,
const wxString& text,
int image = -1, int selImage = -1,
wxTreeItemData *data = NULL) = 0;
// real HitTest() implementation: again, can't be called just HitTest()
// because it's overloaded and so the non-virtual overload would be hidden
// (and can't be called DoHitTest() because this is already in wxWindow)
virtual wxTreeItemId DoTreeHitTest(const wxPoint& point,
int& flags) const = 0;
wxImageList *m_imageListNormal, // images for tree elements
*m_imageListState; // special images for app defined states
bool m_ownsImageListNormal,
m_ownsImageListState;
// spacing between left border and the text
unsigned int m_spacing;
// whether full or quick calculation is done in DoGetBestSize
bool m_quickBestSize;
private:
// Intercept Escape and Return keys to ensure that our in-place edit
// control always gets them before they're used for dialog navigation or
// anything else.
void OnCharHook(wxKeyEvent& event);
wxDECLARE_NO_COPY_CLASS(wxTreeCtrlBase);
};
// ----------------------------------------------------------------------------
// include the platform-dependent wxTreeCtrl class
// ----------------------------------------------------------------------------
#ifdef wxHAS_GENERIC_TREECTRL
#include "wx/generic/treectlg.h"
#elif defined(__WXMSW__)
#include "wx/msw/treectrl.h"
#else
#error "unknown native wxTreeCtrl implementation"
#endif
#endif // wxUSE_TREECTRL
#endif // _WX_TREECTRL_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/textctrl.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/textctrl.h
// Purpose: wxTextAttr and wxTextCtrlBase class - the interface of wxTextCtrl
// Author: Vadim Zeitlin
// Modified by:
// Created: 13.07.99
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TEXTCTRL_H_BASE_
#define _WX_TEXTCTRL_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_TEXTCTRL
#include "wx/control.h" // the base class
#include "wx/textentry.h" // single-line text entry interface
#include "wx/dynarray.h" // wxArrayInt
#include "wx/gdicmn.h" // wxPoint
#if wxUSE_STD_IOSTREAM
#include "wx/ioswrap.h"
#define wxHAS_TEXT_WINDOW_STREAM 1
#else
#define wxHAS_TEXT_WINDOW_STREAM 0
#endif
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
class WXDLLIMPEXP_FWD_CORE wxTextCtrlBase;
// ----------------------------------------------------------------------------
// wxTextCtrl types
// ----------------------------------------------------------------------------
// wxTextCoord is the line or row number (which should have been unsigned but
// is long for backwards compatibility)
typedef long wxTextCoord;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
extern WXDLLIMPEXP_DATA_CORE(const char) wxTextCtrlNameStr[];
// this is intentionally not enum to avoid warning fixes with
// typecasting from enum type to wxTextCoord
const wxTextCoord wxOutOfRangeTextCoord = -1;
const wxTextCoord wxInvalidTextCoord = -2;
// ----------------------------------------------------------------------------
// wxTextCtrl style flags
// ----------------------------------------------------------------------------
#define wxTE_NO_VSCROLL 0x0002
#define wxTE_READONLY 0x0010
#define wxTE_MULTILINE 0x0020
#define wxTE_PROCESS_TAB 0x0040
// alignment flags
#define wxTE_LEFT 0x0000 // 0x0000
#define wxTE_CENTER wxALIGN_CENTER_HORIZONTAL // 0x0100
#define wxTE_RIGHT wxALIGN_RIGHT // 0x0200
#define wxTE_CENTRE wxTE_CENTER
// this style means to use RICHEDIT control and does something only under wxMSW
// and Win32 and is silently ignored under all other platforms
#define wxTE_RICH 0x0080
#define wxTE_PROCESS_ENTER 0x0400
#define wxTE_PASSWORD 0x0800
// automatically detect the URLs and generate the events when mouse is
// moved/clicked over an URL
//
// this is for Win32 richedit and wxGTK2 multiline controls only so far
#define wxTE_AUTO_URL 0x1000
// by default, the Windows text control doesn't show the selection when it
// doesn't have focus - use this style to force it to always show it
#define wxTE_NOHIDESEL 0x2000
// use wxHSCROLL to not wrap text at all, wxTE_CHARWRAP to wrap it at any
// position and wxTE_WORDWRAP to wrap at words boundary
//
// if no wrapping style is given at all, the control wraps at word boundary
#define wxTE_DONTWRAP wxHSCROLL
#define wxTE_CHARWRAP 0x4000 // wrap at any position
#define wxTE_WORDWRAP 0x0001 // wrap only at words boundaries
#define wxTE_BESTWRAP 0x0000 // this is the default
#if WXWIN_COMPATIBILITY_2_8
// this style is (or at least should be) on by default now, don't use it
#define wxTE_AUTO_SCROLL 0
#endif // WXWIN_COMPATIBILITY_2_8
// force using RichEdit version 2.0 or 3.0 instead of 1.0 (default) for
// wxTE_RICH controls - can be used together with or instead of wxTE_RICH
#define wxTE_RICH2 0x8000
#if defined(__WXOSX_IPHONE__)
#define wxTE_CAPITALIZE wxTE_RICH2
#else
#define wxTE_CAPITALIZE 0
#endif
// ----------------------------------------------------------------------------
// wxTextCtrl file types
// ----------------------------------------------------------------------------
#define wxTEXT_TYPE_ANY 0
// ----------------------------------------------------------------------------
// wxTextCtrl::HitTest return values
// ----------------------------------------------------------------------------
// the point asked is ...
enum wxTextCtrlHitTestResult
{
wxTE_HT_UNKNOWN = -2, // this means HitTest() is simply not implemented
wxTE_HT_BEFORE, // either to the left or upper
wxTE_HT_ON_TEXT, // directly on
wxTE_HT_BELOW, // below [the last line]
wxTE_HT_BEYOND // after [the end of line]
};
// ... the character returned
// ----------------------------------------------------------------------------
// Types for wxTextAttr
// ----------------------------------------------------------------------------
// Alignment
enum wxTextAttrAlignment
{
wxTEXT_ALIGNMENT_DEFAULT,
wxTEXT_ALIGNMENT_LEFT,
wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_RIGHT,
wxTEXT_ALIGNMENT_JUSTIFIED
};
// Flags to indicate which attributes are being applied
enum wxTextAttrFlags
{
wxTEXT_ATTR_TEXT_COLOUR = 0x00000001,
wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002,
wxTEXT_ATTR_FONT_FACE = 0x00000004,
wxTEXT_ATTR_FONT_POINT_SIZE = 0x00000008,
wxTEXT_ATTR_FONT_PIXEL_SIZE = 0x10000000,
wxTEXT_ATTR_FONT_WEIGHT = 0x00000010,
wxTEXT_ATTR_FONT_ITALIC = 0x00000020,
wxTEXT_ATTR_FONT_UNDERLINE = 0x00000040,
wxTEXT_ATTR_FONT_STRIKETHROUGH = 0x08000000,
wxTEXT_ATTR_FONT_ENCODING = 0x02000000,
wxTEXT_ATTR_FONT_FAMILY = 0x04000000,
wxTEXT_ATTR_FONT_SIZE = \
( wxTEXT_ATTR_FONT_POINT_SIZE | wxTEXT_ATTR_FONT_PIXEL_SIZE ),
wxTEXT_ATTR_FONT = \
( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \
wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_STRIKETHROUGH | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ),
wxTEXT_ATTR_ALIGNMENT = 0x00000080,
wxTEXT_ATTR_LEFT_INDENT = 0x00000100,
wxTEXT_ATTR_RIGHT_INDENT = 0x00000200,
wxTEXT_ATTR_TABS = 0x00000400,
wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800,
wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000,
wxTEXT_ATTR_LINE_SPACING = 0x00002000,
wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000,
wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000,
wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000,
wxTEXT_ATTR_BULLET_STYLE = 0x00020000,
wxTEXT_ATTR_BULLET_NUMBER = 0x00040000,
wxTEXT_ATTR_BULLET_TEXT = 0x00080000,
wxTEXT_ATTR_BULLET_NAME = 0x00100000,
wxTEXT_ATTR_BULLET = \
( wxTEXT_ATTR_BULLET_STYLE | wxTEXT_ATTR_BULLET_NUMBER | wxTEXT_ATTR_BULLET_TEXT | \
wxTEXT_ATTR_BULLET_NAME ),
wxTEXT_ATTR_URL = 0x00200000,
wxTEXT_ATTR_PAGE_BREAK = 0x00400000,
wxTEXT_ATTR_EFFECTS = 0x00800000,
wxTEXT_ATTR_OUTLINE_LEVEL = 0x01000000,
wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE = 0x20000000,
wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER = 0x40000000,
/*!
* Character and paragraph combined styles
*/
wxTEXT_ATTR_CHARACTER = \
(wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS| \
wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL),
wxTEXT_ATTR_PARAGRAPH = \
(wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\
wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\
wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL|\
wxTEXT_ATTR_PAGE_BREAK|wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE|wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER),
wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH)
};
/*!
* Styles for wxTextAttr::SetBulletStyle
*/
enum wxTextAttrBulletStyle
{
wxTEXT_ATTR_BULLET_STYLE_NONE = 0x00000000,
wxTEXT_ATTR_BULLET_STYLE_ARABIC = 0x00000001,
wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER = 0x00000002,
wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER = 0x00000004,
wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER = 0x00000008,
wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER = 0x00000010,
wxTEXT_ATTR_BULLET_STYLE_SYMBOL = 0x00000020,
wxTEXT_ATTR_BULLET_STYLE_BITMAP = 0x00000040,
wxTEXT_ATTR_BULLET_STYLE_PARENTHESES = 0x00000080,
wxTEXT_ATTR_BULLET_STYLE_PERIOD = 0x00000100,
wxTEXT_ATTR_BULLET_STYLE_STANDARD = 0x00000200,
wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS = 0x00000400,
wxTEXT_ATTR_BULLET_STYLE_OUTLINE = 0x00000800,
wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT = 0x00000000,
wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT = 0x00001000,
wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE = 0x00002000,
wxTEXT_ATTR_BULLET_STYLE_CONTINUATION = 0x00004000
};
/*!
* Styles for wxTextAttr::SetTextEffects
*/
enum wxTextAttrEffects
{
wxTEXT_ATTR_EFFECT_NONE = 0x00000000,
wxTEXT_ATTR_EFFECT_CAPITALS = 0x00000001,
wxTEXT_ATTR_EFFECT_SMALL_CAPITALS = 0x00000002,
wxTEXT_ATTR_EFFECT_STRIKETHROUGH = 0x00000004,
wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH = 0x00000008,
wxTEXT_ATTR_EFFECT_SHADOW = 0x00000010,
wxTEXT_ATTR_EFFECT_EMBOSS = 0x00000020,
wxTEXT_ATTR_EFFECT_OUTLINE = 0x00000040,
wxTEXT_ATTR_EFFECT_ENGRAVE = 0x00000080,
wxTEXT_ATTR_EFFECT_SUPERSCRIPT = 0x00000100,
wxTEXT_ATTR_EFFECT_SUBSCRIPT = 0x00000200,
wxTEXT_ATTR_EFFECT_RTL = 0x00000400,
wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION = 0x00001000
};
/*!
* Line spacing values
*/
enum wxTextAttrLineSpacing
{
wxTEXT_ATTR_LINE_SPACING_NORMAL = 10,
wxTEXT_ATTR_LINE_SPACING_HALF = 15,
wxTEXT_ATTR_LINE_SPACING_TWICE = 20
};
// ----------------------------------------------------------------------------
// wxTextAttr: a structure containing the visual attributes of a text
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTextAttr
{
public:
// ctors
wxTextAttr() { Init(); }
wxTextAttr(const wxTextAttr& attr) { Init(); Copy(attr); }
wxTextAttr(const wxColour& colText,
const wxColour& colBack = wxNullColour,
const wxFont& font = wxNullFont,
wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT);
// Initialise this object.
void Init();
// Copy
void Copy(const wxTextAttr& attr);
// Assignment
void operator= (const wxTextAttr& attr);
// Equality test
bool operator== (const wxTextAttr& attr) const;
// Partial equality test. If @a weakTest is @true, attributes of this object do not
// have to be present if those attributes of @a attr are present. If @a weakTest is
// @false, the function will fail if an attribute is present in @a attr but not
// in this object.
bool EqPartial(const wxTextAttr& attr, bool weakTest = true) const;
// Get attributes from font.
bool GetFontAttributes(const wxFont& font, int flags = wxTEXT_ATTR_FONT);
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; }
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; }
void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; }
void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; }
void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; }
void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; }
void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_POINT_SIZE; }
void SetFontPointSize(int pointSize) { m_fontSize = pointSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_POINT_SIZE; }
void SetFontPixelSize(int pixelSize) { m_fontSize = pixelSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_PIXEL_SIZE; }
void SetFontStyle(wxFontStyle fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; }
void SetFontWeight(wxFontWeight fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; }
void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; }
void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; }
void SetFontStrikethrough(bool strikethrough) { m_fontStrikethrough = strikethrough; m_flags |= wxTEXT_ATTR_FONT_STRIKETHROUGH; }
void SetFontEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; m_flags |= wxTEXT_ATTR_FONT_ENCODING; }
void SetFontFamily(wxFontFamily family) { m_fontFamily = family; m_flags |= wxTEXT_ATTR_FONT_FAMILY; }
// Set font
void SetFont(const wxFont& font, int flags = (wxTEXT_ATTR_FONT & ~wxTEXT_ATTR_FONT_PIXEL_SIZE)) { GetFontAttributes(font, flags); }
void SetFlags(long flags) { m_flags = flags; }
void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; m_flags |= wxTEXT_ATTR_CHARACTER_STYLE_NAME; }
void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; m_flags |= wxTEXT_ATTR_PARAGRAPH_STYLE_NAME; }
void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); }
void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_AFTER; }
void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_BEFORE; }
void SetLineSpacing(int spacing) { m_lineSpacing = spacing; m_flags |= wxTEXT_ATTR_LINE_SPACING; }
void SetBulletStyle(int style) { m_bulletStyle = style; m_flags |= wxTEXT_ATTR_BULLET_STYLE; }
void SetBulletNumber(int n) { m_bulletNumber = n; m_flags |= wxTEXT_ATTR_BULLET_NUMBER; }
void SetBulletText(const wxString& text) { m_bulletText = text; m_flags |= wxTEXT_ATTR_BULLET_TEXT; }
void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; }
void SetBulletName(const wxString& name) { m_bulletName = name; m_flags |= wxTEXT_ATTR_BULLET_NAME; }
void SetURL(const wxString& url) { m_urlTarget = url; m_flags |= wxTEXT_ATTR_URL; }
void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); }
void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); }
void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; }
void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
wxTextAttrAlignment GetAlignment() const { return m_textAlignment; }
const wxArrayInt& GetTabs() const { return m_tabs; }
long GetLeftIndent() const { return m_leftIndent; }
long GetLeftSubIndent() const { return m_leftSubIndent; }
long GetRightIndent() const { return m_rightIndent; }
long GetFlags() const { return m_flags; }
int GetFontSize() const { return m_fontSize; }
wxFontStyle GetFontStyle() const { return m_fontStyle; }
wxFontWeight GetFontWeight() const { return m_fontWeight; }
bool GetFontUnderlined() const { return m_fontUnderlined; }
bool GetFontStrikethrough() const { return m_fontStrikethrough; }
const wxString& GetFontFaceName() const { return m_fontFaceName; }
wxFontEncoding GetFontEncoding() const { return m_fontEncoding; }
wxFontFamily GetFontFamily() const { return m_fontFamily; }
wxFont GetFont() const;
const wxString& GetCharacterStyleName() const { return m_characterStyleName; }
const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; }
const wxString& GetListStyleName() const { return m_listStyleName; }
int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; }
int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; }
int GetLineSpacing() const { return m_lineSpacing; }
int GetBulletStyle() const { return m_bulletStyle; }
int GetBulletNumber() const { return m_bulletNumber; }
const wxString& GetBulletText() const { return m_bulletText; }
const wxString& GetBulletFont() const { return m_bulletFont; }
const wxString& GetBulletName() const { return m_bulletName; }
const wxString& GetURL() const { return m_urlTarget; }
int GetTextEffects() const { return m_textEffects; }
int GetTextEffectFlags() const { return m_textEffectFlags; }
int GetOutlineLevel() const { return m_outlineLevel; }
// accessors
bool HasTextColour() const { return m_colText.IsOk() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; }
bool HasBackgroundColour() const { return m_colBack.IsOk() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; }
bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && HasFlag(wxTEXT_ATTR_ALIGNMENT) ; }
bool HasTabs() const { return HasFlag(wxTEXT_ATTR_TABS) ; }
bool HasLeftIndent() const { return HasFlag(wxTEXT_ATTR_LEFT_INDENT); }
bool HasRightIndent() const { return HasFlag(wxTEXT_ATTR_RIGHT_INDENT); }
bool HasFontWeight() const { return HasFlag(wxTEXT_ATTR_FONT_WEIGHT); }
bool HasFontSize() const { return HasFlag(wxTEXT_ATTR_FONT_SIZE); }
bool HasFontPointSize() const { return HasFlag(wxTEXT_ATTR_FONT_POINT_SIZE); }
bool HasFontPixelSize() const { return HasFlag(wxTEXT_ATTR_FONT_PIXEL_SIZE); }
bool HasFontItalic() const { return HasFlag(wxTEXT_ATTR_FONT_ITALIC); }
bool HasFontUnderlined() const { return HasFlag(wxTEXT_ATTR_FONT_UNDERLINE); }
bool HasFontStrikethrough() const { return HasFlag(wxTEXT_ATTR_FONT_STRIKETHROUGH); }
bool HasFontFaceName() const { return HasFlag(wxTEXT_ATTR_FONT_FACE); }
bool HasFontEncoding() const { return HasFlag(wxTEXT_ATTR_FONT_ENCODING); }
bool HasFontFamily() const { return HasFlag(wxTEXT_ATTR_FONT_FAMILY); }
bool HasFont() const { return HasFlag(wxTEXT_ATTR_FONT); }
bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); }
bool HasParagraphSpacingBefore() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_BEFORE); }
bool HasLineSpacing() const { return HasFlag(wxTEXT_ATTR_LINE_SPACING); }
bool HasCharacterStyleName() const { return HasFlag(wxTEXT_ATTR_CHARACTER_STYLE_NAME) && !m_characterStyleName.IsEmpty(); }
bool HasParagraphStyleName() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) && !m_paragraphStyleName.IsEmpty(); }
bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); }
bool HasBulletStyle() const { return HasFlag(wxTEXT_ATTR_BULLET_STYLE); }
bool HasBulletNumber() const { return HasFlag(wxTEXT_ATTR_BULLET_NUMBER); }
bool HasBulletText() const { return HasFlag(wxTEXT_ATTR_BULLET_TEXT); }
bool HasBulletName() const { return HasFlag(wxTEXT_ATTR_BULLET_NAME); }
bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); }
bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); }
bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); }
bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); }
bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); }
bool HasFlag(long flag) const { return (m_flags & flag) != 0; }
void RemoveFlag(long flag) { m_flags &= ~flag; }
void AddFlag(long flag) { m_flags |= flag; }
// Is this a character style?
bool IsCharacterStyle() const { return HasFlag(wxTEXT_ATTR_CHARACTER); }
bool IsParagraphStyle() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH); }
// returns false if we have any attributes set, true otherwise
bool IsDefault() const
{
return GetFlags() == 0;
}
// Merges the given attributes. If compareWith
// is non-NULL, then it will be used to mask out those attributes that are the same in style
// and compareWith, for situations where we don't want to explicitly set inherited attributes.
bool Apply(const wxTextAttr& style, const wxTextAttr* compareWith = NULL);
// merges the attributes of the base and the overlay objects and returns
// the result; the parameter attributes take precedence
//
// WARNING: the order of arguments is the opposite of Combine()
static wxTextAttr Merge(const wxTextAttr& base, const wxTextAttr& overlay)
{
return Combine(overlay, base, NULL);
}
// merges the attributes of this object and overlay
void Merge(const wxTextAttr& overlay)
{
*this = Merge(*this, overlay);
}
// return the attribute having the valid font and colours: it uses the
// attributes set in attr and falls back first to attrDefault and then to
// the text control font/colours for those attributes which are not set
static wxTextAttr Combine(const wxTextAttr& attr,
const wxTextAttr& attrDef,
const wxTextCtrlBase *text);
// Compare tabs
static bool TabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2);
// Remove attributes
static bool RemoveStyle(wxTextAttr& destStyle, const wxTextAttr& style);
// Combine two bitlists, specifying the bits of interest with separate flags.
static bool CombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB);
// Compare two bitlists
static bool BitlistsEqPartial(int valueA, int valueB, int flags);
// Split into paragraph and character styles
static bool SplitParaCharStyles(const wxTextAttr& style, wxTextAttr& parStyle, wxTextAttr& charStyle);
private:
long m_flags;
// Paragraph styles
wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm
int m_leftIndent; // left indent in 1/10 mm
int m_leftSubIndent; // left indent for all but the first
// line in a paragraph relative to the
// first line, in 1/10 mm
int m_rightIndent; // right indent in 1/10 mm
wxTextAttrAlignment m_textAlignment;
int m_paragraphSpacingAfter;
int m_paragraphSpacingBefore;
int m_lineSpacing;
int m_bulletStyle;
int m_bulletNumber;
int m_textEffects;
int m_textEffectFlags;
int m_outlineLevel;
wxString m_bulletText;
wxString m_bulletFont;
wxString m_bulletName;
wxString m_urlTarget;
wxFontEncoding m_fontEncoding;
// Character styles
wxColour m_colText,
m_colBack;
int m_fontSize;
wxFontStyle m_fontStyle;
wxFontWeight m_fontWeight;
wxFontFamily m_fontFamily;
bool m_fontUnderlined;
bool m_fontStrikethrough;
wxString m_fontFaceName;
// Character style
wxString m_characterStyleName;
// Paragraph style
wxString m_paragraphStyleName;
// List style
wxString m_listStyleName;
};
// ----------------------------------------------------------------------------
// wxTextAreaBase: multiline text control specific methods
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTextAreaBase
{
public:
wxTextAreaBase() { }
virtual ~wxTextAreaBase() { }
// lines access
// ------------
virtual int GetLineLength(long lineNo) const = 0;
virtual wxString GetLineText(long lineNo) const = 0;
virtual int GetNumberOfLines() const = 0;
// file IO
// -------
bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY)
{ return DoLoadFile(file, fileType); }
bool SaveFile(const wxString& file = wxEmptyString,
int fileType = wxTEXT_TYPE_ANY);
// dirty flag handling
// -------------------
virtual bool IsModified() const = 0;
virtual void MarkDirty() = 0;
virtual void DiscardEdits() = 0;
void SetModified(bool modified)
{
if ( modified )
MarkDirty();
else
DiscardEdits();
}
// styles handling
// ---------------
// text control under some platforms supports the text styles: these
// methods allow to apply the given text style to the given selection or to
// set/get the style which will be used for all appended text
virtual bool SetStyle(long start, long end, const wxTextAttr& style) = 0;
virtual bool GetStyle(long position, wxTextAttr& style) = 0;
virtual bool SetDefaultStyle(const wxTextAttr& style) = 0;
virtual const wxTextAttr& GetDefaultStyle() const { return m_defaultStyle; }
// coordinates translation
// -----------------------
// translate between the position (which is just an index in the text ctrl
// considering all its contents as a single strings) and (x, y) coordinates
// which represent column and line.
virtual long XYToPosition(long x, long y) const = 0;
virtual bool PositionToXY(long pos, long *x, long *y) const = 0;
// translate the given position (which is just an index in the text control)
// to client coordinates
wxPoint PositionToCoords(long pos) const;
virtual void ShowPosition(long pos) = 0;
// find the character at position given in pixels
//
// NB: pt is in device coords (not adjusted for the client area origin nor
// scrolling)
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
wxTextCoord *col,
wxTextCoord *row) const;
virtual wxString GetValue() const = 0;
virtual void SetValue(const wxString& value) = 0;
protected:
// implementation of loading/saving
virtual bool DoLoadFile(const wxString& file, int fileType);
virtual bool DoSaveFile(const wxString& file, int fileType);
// Return true if the given position is valid, i.e. positive and less than
// the last position.
virtual bool IsValidPosition(long pos) const = 0;
// Default stub implementation of PositionToCoords() always returns
// wxDefaultPosition.
virtual wxPoint DoPositionToCoords(long pos) const;
// the name of the last file loaded with LoadFile() which will be used by
// SaveFile() by default
wxString m_filename;
// the text style which will be used for any new text added to the control
wxTextAttr m_defaultStyle;
wxDECLARE_NO_COPY_CLASS(wxTextAreaBase);
};
// this class defines wxTextCtrl interface, wxTextCtrlBase actually implements
// too much things because it derives from wxTextEntry and not wxTextEntryBase
// and so any classes which "look like" wxTextCtrl (such as wxRichTextCtrl)
// but don't need the (native) implementation bits from wxTextEntry should
// actually derive from this one and not wxTextCtrlBase
class WXDLLIMPEXP_CORE wxTextCtrlIface : public wxTextAreaBase,
public wxTextEntryBase
{
public:
wxTextCtrlIface() { }
// wxTextAreaBase overrides
virtual wxString GetValue() const wxOVERRIDE
{
return wxTextEntryBase::GetValue();
}
virtual void SetValue(const wxString& value) wxOVERRIDE
{
wxTextEntryBase::SetValue(value);
}
protected:
virtual bool IsValidPosition(long pos) const wxOVERRIDE
{
return pos >= 0 && pos <= GetLastPosition();
}
private:
wxDECLARE_NO_COPY_CLASS(wxTextCtrlIface);
};
// ----------------------------------------------------------------------------
// wxTextCtrl: a single or multiple line text zone where user can edit text
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTextCtrlBase : public wxControl,
#if wxHAS_TEXT_WINDOW_STREAM
public wxSTD streambuf,
#endif
public wxTextAreaBase,
public wxTextEntry
{
public:
// creation
// --------
wxTextCtrlBase() { }
virtual ~wxTextCtrlBase() { }
// more readable flag testing methods
bool IsSingleLine() const { return !HasFlag(wxTE_MULTILINE); }
bool IsMultiLine() const { return !IsSingleLine(); }
// stream-like insertion operators: these are always available, whether we
// were, or not, compiled with streambuf support
wxTextCtrl& operator<<(const wxString& s);
wxTextCtrl& operator<<(int i);
wxTextCtrl& operator<<(long i);
wxTextCtrl& operator<<(float f) { return *this << double(f); }
wxTextCtrl& operator<<(double d);
wxTextCtrl& operator<<(char c) { return *this << wxString(c); }
wxTextCtrl& operator<<(wchar_t c) { return *this << wxString(c); }
// insert the character which would have resulted from this key event,
// return true if anything has been inserted
virtual bool EmulateKeyPress(const wxKeyEvent& event);
// do the window-specific processing after processing the update event
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE;
virtual bool ShouldInheritColours() const wxOVERRIDE { return false; }
// work around the problem with having HitTest() both in wxControl and
// wxTextAreaBase base classes
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE
{
return wxTextAreaBase::HitTest(pt, pos);
}
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
wxTextCoord *col,
wxTextCoord *row) const wxOVERRIDE
{
return wxTextAreaBase::HitTest(pt, col, row);
}
// we provide stubs for these functions as not all platforms have styles
// support, but we really should leave them pure virtual here
virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE;
virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE;
virtual bool SetDefaultStyle(const wxTextAttr& style) wxOVERRIDE;
// wxTextAreaBase overrides
virtual wxString GetValue() const wxOVERRIDE
{
return wxTextEntry::GetValue();
}
virtual void SetValue(const wxString& value) wxOVERRIDE
{
wxTextEntry::SetValue(value);
}
// wxWindow overrides
virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE
{
return GetClassDefaultAttributes(GetWindowVariant());
}
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL)
{
return GetCompositeControlsDefaultAttributes(variant);
}
protected:
// Override wxEvtHandler method to check for a common problem of binding
// wxEVT_TEXT_ENTER to a control without wxTE_PROCESS_ENTER style, which is
// never going to work.
virtual bool OnDynamicBind(wxDynamicEventTableEntry& entry) wxOVERRIDE;
// override streambuf method
#if wxHAS_TEXT_WINDOW_STREAM
int overflow(int i) wxOVERRIDE;
#endif // wxHAS_TEXT_WINDOW_STREAM
// Another wxTextAreaBase override.
virtual bool IsValidPosition(long pos) const wxOVERRIDE
{
return pos >= 0 && pos <= GetLastPosition();
}
// implement the wxTextEntry pure virtual method
virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; }
wxDECLARE_NO_COPY_CLASS(wxTextCtrlBase);
wxDECLARE_ABSTRACT_CLASS(wxTextCtrlBase);
};
// ----------------------------------------------------------------------------
// include the platform-dependent class definition
// ----------------------------------------------------------------------------
#if defined(__WXX11__)
#include "wx/x11/textctrl.h"
#elif defined(__WXUNIVERSAL__)
#include "wx/univ/textctrl.h"
#elif defined(__WXMSW__)
#include "wx/msw/textctrl.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/textctrl.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/textctrl.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/textctrl.h"
#elif defined(__WXMAC__)
#include "wx/osx/textctrl.h"
#elif defined(__WXQT__)
#include "wx/qt/textctrl.h"
#endif
// ----------------------------------------------------------------------------
// wxTextCtrl events
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxTextUrlEvent;
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_ENTER, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_URL, wxTextUrlEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_MAXLEN, wxCommandEvent);
class WXDLLIMPEXP_CORE wxTextUrlEvent : public wxCommandEvent
{
public:
wxTextUrlEvent(int winid, const wxMouseEvent& evtMouse,
long start, long end)
: wxCommandEvent(wxEVT_TEXT_URL, winid),
m_evtMouse(evtMouse), m_start(start), m_end(end)
{ }
wxTextUrlEvent(const wxTextUrlEvent& event)
: wxCommandEvent(event),
m_evtMouse(event.m_evtMouse),
m_start(event.m_start),
m_end(event.m_end) { }
// get the mouse event which happened over the URL
const wxMouseEvent& GetMouseEvent() const { return m_evtMouse; }
// get the start of the URL
long GetURLStart() const { return m_start; }
// get the end of the URL
long GetURLEnd() const { return m_end; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxTextUrlEvent(*this); }
protected:
// the corresponding mouse event
wxMouseEvent m_evtMouse;
// the start and end indices of the URL in the text control
long m_start,
m_end;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTextUrlEvent);
public:
// for wxWin RTTI only, don't use
wxTextUrlEvent() : m_evtMouse(), m_start(0), m_end(0) { }
};
typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&);
#define wxTextEventHandler(func) wxCommandEventHandler(func)
#define wxTextUrlEventHandler(func) \
wxEVENT_HANDLER_CAST(wxTextUrlEventFunction, func)
#define wx__DECLARE_TEXTEVT(evt, id, fn) \
wx__DECLARE_EVT1(wxEVT_TEXT_ ## evt, id, wxTextEventHandler(fn))
#define wx__DECLARE_TEXTURLEVT(evt, id, fn) \
wx__DECLARE_EVT1(wxEVT_TEXT_ ## evt, id, wxTextUrlEventHandler(fn))
#define EVT_TEXT(id, fn) wx__DECLARE_EVT1(wxEVT_TEXT, id, wxTextEventHandler(fn))
#define EVT_TEXT_ENTER(id, fn) wx__DECLARE_TEXTEVT(ENTER, id, fn)
#define EVT_TEXT_URL(id, fn) wx__DECLARE_TEXTURLEVT(URL, id, fn)
#define EVT_TEXT_MAXLEN(id, fn) wx__DECLARE_TEXTEVT(MAXLEN, id, fn)
#if wxHAS_TEXT_WINDOW_STREAM
// ----------------------------------------------------------------------------
// wxStreamToTextRedirector: this class redirects all data sent to the given
// C++ stream to the wxTextCtrl given to its ctor during its lifetime.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxStreamToTextRedirector
{
private:
void Init(wxTextCtrl *text)
{
m_sbufOld = m_ostr.rdbuf();
m_ostr.rdbuf(text);
}
public:
wxStreamToTextRedirector(wxTextCtrl *text)
: m_ostr(wxSTD cout)
{
Init(text);
}
wxStreamToTextRedirector(wxTextCtrl *text, wxSTD ostream *ostr)
: m_ostr(*ostr)
{
Init(text);
}
~wxStreamToTextRedirector()
{
m_ostr.rdbuf(m_sbufOld);
}
private:
// the stream we're redirecting
wxSTD ostream& m_ostr;
// the old streambuf (before we changed it)
wxSTD streambuf *m_sbufOld;
};
#endif // wxHAS_TEXT_WINDOW_STREAM
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_TEXT_UPDATED wxEVT_TEXT
#define wxEVT_COMMAND_TEXT_ENTER wxEVT_TEXT_ENTER
#define wxEVT_COMMAND_TEXT_URL wxEVT_TEXT_URL
#define wxEVT_COMMAND_TEXT_MAXLEN wxEVT_TEXT_MAXLEN
#endif // wxUSE_TEXTCTRL
#endif
// _WX_TEXTCTRL_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/rearrangectrl.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/rearrangectrl.h
// Purpose: various controls for rearranging the items interactively
// Author: Vadim Zeitlin
// Created: 2008-12-15
// Copyright: (c) 2008 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_REARRANGECTRL_H_
#define _WX_REARRANGECTRL_H_
#include "wx/checklst.h"
#if wxUSE_REARRANGECTRL
#include "wx/panel.h"
#include "wx/dialog.h"
#include "wx/arrstr.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxRearrangeListNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxRearrangeDialogNameStr[];
// ----------------------------------------------------------------------------
// wxRearrangeList: a (check) list box allowing to move items around
// ----------------------------------------------------------------------------
// This class works allows to change the order of the items shown in it as well
// as to check or uncheck them individually. The data structure used to allow
// this is the order array which contains the items indices indexed by their
// position with an added twist that the unchecked items are represented by the
// bitwise complement of the corresponding index (for any architecture using
// two's complement for negative numbers representation (i.e. just about any at
// all) this means that a checked item N is represented by -N-1 in unchecked
// state).
//
// So, for example, the array order [1 -3 0] used in conjunction with the items
// array ["first", "second", "third"] means that the items are displayed in the
// order "second", "third", "first" and the "third" item is unchecked while the
// other two are checked.
class WXDLLIMPEXP_CORE wxRearrangeList : public wxCheckListBox
{
public:
// ctors and such
// --------------
// default ctor, call Create() later
wxRearrangeList() { }
// ctor creating the control, the arguments are the same as for
// wxCheckListBox except for the extra order array which defines the
// (initial) display order of the items as well as their statuses, see the
// description above
wxRearrangeList(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayInt& order,
const wxArrayString& items,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxRearrangeListNameStr)
{
Create(parent, id, pos, size, order, items, style, validator, name);
}
// Create() function takes the same parameters as the base class one and
// the order array determining the initial display order
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayInt& order,
const wxArrayString& items,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxRearrangeListNameStr);
// items order
// -----------
// get the current items order; the returned array uses the same convention
// as the one passed to the ctor
const wxArrayInt& GetCurrentOrder() const { return m_order; }
// return true if the current item can be moved up or down (i.e. just that
// it's not the first or the last one)
bool CanMoveCurrentUp() const;
bool CanMoveCurrentDown() const;
// move the current item one position up or down, return true if it was moved
// or false if the current item was the first/last one and so nothing was done
bool MoveCurrentUp();
bool MoveCurrentDown();
// Override this to keep our m_order array in sync with the real item state.
virtual void Check(unsigned int item, bool check = true) wxOVERRIDE;
int DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos,
void **clientData, wxClientDataType type) wxOVERRIDE;
void DoDeleteOneItem(unsigned int n) wxOVERRIDE;
void DoClear() wxOVERRIDE;
private:
// swap two items at the given positions in the listbox
void Swap(int pos1, int pos2);
// event handler for item checking/unchecking
void OnCheck(wxCommandEvent& event);
// the current order array
wxArrayInt m_order;
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxRearrangeList);
};
// ----------------------------------------------------------------------------
// wxRearrangeCtrl: composite control containing a wxRearrangeList and buttons
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRearrangeCtrl : public wxPanel
{
public:
// ctors/Create function are the same as for wxRearrangeList
wxRearrangeCtrl()
{
Init();
}
wxRearrangeCtrl(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayInt& order,
const wxArrayString& items,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxRearrangeListNameStr)
{
Init();
Create(parent, id, pos, size, order, items, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayInt& order,
const wxArrayString& items,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxRearrangeListNameStr);
// get the underlying listbox
wxRearrangeList *GetList() const { return m_list; }
private:
// common part of all ctors
void Init();
// event handlers for the buttons
void OnUpdateButtonUI(wxUpdateUIEvent& event);
void OnButton(wxCommandEvent& event);
wxRearrangeList *m_list;
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxRearrangeCtrl);
};
// ----------------------------------------------------------------------------
// wxRearrangeDialog: dialog containing a wxRearrangeCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRearrangeDialog : public wxDialog
{
public:
// default ctor, use Create() later
wxRearrangeDialog() { Init(); }
// ctor for the dialog: message is shown inside the dialog itself, order
// and items are passed to wxRearrangeList used internally
wxRearrangeDialog(wxWindow *parent,
const wxString& message,
const wxString& title,
const wxArrayInt& order,
const wxArrayString& items,
const wxPoint& pos = wxDefaultPosition,
const wxString& name = wxRearrangeDialogNameStr)
{
Init();
Create(parent, message, title, order, items, pos, name);
}
bool Create(wxWindow *parent,
const wxString& message,
const wxString& title,
const wxArrayInt& order,
const wxArrayString& items,
const wxPoint& pos = wxDefaultPosition,
const wxString& name = wxRearrangeDialogNameStr);
// methods for the dialog customization
// add extra contents to the dialog below the wxRearrangeCtrl part: the
// given window (usually a wxPanel containing more control inside it) must
// have the dialog as its parent and will be inserted into it at the right
// place by this method
void AddExtraControls(wxWindow *win);
// return the wxRearrangeList control used by the dialog
wxRearrangeList *GetList() const;
// get the order of items after it was modified by the user
wxArrayInt GetOrder() const;
private:
// common part of all ctors
void Init() { m_ctrl = NULL; }
wxRearrangeCtrl *m_ctrl;
wxDECLARE_NO_COPY_CLASS(wxRearrangeDialog);
};
#endif // wxUSE_REARRANGECTRL
#endif // _WX_REARRANGECTRL_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/bannerwindow.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/bannerwindow.h
// Purpose: wxBannerWindow class declaration
// Author: Vadim Zeitlin
// Created: 2011-08-16
// Copyright: (c) 2011 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BANNERWINDOW_H_
#define _WX_BANNERWINDOW_H_
#include "wx/defs.h"
#if wxUSE_BANNERWINDOW
#include "wx/bitmap.h"
#include "wx/event.h"
#include "wx/window.h"
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxColour;
class WXDLLIMPEXP_FWD_CORE wxDC;
extern WXDLLIMPEXP_DATA_CORE(const char) wxBannerWindowNameStr[];
// ----------------------------------------------------------------------------
// A simple banner window showing either a bitmap or text.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBannerWindow : public wxWindow
{
public:
// Default constructor, use Create() later.
wxBannerWindow() { Init(); }
// Convenient constructor that should be used in the majority of cases.
//
// The banner orientation changes how the text in it is displayed and also
// defines where is the bitmap truncated if it's too big to fit but doesn't
// do anything for the banner position, this is supposed to be taken care
// of in the usual way, e.g. using sizers.
wxBannerWindow(wxWindow* parent, wxDirection dir = wxLEFT)
{
Init();
Create(parent, wxID_ANY, dir);
}
// Full constructor provided for consistency with the other classes only.
wxBannerWindow(wxWindow* parent,
wxWindowID winid,
wxDirection dir = wxLEFT,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxBannerWindowNameStr)
{
Init();
Create(parent, winid, dir, pos, size, style, name);
}
// Can be only called on objects created with the default constructor.
bool Create(wxWindow* parent,
wxWindowID winid,
wxDirection dir = wxLEFT,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxBannerWindowNameStr);
// Provide an existing bitmap to show. For wxLEFT orientation the bitmap is
// truncated from the top, for wxTOP and wxBOTTOM -- from the right and for
// wxRIGHT -- from the bottom, so put the most important part of the bitmap
// information in the opposite direction.
void SetBitmap(const wxBitmap& bmp);
// Set the text to display. This is mutually exclusive with SetBitmap().
// Title is rendered in bold and should be single line, message can have
// multiple lines but is not wrapped automatically.
void SetText(const wxString& title, const wxString& message);
// Set the colours between which the gradient runs. This can be combined
// with SetText() but not SetBitmap().
void SetGradient(const wxColour& start, const wxColour& end);
protected:
virtual wxSize DoGetBestClientSize() const wxOVERRIDE;
private:
// Common part of all constructors.
void Init();
// Fully invalidates the window.
void OnSize(wxSizeEvent& event);
// Redraws the window using either m_bitmap or m_title/m_message.
void OnPaint(wxPaintEvent& event);
// Helper of OnPaint(): draw the bitmap at the correct position depending
// on our orientation.
void DrawBitmapBackground(wxDC& dc);
// Helper of OnPaint(): draw the text in the appropriate direction.
void DrawBannerTextLine(wxDC& dc, const wxString& str, const wxPoint& pos);
// Return the font to use for the title. Currently this is hardcoded as a
// larger bold version of the standard window font but could be made
// configurable in the future.
wxFont GetTitleFont() const;
// Return the colour to use for extending the bitmap. Non-const as it
// updates m_colBitmapBg if needed.
wxColour GetBitmapBg();
// The window side along which the banner is laid out.
wxDirection m_direction;
// If valid, this bitmap is drawn as is.
wxBitmap m_bitmap;
// If bitmap is valid, this is the colour we use to extend it if the bitmap
// is smaller than this window. It is computed on demand by GetBitmapBg().
wxColour m_colBitmapBg;
// The title and main message to draw, used if m_bitmap is invalid.
wxString m_title,
m_message;
// Start and stop gradient colours, only used when drawing text.
wxColour m_colStart,
m_colEnd;
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxBannerWindow);
};
#endif // wxUSE_BANNERWINDOW
#endif // _WX_BANNERWINDOW_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/wxprec.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/wxprec.h
// Purpose: Includes the appropriate files for precompiled headers
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// compiler detection; includes setup.h
#include "wx/defs.h"
// check if to use precompiled headers: do it for most Windows compilers unless
// explicitly disabled by defining NOPCH
#if defined(__VISUALC__) || defined(__BORLANDC__)
// If user did not request NOCPH and we're not building using configure
// then assume user wants precompiled headers.
#if !defined(NOPCH) && !defined(__WX_SETUP_H__)
#define WX_PRECOMP
#endif
#endif
#ifdef WX_PRECOMP
// include "wx/chartype.h" first to ensure that UNICODE macro is correctly set
// _before_ including <windows.h>
#include "wx/chartype.h"
// include standard Windows headers
#if defined(__WINDOWS__)
#include "wx/msw/wrapwin.h"
#include "wx/msw/private.h"
#endif
#if defined(__WXMSW__)
#include "wx/msw/wrapcctl.h"
#include "wx/msw/wrapcdlg.h"
#include "wx/msw/missing.h"
#endif
// include the most common wx headers
#include "wx/wx.h"
#endif // WX_PRECOMP
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/wrapsizer.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/wrapsizer.h
// Purpose: provide wrapping sizer for layout (wxWrapSizer)
// Author: Arne Steinarson
// Created: 2008-05-08
// Copyright: (c) Arne Steinarson
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WRAPSIZER_H_
#define _WX_WRAPSIZER_H_
#include "wx/sizer.h"
// flags for wxWrapSizer
enum
{
wxEXTEND_LAST_ON_EACH_LINE = 1,
// don't leave spacers in the beginning of a new row
wxREMOVE_LEADING_SPACES = 2,
wxWRAPSIZER_DEFAULT_FLAGS = wxEXTEND_LAST_ON_EACH_LINE |
wxREMOVE_LEADING_SPACES
};
// ----------------------------------------------------------------------------
// A box sizer that can wrap items on several lines when sum of widths exceed
// available line width.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxWrapSizer : public wxBoxSizer
{
public:
wxWrapSizer(int orient = wxHORIZONTAL, int flags = wxWRAPSIZER_DEFAULT_FLAGS);
virtual ~wxWrapSizer();
// override base class virtual methods
virtual wxSize CalcMin() wxOVERRIDE;
virtual void RecalcSizes() wxOVERRIDE;
virtual bool InformFirstDirection(int direction,
int size,
int availableOtherDir) wxOVERRIDE;
protected:
// This method is called to decide if an item represents empty space or
// not. We do this to avoid having space-only items first or last on a
// wrapped line (left alignment).
//
// By default only spacers are considered to be empty items but a derived
// class may override this item if some other kind of sizer elements should
// be also considered empty for some reason.
virtual bool IsSpaceItem(wxSizerItem *item) const
{
return item->IsSpacer();
}
// helpers of CalcMin()
void CalcMinFromMinor(int totMinor);
void CalcMinFromMajor(int totMajor);
void CalcMinUsingCurrentLayout();
void CalcMinFittingSize(const wxSize& szBoundary);
void CalcMaxSingleItemSize();
// temporarily change the proportion of the last item of the N-th row to
// extend to the end of line if the appropriate flag is set
void AdjustLastRowItemProp(size_t n, wxSizerItem *itemLast);
// remove all the items from m_rows
void ClearRows();
// return the N-th row sizer from m_rows creating it if necessary
wxSizer *GetRowSizer(size_t n);
// should be called after completion of each row
void FinishRow(size_t n, int rowMajor, int rowMinor, wxSizerItem *itemLast);
const int m_flags; // Flags specified in the ctor
int m_dirInform; // Direction for size information
int m_availSize; // Size available in m_dirInform direction
int m_availableOtherDir; // Size available in the other direction
bool m_lastUsed; // Indicates whether value from InformFirst... has
// been used yet
// The sizes below are computed by RecalcSizes(), i.e. they don't have
// valid values during the initial call to CalcMin() and they are only
// valid for the current layout (i.e. the current number of rows)
int m_minSizeMinor; // Min size in minor direction
int m_maxSizeMajor; // Size of longest row
int m_minItemMajor; // Size of smallest item in major direction
wxBoxSizer m_rows; // Sizer containing multiple rows of our items
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWrapSizer);
};
#endif // _WX_WRAPSIZER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/platform.h | /**
* Name: wx/platform.h
* Purpose: define the OS and compiler identification macros
* Author: Vadim Zeitlin
* Modified by:
* Created: 29.10.01 (extracted from wx/defs.h)
* Copyright: (c) 1997-2001 Vadim Zeitlin
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_PLATFORM_H_
#define _WX_PLATFORM_H_
#ifdef __WXMAC_XCODE__
# include <unistd.h>
# include <TargetConditionals.h>
# include <AvailabilityMacros.h>
# ifndef MAC_OS_X_VERSION_10_4
# define MAC_OS_X_VERSION_10_4 1040
# endif
# ifndef MAC_OS_X_VERSION_10_5
# define MAC_OS_X_VERSION_10_5 1050
# endif
# ifndef MAC_OS_X_VERSION_10_6
# define MAC_OS_X_VERSION_10_6 1060
# endif
# ifndef MAC_OS_X_VERSION_10_7
# define MAC_OS_X_VERSION_10_7 1070
# endif
# ifndef MAC_OS_X_VERSION_10_8
# define MAC_OS_X_VERSION_10_8 1080
# endif
# ifndef MAC_OS_X_VERSION_10_9
# define MAC_OS_X_VERSION_10_9 1090
# endif
# ifndef MAC_OS_X_VERSION_10_10
# define MAC_OS_X_VERSION_10_10 101000
# endif
# ifndef MAC_OS_X_VERSION_10_11
# define MAC_OS_X_VERSION_10_11 101100
# endif
# ifndef MAC_OS_X_VERSION_10_12
# define MAC_OS_X_VERSION_10_12 101200
# endif
# ifndef MAC_OS_X_VERSION_10_13
# define MAC_OS_X_VERSION_10_13 101300
# endif
# if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13
# ifndef NSAppKitVersionNumber10_10
# define NSAppKitVersionNumber10_10 1343
# endif
# ifndef NSAppKitVersionNumber10_11
# define NSAppKitVersionNumber10_11 1404
# endif
# endif
# ifndef __WXOSX__
# define __WXOSX__ 1
# endif
# ifndef __WXMAC__
# define __WXMAC__ 1
# endif
#endif
/*
We use __WINDOWS__ as our main identification symbol for Microsoft Windows
but it's actually not predefined directly by any commonly used compilers
(only Watcom defines it itself and it's not supported any longer), so we
define it ourselves if any of the following macros is defined:
- MSVC _WIN32 (notice that this is also defined under Win64)
- Borland __WIN32__
- Our __WXMSW__ which selects Windows as platform automatically
*/
#if defined(_WIN32) || defined(__WIN32__) || defined(__WXMSW__)
# ifndef __WINDOWS__
# define __WINDOWS__
# endif /* !__WINDOWS__ */
#endif /* Any standard symbol indicating Windows */
#if defined(__WINDOWS__)
/* Select wxMSW under Windows if no other port is specified. */
# if !defined(__WXMSW__) && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) && !defined(__WXQT__)
# define __WXMSW__
# endif
# ifndef _WIN32
# define _WIN32
# endif
# ifndef WIN32
# define WIN32
# endif
# ifndef __WIN32__
# define __WIN32__
# endif
/* MSVC predefines _WIN64 for 64 bit builds, for gcc we use generic
architecture definitions. */
# if defined(_WIN64) || defined(__x86_64__)
# ifndef __WIN64__
# define __WIN64__
# endif /* !__WIN64__ */
# endif /* _WIN64 */
#endif /* __WINDOWS__ */
/*
Don't use widget toolkit specific code in non-GUI code in the library
itself to ensure that the same base library is used for both MSW and GTK
ports. But keep __WXMSW__ defined for (console) applications using
wxWidgets for compatibility.
*/
#if defined(WXBUILDING) && defined(wxUSE_GUI) && !wxUSE_GUI
# ifdef __WXMSW__
# undef __WXMSW__
# endif
# ifdef __WXGTK__
# undef __WXGTK__
# endif
#endif
#if (defined(__WXGTK__) || defined(__WXQT__)) && defined(__WINDOWS__)
# ifdef __WXMSW__
# undef __WXMSW__
# endif
#endif /* (__WXGTK__ || __WXQT__) && __WINDOWS__ */
#ifdef __ANDROID__
# define __WXANDROID__
# include "wx/android/config_android.h"
#endif
#include "wx/compiler.h"
/*
Include wx/setup.h for the Unix platform defines generated by configure and
the library compilation options
Note that it must be included before defining hardware symbols below as they
could be already defined by configure but it must be included after defining
the compiler macros above as msvc/wx/setup.h relies on them under Windows.
*/
#include "wx/setup.h"
/*
Convenience for any optional classes that use the wxAnyButton base class.
*/
#if wxUSE_TOGGLEBTN || wxUSE_BUTTON
#define wxHAS_ANY_BUTTON
#endif
/*
Hardware platform detection.
VC++ defines _M_xxx symbols.
*/
#if defined(_M_IX86) || defined(i386) || defined(__i386) || defined(__i386__)
#ifndef __INTEL__
#define __INTEL__
#endif
#endif /* x86 */
#if defined(_M_IA64)
#ifndef __IA64__
#define __IA64__
#endif
#endif /* ia64 */
#if defined(_M_MPPC) || defined(__PPC__) || defined(__ppc__)
#ifndef __POWERPC__
#define __POWERPC__
#endif
#endif /* alpha */
#if defined(_M_ALPHA) || defined(__AXP__)
#ifndef __ALPHA__
#define __ALPHA__
#endif
#endif /* alpha */
/*
adjust the Unicode setting: wxUSE_UNICODE should be defined as 0 or 1
and is used by wxWidgets, _UNICODE and/or UNICODE may be defined or used by
the system headers so bring these settings in sync
*/
/* set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined */
#if defined(_UNICODE) || defined(UNICODE)
# undef wxUSE_UNICODE
# define wxUSE_UNICODE 1
#else /* !UNICODE */
# ifndef wxUSE_UNICODE
# define wxUSE_UNICODE 0
# endif
#endif /* UNICODE/!UNICODE */
/* and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1 */
#if wxUSE_UNICODE
# ifndef _UNICODE
# define _UNICODE
# endif
# ifndef UNICODE
# define UNICODE
# endif
#endif /* wxUSE_UNICODE */
/*
test for old versions of Borland C, normally need at least 5.82, Turbo
explorer, available for free at http://www.turboexplorer.com/downloads
*/
/*
Older versions of Borland C have some compiler bugs that need
workarounds. Mostly pertains to the free command line compiler 5.5.1.
*/
#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x551)
/*
The Borland free compiler is unable to handle overloaded enum
comparisons under certain conditions e.g. when any class has a
conversion ctor for an integral type and there's an overload to
compare between an integral type and that class type.
*/
# define wxCOMPILER_NO_OVERLOAD_ON_ENUM
/*
This is needed to overcome bugs in 5.5.1 STL, linking errors will
result if it is not defined.
*/
# define _RWSTD_COMPILE_INSTANTIATE
/*
Preprocessor in older Borland compilers have major problems
concatenating with ##. Specifically, if the string operands being
concatenated have special meaning (e.g. L"str", 123i64 etc)
then ## will not concatenate the operands correctly.
As a workaround, define wxPREPEND* and wxAPPEND* without using
wxCONCAT_HELPER.
*/
# define wxCOMPILER_BROKEN_CONCAT_OPER
#endif /* __BORLANDC__ */
/*
OS: then test for generic Unix defines, then for particular flavours and
finally for Unix-like systems
Mac OS X matches this case (__MACH__), prior Mac OS do not.
*/
#if defined(__UNIX__) || defined(__unix) || defined(__unix__) || \
defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \
defined(__hpux) || defined(__sun) || defined(__SUN__) || defined(_AIX) || \
defined(__VMS) || defined(__BEOS__) || defined(__MACH__)
# define __UNIX_LIKE__
# ifdef __SGI__
# ifdef __GNUG__
# else /* !gcc */
/*
Note I use the term __SGI_CC__ for both cc and CC, its not a good
idea to mix gcc and cc/CC, the name mangling is different
*/
# define __SGI_CC__
# endif /* gcc/!gcc */
/* system headers use this symbol and not __cplusplus in some places */
# ifndef _LANGUAGE_C_PLUS_PLUS
# define _LANGUAGE_C_PLUS_PLUS
# endif
# endif /* SGI */
# if defined(__INNOTEK_LIBC__)
/* Ensure visibility of strnlen declaration */
# define _GNU_SOURCE
# endif
/* define __HPUX__ for HP-UX where standard macro is __hpux */
# if defined(__hpux) && !defined(__HPUX__)
# define __HPUX__
# endif /* HP-UX */
/* All of these should already be defined by including configure-
generated setup.h but we wish to support Xcode compilation without
requiring the user to define these himself.
*/
# if defined(__APPLE__) && defined(__MACH__)
# ifndef __UNIX__
# define __UNIX__ 1
# endif
# ifndef __BSD__
# define __BSD__ 1
# endif
/* __DARWIN__ is our own define to mean OS X or pure Darwin */
# ifndef __DARWIN__
# define __DARWIN__ 1
# endif
/* OS X uses unsigned long size_t for both ILP32 and LP64 modes. */
# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
# define wxSIZE_T_IS_ULONG
# endif
# endif
/*
OS: Windows
*/
#elif defined(__WINDOWS__)
/* to be changed for Win64! */
# ifndef __WIN32__
# error "__WIN32__ should be defined for Win32 and Win64, Win16 is not supported"
# endif
/* size_t is the same as unsigned int for all Windows compilers we know, */
/* so define it if it hadn't been done by configure yet */
# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) && !defined(__WIN64__)
# define wxSIZE_T_IS_UINT
# endif
#else
# error "Unknown platform."
#endif /* OS */
/*
if we're on a Unix system but didn't use configure (so that setup.h didn't
define __UNIX__), do define __UNIX__ now
*/
#if !defined(__UNIX__) && defined(__UNIX_LIKE__)
# define __UNIX__
#endif /* Unix */
#if defined(__WXMOTIF__) || defined(__WXX11__)
# define __X__
#endif
/*
We get "Large Files (ILP32) not supported in strict ANSI mode." #error
from HP-UX standard headers when compiling with g++ without this:
*/
#if defined(__HPUX__) && !defined(__STDC_EXT__)
# define __STDC_EXT__ 1
#endif
/* Force linking against required libraries under Windows: */
#if defined __WINDOWS__
# include "wx/msw/libraries.h"
#endif
#if defined(__BORLANDC__) || (defined(__GNUC__) && __GNUC__ < 3)
#define wxNEEDS_CHARPP
#endif
/*
Note that wx/msw/gccpriv.h must be included after defining UNICODE and
_UNICODE macros as it includes _mingw.h which relies on them being set.
*/
#if ( defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \
( defined( __CYGWIN__ ) && defined( __WINDOWS__ ) ) ) && \
!defined(__WXMOTIF__) && \
!defined(__WXX11__)
# include "wx/msw/gccpriv.h"
#else
# undef wxCHECK_W32API_VERSION
# define wxCHECK_W32API_VERSION(maj, min) (0)
# undef wxCHECK_MINGW32_VERSION
# define wxCHECK_MINGW32_VERSION( major, minor ) (0)
# define wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params)
# define wxDECL_FOR_STRICT_MINGW32(rettype, func, params)
#endif
/*
Handle Darwin gcc universal compilation. Don't do this in an Apple-
specific case since no sane compiler should be defining either
__BIG_ENDIAN__ or __LITTLE_ENDIAN__ unless it really is generating
code that will be hosted on a machine with the appropriate endianness.
If a compiler defines neither, assume the user or configure set
WORDS_BIGENDIAN appropriately.
*/
#if defined(__BIG_ENDIAN__)
# undef WORDS_BIGENDIAN
# define WORDS_BIGENDIAN 1
#elif defined(__LITTLE_ENDIAN__)
# undef WORDS_BIGENDIAN
#elif defined(__WXMAC__) && !defined(WORDS_BIGENDIAN)
/* According to Stefan even ancient Mac compilers defined __BIG_ENDIAN__ */
# warning "Compiling wxMac with probably wrong endianness"
#endif
/* also the 32/64 bit universal builds must be handled accordingly */
#ifdef __DARWIN__
# ifdef __LP64__
# undef SIZEOF_VOID_P
# undef SIZEOF_LONG
# undef SIZEOF_SIZE_T
# define SIZEOF_VOID_P 8
# define SIZEOF_LONG 8
# define SIZEOF_SIZE_T 8
# else
# undef SIZEOF_VOID_P
# undef SIZEOF_LONG
# undef SIZEOF_SIZE_T
# define SIZEOF_VOID_P 4
# define SIZEOF_LONG 4
# define SIZEOF_SIZE_T 4
# endif
#endif
/*
Define various OS X symbols before including wx/chkconf.h which uses them.
__WXOSX_MAC__ means Mac OS X, non embedded
__WXOSX_IPHONE__ means OS X iPhone
*/
/*
Normally all of __WXOSX_XXX__, __WXOSX__ and __WXMAC__ are defined by
configure but ensure that we also define them if configure was not used for
whatever reason.
The primary symbol remains __WXOSX_XXX__ one, __WXOSX__ exists to allow
checking for any OS X port (Cocoa) and __WXMAC__ is an old name
for it.
*/
#if defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__)
# ifndef __WXOSX__
# define __WXOSX__ 1
# endif
# ifndef __WXMAC__
# define __WXMAC__ 1
# endif
#endif
#ifdef __WXOSX__
/* setup precise defines according to sdk used */
# include <TargetConditionals.h>
# if defined(__WXOSX_IPHONE__)
# if !( defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE )
# error "incorrect SDK for an iPhone build"
# endif
# else
# if wxUSE_GUI && !defined(__WXOSX_COCOA__)
# error "one of __WXOSX_IPHONE__ or __WXOSX_COCOA__ must be defined for the GUI build"
# endif
# if !( defined(TARGET_OS_MAC) && TARGET_OS_MAC )
# error "incorrect SDK for a Mac OS X build"
# endif
# define __WXOSX_MAC__ 1
# endif
#endif
#ifdef __WXOSX_MAC__
# if defined(__MACH__)
# include <AvailabilityMacros.h>
# ifndef MAC_OS_X_VERSION_10_4
# define MAC_OS_X_VERSION_10_4 1040
# endif
# ifndef MAC_OS_X_VERSION_10_5
# define MAC_OS_X_VERSION_10_5 1050
# endif
# ifndef MAC_OS_X_VERSION_10_6
# define MAC_OS_X_VERSION_10_6 1060
# endif
# ifndef MAC_OS_X_VERSION_10_7
# define MAC_OS_X_VERSION_10_7 1070
# endif
# ifndef MAC_OS_X_VERSION_10_8
# define MAC_OS_X_VERSION_10_8 1080
# endif
# ifndef MAC_OS_X_VERSION_10_9
# define MAC_OS_X_VERSION_10_9 1090
# endif
# ifndef MAC_OS_X_VERSION_10_10
# define MAC_OS_X_VERSION_10_10 101000
# endif
# ifndef MAC_OS_X_VERSION_10_11
# define MAC_OS_X_VERSION_10_11 101100
# endif
# ifndef MAC_OS_X_VERSION_10_12
# define MAC_OS_X_VERSION_10_12 101200
# endif
# ifndef MAC_OS_X_VERSION_10_13
# define MAC_OS_X_VERSION_10_13 101300
# endif
# ifndef MAC_OS_X_VERSION_10_14
# define MAC_OS_X_VERSION_10_14 101400
# endif
# if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13
# ifndef NSAppKitVersionNumber10_10
# define NSAppKitVersionNumber10_10 1343
# endif
# ifndef NSAppKitVersionNumber10_11
# define NSAppKitVersionNumber10_11 1404
# endif
# endif
# else
# error "only mach-o configurations are supported"
# endif
#endif
/*
This is obsolete and kept for backwards compatibility only.
*/
#if defined(__WXOSX__)
# define __WXOSX_OR_COCOA__ 1
#endif
/*
check the consistency of the settings in setup.h: note that this must be
done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h
and after defining the compiler macros which are used in it too
*/
#include "wx/chkconf.h"
/*
some compilers don't support iostream.h any longer, while some of theme
are not updated with <iostream> yet, so override the users setting here
in such case.
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1310)
# undef wxUSE_IOSTREAMH
# define wxUSE_IOSTREAMH 0
#elif defined(__MINGW32__)
# undef wxUSE_IOSTREAMH
# define wxUSE_IOSTREAMH 0
#endif /* compilers with/without iostream.h */
/*
old C++ headers (like <iostream.h>) declare classes in the global namespace
while the new, standard ones (like <iostream>) do it in std:: namespace,
unless it's an old gcc version.
using this macro allows constuctions like "wxSTD iostream" to work in
either case
*/
#if !wxUSE_IOSTREAMH && (!defined(__GNUC__) || ( __GNUC__ > 2 ) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
# define wxSTD std::
#else
# define wxSTD
#endif
/* On OpenVMS with the most recent HP C++ compiler some function (i.e. wscanf)
* are only available in the std-namespace. (BUG???)
*/
#if defined( __VMS ) && (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD )
# define wxVMS_USE_STD std::
#else
# define wxVMS_USE_STD
#endif
#ifdef __VMS
#define XtDisplay XTDISPLAY
#ifdef __WXMOTIF__
#define XtParent XTPARENT
#define XtScreen XTSCREEN
#define XtWindow XTWINDOW
#endif
#endif
/* Choose which method we will use for updating menus
* - in OnIdle, or when we receive a wxEVT_MENU_OPEN event.
* Presently, only Windows, OS X and GTK+ support wxEVT_MENU_OPEN.
*/
#ifndef wxUSE_IDLEMENUUPDATES
# if (defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXOSX__)) && !defined(__WXUNIVERSAL__)
# define wxUSE_IDLEMENUUPDATES 0
# else
# define wxUSE_IDLEMENUUPDATES 1
# endif
#endif
/*
* Define symbols that are not yet in
* configure or possibly some setup.h files.
* They will need to be added.
*/
#ifndef wxUSE_FILECONFIG
# if wxUSE_CONFIG && wxUSE_TEXTFILE
# define wxUSE_FILECONFIG 1
# else
# define wxUSE_FILECONFIG 0
# endif
#endif
#ifndef wxUSE_HOTKEY
# define wxUSE_HOTKEY 0
#endif
#if !defined(wxUSE_WXDIB) && defined(__WXMSW__)
# define wxUSE_WXDIB 1
#endif
/*
Optionally supported C++ features.
*/
/*
RTTI: if it is disabled in build/msw/makefile.* then this symbol will
already be defined but it's also possible to do it from configure (with
g++) or by editing project files with MSVC so test for it here too.
*/
#ifndef wxNO_RTTI
/*
Only 4.3 defines __GXX_RTTI by default so its absence is not an
indication of disabled RTTI with the previous versions.
*/
# if wxCHECK_GCC_VERSION(4, 3)
# ifndef __GXX_RTTI
# define wxNO_RTTI
# endif
# elif defined(_MSC_VER)
# ifndef _CPPRTTI
# define wxNO_RTTI
# endif
# endif
#endif /* wxNO_RTTI */
#endif /* _WX_PLATFORM_H_ */
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win64/include/wx/aboutdlg.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/aboutdlg.h
// Purpose: declaration of wxAboutDialog class
// Author: Vadim Zeitlin
// Created: 2006-10-07
// Copyright: (c) 2006 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ABOUTDLG_H_
#define _WX_ABOUTDLG_H_
#include "wx/defs.h"
#if wxUSE_ABOUTDLG
#include "wx/app.h"
#include "wx/icon.h"
// ----------------------------------------------------------------------------
// wxAboutDialogInfo: information shown by the standard "About" dialog
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxAboutDialogInfo
{
public:
// all fields are initially uninitialized
wxAboutDialogInfo() { }
// accessors for various simply fields
// -----------------------------------
// name of the program, if not used defaults to wxApp::GetAppDisplayName()
void SetName(const wxString& name) { m_name = name; }
wxString GetName() const
{ return m_name.empty() ? wxTheApp->GetAppDisplayName() : m_name; }
// version should contain program version without "version" word (e.g.,
// "1.2" or "RC2") while longVersion may contain the full version including
// "version" word (e.g., "Version 1.2" or "Release Candidate 2")
//
// if longVersion is empty, it is automatically constructed from version
//
// generic and gtk native: use short version only, as a suffix to the
// program name msw and osx native: use long version
void SetVersion(const wxString& version,
const wxString& longVersion = wxString());
bool HasVersion() const { return !m_version.empty(); }
const wxString& GetVersion() const { return m_version; }
const wxString& GetLongVersion() const { return m_longVersion; }
// brief, but possibly multiline, description of the program
void SetDescription(const wxString& desc) { m_description = desc; }
bool HasDescription() const { return !m_description.empty(); }
const wxString& GetDescription() const { return m_description; }
// short string containing the program copyright information
void SetCopyright(const wxString& copyright) { m_copyright = copyright; }
bool HasCopyright() const { return !m_copyright.empty(); }
const wxString& GetCopyright() const { return m_copyright; }
// long, multiline string containing the text of the program licence
void SetLicence(const wxString& licence) { m_licence = licence; }
void SetLicense(const wxString& licence) { m_licence = licence; }
bool HasLicence() const { return !m_licence.empty(); }
const wxString& GetLicence() const { return m_licence; }
// icon to be shown in the dialog, defaults to the main frame icon
void SetIcon(const wxIcon& icon) { m_icon = icon; }
bool HasIcon() const { return m_icon.IsOk(); }
wxIcon GetIcon() const;
// web site for the program and its description (defaults to URL itself if
// empty)
void SetWebSite(const wxString& url, const wxString& desc = wxEmptyString)
{
m_url = url;
m_urlDesc = desc.empty() ? url : desc;
}
bool HasWebSite() const { return !m_url.empty(); }
const wxString& GetWebSiteURL() const { return m_url; }
const wxString& GetWebSiteDescription() const { return m_urlDesc; }
// accessors for the arrays
// ------------------------
// the list of developers of the program
void SetDevelopers(const wxArrayString& developers)
{ m_developers = developers; }
void AddDeveloper(const wxString& developer)
{ m_developers.push_back(developer); }
bool HasDevelopers() const { return !m_developers.empty(); }
const wxArrayString& GetDevelopers() const { return m_developers; }
// the list of documentation writers
void SetDocWriters(const wxArrayString& docwriters)
{ m_docwriters = docwriters; }
void AddDocWriter(const wxString& docwriter)
{ m_docwriters.push_back(docwriter); }
bool HasDocWriters() const { return !m_docwriters.empty(); }
const wxArrayString& GetDocWriters() const { return m_docwriters; }
// the list of artists for the program art
void SetArtists(const wxArrayString& artists)
{ m_artists = artists; }
void AddArtist(const wxString& artist)
{ m_artists.push_back(artist); }
bool HasArtists() const { return !m_artists.empty(); }
const wxArrayString& GetArtists() const { return m_artists; }
// the list of translators
void SetTranslators(const wxArrayString& translators)
{ m_translators = translators; }
void AddTranslator(const wxString& translator)
{ m_translators.push_back(translator); }
bool HasTranslators() const { return !m_translators.empty(); }
const wxArrayString& GetTranslators() const { return m_translators; }
// implementation only
// -------------------
// "simple" about dialog shows only textual information (with possibly
// default icon but without hyperlink nor any long texts such as the
// licence text)
bool IsSimple() const
{ return !HasWebSite() && !HasIcon() && !HasLicence(); }
// get the description and credits (i.e. all of developers, doc writers,
// artists and translators) as a one long multiline string
wxString GetDescriptionAndCredits() const;
// returns the copyright with the (C) string substituted by the Unicode
// character U+00A9
wxString GetCopyrightToDisplay() const;
private:
wxString m_name,
m_version,
m_longVersion,
m_description,
m_copyright,
m_licence;
wxIcon m_icon;
wxString m_url,
m_urlDesc;
wxArrayString m_developers,
m_docwriters,
m_artists,
m_translators;
};
// functions to show the about dialog box
WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
#endif // wxUSE_ABOUTDLG
#endif // _WX_ABOUTDLG_H_
| h |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.