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/Win32/include/wx/afterstd.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/afterstd.h
// Purpose: #include after STL headers
// Author: Vadim Zeitlin
// Modified by:
// Created: 07/07/03
// Copyright: (c) 2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/**
See the comments in beforestd.h.
*/
#if defined(__WINDOWS__)
#include "wx/msw/winundef.h"
#endif
// undo what we did in wx/beforestd.h
#if defined(__VISUALC__) && __VISUALC__ <= 1201
#pragma warning(pop)
#endif
// see beforestd.h for explanation
#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY)
#pragma GCC visibility pop
#endif
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/imagxpm.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/imagxpm.h
// Purpose: wxImage XPM handler
// Author: Vaclav Slavik
// Copyright: (c) 2001 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_IMAGXPM_H_
#define _WX_IMAGXPM_H_
#include "wx/image.h"
#if wxUSE_XPM
//-----------------------------------------------------------------------------
// wxXPMHandler
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxXPMHandler : public wxImageHandler
{
public:
inline wxXPMHandler()
{
m_name = wxT("XPM file");
m_extension = wxT("xpm");
m_type = wxBITMAP_TYPE_XPM;
m_mime = wxT("image/xpm");
}
#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
private:
wxDECLARE_DYNAMIC_CLASS(wxXPMHandler);
};
#endif // wxUSE_XPM
#endif // _WX_IMAGXPM_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/iosfwrap.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/iosfwrap.h
// Purpose: includes the correct stream-related forward declarations
// Author: Jan van Dijk <[email protected]>
// Modified by:
// Created: 18.12.2002
// Copyright: wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#if wxUSE_STD_IOSTREAM
#if wxUSE_IOSTREAMH
// There is no pre-ANSI iosfwd header so we include the full declarations.
# include <iostream.h>
#else
# include <iosfwd>
#endif
#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/Win32/include/wx/valnum.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/valnum.h
// Purpose: Numeric validator classes.
// Author: Vadim Zeitlin based on the submission of Fulvio Senore
// Created: 2010-11-06
// Copyright: (c) 2010 wxWidgets team
// (c) 2011 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_VALNUM_H_
#define _WX_VALNUM_H_
#include "wx/defs.h"
#if wxUSE_VALIDATORS
#include "wx/textentry.h"
#include "wx/validate.h"
// This header uses std::numeric_limits<>::min/max, but these symbols are,
// unfortunately, often defined as macros and the code here wouldn't compile in
// this case, so preventively undefine them to avoid this problem.
#undef min
#undef max
#include <limits>
// Bit masks used for numeric validator styles.
enum wxNumValidatorStyle
{
wxNUM_VAL_DEFAULT = 0x0,
wxNUM_VAL_THOUSANDS_SEPARATOR = 0x1,
wxNUM_VAL_ZERO_AS_BLANK = 0x2,
wxNUM_VAL_NO_TRAILING_ZEROES = 0x4
};
// ----------------------------------------------------------------------------
// Base class for all numeric validators.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNumValidatorBase : public wxValidator
{
public:
// Change the validator style. Usually it's specified during construction.
void SetStyle(int style) { m_style = style; }
// Override base class method to not do anything but always return success:
// we don't need this as we do our validation on the fly here.
virtual bool Validate(wxWindow * WXUNUSED(parent)) wxOVERRIDE { return true; }
// Override base class method to check that the window is a text control or
// combobox.
virtual void SetWindow(wxWindow *win) wxOVERRIDE;
protected:
wxNumValidatorBase(int style)
{
m_style = style;
}
wxNumValidatorBase(const wxNumValidatorBase& other) : wxValidator(other)
{
m_style = other.m_style;
}
bool HasFlag(wxNumValidatorStyle style) const
{
return (m_style & style) != 0;
}
// Get the text entry of the associated control. Normally shouldn't ever
// return NULL (and will assert if it does return it) but the caller should
// still test the return value for safety.
wxTextEntry *GetTextEntry() const;
// Convert wxNUM_VAL_THOUSANDS_SEPARATOR and wxNUM_VAL_NO_TRAILING_ZEROES
// bits of our style to the corresponding wxNumberFormatter::Style values.
int GetFormatFlags() const;
// Return true if pressing a '-' key is acceptable for the current control
// contents and insertion point. This is meant to be called from the
// derived class IsCharOk() implementation.
bool IsMinusOk(const wxString& val, int pos) const;
// Return the string which would result from inserting the given character
// at the specified position.
wxString GetValueAfterInsertingChar(wxString val, int pos, wxChar ch) const
{
val.insert(pos, ch);
return val;
}
private:
// Check whether the specified character can be inserted in the control at
// the given position in the string representing the current controls
// contents.
//
// Notice that the base class checks for '-' itself so it's never passed to
// this function.
virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const = 0;
// NormalizeString the contents of the string if it's a valid number, return
// empty string otherwise.
virtual wxString NormalizeString(const wxString& s) const = 0;
// Event handlers.
void OnChar(wxKeyEvent& event);
void OnKillFocus(wxFocusEvent& event);
// Determine the current insertion point and text in the associated control.
void GetCurrentValueAndInsertionPoint(wxString& val, int& pos) const;
// Combination of wxVAL_NUM_XXX values.
int m_style;
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_ASSIGN_CLASS(wxNumValidatorBase);
};
namespace wxPrivate
{
// This is a helper class used by wxIntegerValidator and wxFloatingPointValidator
// below that implements Transfer{To,From}Window() adapted to the type of the
// variable.
//
// The template argument B is the name of the base class which must derive from
// wxNumValidatorBase and define LongestValueType type and {To,As}String()
// methods i.e. basically be one of wx{Integer,Number}ValidatorBase classes.
//
// The template argument T is just the type handled by the validator that will
// inherit from this one.
template <class B, typename T>
class wxNumValidator : public B
{
public:
typedef B BaseValidator;
typedef T ValueType;
typedef typename BaseValidator::LongestValueType LongestValueType;
wxCOMPILE_TIME_ASSERT
(
sizeof(ValueType) <= sizeof(LongestValueType),
UnsupportedType
);
void SetMin(ValueType min)
{
this->DoSetMin(min);
}
void SetMax(ValueType max)
{
this->DoSetMax(max);
}
void SetRange(ValueType min, ValueType max)
{
SetMin(min);
SetMax(max);
}
virtual bool TransferToWindow() wxOVERRIDE
{
if ( m_value )
{
wxTextEntry * const control = BaseValidator::GetTextEntry();
if ( !control )
return false;
control->SetValue(NormalizeValue(*m_value));
}
return true;
}
virtual bool TransferFromWindow() wxOVERRIDE
{
if ( m_value )
{
wxTextEntry * const control = BaseValidator::GetTextEntry();
if ( !control )
return false;
const wxString s(control->GetValue());
LongestValueType value;
if ( s.empty() && BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) )
value = 0;
else if ( !BaseValidator::FromString(s, &value) )
return false;
if ( !this->IsInRange(value) )
return false;
*m_value = static_cast<ValueType>(value);
}
return true;
}
protected:
wxNumValidator(ValueType *value, int style)
: BaseValidator(style),
m_value(value)
{
}
// Implement wxNumValidatorBase virtual method which is the same for
// both integer and floating point numbers.
virtual wxString NormalizeString(const wxString& s) const wxOVERRIDE
{
LongestValueType value;
return BaseValidator::FromString(s, &value) ? NormalizeValue(value)
: wxString();
}
private:
// Just a helper which is a common part of TransferToWindow() and
// NormalizeString(): returns string representation of a number honouring
// wxNUM_VAL_ZERO_AS_BLANK flag.
wxString NormalizeValue(LongestValueType value) const
{
// We really want to compare with the exact 0 here, so disable gcc
// warning about doing this.
wxGCC_WARNING_SUPPRESS(float-equal)
wxString s;
if ( value != 0 || !BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) )
s = this->ToString(value);
wxGCC_WARNING_RESTORE(float-equal)
return s;
}
ValueType * const m_value;
wxDECLARE_NO_ASSIGN_CLASS(wxNumValidator);
};
} // namespace wxPrivate
// ----------------------------------------------------------------------------
// Validators for integer numbers.
// ----------------------------------------------------------------------------
// Base class for integer numbers validator. This class contains all non
// type-dependent code of wxIntegerValidator<> and always works with values of
// type LongestValueType. It is not meant to be used directly, please use
// wxIntegerValidator<> only instead.
class WXDLLIMPEXP_CORE wxIntegerValidatorBase : public wxNumValidatorBase
{
protected:
// Define the type we use here, it should be the maximal-sized integer type
// we support to make it possible to base wxIntegerValidator<> for any type
// on it.
#ifdef wxLongLong_t
typedef wxLongLong_t LongestValueType;
#else
typedef long LongestValueType;
#endif
wxIntegerValidatorBase(int style)
: wxNumValidatorBase(style)
{
wxASSERT_MSG( !(style & wxNUM_VAL_NO_TRAILING_ZEROES),
"This style doesn't make sense for integers." );
}
wxIntegerValidatorBase(const wxIntegerValidatorBase& other)
: wxNumValidatorBase(other)
{
m_min = other.m_min;
m_max = other.m_max;
}
// Provide methods for wxNumValidator use.
wxString ToString(LongestValueType value) const;
static bool FromString(const wxString& s, LongestValueType *value);
void DoSetMin(LongestValueType min) { m_min = min; }
void DoSetMax(LongestValueType max) { m_max = max; }
bool IsInRange(LongestValueType value) const
{
return m_min <= value && value <= m_max;
}
// Implement wxNumValidatorBase pure virtual method.
virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const wxOVERRIDE;
private:
// Minimal and maximal values accepted (inclusive).
LongestValueType m_min, m_max;
wxDECLARE_NO_ASSIGN_CLASS(wxIntegerValidatorBase);
};
// Validator for integer numbers. It can actually work with any integer type
// (short, int or long and long long if supported) and their unsigned versions
// as well.
template <typename T>
class wxIntegerValidator
: public wxPrivate::wxNumValidator<wxIntegerValidatorBase, T>
{
public:
typedef T ValueType;
typedef
wxPrivate::wxNumValidator<wxIntegerValidatorBase, T> Base;
// Ctor for an integer validator.
//
// Sets the range appropriately for the type, including setting 0 as the
// minimal value for the unsigned types.
wxIntegerValidator(ValueType *value = NULL, int style = wxNUM_VAL_DEFAULT)
: Base(value, style)
{
this->DoSetMin(std::numeric_limits<ValueType>::min());
this->DoSetMax(std::numeric_limits<ValueType>::max());
}
virtual wxObject *Clone() const wxOVERRIDE { return new wxIntegerValidator(*this); }
private:
wxDECLARE_NO_ASSIGN_CLASS(wxIntegerValidator);
};
// Helper function for creating integer validators which allows to avoid
// explicitly specifying the type as it deduces it from its parameter.
template <typename T>
inline wxIntegerValidator<T>
wxMakeIntegerValidator(T *value, int style = wxNUM_VAL_DEFAULT)
{
return wxIntegerValidator<T>(value, style);
}
// ----------------------------------------------------------------------------
// Validators for floating point numbers.
// ----------------------------------------------------------------------------
// Similar to wxIntegerValidatorBase, this class is not meant to be used
// directly, only wxFloatingPointValidator<> should be used in the user code.
class WXDLLIMPEXP_CORE wxFloatingPointValidatorBase : public wxNumValidatorBase
{
public:
// Set precision i.e. the number of digits shown (and accepted on input)
// after the decimal point. By default this is set to the maximal precision
// supported by the type handled by the validator.
void SetPrecision(unsigned precision) { m_precision = precision; }
// Set multiplier applied for displaying the value, e.g. 100 if the value
// should be displayed in percents, so that the variable containing 0.5
// would be displayed as 50.
void SetFactor(double factor) { m_factor = factor; }
protected:
// Notice that we can't use "long double" here because it's not supported
// by wxNumberFormatter yet, so restrict ourselves to just double (and
// float).
typedef double LongestValueType;
wxFloatingPointValidatorBase(int style)
: wxNumValidatorBase(style)
{
m_factor = 1.0;
}
wxFloatingPointValidatorBase(const wxFloatingPointValidatorBase& other)
: wxNumValidatorBase(other)
{
m_precision = other.m_precision;
m_factor = other.m_factor;
m_min = other.m_min;
m_max = other.m_max;
}
// Provide methods for wxNumValidator use.
wxString ToString(LongestValueType value) const;
bool FromString(const wxString& s, LongestValueType *value) const;
void DoSetMin(LongestValueType min) { m_min = min; }
void DoSetMax(LongestValueType max) { m_max = max; }
bool IsInRange(LongestValueType value) const
{
return m_min <= value && value <= m_max;
}
// Implement wxNumValidatorBase pure virtual method.
virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const wxOVERRIDE;
private:
// Maximum number of decimals digits after the decimal separator.
unsigned m_precision;
// Factor applied for the displayed the value.
double m_factor;
// Minimal and maximal values accepted (inclusive).
LongestValueType m_min, m_max;
wxDECLARE_NO_ASSIGN_CLASS(wxFloatingPointValidatorBase);
};
// Validator for floating point numbers. It can be used with float, double or
// long double values.
template <typename T>
class wxFloatingPointValidator
: public wxPrivate::wxNumValidator<wxFloatingPointValidatorBase, T>
{
public:
typedef T ValueType;
typedef wxPrivate::wxNumValidator<wxFloatingPointValidatorBase, T> Base;
// Ctor using implicit (maximal) precision for this type.
wxFloatingPointValidator(ValueType *value = NULL,
int style = wxNUM_VAL_DEFAULT)
: Base(value, style)
{
DoSetMinMax();
this->SetPrecision(std::numeric_limits<ValueType>::digits10);
}
// Ctor specifying an explicit precision.
wxFloatingPointValidator(int precision,
ValueType *value = NULL,
int style = wxNUM_VAL_DEFAULT)
: Base(value, style)
{
DoSetMinMax();
this->SetPrecision(precision);
}
virtual wxObject *Clone() const wxOVERRIDE
{
return new wxFloatingPointValidator(*this);
}
private:
void DoSetMinMax()
{
// NB: Do not use min(), it's not the smallest representable value for
// the floating point types but rather the smallest representable
// positive value.
this->DoSetMin(-std::numeric_limits<ValueType>::max());
this->DoSetMax( std::numeric_limits<ValueType>::max());
}
};
// Helper similar to wxMakeIntValidator().
//
// NB: Unfortunately we can't just have a wxMakeNumericValidator() which would
// return either wxIntegerValidator<> or wxFloatingPointValidator<> so we
// do need two different functions.
template <typename T>
inline wxFloatingPointValidator<T>
wxMakeFloatingPointValidator(T *value, int style = wxNUM_VAL_DEFAULT)
{
return wxFloatingPointValidator<T>(value, style);
}
template <typename T>
inline wxFloatingPointValidator<T>
wxMakeFloatingPointValidator(int precision, T *value, int style = wxNUM_VAL_DEFAULT)
{
return wxFloatingPointValidator<T>(precision, value, style);
}
#endif // wxUSE_VALIDATORS
#endif // _WX_VALNUM_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/ffile.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/ffile.h
// Purpose: wxFFile - encapsulates "FILE *" stream
// Author: Vadim Zeitlin
// Modified by:
// Created: 14.07.99
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FFILE_H_
#define _WX_FFILE_H_
#include "wx/defs.h" // for wxUSE_FFILE
#if wxUSE_FFILE
#include "wx/string.h"
#include "wx/filefn.h"
#include "wx/convauto.h"
#include <stdio.h>
// ----------------------------------------------------------------------------
// class wxFFile: standard C stream library IO
//
// NB: for space efficiency this class has no virtual functions, including
// dtor which is _not_ virtual, so it shouldn't be used as a base class.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxFFile
{
public:
// ctors
// -----
// def ctor
wxFFile() { m_fp = NULL; }
// open specified file (may fail, use IsOpened())
wxFFile(const wxString& filename, const wxString& mode = wxT("r"));
// attach to (already opened) file
wxFFile(FILE *lfp) { m_fp = lfp; }
// open/close
// open a file (existing or not - the mode controls what happens)
bool Open(const wxString& filename, const wxString& mode = wxT("r"));
// closes the opened file (this is a NOP if not opened)
bool Close();
// assign an existing file descriptor and get it back from wxFFile object
void Attach(FILE *lfp, const wxString& name = wxEmptyString)
{ Close(); m_fp = lfp; m_name = name; }
FILE* Detach() { FILE* fpOld = m_fp; m_fp = NULL; return fpOld; }
FILE *fp() const { return m_fp; }
// read/write (unbuffered)
// read all data from the file into a string (useful for text files)
bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto());
// returns number of bytes read - use Eof() and Error() to see if an error
// occurred or not
size_t Read(void *pBuf, size_t nCount);
// returns the number of bytes written
size_t Write(const void *pBuf, size_t nCount);
// returns true on success
bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto());
// flush data not yet written
bool Flush();
// file pointer operations (return ofsInvalid on failure)
// move ptr ofs bytes related to start/current pos/end of file
bool Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart);
// move ptr to ofs bytes before the end
bool SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); }
// get current position in the file
wxFileOffset Tell() const;
// get current file length
wxFileOffset Length() const;
// simple accessors: note that Eof() and Error() may only be called if
// IsOpened(). Otherwise they assert and return false.
// is file opened?
bool IsOpened() const { return m_fp != NULL; }
// is end of file reached?
bool Eof() const;
// has an error occurred?
bool Error() const;
// get the file name
const wxString& GetName() const { return m_name; }
// type such as disk or pipe
wxFileKind GetKind() const { return wxGetFileKind(m_fp); }
// dtor closes the file if opened
~wxFFile() { Close(); }
private:
// copy ctor and assignment operator are private because it doesn't make
// sense to copy files this way: attempt to do it will provoke a compile-time
// error.
wxFFile(const wxFFile&);
wxFFile& operator=(const wxFFile&);
FILE *m_fp; // IO stream or NULL if not opened
wxString m_name; // the name of the file (for diagnostic messages)
};
#endif // wxUSE_FFILE
#endif // _WX_FFILE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/radiobut.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/radiobut.h
// Purpose: wxRadioButton declaration
// Author: Vadim Zeitlin
// Modified by:
// Created: 07.09.00
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RADIOBUT_H_BASE_
#define _WX_RADIOBUT_H_BASE_
#include "wx/defs.h"
#if wxUSE_RADIOBTN
/*
There is no wxRadioButtonBase class as wxRadioButton interface is the same
as wxCheckBox(Base), but under some platforms wxRadioButton really
derives from wxCheckBox and on the others it doesn't.
The pseudo-declaration of wxRadioButtonBase would look like this:
class wxRadioButtonBase : public ...
{
public:
virtual void SetValue(bool value);
virtual bool GetValue() const;
};
*/
#include "wx/control.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioButtonNameStr[];
#if defined(__WXUNIVERSAL__)
#include "wx/univ/radiobut.h"
#elif defined(__WXMSW__)
#include "wx/msw/radiobut.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/radiobut.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/radiobut.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/radiobut.h"
#elif defined(__WXMAC__)
#include "wx/osx/radiobut.h"
#elif defined(__WXQT__)
#include "wx/qt/radiobut.h"
#endif
#endif // wxUSE_RADIOBTN
#endif
// _WX_RADIOBUT_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/display.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/display.h
// Purpose: wxDisplay class
// Author: Royce Mitchell III, Vadim Zeitlin
// Created: 06/21/02
// Copyright: (c) 2002-2006 wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DISPLAY_H_BASE_
#define _WX_DISPLAY_H_BASE_
#include "wx/defs.h"
#include "wx/gdicmn.h" // wxSize
// NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but
// not the video mode stuff) is always available but if wxUSE_DISPLAY == 0
// it becomes just a trivial wrapper around the old wxDisplayXXX() functions
#if wxUSE_DISPLAY
#include "wx/dynarray.h"
#include "wx/vidmode.h"
WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes);
// default, uninitialized, video mode object
extern WXDLLIMPEXP_DATA_CORE(const wxVideoMode) wxDefaultVideoMode;
#endif // wxUSE_DISPLAY
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxPoint;
class WXDLLIMPEXP_FWD_CORE wxRect;
class WXDLLIMPEXP_FWD_BASE wxString;
class WXDLLIMPEXP_FWD_CORE wxDisplayFactory;
class WXDLLIMPEXP_FWD_CORE wxDisplayImpl;
// ----------------------------------------------------------------------------
// wxDisplay: represents a display/monitor attached to the system
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDisplay
{
public:
// initialize the object containing all information about the given
// display
//
// the displays are numbered from 0 to GetCount() - 1, 0 is always the
// primary display and the only one which is always supported
wxDisplay(unsigned n = 0);
// create display object corresponding to the display of the given window
// or the default one if the window display couldn't be found
explicit wxDisplay(const wxWindow* window);
// dtor is not virtual as this is a concrete class not meant to be derived
// from
// return the number of available displays, valid parameters to
// wxDisplay ctor are from 0 up to this number
static unsigned GetCount();
// find the display where the given point lies, return wxNOT_FOUND if
// it doesn't belong to any display
static int GetFromPoint(const wxPoint& pt);
// find the display where the given window lies, return wxNOT_FOUND if it
// is not shown at all
static int GetFromWindow(const wxWindow *window);
// return true if the object was initialized successfully
bool IsOk() const { return m_impl != NULL; }
// get the full display size
wxRect GetGeometry() const;
// get the client area of the display, i.e. without taskbars and such
wxRect GetClientArea() const;
// get the depth, i.e. number of bits per pixel (0 if unknown)
int GetDepth() const;
// get the resolution of this monitor in pixels per inch
wxSize GetPPI() const;
// name may be empty
wxString GetName() const;
// display 0 is usually the primary display
bool IsPrimary() const;
#if wxUSE_DISPLAY
// enumerate all video modes supported by this display matching the given
// one (in the sense of wxVideoMode::Match())
//
// as any mode matches the default value of the argument and there is
// always at least one video mode supported by display, the returned array
// is only empty for the default value of the argument if this function is
// not supported at all on this platform
wxArrayVideoModes
GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const;
// get current video mode
wxVideoMode GetCurrentMode() const;
// change current mode, return true if succeeded, false otherwise
//
// for the default value of the argument restores the video mode to default
bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode);
// restore the default video mode (just a more readable synonym)
void ResetMode() { (void)ChangeMode(); }
#endif // wxUSE_DISPLAY
private:
// returns the factory used to implement our static methods and create new
// displays
static wxDisplayFactory& Factory();
// creates the factory object, called by Factory() when it is called for
// the first time and should return a pointer allocated with new (the
// caller will delete it)
//
// this method must be implemented in platform-specific code if
// wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code)
static wxDisplayFactory *CreateFactory();
// the real implementation
wxDisplayImpl *m_impl;
wxDECLARE_NO_COPY_CLASS(wxDisplay);
};
#endif // _WX_DISPLAY_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/variant.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/variant.h
// Purpose: wxVariant class, container for any type
// Author: Julian Smart
// Modified by:
// Created: 10/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_VARIANT_H_
#define _WX_VARIANT_H_
#include "wx/defs.h"
#if wxUSE_VARIANT
#include "wx/object.h"
#include "wx/string.h"
#include "wx/arrstr.h"
#include "wx/list.h"
#include "wx/cpp.h"
#include "wx/longlong.h"
#if wxUSE_DATETIME
#include "wx/datetime.h"
#endif // wxUSE_DATETIME
#include "wx/iosfwrap.h"
class wxAny;
/*
* wxVariantData stores the actual data in a wxVariant object,
* to allow it to store any type of data.
* Derive from this to provide custom data handling.
*
* NB: When you construct a wxVariantData, it will have refcount
* of one. Refcount will not be further increased when
* it is passed to wxVariant. This simulates old common
* scenario where wxVariant took ownership of wxVariantData
* passed to it.
* If you create wxVariantData for other reasons than passing
* it to wxVariant, technically you are not required to call
* DecRef() before deleting it.
*
* TODO: in order to replace wxPropertyValue, we would need
* to consider adding constructors that take pointers to C++ variables,
* or removing that functionality from the wxProperty library.
* Essentially wxPropertyValue takes on some of the wxValidator functionality
* by storing pointers and not just actual values, allowing update of C++ data
* to be handled automatically. Perhaps there's another way of doing this without
* overloading wxVariant with unnecessary functionality.
*/
class WXDLLIMPEXP_BASE wxVariantData : public wxObjectRefData
{
friend class wxVariant;
public:
wxVariantData() { }
// Override these to provide common functionality
virtual bool Eq(wxVariantData& data) const = 0;
#if wxUSE_STD_IOSTREAM
virtual bool Write(wxSTD ostream& WXUNUSED(str)) const { return false; }
#endif
virtual bool Write(wxString& WXUNUSED(str)) const { return false; }
#if wxUSE_STD_IOSTREAM
virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; }
#endif
virtual bool Read(wxString& WXUNUSED(str)) { return false; }
// What type is it? Return a string name.
virtual wxString GetType() const = 0;
// If it based on wxObject return the ClassInfo.
virtual wxClassInfo* GetValueClassInfo() { return NULL; }
// Implement this to make wxVariant::UnShare work. Returns
// a copy of the data.
virtual wxVariantData* Clone() const { return NULL; }
#if wxUSE_ANY
// Converts value to wxAny, if possible. Return true if successful.
virtual bool GetAsAny(wxAny* WXUNUSED(any)) const { return false; }
#endif
protected:
// Protected dtor should make some incompatible code
// break more louder. That is, they should do data->DecRef()
// instead of delete data.
virtual ~wxVariantData() { }
};
/*
* wxVariant can store any kind of data, but has some basic types
* built in.
*/
class WXDLLIMPEXP_FWD_BASE wxVariant;
WX_DECLARE_LIST_WITH_DECL(wxVariant, wxVariantList, class WXDLLIMPEXP_BASE);
class WXDLLIMPEXP_BASE wxVariant: public wxObject
{
public:
wxVariant();
wxVariant(const wxVariant& variant);
wxVariant(wxVariantData* data, const wxString& name = wxEmptyString);
#if wxUSE_ANY
wxVariant(const wxAny& any);
#endif
virtual ~wxVariant();
// generic assignment
void operator= (const wxVariant& variant);
// Assignment using data, e.g.
// myVariant = new wxStringVariantData("hello");
void operator= (wxVariantData* variantData);
bool operator== (const wxVariant& variant) const;
bool operator!= (const wxVariant& variant) const;
// Sets/gets name
inline void SetName(const wxString& name) { m_name = name; }
inline const wxString& GetName() const { return m_name; }
// Tests whether there is data
bool IsNull() const;
// For compatibility with wxWidgets <= 2.6, this doesn't increase
// reference count.
wxVariantData* GetData() const
{
return (wxVariantData*) m_refData;
}
void SetData(wxVariantData* data) ;
// make a 'clone' of the object
void Ref(const wxVariant& clone) { wxObject::Ref(clone); }
// ensure that the data is exclusive to this variant, and not shared
bool Unshare();
// Make NULL (i.e. delete the data)
void MakeNull();
// Delete data and name
void Clear();
// Returns a string representing the type of the variant,
// e.g. "string", "bool", "stringlist", "list", "double", "long"
wxString GetType() const;
bool IsType(const wxString& type) const;
bool IsValueKindOf(const wxClassInfo* type) const;
// write contents to a string (e.g. for debugging)
wxString MakeString() const;
#if wxUSE_ANY
wxAny GetAny() const;
#endif
// double
wxVariant(double val, const wxString& name = wxEmptyString);
bool operator== (double value) const;
bool operator!= (double value) const;
void operator= (double value) ;
inline operator double () const { return GetDouble(); }
inline double GetReal() const { return GetDouble(); }
double GetDouble() const;
// long
wxVariant(long val, const wxString& name = wxEmptyString);
wxVariant(int val, const wxString& name = wxEmptyString);
wxVariant(short val, const wxString& name = wxEmptyString);
bool operator== (long value) const;
bool operator!= (long value) const;
void operator= (long value) ;
inline operator long () const { return GetLong(); }
inline long GetInteger() const { return GetLong(); }
long GetLong() const;
// bool
wxVariant(bool val, const wxString& name = wxEmptyString);
bool operator== (bool value) const;
bool operator!= (bool value) const;
void operator= (bool value) ;
inline operator bool () const { return GetBool(); }
bool GetBool() const ;
// wxDateTime
#if wxUSE_DATETIME
wxVariant(const wxDateTime& val, const wxString& name = wxEmptyString);
bool operator== (const wxDateTime& value) const;
bool operator!= (const wxDateTime& value) const;
void operator= (const wxDateTime& value) ;
inline operator wxDateTime () const { return GetDateTime(); }
wxDateTime GetDateTime() const;
#endif
// wxString
wxVariant(const wxString& val, const wxString& name = wxEmptyString);
// these overloads are necessary to prevent the compiler from using bool
// version instead of wxString one:
wxVariant(const char* val, const wxString& name = wxEmptyString);
wxVariant(const wchar_t* val, const wxString& name = wxEmptyString);
wxVariant(const wxCStrData& val, const wxString& name = wxEmptyString);
wxVariant(const wxScopedCharBuffer& val, const wxString& name = wxEmptyString);
wxVariant(const wxScopedWCharBuffer& val, const wxString& name = wxEmptyString);
bool operator== (const wxString& value) const;
bool operator!= (const wxString& value) const;
wxVariant& operator=(const wxString& value);
// these overloads are necessary to prevent the compiler from using bool
// version instead of wxString one:
wxVariant& operator=(const char* value)
{ return *this = wxString(value); }
wxVariant& operator=(const wchar_t* value)
{ return *this = wxString(value); }
wxVariant& operator=(const wxCStrData& value)
{ return *this = value.AsString(); }
template<typename T>
wxVariant& operator=(const wxScopedCharTypeBuffer<T>& value)
{ return *this = value.data(); }
inline operator wxString () const { return MakeString(); }
wxString GetString() const;
#if wxUSE_STD_STRING
wxVariant(const std::string& val, const wxString& name = wxEmptyString);
bool operator==(const std::string& value) const
{ return operator==(wxString(value)); }
bool operator!=(const std::string& value) const
{ return operator!=(wxString(value)); }
wxVariant& operator=(const std::string& value)
{ return operator=(wxString(value)); }
operator std::string() const { return (operator wxString()).ToStdString(); }
wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString);
bool operator==(const wxStdWideString& value) const
{ return operator==(wxString(value)); }
bool operator!=(const wxStdWideString& value) const
{ return operator!=(wxString(value)); }
wxVariant& operator=(const wxStdWideString& value)
{ return operator=(wxString(value)); }
operator wxStdWideString() const { return (operator wxString()).ToStdWstring(); }
#endif // wxUSE_STD_STRING
// wxUniChar
wxVariant(const wxUniChar& val, const wxString& name = wxEmptyString);
wxVariant(const wxUniCharRef& val, const wxString& name = wxEmptyString);
wxVariant(char val, const wxString& name = wxEmptyString);
wxVariant(wchar_t val, const wxString& name = wxEmptyString);
bool operator==(const wxUniChar& value) const;
bool operator==(const wxUniCharRef& value) const { return *this == wxUniChar(value); }
bool operator==(char value) const { return *this == wxUniChar(value); }
bool operator==(wchar_t value) const { return *this == wxUniChar(value); }
bool operator!=(const wxUniChar& value) const { return !(*this == value); }
bool operator!=(const wxUniCharRef& value) const { return !(*this == value); }
bool operator!=(char value) const { return !(*this == value); }
bool operator!=(wchar_t value) const { return !(*this == value); }
wxVariant& operator=(const wxUniChar& value);
wxVariant& operator=(const wxUniCharRef& value) { return *this = wxUniChar(value); }
wxVariant& operator=(char value) { return *this = wxUniChar(value); }
wxVariant& operator=(wchar_t value) { return *this = wxUniChar(value); }
operator wxUniChar() const { return GetChar(); }
operator char() const { return GetChar(); }
operator wchar_t() const { return GetChar(); }
wxUniChar GetChar() const;
// wxArrayString
wxVariant(const wxArrayString& val, const wxString& name = wxEmptyString);
bool operator== (const wxArrayString& value) const;
bool operator!= (const wxArrayString& value) const;
void operator= (const wxArrayString& value);
operator wxArrayString () const { return GetArrayString(); }
wxArrayString GetArrayString() const;
// void*
wxVariant(void* ptr, const wxString& name = wxEmptyString);
bool operator== (void* value) const;
bool operator!= (void* value) const;
void operator= (void* value);
operator void* () const { return GetVoidPtr(); }
void* GetVoidPtr() const;
// wxObject*
wxVariant(wxObject* ptr, const wxString& name = wxEmptyString);
bool operator== (wxObject* value) const;
bool operator!= (wxObject* value) const;
void operator= (wxObject* value);
wxObject* GetWxObjectPtr() const;
#if wxUSE_LONGLONG
// wxLongLong
wxVariant(wxLongLong, const wxString& name = wxEmptyString);
bool operator==(wxLongLong value) const;
bool operator!=(wxLongLong value) const;
void operator=(wxLongLong value);
operator wxLongLong() const { return GetLongLong(); }
wxLongLong GetLongLong() const;
// wxULongLong
wxVariant(wxULongLong, const wxString& name = wxEmptyString);
bool operator==(wxULongLong value) const;
bool operator!=(wxULongLong value) const;
void operator=(wxULongLong value);
operator wxULongLong() const { return GetULongLong(); }
wxULongLong GetULongLong() const;
#endif
// ------------------------------
// list operations
// ------------------------------
wxVariant(const wxVariantList& val, const wxString& name = wxEmptyString); // List of variants
bool operator== (const wxVariantList& value) const;
bool operator!= (const wxVariantList& value) const;
void operator= (const wxVariantList& value) ;
// Treat a list variant as an array
wxVariant operator[] (size_t idx) const;
wxVariant& operator[] (size_t idx) ;
wxVariantList& GetList() const ;
// Return the number of elements in a list
size_t GetCount() const;
// Make empty list
void NullList();
// Append to list
void Append(const wxVariant& value);
// Insert at front of list
void Insert(const wxVariant& value);
// Returns true if the variant is a member of the list
bool Member(const wxVariant& value) const;
// Deletes the nth element of the list
bool Delete(size_t item);
// Clear list
void ClearList();
public:
// Type conversion
bool Convert(long* value) const;
bool Convert(bool* value) const;
bool Convert(double* value) const;
bool Convert(wxString* value) const;
bool Convert(wxUniChar* value) const;
bool Convert(char* value) const;
bool Convert(wchar_t* value) const;
#if wxUSE_DATETIME
bool Convert(wxDateTime* value) const;
#endif // wxUSE_DATETIME
#if wxUSE_LONGLONG
bool Convert(wxLongLong* value) const;
bool Convert(wxULongLong* value) const;
#ifdef wxLongLong_t
bool Convert(wxLongLong_t* value) const
{
wxLongLong temp;
if ( !Convert(&temp) )
return false;
*value = temp.GetValue();
return true;
}
bool Convert(wxULongLong_t* value) const
{
wxULongLong temp;
if ( !Convert(&temp) )
return false;
*value = temp.GetValue();
return true;
}
#endif // wxLongLong_t
#endif // wxUSE_LONGLONG
// Attributes
protected:
virtual wxObjectRefData *CreateRefData() const wxOVERRIDE;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE;
wxString m_name;
private:
wxDECLARE_DYNAMIC_CLASS(wxVariant);
};
//
// wxVariant <-> wxAny conversion code
//
#if wxUSE_ANY
#include "wx/any.h"
// In order to convert wxAny to wxVariant, we need to be able to associate
// wxAnyValueType with a wxVariantData factory function.
typedef wxVariantData* (*wxVariantDataFactory)(const wxAny& any);
// Actual Any-to-Variant registration must be postponed to a time when all
// global variables have been initialized. Hence this arrangement.
// wxAnyToVariantRegistration instances are kept in global scope and
// wxAnyValueTypeGlobals in any.cpp will use their data when the time is
// right.
class WXDLLIMPEXP_BASE wxAnyToVariantRegistration
{
public:
wxAnyToVariantRegistration(wxVariantDataFactory factory);
virtual ~wxAnyToVariantRegistration();
virtual wxAnyValueType* GetAssociatedType() = 0;
wxVariantDataFactory GetFactory() const { return m_factory; }
private:
wxVariantDataFactory m_factory;
};
template<typename T>
class wxAnyToVariantRegistrationImpl : public wxAnyToVariantRegistration
{
public:
wxAnyToVariantRegistrationImpl(wxVariantDataFactory factory)
: wxAnyToVariantRegistration(factory)
{
}
virtual wxAnyValueType* GetAssociatedType() wxOVERRIDE
{
return wxAnyValueTypeImpl<T>::GetInstance();
}
private:
};
#define DECLARE_WXANY_CONVERSION() \
virtual bool GetAsAny(wxAny* any) const wxOVERRIDE; \
static wxVariantData* VariantDataFactory(const wxAny& any);
#define _REGISTER_WXANY_CONVERSION(T, CLASSNAME, FUNC) \
static wxAnyToVariantRegistrationImpl<T> \
gs_##CLASSNAME##AnyToVariantRegistration = \
wxAnyToVariantRegistrationImpl<T>(&FUNC);
#define REGISTER_WXANY_CONVERSION(T, CLASSNAME) \
_REGISTER_WXANY_CONVERSION(T, CLASSNAME, CLASSNAME::VariantDataFactory)
#define IMPLEMENT_TRIVIAL_WXANY_CONVERSION(T, CLASSNAME) \
bool CLASSNAME::GetAsAny(wxAny* any) const \
{ \
*any = m_value; \
return true; \
} \
wxVariantData* CLASSNAME::VariantDataFactory(const wxAny& any) \
{ \
return new CLASSNAME(any.As<T>()); \
} \
REGISTER_WXANY_CONVERSION(T, CLASSNAME)
#else // if !wxUSE_ANY
#define DECLARE_WXANY_CONVERSION()
#define REGISTER_WXANY_CONVERSION(T, CLASSNAME)
#define IMPLEMENT_TRIVIAL_WXANY_CONVERSION(T, CLASSNAME)
#endif // wxUSE_ANY/!wxUSE_ANY
#define DECLARE_VARIANT_OBJECT(classname) \
DECLARE_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
#define DECLARE_VARIANT_OBJECT_EXPORTED(classname,expdecl) \
expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
expdecl wxVariant& operator << ( wxVariant &variant, const classname &object );
#define IMPLEMENT_VARIANT_OBJECT(classname) \
IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,expdecl) \
class classname##VariantData: public wxVariantData \
{ \
public:\
classname##VariantData() {} \
classname##VariantData( const classname &value ) { m_value = value; } \
\
classname &GetValue() { return m_value; } \
\
virtual bool Eq(wxVariantData& data) const wxOVERRIDE; \
\
virtual wxString GetType() const wxOVERRIDE; \
virtual wxClassInfo* GetValueClassInfo() wxOVERRIDE; \
\
virtual wxVariantData* Clone() const wxOVERRIDE { return new classname##VariantData(m_value); } \
\
DECLARE_WXANY_CONVERSION() \
protected:\
classname m_value; \
};\
\
wxString classname##VariantData::GetType() const\
{\
return m_value.GetClassInfo()->GetClassName();\
}\
\
wxClassInfo* classname##VariantData::GetValueClassInfo()\
{\
return m_value.GetClassInfo();\
}\
\
expdecl classname& operator << ( classname &value, const wxVariant &variant )\
{\
wxASSERT( variant.GetType() == #classname );\
\
classname##VariantData *data = (classname##VariantData*) variant.GetData();\
value = data->GetValue();\
return value;\
}\
\
expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
{\
classname##VariantData *data = new classname##VariantData( value );\
variant.SetData( data );\
return variant;\
} \
IMPLEMENT_TRIVIAL_WXANY_CONVERSION(classname, classname##VariantData)
// implements a wxVariantData-derived class using for the Eq() method the
// operator== which must have been provided by "classname"
#define IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname,expdecl) \
IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
\
bool classname##VariantData::Eq(wxVariantData& data) const \
{\
wxASSERT( GetType() == data.GetType() );\
\
classname##VariantData & otherData = (classname##VariantData &) data;\
\
return otherData.m_value == m_value;\
}\
// implements a wxVariantData-derived class using for the Eq() method a shallow
// comparison (through wxObject::IsSameAs function)
#define IMPLEMENT_VARIANT_OBJECT_SHALLOWCMP(classname) \
IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname, wxEMPTY_PARAMETER_VALUE)
#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname,expdecl) \
IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
\
bool classname##VariantData::Eq(wxVariantData& data) const \
{\
wxASSERT( GetType() == data.GetType() );\
\
classname##VariantData & otherData = (classname##VariantData &) data;\
\
return (otherData.m_value.IsSameAs(m_value));\
}\
// Since we want type safety wxVariant we need to fetch and dynamic_cast
// in a seemingly safe way so the compiler can check, so we define
// a dynamic_cast /wxDynamicCast analogue.
#define wxGetVariantCast(var,classname) \
((classname*)(var.IsValueKindOf(&classname::ms_classInfo) ?\
var.GetWxObjectPtr() : NULL));
// Replacement for using wxDynamicCast on a wxVariantData object
#ifndef wxNO_RTTI
#define wxDynamicCastVariantData(data, classname) dynamic_cast<classname*>(data)
#endif
#define wxStaticCastVariantData(data, classname) static_cast<classname*>(data)
extern wxVariant WXDLLIMPEXP_BASE wxNullVariant;
#endif // wxUSE_VARIANT
#endif // _WX_VARIANT_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/scopedarray.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/scopedarray.h
// Purpose: scoped smart pointer class
// Author: Vadim Zeitlin
// Created: 2009-02-03
// Copyright: (c) Jesse Lovelace and original Boost authors (see below)
// (c) 2009 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SCOPED_ARRAY_H_
#define _WX_SCOPED_ARRAY_H_
#include "wx/defs.h"
#include "wx/checkeddelete.h"
// ----------------------------------------------------------------------------
// wxScopedArray: A scoped array
// ----------------------------------------------------------------------------
template <class T>
class wxScopedArray
{
public:
typedef T element_type;
explicit wxScopedArray(T * array = NULL) : m_array(array) { }
explicit wxScopedArray(size_t count) : m_array(new T[count]) { }
~wxScopedArray() { delete [] m_array; }
// test for pointer validity: defining conversion to unspecified_bool_type
// and not more obvious bool to avoid implicit conversions to integer types
typedef T *(wxScopedArray<T>::*unspecified_bool_type)() const;
operator unspecified_bool_type() const
{
return m_array ? &wxScopedArray<T>::get : NULL;
}
void reset(T *array = NULL)
{
if ( array != m_array )
{
delete [] m_array;
m_array = array;
}
}
T& operator[](size_t n) const { return m_array[n]; }
T *get() const { return m_array; }
void swap(wxScopedArray &other)
{
T * const tmp = other.m_array;
other.m_array = m_array;
m_array = tmp;
}
private:
T *m_array;
wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedArray, T);
};
// ----------------------------------------------------------------------------
// old macro based implementation
// ----------------------------------------------------------------------------
// the same but for arrays instead of simple pointers
#define wxDECLARE_SCOPED_ARRAY(T, name)\
class name \
{ \
private: \
T * m_ptr; \
name(name const &); \
name & operator=(name const &); \
\
public: \
explicit name(T * p = NULL) : m_ptr(p) \
{} \
\
~name(); \
void reset(T * p = NULL); \
\
T & operator[](long int i) const\
{ \
wxASSERT(m_ptr != NULL); \
wxASSERT(i >= 0); \
return m_ptr[i]; \
} \
\
T * get() const \
{ \
return m_ptr; \
} \
\
void swap(name & ot) \
{ \
T * tmp = ot.m_ptr; \
ot.m_ptr = m_ptr; \
m_ptr = tmp; \
} \
};
#define wxDEFINE_SCOPED_ARRAY(T, name) \
name::~name() \
{ \
wxCHECKED_DELETE_ARRAY(m_ptr); \
} \
void name::reset(T * p){ \
if (m_ptr != p) \
{ \
wxCHECKED_DELETE_ARRAY(m_ptr); \
m_ptr = p; \
} \
}
#endif // _WX_SCOPED_ARRAY_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/any.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/any.h
// Purpose: wxAny class
// Author: Jaakko Salli
// Modified by:
// Created: 07/05/2009
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ANY_H_
#define _WX_ANY_H_
#include "wx/defs.h"
#if wxUSE_ANY
#include <new> // for placement new
#include "wx/string.h"
#include "wx/meta/if.h"
#include "wx/typeinfo.h"
#include "wx/list.h"
// Size of the wxAny value buffer.
enum
{
WX_ANY_VALUE_BUFFER_SIZE = 16
};
union wxAnyValueBuffer
{
union Alignment
{
#if wxHAS_INT64
wxInt64 m_int64;
#endif
long double m_longDouble;
void ( *m_funcPtr )(void);
void ( wxAnyValueBuffer::*m_mFuncPtr )(void);
} m_alignment;
void* m_ptr;
wxByte m_buffer[WX_ANY_VALUE_BUFFER_SIZE];
};
//
// wxAnyValueType is base class for value type functionality for C++ data
// types used with wxAny. Usually the default template (wxAnyValueTypeImpl<>)
// will create a satisfactory wxAnyValueType implementation for a data type.
//
class WXDLLIMPEXP_BASE wxAnyValueType
{
WX_DECLARE_ABSTRACT_TYPEINFO(wxAnyValueType)
public:
/**
Default constructor.
*/
wxAnyValueType()
{
}
/**
Destructor.
*/
virtual ~wxAnyValueType()
{
}
/**
This function is used for internal type matching.
*/
virtual bool IsSameType(const wxAnyValueType* otherType) const = 0;
/**
This function is called every time the data in wxAny
buffer needs to be freed.
*/
virtual void DeleteValue(wxAnyValueBuffer& buf) const = 0;
/**
Implement this for buffer-to-buffer copy.
@param src
This is the source data buffer.
@param dst
This is the destination data buffer that is in either
uninitialized or freed state.
*/
virtual void CopyBuffer(const wxAnyValueBuffer& src,
wxAnyValueBuffer& dst) const = 0;
/**
Convert value into buffer of different type. Return false if
not possible.
*/
virtual bool ConvertValue(const wxAnyValueBuffer& src,
wxAnyValueType* dstType,
wxAnyValueBuffer& dst) const = 0;
/**
Use this template function for checking if wxAnyValueType represents
a specific C++ data type.
@see wxAny::CheckType()
*/
template <typename T>
bool CheckType() const;
#if wxUSE_EXTENDED_RTTI
virtual const wxTypeInfo* GetTypeInfo() const = 0;
#endif
private:
};
//
// We need to allocate wxAnyValueType instances in heap, and need to use
// scoped ptr to properly deallocate them in dynamic library use cases.
// Here we have a minimal specialized scoped ptr implementation to deal
// with various compiler-specific problems with template class' static
// member variable of template type with explicit constructor which
// is initialized in global scope.
//
class wxAnyValueTypeScopedPtr
{
public:
wxAnyValueTypeScopedPtr(wxAnyValueType* ptr) : m_ptr(ptr) { }
~wxAnyValueTypeScopedPtr() { delete m_ptr; }
wxAnyValueType* get() const { return m_ptr; }
private:
wxAnyValueType* m_ptr;
};
// Deprecated macro for checking the type which was originally introduced for
// MSVC6 compatibility and is not needed any longer now that this compiler is
// not supported any more.
#define wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T) \
wxAnyValueTypeImpl<T>::IsSameClass(valueTypePtr)
/**
Helper macro for defining user value types.
Even though C++ RTTI would be fully available to use, we'd have to to
facilitate sub-type system which allows, for instance, wxAny with
signed short '15' to be treated equal to wxAny with signed long long '15'.
Having sm_instance is important here.
NB: We really need to have wxAnyValueType instances allocated
in heap. They are stored as static template member variables,
and with them we just can't be too careful (eg. not allocating
them in heap broke the type identification in GCC).
*/
#define WX_DECLARE_ANY_VALUE_TYPE(CLS) \
friend class wxAny; \
WX_DECLARE_TYPEINFO_INLINE(CLS) \
public: \
static bool IsSameClass(const wxAnyValueType* otherType) \
{ \
return AreSameClasses(*sm_instance.get(), *otherType); \
} \
virtual bool IsSameType(const wxAnyValueType* otherType) const wxOVERRIDE \
{ \
return IsSameClass(otherType); \
} \
private: \
static bool AreSameClasses(const wxAnyValueType& a, const wxAnyValueType& b) \
{ \
return wxTypeId(a) == wxTypeId(b); \
} \
static wxAnyValueTypeScopedPtr sm_instance; \
public: \
static wxAnyValueType* GetInstance() \
{ \
return sm_instance.get(); \
}
#define WX_IMPLEMENT_ANY_VALUE_TYPE(CLS) \
wxAnyValueTypeScopedPtr CLS::sm_instance(new CLS());
/**
Following are helper classes for the wxAnyValueTypeImplBase.
*/
namespace wxPrivate
{
template<typename T>
class wxAnyValueTypeOpsInplace
{
public:
static void DeleteValue(wxAnyValueBuffer& buf)
{
GetValue(buf).~T();
}
static void SetValue(const T& value,
wxAnyValueBuffer& buf)
{
// Use placement new
void* const place = buf.m_buffer;
::new(place) T(value);
}
static const T& GetValue(const wxAnyValueBuffer& buf)
{
// Use a union to avoid undefined behaviour (and gcc -Wstrict-alias
// warnings about it) which would occur if we just casted a wxByte
// pointer to a T one.
union
{
const T* ptr;
const wxByte *buf;
} u;
u.buf = buf.m_buffer;
return *u.ptr;
}
};
template<typename T>
class wxAnyValueTypeOpsGeneric
{
public:
template<typename T2>
class DataHolder
{
public:
DataHolder(const T2& value)
{
m_value = value;
}
virtual ~DataHolder() { }
T2 m_value;
private:
wxDECLARE_NO_COPY_CLASS(DataHolder);
};
static void DeleteValue(wxAnyValueBuffer& buf)
{
DataHolder<T>* holder = static_cast<DataHolder<T>*>(buf.m_ptr);
delete holder;
}
static void SetValue(const T& value,
wxAnyValueBuffer& buf)
{
DataHolder<T>* holder = new DataHolder<T>(value);
buf.m_ptr = holder;
}
static const T& GetValue(const wxAnyValueBuffer& buf)
{
DataHolder<T>* holder = static_cast<DataHolder<T>*>(buf.m_ptr);
return holder->m_value;
}
};
template <typename T>
struct wxAnyAsImpl;
} // namespace wxPrivate
/**
Intermediate template for the generic value type implementation.
We can derive from this same value type for multiple actual types
(for instance, we can have wxAnyValueTypeImplInt for all signed
integer types), and also easily implement specialized templates
with specific dynamic type conversion.
*/
template<typename T>
class wxAnyValueTypeImplBase : public wxAnyValueType
{
typedef typename wxIf< sizeof(T) <= WX_ANY_VALUE_BUFFER_SIZE,
wxPrivate::wxAnyValueTypeOpsInplace<T>,
wxPrivate::wxAnyValueTypeOpsGeneric<T> >::value
Ops;
public:
wxAnyValueTypeImplBase() : wxAnyValueType() { }
virtual ~wxAnyValueTypeImplBase() { }
virtual void DeleteValue(wxAnyValueBuffer& buf) const wxOVERRIDE
{
Ops::DeleteValue(buf);
}
virtual void CopyBuffer(const wxAnyValueBuffer& src,
wxAnyValueBuffer& dst) const wxOVERRIDE
{
Ops::SetValue(Ops::GetValue(src), dst);
}
/**
It is important to reimplement this in any specialized template
classes that inherit from wxAnyValueTypeImplBase.
*/
static void SetValue(const T& value,
wxAnyValueBuffer& buf)
{
Ops::SetValue(value, buf);
}
/**
It is important to reimplement this in any specialized template
classes that inherit from wxAnyValueTypeImplBase.
*/
static const T& GetValue(const wxAnyValueBuffer& buf)
{
return Ops::GetValue(buf);
}
#if wxUSE_EXTENDED_RTTI
virtual const wxTypeInfo* GetTypeInfo() const
{
return wxGetTypeInfo((T*)NULL);
}
#endif
};
/*
Generic value type template. Note that bulk of the implementation
resides in wxAnyValueTypeImplBase.
*/
template<typename T>
class wxAnyValueTypeImpl : public wxAnyValueTypeImplBase<T>
{
WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl<T>)
public:
wxAnyValueTypeImpl() : wxAnyValueTypeImplBase<T>() { }
virtual ~wxAnyValueTypeImpl() { }
virtual bool ConvertValue(const wxAnyValueBuffer& src,
wxAnyValueType* dstType,
wxAnyValueBuffer& dst) const wxOVERRIDE
{
wxUnusedVar(src);
wxUnusedVar(dstType);
wxUnusedVar(dst);
return false;
}
};
template<typename T>
wxAnyValueTypeScopedPtr wxAnyValueTypeImpl<T>::sm_instance = new wxAnyValueTypeImpl<T>();
//
// Helper macro for using same base value type implementation for multiple
// actual C++ data types.
//
#define _WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \
template<> \
class wxAnyValueTypeImpl<T> : public wxAnyValueTypeImpl##CLSTYPE \
{ \
typedef wxAnyBase##CLSTYPE##Type UseDataType; \
public: \
wxAnyValueTypeImpl() : wxAnyValueTypeImpl##CLSTYPE() { } \
virtual ~wxAnyValueTypeImpl() { } \
static void SetValue(const T& value, wxAnyValueBuffer& buf) \
{ \
void* voidPtr = reinterpret_cast<void*>(&buf.m_buffer[0]); \
UseDataType* dptr = reinterpret_cast<UseDataType*>(voidPtr); \
*dptr = static_cast<UseDataType>(value); \
} \
static T GetValue(const wxAnyValueBuffer& buf) \
{ \
const void* voidPtr = \
reinterpret_cast<const void*>(&buf.m_buffer[0]); \
const UseDataType* sptr = \
reinterpret_cast<const UseDataType*>(voidPtr); \
return static_cast<T>(*sptr); \
}
#if wxUSE_EXTENDED_RTTI
#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \
_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\
virtual const wxTypeInfo* GetTypeInfo() const \
{ \
return wxGetTypeInfo((T*)NULL); \
} \
};
#else
#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \
_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\
};
#endif
//
// Integer value types
//
#ifdef wxLongLong_t
typedef wxLongLong_t wxAnyBaseIntType;
typedef wxULongLong_t wxAnyBaseUintType;
#else
typedef long wxAnyBaseIntType;
typedef unsigned long wxAnyBaseUintType;
#endif
class WXDLLIMPEXP_BASE wxAnyValueTypeImplInt :
public wxAnyValueTypeImplBase<wxAnyBaseIntType>
{
WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplInt)
public:
wxAnyValueTypeImplInt() :
wxAnyValueTypeImplBase<wxAnyBaseIntType>() { }
virtual ~wxAnyValueTypeImplInt() { }
virtual bool ConvertValue(const wxAnyValueBuffer& src,
wxAnyValueType* dstType,
wxAnyValueBuffer& dst) const wxOVERRIDE;
};
class WXDLLIMPEXP_BASE wxAnyValueTypeImplUint :
public wxAnyValueTypeImplBase<wxAnyBaseUintType>
{
WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplUint)
public:
wxAnyValueTypeImplUint() :
wxAnyValueTypeImplBase<wxAnyBaseUintType>() { }
virtual ~wxAnyValueTypeImplUint() { }
virtual bool ConvertValue(const wxAnyValueBuffer& src,
wxAnyValueType* dstType,
wxAnyValueBuffer& dst) const wxOVERRIDE;
};
WX_ANY_DEFINE_SUB_TYPE(signed long, Int)
WX_ANY_DEFINE_SUB_TYPE(signed int, Int)
WX_ANY_DEFINE_SUB_TYPE(signed short, Int)
WX_ANY_DEFINE_SUB_TYPE(signed char, Int)
#ifdef wxLongLong_t
WX_ANY_DEFINE_SUB_TYPE(wxLongLong_t, Int)
#endif
WX_ANY_DEFINE_SUB_TYPE(unsigned long, Uint)
WX_ANY_DEFINE_SUB_TYPE(unsigned int, Uint)
WX_ANY_DEFINE_SUB_TYPE(unsigned short, Uint)
WX_ANY_DEFINE_SUB_TYPE(unsigned char, Uint)
#ifdef wxLongLong_t
WX_ANY_DEFINE_SUB_TYPE(wxULongLong_t, Uint)
#endif
//
// This macro is used in header, but then in source file we must have:
// WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl##TYPENAME)
//
#define _WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, GV) \
class WXDLLIMPEXP_BASE wxAnyValueTypeImpl##TYPENAME : \
public wxAnyValueTypeImplBase<T> \
{ \
WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl##TYPENAME) \
public: \
wxAnyValueTypeImpl##TYPENAME() : \
wxAnyValueTypeImplBase<T>() { } \
virtual ~wxAnyValueTypeImpl##TYPENAME() { } \
virtual bool ConvertValue(const wxAnyValueBuffer& src, \
wxAnyValueType* dstType, \
wxAnyValueBuffer& dst) const wxOVERRIDE \
{ \
GV value = GetValue(src); \
return CONVFUNC(value, dstType, dst); \
} \
}; \
template<> \
class wxAnyValueTypeImpl<T> : public wxAnyValueTypeImpl##TYPENAME \
{ \
public: \
wxAnyValueTypeImpl() : wxAnyValueTypeImpl##TYPENAME() { } \
virtual ~wxAnyValueTypeImpl() { } \
};
#define WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, BT) \
_WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, BT) \
#define WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(T, TYPENAME, CONVFUNC) \
_WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, \
CONVFUNC, const T&) \
//
// String value type
//
// Convert wxString to destination wxAny value type
extern WXDLLIMPEXP_BASE bool wxAnyConvertString(const wxString& value,
wxAnyValueType* dstType,
wxAnyValueBuffer& dst);
WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(wxString, wxString, wxAnyConvertString)
WX_ANY_DEFINE_CONVERTIBLE_TYPE(const char*, ConstCharPtr,
wxAnyConvertString, wxString)
WX_ANY_DEFINE_CONVERTIBLE_TYPE(const wchar_t*, ConstWchar_tPtr,
wxAnyConvertString, wxString)
//
// Bool value type
//
template<>
class WXDLLIMPEXP_BASE wxAnyValueTypeImpl<bool> :
public wxAnyValueTypeImplBase<bool>
{
WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl<bool>)
public:
wxAnyValueTypeImpl() :
wxAnyValueTypeImplBase<bool>() { }
virtual ~wxAnyValueTypeImpl() { }
virtual bool ConvertValue(const wxAnyValueBuffer& src,
wxAnyValueType* dstType,
wxAnyValueBuffer& dst) const wxOVERRIDE;
};
//
// Floating point value type
//
class WXDLLIMPEXP_BASE wxAnyValueTypeImplDouble :
public wxAnyValueTypeImplBase<double>
{
WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplDouble)
public:
wxAnyValueTypeImplDouble() :
wxAnyValueTypeImplBase<double>() { }
virtual ~wxAnyValueTypeImplDouble() { }
virtual bool ConvertValue(const wxAnyValueBuffer& src,
wxAnyValueType* dstType,
wxAnyValueBuffer& dst) const wxOVERRIDE;
};
// WX_ANY_DEFINE_SUB_TYPE requires this
typedef double wxAnyBaseDoubleType;
WX_ANY_DEFINE_SUB_TYPE(float, Double)
WX_ANY_DEFINE_SUB_TYPE(double, Double)
//
// Defines a dummy wxAnyValueTypeImpl<> with given export
// declaration. This is needed if a class is used with
// wxAny in both user shared library and application.
//
#define wxDECLARE_ANY_TYPE(CLS, DECL) \
template<> \
class DECL wxAnyValueTypeImpl<CLS> : \
public wxAnyValueTypeImplBase<CLS> \
{ \
WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl<CLS>) \
public: \
wxAnyValueTypeImpl() : \
wxAnyValueTypeImplBase<CLS>() { } \
virtual ~wxAnyValueTypeImpl() { } \
\
virtual bool ConvertValue(const wxAnyValueBuffer& src, \
wxAnyValueType* dstType, \
wxAnyValueBuffer& dst) const wxOVERRIDE \
{ \
wxUnusedVar(src); \
wxUnusedVar(dstType); \
wxUnusedVar(dst); \
return false; \
} \
};
// Make sure some of wx's own types get the right wxAnyValueType export
// (this is needed only for types that are referred to from wxBase.
// currently we may not use any of these types from there, but let's
// use the macro on at least one to make sure it compiles since we can't
// really test it properly in unit tests since a separate DLL would
// be needed).
#if wxUSE_DATETIME
#include "wx/datetime.h"
wxDECLARE_ANY_TYPE(wxDateTime, WXDLLIMPEXP_BASE)
#endif
//#include "wx/object.h"
//wxDECLARE_ANY_TYPE(wxObject*, WXDLLIMPEXP_BASE)
//#include "wx/arrstr.h"
//wxDECLARE_ANY_TYPE(wxArrayString, WXDLLIMPEXP_BASE)
#if wxUSE_VARIANT
class WXDLLIMPEXP_FWD_BASE wxAnyToVariantRegistration;
// Because of header inter-dependencies, cannot include this earlier
#include "wx/variant.h"
//
// wxVariantData* data type implementation. For cases when appropriate
// wxAny<->wxVariant conversion code is missing.
//
class WXDLLIMPEXP_BASE wxAnyValueTypeImplVariantData :
public wxAnyValueTypeImplBase<wxVariantData*>
{
WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplVariantData)
public:
wxAnyValueTypeImplVariantData() :
wxAnyValueTypeImplBase<wxVariantData*>() { }
virtual ~wxAnyValueTypeImplVariantData() { }
virtual void DeleteValue(wxAnyValueBuffer& buf) const wxOVERRIDE
{
wxVariantData* data = static_cast<wxVariantData*>(buf.m_ptr);
if ( data )
data->DecRef();
}
virtual void CopyBuffer(const wxAnyValueBuffer& src,
wxAnyValueBuffer& dst) const wxOVERRIDE
{
wxVariantData* data = static_cast<wxVariantData*>(src.m_ptr);
if ( data )
data->IncRef();
dst.m_ptr = data;
}
static void SetValue(wxVariantData* value,
wxAnyValueBuffer& buf)
{
value->IncRef();
buf.m_ptr = value;
}
static wxVariantData* GetValue(const wxAnyValueBuffer& buf)
{
return static_cast<wxVariantData*>(buf.m_ptr);
}
virtual bool ConvertValue(const wxAnyValueBuffer& src,
wxAnyValueType* dstType,
wxAnyValueBuffer& dst) const wxOVERRIDE
{
wxUnusedVar(src);
wxUnusedVar(dstType);
wxUnusedVar(dst);
return false;
}
};
template<>
class wxAnyValueTypeImpl<wxVariantData*> :
public wxAnyValueTypeImplVariantData
{
public:
wxAnyValueTypeImpl() : wxAnyValueTypeImplVariantData() { }
virtual ~wxAnyValueTypeImpl() { }
};
#endif // wxUSE_VARIANT
/*
Let's define a discrete Null value so we don't have to really
ever check if wxAny.m_type pointer is NULL or not. This is an
optimization, mostly. Implementation of this value type is
"hidden" in the source file.
*/
extern WXDLLIMPEXP_DATA_BASE(wxAnyValueType*) wxAnyNullValueType;
//
// We need to implement custom signed/unsigned int equals operators
// for signed/unsigned (eg. wxAny(128UL) == 128L) comparisons to work.
#define WXANY_IMPLEMENT_INT_EQ_OP(TS, TUS) \
bool operator==(TS value) const \
{ \
if ( wxAnyValueTypeImpl<TS>::IsSameClass(m_type) ) \
return (value == static_cast<TS> \
(wxAnyValueTypeImpl<TS>::GetValue(m_buffer))); \
if ( wxAnyValueTypeImpl<TUS>::IsSameClass(m_type) ) \
return (value == static_cast<TS> \
(wxAnyValueTypeImpl<TUS>::GetValue(m_buffer))); \
return false; \
} \
bool operator==(TUS value) const \
{ \
if ( wxAnyValueTypeImpl<TUS>::IsSameClass(m_type) ) \
return (value == static_cast<TUS> \
(wxAnyValueTypeImpl<TUS>::GetValue(m_buffer))); \
if ( wxAnyValueTypeImpl<TS>::IsSameClass(m_type) ) \
return (value == static_cast<TUS> \
(wxAnyValueTypeImpl<TS>::GetValue(m_buffer))); \
return false; \
}
#if wxUSE_VARIANT
// Note that the following functions are implemented outside wxAny class
// so that it can reside entirely in header and lack the export declaration.
// Helper function used to associate wxAnyValueType with a wxVariantData.
extern WXDLLIMPEXP_BASE void
wxPreRegisterAnyToVariant(wxAnyToVariantRegistration* reg);
// This function performs main wxAny to wxVariant conversion duties.
extern WXDLLIMPEXP_BASE bool
wxConvertAnyToVariant(const wxAny& any, wxVariant* variant);
#endif // wxUSE_VARIANT
//
// The wxAny class represents a container for any type. A variant's value
// can be changed at run time, possibly to a different type of value.
//
// As standard, wxAny can store value of almost any type, in a fairly
// optimal manner even.
//
class wxAny
{
public:
/**
Default constructor.
*/
wxAny()
{
m_type = wxAnyNullValueType;
}
/**
Destructor.
*/
~wxAny()
{
m_type->DeleteValue(m_buffer);
}
//@{
/**
Various constructors.
*/
template<typename T>
wxAny(const T& value)
{
m_type = wxAnyValueTypeImpl<T>::sm_instance.get();
wxAnyValueTypeImpl<T>::SetValue(value, m_buffer);
}
// These two constructors are needed to deal with string literals
wxAny(const char* value)
{
m_type = wxAnyValueTypeImpl<const char*>::sm_instance.get();
wxAnyValueTypeImpl<const char*>::SetValue(value, m_buffer);
}
wxAny(const wchar_t* value)
{
m_type = wxAnyValueTypeImpl<const wchar_t*>::sm_instance.get();
wxAnyValueTypeImpl<const wchar_t*>::SetValue(value, m_buffer);
}
wxAny(const wxAny& any)
{
m_type = wxAnyNullValueType;
AssignAny(any);
}
#if wxUSE_VARIANT
wxAny(const wxVariant& variant)
{
m_type = wxAnyNullValueType;
AssignVariant(variant);
}
#endif
//@}
/**
Use this template function for checking if this wxAny holds
a specific C++ data type.
@see wxAnyValueType::CheckType()
*/
template <typename T>
bool CheckType() const
{
return m_type->CheckType<T>();
}
/**
Returns the value type as wxAnyValueType instance.
@remarks You cannot reliably test whether two wxAnys are of
same value type by simply comparing return values
of wxAny::GetType(). Instead, use wxAny::HasSameType().
@see HasSameType()
*/
const wxAnyValueType* GetType() const
{
return m_type;
}
/**
Returns @true if this and another wxAny have the same
value type.
*/
bool HasSameType(const wxAny& other) const
{
return GetType()->IsSameType(other.GetType());
}
/**
Tests if wxAny is null (that is, whether there is no data).
*/
bool IsNull() const
{
return (m_type == wxAnyNullValueType);
}
/**
Makes wxAny null (that is, clears it).
*/
void MakeNull()
{
m_type->DeleteValue(m_buffer);
m_type = wxAnyNullValueType;
}
//@{
/**
Assignment operators.
*/
template<typename T>
wxAny& operator=(const T &value)
{
m_type->DeleteValue(m_buffer);
m_type = wxAnyValueTypeImpl<T>::sm_instance.get();
wxAnyValueTypeImpl<T>::SetValue(value, m_buffer);
return *this;
}
wxAny& operator=(const wxAny &any)
{
if (this != &any)
AssignAny(any);
return *this;
}
#if wxUSE_VARIANT
wxAny& operator=(const wxVariant &variant)
{
AssignVariant(variant);
return *this;
}
#endif
// These two operators are needed to deal with string literals
wxAny& operator=(const char* value)
{
Assign(value);
return *this;
}
wxAny& operator=(const wchar_t* value)
{
Assign(value);
return *this;
}
//@{
/**
Equality operators.
*/
bool operator==(const wxString& value) const
{
wxString value2;
if ( !GetAs(&value2) )
return false;
return value == value2;
}
bool operator==(const char* value) const
{ return (*this) == wxString(value); }
bool operator==(const wchar_t* value) const
{ return (*this) == wxString(value); }
//
// We need to implement custom signed/unsigned int equals operators
// for signed/unsigned (eg. wxAny(128UL) == 128L) comparisons to work.
WXANY_IMPLEMENT_INT_EQ_OP(signed char, unsigned char)
WXANY_IMPLEMENT_INT_EQ_OP(signed short, unsigned short)
WXANY_IMPLEMENT_INT_EQ_OP(signed int, unsigned int)
WXANY_IMPLEMENT_INT_EQ_OP(signed long, unsigned long)
#ifdef wxLongLong_t
WXANY_IMPLEMENT_INT_EQ_OP(wxLongLong_t, wxULongLong_t)
#endif
wxGCC_WARNING_SUPPRESS(float-equal)
bool operator==(float value) const
{
if ( !wxAnyValueTypeImpl<float>::IsSameClass(m_type) )
return false;
return value ==
static_cast<float>
(wxAnyValueTypeImpl<float>::GetValue(m_buffer));
}
bool operator==(double value) const
{
if ( !wxAnyValueTypeImpl<double>::IsSameClass(m_type) )
return false;
return value ==
static_cast<double>
(wxAnyValueTypeImpl<double>::GetValue(m_buffer));
}
wxGCC_WARNING_RESTORE(float-equal)
bool operator==(bool value) const
{
if ( !wxAnyValueTypeImpl<bool>::IsSameClass(m_type) )
return false;
return value == (wxAnyValueTypeImpl<bool>::GetValue(m_buffer));
}
//@}
//@{
/**
Inequality operators (implement as template).
*/
template<typename T>
bool operator!=(const T& value) const
{ return !((*this) == value); }
//@}
/**
This template function converts wxAny into given type. In most cases
no type conversion is performed, so if the type is incorrect an
assertion failure will occur.
@remarks For convenience, conversion is done when T is wxString. This
is useful when a string literal (which are treated as
const char* and const wchar_t*) has been assigned to wxAny.
*/
template <typename T>
T As(T* = NULL) const
{
return wxPrivate::wxAnyAsImpl<T>::DoAs(*this);
}
// Semi private helper: get the value without coercion, for all types.
template <typename T>
T RawAs() const
{
if ( !wxAnyValueTypeImpl<T>::IsSameClass(m_type) )
{
wxFAIL_MSG("Incorrect or non-convertible data type");
}
return static_cast<T>(wxAnyValueTypeImpl<T>::GetValue(m_buffer));
}
#if wxUSE_EXTENDED_RTTI
const wxTypeInfo* GetTypeInfo() const
{
return m_type->GetTypeInfo();
}
#endif
/**
Template function that retrieves and converts the value of this
variant to the type that T* value is.
@return Returns @true if conversion was successful.
*/
template<typename T>
bool GetAs(T* value) const
{
if ( !wxAnyValueTypeImpl<T>::IsSameClass(m_type) )
{
wxAnyValueType* otherType =
wxAnyValueTypeImpl<T>::sm_instance.get();
wxAnyValueBuffer temp_buf;
if ( !m_type->ConvertValue(m_buffer, otherType, temp_buf) )
return false;
*value =
static_cast<T>(wxAnyValueTypeImpl<T>::GetValue(temp_buf));
otherType->DeleteValue(temp_buf);
return true;
}
*value = static_cast<T>(wxAnyValueTypeImpl<T>::GetValue(m_buffer));
return true;
}
#if wxUSE_VARIANT
// GetAs() wxVariant specialization
bool GetAs(wxVariant* value) const
{
return wxConvertAnyToVariant(*this, value);
}
#endif
private:
// Assignment functions
void AssignAny(const wxAny& any)
{
// Must delete value - CopyBuffer() never does that
m_type->DeleteValue(m_buffer);
wxAnyValueType* newType = any.m_type;
if ( !newType->IsSameType(m_type) )
m_type = newType;
newType->CopyBuffer(any.m_buffer, m_buffer);
}
#if wxUSE_VARIANT
void AssignVariant(const wxVariant& variant)
{
wxVariantData* data = variant.GetData();
if ( data && data->GetAsAny(this) )
return;
m_type->DeleteValue(m_buffer);
if ( variant.IsNull() )
{
// Init as Null
m_type = wxAnyNullValueType;
}
else
{
// If everything else fails, wrap the whole wxVariantData
m_type = wxAnyValueTypeImpl<wxVariantData*>::sm_instance.get();
wxAnyValueTypeImpl<wxVariantData*>::SetValue(data, m_buffer);
}
}
#endif
template<typename T>
void Assign(const T &value)
{
m_type->DeleteValue(m_buffer);
m_type = wxAnyValueTypeImpl<T>::sm_instance.get();
wxAnyValueTypeImpl<T>::SetValue(value, m_buffer);
}
// Data
wxAnyValueBuffer m_buffer;
wxAnyValueType* m_type;
};
namespace wxPrivate
{
// Dispatcher for template wxAny::As() implementation which is different for
// wxString and all the other types: the generic implementation check if the
// value is of the right type and returns it.
template <typename T>
struct wxAnyAsImpl
{
static T DoAs(const wxAny& any)
{
return any.RawAs<T>();
}
};
// Specialization for wxString does coercion.
template <>
struct wxAnyAsImpl<wxString>
{
static wxString DoAs(const wxAny& any)
{
wxString value;
if ( !any.GetAs(&value) )
{
wxFAIL_MSG("Incorrect or non-convertible data type");
}
return value;
}
};
}
// See comment for wxANY_VALUE_TYPE_CHECK_TYPE.
#define wxANY_CHECK_TYPE(any, T) \
wxANY_VALUE_TYPE_CHECK_TYPE((any).GetType(), T)
// This macro shouldn't be used any longer for the same reasons as
// wxANY_VALUE_TYPE_CHECK_TYPE(), just call As() directly.
#define wxANY_AS(any, T) \
(any).As(static_cast<T*>(NULL))
template<typename T>
inline bool wxAnyValueType::CheckType() const
{
return wxAnyValueTypeImpl<T>::IsSameClass(this);
}
WX_DECLARE_LIST_WITH_DECL(wxAny, wxAnyList, class WXDLLIMPEXP_BASE);
#endif // wxUSE_ANY
#endif // _WX_ANY_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/radiobox.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/radiobox.h
// Purpose: wxRadioBox declaration
// Author: Vadim Zeitlin
// Modified by:
// Created: 10.09.00
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RADIOBOX_H_BASE_
#define _WX_RADIOBOX_H_BASE_
#include "wx/defs.h"
#if wxUSE_RADIOBOX
#include "wx/ctrlsub.h"
#if wxUSE_TOOLTIPS
#include "wx/dynarray.h"
class WXDLLIMPEXP_FWD_CORE wxToolTip;
WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray);
#endif // wxUSE_TOOLTIPS
extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioBoxNameStr[];
// ----------------------------------------------------------------------------
// wxRadioBoxBase is not a normal base class, but rather a mix-in because the
// real wxRadioBox derives from different classes on different platforms: for
// example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRadioBoxBase : public wxItemContainerImmutable
{
public:
virtual ~wxRadioBoxBase();
// change/query the individual radio button state
virtual bool Enable(unsigned int n, bool enable = true) = 0;
virtual bool Show(unsigned int n, bool show = true) = 0;
virtual bool IsItemEnabled(unsigned int n) const = 0;
virtual bool IsItemShown(unsigned int n) const = 0;
// return number of columns/rows in this radiobox
unsigned int GetColumnCount() const { return m_numCols; }
unsigned int GetRowCount() const { return m_numRows; }
// return the next active (i.e. shown and not disabled) item above/below/to
// the left/right of the given one
int GetNextItem(int item, wxDirection dir, long style) const;
#if wxUSE_TOOLTIPS
// set the tooltip text for a radio item, empty string unsets any tooltip
void SetItemToolTip(unsigned int item, const wxString& text);
// get the individual items tooltip; returns NULL if none
wxToolTip *GetItemToolTip(unsigned int item) const
{ return m_itemsTooltips ? (*m_itemsTooltips)[item] : NULL; }
#endif // wxUSE_TOOLTIPS
#if wxUSE_HELP
// set helptext for a particular item, pass an empty string to erase it
void SetItemHelpText(unsigned int n, const wxString& helpText);
// retrieve helptext for a particular item, empty string means no help text
wxString GetItemHelpText(unsigned int n) const;
#else // wxUSE_HELP
// just silently ignore the help text, it's better than requiring using
// conditional compilation in all code using this function
void SetItemHelpText(unsigned int WXUNUSED(n),
const wxString& WXUNUSED(helpText))
{
}
#endif // wxUSE_HELP
// returns the radio item at the given position or wxNOT_FOUND if none
// (currently implemented only under MSW and GTK)
virtual int GetItemFromPoint(const wxPoint& WXUNUSED(pt)) const
{
return wxNOT_FOUND;
}
protected:
wxRadioBoxBase()
{
m_numCols =
m_numRows =
m_majorDim = 0;
#if wxUSE_TOOLTIPS
m_itemsTooltips = NULL;
#endif // wxUSE_TOOLTIPS
}
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
// return the number of items in major direction (which depends on whether
// we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style)
unsigned int GetMajorDim() const { return m_majorDim; }
// sets m_majorDim and also updates m_numCols/Rows
//
// the style parameter should be the style of the radiobox itself
void SetMajorDim(unsigned int majorDim, long style);
#if wxUSE_TOOLTIPS
// called from SetItemToolTip() to really set the tooltip for the specified
// item in the box (or, if tooltip is NULL, to remove any existing one).
//
// NB: this function should really be pure virtual but to avoid breaking
// the build of the ports for which it's not implemented yet we provide
// an empty stub in the base class for now
virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip);
// returns true if we have any item tooltips
bool HasItemToolTips() const { return m_itemsTooltips != NULL; }
#endif // wxUSE_TOOLTIPS
#if wxUSE_HELP
// Retrieve help text for an item: this is a helper for the implementation
// of wxWindow::GetHelpTextAtPoint() in the real radiobox class
wxString DoGetHelpTextAtPoint(const wxWindow *derived,
const wxPoint& pt,
wxHelpEvent::Origin origin) const;
#endif // wxUSE_HELP
private:
// the number of elements in major dimension (i.e. number of columns if
// wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also
// the number of rows/columns calculated from it
unsigned int m_majorDim,
m_numCols,
m_numRows;
#if wxUSE_TOOLTIPS
// array of tooltips for the individual items
//
// this array is initially NULL and initialized on first use
wxToolTipArray *m_itemsTooltips;
#endif
#if wxUSE_HELP
// help text associated with a particular item or empty string if none
wxArrayString m_itemsHelpTexts;
#endif // wxUSE_HELP
};
#if defined(__WXUNIVERSAL__)
#include "wx/univ/radiobox.h"
#elif defined(__WXMSW__)
#include "wx/msw/radiobox.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/radiobox.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/radiobox.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/radiobox.h"
#elif defined(__WXMAC__)
#include "wx/osx/radiobox.h"
#elif defined(__WXQT__)
#include "wx/qt/radiobox.h"
#endif
#endif // wxUSE_RADIOBOX
#endif // _WX_RADIOBOX_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/regex.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/regex.h
// Purpose: regular expression matching
// Author: Karsten Ballueder
// Modified by: VZ at 13.07.01 (integrated to wxWin)
// Created: 05.02.2000
// Copyright: (c) 2000 Karsten Ballueder <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_REGEX_H_
#define _WX_REGEX_H_
#include "wx/defs.h"
#if wxUSE_REGEX
#include "wx/string.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// flags for regex compilation: these can be used with Compile()
enum
{
// use extended regex syntax
wxRE_EXTENDED = 0,
// use advanced RE syntax (built-in regex only)
#ifdef wxHAS_REGEX_ADVANCED
wxRE_ADVANCED = 1,
#endif
// use basic RE syntax
wxRE_BASIC = 2,
// ignore case in match
wxRE_ICASE = 4,
// only check match, don't set back references
wxRE_NOSUB = 8,
// if not set, treat '\n' as an ordinary character, otherwise it is
// special: it is not matched by '.' and '^' and '$' always match
// after/before it regardless of the setting of wxRE_NOT[BE]OL
wxRE_NEWLINE = 16,
// default flags
wxRE_DEFAULT = wxRE_EXTENDED
};
// flags for regex matching: these can be used with Matches()
//
// these flags are mainly useful when doing several matches in a long string,
// they can be used to prevent erroneous matches for '^' and '$'
enum
{
// '^' doesn't match at the start of line
wxRE_NOTBOL = 32,
// '$' doesn't match at the end of line
wxRE_NOTEOL = 64
};
// ----------------------------------------------------------------------------
// wxRegEx: a regular expression
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_BASE wxRegExImpl;
class WXDLLIMPEXP_BASE wxRegEx
{
public:
// default ctor: use Compile() later
wxRegEx() { Init(); }
// create and compile
wxRegEx(const wxString& expr, int flags = wxRE_DEFAULT)
{
Init();
(void)Compile(expr, flags);
}
// return true if this is a valid compiled regular expression
bool IsValid() const { return m_impl != NULL; }
// compile the string into regular expression, return true if ok or false
// if string has a syntax error
bool Compile(const wxString& pattern, int flags = wxRE_DEFAULT);
// matches the precompiled regular expression against a string, return
// true if matches and false otherwise
//
// flags may be combination of wxRE_NOTBOL and wxRE_NOTEOL
// len may be the length of text (ignored by most system regex libs)
//
// may only be called after successful call to Compile()
bool Matches(const wxString& text, int flags = 0) const;
bool Matches(const wxChar *text, int flags, size_t len) const
{ return Matches(wxString(text, len), flags); }
// get the start index and the length of the match of the expression
// (index 0) or a bracketed subexpression (index != 0)
//
// may only be called after successful call to Matches()
//
// return false if no match or on error
bool GetMatch(size_t *start, size_t *len, size_t index = 0) const;
// return the part of string corresponding to the match, empty string is
// returned if match failed
//
// may only be called after successful call to Matches()
wxString GetMatch(const wxString& text, size_t index = 0) const;
// return the size of the array of matches, i.e. the number of bracketed
// subexpressions plus one for the expression itself, or 0 on error.
//
// may only be called after successful call to Compile()
size_t GetMatchCount() const;
// replaces the current regular expression in the string pointed to by
// pattern, with the text in replacement and return number of matches
// replaced (maybe 0 if none found) or -1 on error
//
// the replacement text may contain backreferences (\number) which will be
// replaced with the value of the corresponding subexpression in the
// pattern match
//
// maxMatches may be used to limit the number of replacements made, setting
// it to 1, for example, will only replace first occurrence (if any) of the
// pattern in the text while default value of 0 means replace all
int Replace(wxString *text, const wxString& replacement,
size_t maxMatches = 0) const;
// replace the first occurrence
int ReplaceFirst(wxString *text, const wxString& replacement) const
{ return Replace(text, replacement, 1); }
// replace all occurrences: this is actually a synonym for Replace()
int ReplaceAll(wxString *text, const wxString& replacement) const
{ return Replace(text, replacement, 0); }
// dtor not virtual, don't derive from this class
~wxRegEx();
private:
// common part of all ctors
void Init();
// the real guts of this class
wxRegExImpl *m_impl;
// as long as the class wxRegExImpl is not ref-counted,
// instances of the handle wxRegEx must not be copied.
wxRegEx(const wxRegEx&);
wxRegEx &operator=(const wxRegEx&);
};
#endif // wxUSE_REGEX
#endif // _WX_REGEX_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/gdicmn.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/gdicmn.h
// Purpose: Common GDI classes, types and declarations
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GDICMNH__
#define _WX_GDICMNH__
// ---------------------------------------------------------------------------
// headers
// ---------------------------------------------------------------------------
#include "wx/defs.h"
#include "wx/list.h"
#include "wx/string.h"
#include "wx/fontenc.h"
#include "wx/hashmap.h"
#include "wx/math.h"
// ---------------------------------------------------------------------------
// forward declarations
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxBrush;
class WXDLLIMPEXP_FWD_CORE wxColour;
class WXDLLIMPEXP_FWD_CORE wxCursor;
class WXDLLIMPEXP_FWD_CORE wxFont;
class WXDLLIMPEXP_FWD_CORE wxIcon;
class WXDLLIMPEXP_FWD_CORE wxPalette;
class WXDLLIMPEXP_FWD_CORE wxPen;
class WXDLLIMPEXP_FWD_CORE wxRegion;
class WXDLLIMPEXP_FWD_BASE wxString;
class WXDLLIMPEXP_FWD_CORE wxIconBundle;
class WXDLLIMPEXP_FWD_CORE wxPoint;
// ---------------------------------------------------------------------------
// constants
// ---------------------------------------------------------------------------
// Bitmap flags
enum wxBitmapType
{
wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility!
wxBITMAP_TYPE_BMP,
wxBITMAP_TYPE_BMP_RESOURCE,
wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE,
wxBITMAP_TYPE_ICO,
wxBITMAP_TYPE_ICO_RESOURCE,
wxBITMAP_TYPE_CUR,
wxBITMAP_TYPE_CUR_RESOURCE,
wxBITMAP_TYPE_XBM,
wxBITMAP_TYPE_XBM_DATA,
wxBITMAP_TYPE_XPM,
wxBITMAP_TYPE_XPM_DATA,
wxBITMAP_TYPE_TIFF,
wxBITMAP_TYPE_TIF = wxBITMAP_TYPE_TIFF,
wxBITMAP_TYPE_TIFF_RESOURCE,
wxBITMAP_TYPE_TIF_RESOURCE = wxBITMAP_TYPE_TIFF_RESOURCE,
wxBITMAP_TYPE_GIF,
wxBITMAP_TYPE_GIF_RESOURCE,
wxBITMAP_TYPE_PNG,
wxBITMAP_TYPE_PNG_RESOURCE,
wxBITMAP_TYPE_JPEG,
wxBITMAP_TYPE_JPEG_RESOURCE,
wxBITMAP_TYPE_PNM,
wxBITMAP_TYPE_PNM_RESOURCE,
wxBITMAP_TYPE_PCX,
wxBITMAP_TYPE_PCX_RESOURCE,
wxBITMAP_TYPE_PICT,
wxBITMAP_TYPE_PICT_RESOURCE,
wxBITMAP_TYPE_ICON,
wxBITMAP_TYPE_ICON_RESOURCE,
wxBITMAP_TYPE_ANI,
wxBITMAP_TYPE_IFF,
wxBITMAP_TYPE_TGA,
wxBITMAP_TYPE_MACCURSOR,
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
wxBITMAP_TYPE_MAX,
wxBITMAP_TYPE_ANY = 50
};
// Polygon filling mode
enum wxPolygonFillMode
{
wxODDEVEN_RULE = 1,
wxWINDING_RULE
};
// Standard cursors
enum wxStockCursor
{
wxCURSOR_NONE, // should be 0
wxCURSOR_ARROW,
wxCURSOR_RIGHT_ARROW,
wxCURSOR_BULLSEYE,
wxCURSOR_CHAR,
wxCURSOR_CROSS,
wxCURSOR_HAND,
wxCURSOR_IBEAM,
wxCURSOR_LEFT_BUTTON,
wxCURSOR_MAGNIFIER,
wxCURSOR_MIDDLE_BUTTON,
wxCURSOR_NO_ENTRY,
wxCURSOR_PAINT_BRUSH,
wxCURSOR_PENCIL,
wxCURSOR_POINT_LEFT,
wxCURSOR_POINT_RIGHT,
wxCURSOR_QUESTION_ARROW,
wxCURSOR_RIGHT_BUTTON,
wxCURSOR_SIZENESW,
wxCURSOR_SIZENS,
wxCURSOR_SIZENWSE,
wxCURSOR_SIZEWE,
wxCURSOR_SIZING,
wxCURSOR_SPRAYCAN,
wxCURSOR_WAIT,
wxCURSOR_WATCH,
wxCURSOR_BLANK,
#ifdef __WXGTK__
wxCURSOR_DEFAULT, // standard X11 cursor
#endif
#ifdef __WXMAC__
wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow
#endif
#ifdef __X__
// Not yet implemented for Windows
wxCURSOR_CROSS_REVERSE,
wxCURSOR_DOUBLE_ARROW,
wxCURSOR_BASED_ARROW_UP,
wxCURSOR_BASED_ARROW_DOWN,
#endif // X11
wxCURSOR_ARROWWAIT,
#ifdef __WXMAC__
wxCURSOR_OPEN_HAND,
wxCURSOR_CLOSED_HAND,
#endif
wxCURSOR_MAX
};
#ifndef __WXGTK__
#define wxCURSOR_DEFAULT wxCURSOR_ARROW
#endif
#ifndef __WXMAC__
// TODO CS supply openhand and closedhand cursors
#define wxCURSOR_OPEN_HAND wxCURSOR_HAND
#define wxCURSOR_CLOSED_HAND wxCURSOR_HAND
#endif
// ----------------------------------------------------------------------------
// Ellipsize() constants
// ----------------------------------------------------------------------------
enum wxEllipsizeFlags
{
wxELLIPSIZE_FLAGS_NONE = 0,
wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS = 1,
wxELLIPSIZE_FLAGS_EXPAND_TABS = 2,
wxELLIPSIZE_FLAGS_DEFAULT = wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS |
wxELLIPSIZE_FLAGS_EXPAND_TABS
};
// NB: Don't change the order of these values, they're the same as in
// PangoEllipsizeMode enum.
enum wxEllipsizeMode
{
wxELLIPSIZE_NONE,
wxELLIPSIZE_START,
wxELLIPSIZE_MIDDLE,
wxELLIPSIZE_END
};
// ---------------------------------------------------------------------------
// macros
// ---------------------------------------------------------------------------
#if defined(__WINDOWS__) && wxUSE_WXDIB
#define wxHAS_IMAGES_IN_RESOURCES
#endif
/* Useful macro for creating icons portably, for example:
wxIcon *icon = new wxICON(sample);
expands into:
wxIcon *icon = new wxIcon("sample"); // On Windows
wxIcon *icon = new wxIcon(sample_xpm); // On wxGTK/Linux
*/
#ifdef wxHAS_IMAGES_IN_RESOURCES
// Load from a resource
#define wxICON(X) wxIcon(wxT(#X))
#elif defined(__WXDFB__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( X##_xpm )
#elif defined(__WXGTK__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( X##_xpm )
#elif defined(__WXMAC__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( X##_xpm )
#elif defined(__WXMOTIF__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( X##_xpm )
#elif defined(__WXX11__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( X##_xpm )
#elif defined(__WXQT__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( X##_xpm )
#else
// This will usually mean something on any platform
#define wxICON(X) wxIcon(wxT(#X))
#endif // platform
/* Another macro: this one is for portable creation of bitmaps. We assume that
under Unix bitmaps live in XPMs and under Windows they're in ressources.
*/
#if defined(__WINDOWS__) && wxUSE_WXDIB
#define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_BMP_RESOURCE)
#elif defined(__WXGTK__) || \
defined(__WXMOTIF__) || \
defined(__WXX11__) || \
defined(__WXMAC__) || \
defined(__WXDFB__)
// Initialize from an included XPM
#define wxBITMAP(name) wxBitmap(name##_xpm)
#else // other platforms
#define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM)
#endif // platform
// Macro for creating wxBitmap from in-memory PNG data.
//
// It reads PNG data from name_png static byte arrays that can be created using
// e.g. misc/scripts/png2c.py.
//
// This macro exists mostly as a helper for wxBITMAP_PNG() below but also
// because it's slightly more convenient to use than NewFromPNGData() directly.
#define wxBITMAP_PNG_FROM_DATA(name) \
wxBitmap::NewFromPNGData(name##_png, WXSIZEOF(name##_png))
// Similar to wxBITMAP but used for the bitmaps in PNG format.
//
// Under Windows they should be embedded into the resource file using RT_RCDATA
// resource type and under OS X the PNG file with the specified name must be
// available in the resource subdirectory of the bundle. Elsewhere, this is
// exactly the same thing as wxBITMAP_PNG_FROM_DATA() described above.
#if (defined(__WINDOWS__) && wxUSE_WXDIB) || defined(__WXOSX__)
#define wxBITMAP_PNG(name) wxBitmap(wxS(#name), wxBITMAP_TYPE_PNG_RESOURCE)
#else
#define wxBITMAP_PNG(name) wxBITMAP_PNG_FROM_DATA(name)
#endif
// ===========================================================================
// classes
// ===========================================================================
// ---------------------------------------------------------------------------
// wxSize
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSize
{
public:
// members are public for compatibility, don't use them directly.
int x, y;
// constructors
wxSize() : x(0), y(0) { }
wxSize(int xx, int yy) : x(xx), y(yy) { }
// no copy ctor or assignment operator - the defaults are ok
wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; }
wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; }
wxSize& operator/=(int i) { x /= i; y /= i; return *this; }
wxSize& operator*=(int i) { x *= i; y *= i; return *this; }
wxSize& operator/=(unsigned int i) { x /= i; y /= i; return *this; }
wxSize& operator*=(unsigned int i) { x *= i; y *= i; return *this; }
wxSize& operator/=(long i) { x /= i; y /= i; return *this; }
wxSize& operator*=(long i) { x *= i; y *= i; return *this; }
wxSize& operator/=(unsigned long i) { x /= i; y /= i; return *this; }
wxSize& operator*=(unsigned long i) { x *= i; y *= i; return *this; }
wxSize& operator/=(double i) { x = wxRound(x/i); y = wxRound(y/i); return *this; }
wxSize& operator*=(double i) { x = wxRound(x*i); y = wxRound(y*i); return *this; }
void IncTo(const wxSize& sz)
{ if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; }
void DecTo(const wxSize& sz)
{ if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; }
void DecToIfSpecified(const wxSize& sz)
{
if ( sz.x != wxDefaultCoord && sz.x < x )
x = sz.x;
if ( sz.y != wxDefaultCoord && sz.y < y )
y = sz.y;
}
void IncBy(int dx, int dy) { x += dx; y += dy; }
void IncBy(const wxPoint& pt);
void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); }
void IncBy(int d) { IncBy(d, d); }
void DecBy(int dx, int dy) { IncBy(-dx, -dy); }
void DecBy(const wxPoint& pt);
void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); }
void DecBy(int d) { DecBy(d, d); }
wxSize& Scale(double xscale, double yscale)
{ x = wxRound(x*xscale); y = wxRound(y*yscale); return *this; }
// accessors
void Set(int xx, int yy) { x = xx; y = yy; }
void SetWidth(int w) { x = w; }
void SetHeight(int h) { y = h; }
int GetWidth() const { return x; }
int GetHeight() const { return y; }
bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; }
// combine this size with the other one replacing the default (i.e. equal
// to wxDefaultCoord) components of this object with those of the other
void SetDefaults(const wxSize& size)
{
if ( x == wxDefaultCoord )
x = size.x;
if ( y == wxDefaultCoord )
y = size.y;
}
// compatibility
int GetX() const { return x; }
int GetY() const { return y; }
};
inline bool operator==(const wxSize& s1, const wxSize& s2)
{
return s1.x == s2.x && s1.y == s2.y;
}
inline bool operator!=(const wxSize& s1, const wxSize& s2)
{
return s1.x != s2.x || s1.y != s2.y;
}
inline wxSize operator+(const wxSize& s1, const wxSize& s2)
{
return wxSize(s1.x + s2.x, s1.y + s2.y);
}
inline wxSize operator-(const wxSize& s1, const wxSize& s2)
{
return wxSize(s1.x - s2.x, s1.y - s2.y);
}
inline wxSize operator/(const wxSize& s, int i)
{
return wxSize(s.x / i, s.y / i);
}
inline wxSize operator*(const wxSize& s, int i)
{
return wxSize(s.x * i, s.y * i);
}
inline wxSize operator*(int i, const wxSize& s)
{
return wxSize(s.x * i, s.y * i);
}
inline wxSize operator/(const wxSize& s, unsigned int i)
{
return wxSize(s.x / i, s.y / i);
}
inline wxSize operator*(const wxSize& s, unsigned int i)
{
return wxSize(s.x * i, s.y * i);
}
inline wxSize operator*(unsigned int i, const wxSize& s)
{
return wxSize(s.x * i, s.y * i);
}
inline wxSize operator/(const wxSize& s, long i)
{
return wxSize(s.x / i, s.y / i);
}
inline wxSize operator*(const wxSize& s, long i)
{
return wxSize(int(s.x * i), int(s.y * i));
}
inline wxSize operator*(long i, const wxSize& s)
{
return wxSize(int(s.x * i), int(s.y * i));
}
inline wxSize operator/(const wxSize& s, unsigned long i)
{
return wxSize(int(s.x / i), int(s.y / i));
}
inline wxSize operator*(const wxSize& s, unsigned long i)
{
return wxSize(int(s.x * i), int(s.y * i));
}
inline wxSize operator*(unsigned long i, const wxSize& s)
{
return wxSize(int(s.x * i), int(s.y * i));
}
inline wxSize operator*(const wxSize& s, double i)
{
return wxSize(wxRound(s.x * i), wxRound(s.y * i));
}
inline wxSize operator*(double i, const wxSize& s)
{
return wxSize(wxRound(s.x * i), wxRound(s.y * i));
}
// ---------------------------------------------------------------------------
// Point classes: with real or integer coordinates
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRealPoint
{
public:
double x;
double y;
wxRealPoint() : x(0.0), y(0.0) { }
wxRealPoint(double xx, double yy) : x(xx), y(yy) { }
wxRealPoint(const wxPoint& pt);
// no copy ctor or assignment operator - the defaults are ok
//assignment operators
wxRealPoint& operator+=(const wxRealPoint& p) { x += p.x; y += p.y; return *this; }
wxRealPoint& operator-=(const wxRealPoint& p) { x -= p.x; y -= p.y; return *this; }
wxRealPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; }
wxRealPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; }
};
inline bool operator==(const wxRealPoint& p1, const wxRealPoint& p2)
{
return wxIsSameDouble(p1.x, p2.x) && wxIsSameDouble(p1.y, p2.y);
}
inline bool operator!=(const wxRealPoint& p1, const wxRealPoint& p2)
{
return !(p1 == p2);
}
inline wxRealPoint operator+(const wxRealPoint& p1, const wxRealPoint& p2)
{
return wxRealPoint(p1.x + p2.x, p1.y + p2.y);
}
inline wxRealPoint operator-(const wxRealPoint& p1, const wxRealPoint& p2)
{
return wxRealPoint(p1.x - p2.x, p1.y - p2.y);
}
inline wxRealPoint operator/(const wxRealPoint& s, int i)
{
return wxRealPoint(s.x / i, s.y / i);
}
inline wxRealPoint operator*(const wxRealPoint& s, int i)
{
return wxRealPoint(s.x * i, s.y * i);
}
inline wxRealPoint operator*(int i, const wxRealPoint& s)
{
return wxRealPoint(s.x * i, s.y * i);
}
inline wxRealPoint operator/(const wxRealPoint& s, unsigned int i)
{
return wxRealPoint(s.x / i, s.y / i);
}
inline wxRealPoint operator*(const wxRealPoint& s, unsigned int i)
{
return wxRealPoint(s.x * i, s.y * i);
}
inline wxRealPoint operator*(unsigned int i, const wxRealPoint& s)
{
return wxRealPoint(s.x * i, s.y * i);
}
inline wxRealPoint operator/(const wxRealPoint& s, long i)
{
return wxRealPoint(s.x / i, s.y / i);
}
inline wxRealPoint operator*(const wxRealPoint& s, long i)
{
return wxRealPoint(s.x * i, s.y * i);
}
inline wxRealPoint operator*(long i, const wxRealPoint& s)
{
return wxRealPoint(s.x * i, s.y * i);
}
inline wxRealPoint operator/(const wxRealPoint& s, unsigned long i)
{
return wxRealPoint(s.x / i, s.y / i);
}
inline wxRealPoint operator*(const wxRealPoint& s, unsigned long i)
{
return wxRealPoint(s.x * i, s.y * i);
}
inline wxRealPoint operator*(unsigned long i, const wxRealPoint& s)
{
return wxRealPoint(s.x * i, s.y * i);
}
inline wxRealPoint operator*(const wxRealPoint& s, double i)
{
return wxRealPoint(s.x * i, s.y * i);
}
inline wxRealPoint operator*(double i, const wxRealPoint& s)
{
return wxRealPoint(s.x * i, s.y * i);
}
// ----------------------------------------------------------------------------
// wxPoint: 2D point with integer coordinates
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPoint
{
public:
int x, y;
wxPoint() : x(0), y(0) { }
wxPoint(int xx, int yy) : x(xx), y(yy) { }
wxPoint(const wxRealPoint& pt) : x(wxRound(pt.x)), y(wxRound(pt.y)) { }
// no copy ctor or assignment operator - the defaults are ok
//assignment operators
wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; }
wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; }
wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; }
wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; }
// check if both components are set/initialized
bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; }
// fill in the unset components with the values from the other point
void SetDefaults(const wxPoint& pt)
{
if ( x == wxDefaultCoord )
x = pt.x;
if ( y == wxDefaultCoord )
y = pt.y;
}
};
// comparison
inline bool operator==(const wxPoint& p1, const wxPoint& p2)
{
return p1.x == p2.x && p1.y == p2.y;
}
inline bool operator!=(const wxPoint& p1, const wxPoint& p2)
{
return !(p1 == p2);
}
// arithmetic operations (component wise)
inline wxPoint operator+(const wxPoint& p1, const wxPoint& p2)
{
return wxPoint(p1.x + p2.x, p1.y + p2.y);
}
inline wxPoint operator-(const wxPoint& p1, const wxPoint& p2)
{
return wxPoint(p1.x - p2.x, p1.y - p2.y);
}
inline wxPoint operator+(const wxPoint& p, const wxSize& s)
{
return wxPoint(p.x + s.x, p.y + s.y);
}
inline wxPoint operator-(const wxPoint& p, const wxSize& s)
{
return wxPoint(p.x - s.x, p.y - s.y);
}
inline wxPoint operator+(const wxSize& s, const wxPoint& p)
{
return wxPoint(p.x + s.x, p.y + s.y);
}
inline wxPoint operator-(const wxSize& s, const wxPoint& p)
{
return wxPoint(s.x - p.x, s.y - p.y);
}
inline wxPoint operator-(const wxPoint& p)
{
return wxPoint(-p.x, -p.y);
}
inline wxPoint operator/(const wxPoint& s, int i)
{
return wxPoint(s.x / i, s.y / i);
}
inline wxPoint operator*(const wxPoint& s, int i)
{
return wxPoint(s.x * i, s.y * i);
}
inline wxPoint operator*(int i, const wxPoint& s)
{
return wxPoint(s.x * i, s.y * i);
}
inline wxPoint operator/(const wxPoint& s, unsigned int i)
{
return wxPoint(s.x / i, s.y / i);
}
inline wxPoint operator*(const wxPoint& s, unsigned int i)
{
return wxPoint(s.x * i, s.y * i);
}
inline wxPoint operator*(unsigned int i, const wxPoint& s)
{
return wxPoint(s.x * i, s.y * i);
}
inline wxPoint operator/(const wxPoint& s, long i)
{
return wxPoint(s.x / i, s.y / i);
}
inline wxPoint operator*(const wxPoint& s, long i)
{
return wxPoint(int(s.x * i), int(s.y * i));
}
inline wxPoint operator*(long i, const wxPoint& s)
{
return wxPoint(int(s.x * i), int(s.y * i));
}
inline wxPoint operator/(const wxPoint& s, unsigned long i)
{
return wxPoint(s.x / i, s.y / i);
}
inline wxPoint operator*(const wxPoint& s, unsigned long i)
{
return wxPoint(int(s.x * i), int(s.y * i));
}
inline wxPoint operator*(unsigned long i, const wxPoint& s)
{
return wxPoint(int(s.x * i), int(s.y * i));
}
inline wxPoint operator*(const wxPoint& s, double i)
{
return wxPoint(int(s.x * i), int(s.y * i));
}
inline wxPoint operator*(double i, const wxPoint& s)
{
return wxPoint(int(s.x * i), int(s.y * i));
}
WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE);
// ---------------------------------------------------------------------------
// wxRect
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRect
{
public:
wxRect()
: x(0), y(0), width(0), height(0)
{ }
wxRect(int xx, int yy, int ww, int hh)
: x(xx), y(yy), width(ww), height(hh)
{ }
wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
wxRect(const wxPoint& pt, const wxSize& size)
: x(pt.x), y(pt.y), width(size.x), height(size.y)
{ }
wxRect(const wxSize& size)
: x(0), y(0), width(size.x), height(size.y)
{ }
// default copy ctor and assignment operators ok
int GetX() const { return x; }
void SetX(int xx) { x = xx; }
int GetY() const { return y; }
void SetY(int yy) { y = yy; }
int GetWidth() const { return width; }
void SetWidth(int w) { width = w; }
int GetHeight() const { return height; }
void SetHeight(int h) { height = h; }
wxPoint GetPosition() const { return wxPoint(x, y); }
void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; }
wxSize GetSize() const { return wxSize(width, height); }
void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); }
bool IsEmpty() const { return (width <= 0) || (height <= 0); }
int GetLeft() const { return x; }
int GetTop() const { return y; }
int GetBottom() const { return y + height - 1; }
int GetRight() const { return x + width - 1; }
void SetLeft(int left) { x = left; }
void SetRight(int right) { width = right - x + 1; }
void SetTop(int top) { y = top; }
void SetBottom(int bottom) { height = bottom - y + 1; }
wxPoint GetTopLeft() const { return GetPosition(); }
wxPoint GetLeftTop() const { return GetTopLeft(); }
void SetTopLeft(const wxPoint &p) { SetPosition(p); }
void SetLeftTop(const wxPoint &p) { SetTopLeft(p); }
wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); }
wxPoint GetRightBottom() const { return GetBottomRight(); }
void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); }
void SetRightBottom(const wxPoint &p) { SetBottomRight(p); }
wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); }
wxPoint GetRightTop() const { return GetTopRight(); }
void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); }
void SetRightTop(const wxPoint &p) { SetTopRight(p); }
wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); }
wxPoint GetLeftBottom() const { return GetBottomLeft(); }
void SetBottomLeft(const wxPoint &p) { SetLeft(p.x); SetBottom(p.y); }
void SetLeftBottom(const wxPoint &p) { SetBottomLeft(p); }
// operations with rect
wxRect& Inflate(wxCoord dx, wxCoord dy);
wxRect& Inflate(const wxSize& d) { return Inflate(d.x, d.y); }
wxRect& Inflate(wxCoord d) { return Inflate(d, d); }
wxRect Inflate(wxCoord dx, wxCoord dy) const
{
wxRect r = *this;
r.Inflate(dx, dy);
return r;
}
wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); }
wxRect& Deflate(const wxSize& d) { return Inflate(-d.x, -d.y); }
wxRect& Deflate(wxCoord d) { return Inflate(-d); }
wxRect Deflate(wxCoord dx, wxCoord dy) const
{
wxRect r = *this;
r.Deflate(dx, dy);
return r;
}
void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; }
void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); }
wxRect& Intersect(const wxRect& rect);
wxRect Intersect(const wxRect& rect) const
{
wxRect r = *this;
r.Intersect(rect);
return r;
}
wxRect& Union(const wxRect& rect);
wxRect Union(const wxRect& rect) const
{
wxRect r = *this;
r.Union(rect);
return r;
}
// return true if the point is (not strcitly) inside the rect
bool Contains(int x, int y) const;
bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); }
// return true if the rectangle 'rect' is (not strictly) inside this rect
bool Contains(const wxRect& rect) const;
// return true if the rectangles have a non empty intersection
bool Intersects(const wxRect& rect) const;
// like Union() but don't ignore empty rectangles
wxRect& operator+=(const wxRect& rect);
// intersections of two rectrangles not testing for empty rectangles
wxRect& operator*=(const wxRect& rect);
// centre this rectangle in the given (usually, but not necessarily,
// larger) one
wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const
{
return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x,
dir & wxVERTICAL ? r.y + (r.height - height)/2 : y,
width, height);
}
wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const
{
return CentreIn(r, dir);
}
public:
int x, y, width, height;
};
// compare rectangles
inline bool operator==(const wxRect& r1, const wxRect& r2)
{
return (r1.x == r2.x) && (r1.y == r2.y) &&
(r1.width == r2.width) && (r1.height == r2.height);
}
inline bool operator!=(const wxRect& r1, const wxRect& r2)
{
return !(r1 == r2);
}
// like Union() but don't treat empty rectangles specially
WXDLLIMPEXP_CORE wxRect operator+(const wxRect& r1, const wxRect& r2);
// intersections of two rectangles
WXDLLIMPEXP_CORE wxRect operator*(const wxRect& r1, const wxRect& r2);
// define functions which couldn't be defined above because of declarations
// order
inline void wxSize::IncBy(const wxPoint& pt) { IncBy(pt.x, pt.y); }
inline void wxSize::DecBy(const wxPoint& pt) { DecBy(pt.x, pt.y); }
// ---------------------------------------------------------------------------
// Management of pens, brushes and fonts
// ---------------------------------------------------------------------------
typedef wxInt8 wxDash;
class WXDLLIMPEXP_CORE wxGDIObjListBase {
public:
wxGDIObjListBase();
~wxGDIObjListBase();
protected:
wxList list;
};
WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap);
class WXDLLIMPEXP_CORE wxColourDatabase
{
public:
wxColourDatabase();
~wxColourDatabase();
// find colour by name or name for the given colour
wxColour Find(const wxString& name) const;
wxString FindName(const wxColour& colour) const;
// add a new colour to the database
void AddColour(const wxString& name, const wxColour& colour);
private:
// load the database with the built in colour values when called for the
// first time, do nothing after this
void Initialize();
wxStringToColourHashMap *m_map;
};
class WXDLLIMPEXP_CORE wxResourceCache: public wxList
{
public:
wxResourceCache() { }
#if !wxUSE_STD_CONTAINERS
wxResourceCache(unsigned int keyType) : wxList(keyType) { }
#endif
virtual ~wxResourceCache();
};
// ---------------------------------------------------------------------------
// global variables
// ---------------------------------------------------------------------------
/* Stock objects
wxStockGDI creates the stock GDI objects on demand. Pointers to the
created objects are stored in the ms_stockObject array, which is indexed
by the Item enum values. Platorm-specific fonts can be created by
implementing a derived class with an override for the GetFont function.
wxStockGDI operates as a singleton, accessed through the ms_instance
pointer. By default this pointer is set to an instance of wxStockGDI.
A derived class must arrange to set this pointer to an instance of itself.
*/
class WXDLLIMPEXP_CORE wxStockGDI
{
public:
enum Item {
BRUSH_BLACK,
BRUSH_BLUE,
BRUSH_CYAN,
BRUSH_GREEN,
BRUSH_YELLOW,
BRUSH_GREY,
BRUSH_LIGHTGREY,
BRUSH_MEDIUMGREY,
BRUSH_RED,
BRUSH_TRANSPARENT,
BRUSH_WHITE,
COLOUR_BLACK,
COLOUR_BLUE,
COLOUR_CYAN,
COLOUR_GREEN,
COLOUR_YELLOW,
COLOUR_LIGHTGREY,
COLOUR_RED,
COLOUR_WHITE,
CURSOR_CROSS,
CURSOR_HOURGLASS,
CURSOR_STANDARD,
FONT_ITALIC,
FONT_NORMAL,
FONT_SMALL,
FONT_SWISS,
PEN_BLACK,
PEN_BLACKDASHED,
PEN_BLUE,
PEN_CYAN,
PEN_GREEN,
PEN_YELLOW,
PEN_GREY,
PEN_LIGHTGREY,
PEN_MEDIUMGREY,
PEN_RED,
PEN_TRANSPARENT,
PEN_WHITE,
ITEMCOUNT
};
wxStockGDI();
virtual ~wxStockGDI();
static void DeleteAll();
static wxStockGDI& instance() { return *ms_instance; }
static const wxBrush* GetBrush(Item item);
static const wxColour* GetColour(Item item);
static const wxCursor* GetCursor(Item item);
// Can be overridden by platform-specific derived classes
virtual const wxFont* GetFont(Item item);
static const wxPen* GetPen(Item item);
protected:
static wxStockGDI* ms_instance;
static wxObject* ms_stockObject[ITEMCOUNT];
wxDECLARE_NO_COPY_CLASS(wxStockGDI);
};
#define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC)
#define wxNORMAL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL)
#define wxSMALL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SMALL)
#define wxSWISS_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SWISS)
#define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED)
#define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK)
#define wxBLUE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLUE)
#define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN)
#define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN)
#define wxYELLOW_PEN wxStockGDI::GetPen(wxStockGDI::PEN_YELLOW)
#define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY)
#define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY)
#define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY)
#define wxRED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_RED)
#define wxTRANSPARENT_PEN wxStockGDI::GetPen(wxStockGDI::PEN_TRANSPARENT)
#define wxWHITE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_WHITE)
#define wxBLACK_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLACK)
#define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE)
#define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN)
#define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN)
#define wxYELLOW_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_YELLOW)
#define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY)
#define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY)
#define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY)
#define wxRED_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_RED)
#define wxTRANSPARENT_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_TRANSPARENT)
#define wxWHITE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_WHITE)
#define wxBLACK wxStockGDI::GetColour(wxStockGDI::COLOUR_BLACK)
#define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE)
#define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN)
#define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN)
#define wxYELLOW wxStockGDI::GetColour(wxStockGDI::COLOUR_YELLOW)
#define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY)
#define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED)
#define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE)
#define wxCROSS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_CROSS)
#define wxHOURGLASS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_HOURGLASS)
#define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD)
// 'Null' objects
extern WXDLLIMPEXP_DATA_CORE(wxBitmap) wxNullBitmap;
extern WXDLLIMPEXP_DATA_CORE(wxIcon) wxNullIcon;
extern WXDLLIMPEXP_DATA_CORE(wxCursor) wxNullCursor;
extern WXDLLIMPEXP_DATA_CORE(wxPen) wxNullPen;
extern WXDLLIMPEXP_DATA_CORE(wxBrush) wxNullBrush;
extern WXDLLIMPEXP_DATA_CORE(wxPalette) wxNullPalette;
extern WXDLLIMPEXP_DATA_CORE(wxFont) wxNullFont;
extern WXDLLIMPEXP_DATA_CORE(wxColour) wxNullColour;
extern WXDLLIMPEXP_DATA_CORE(wxIconBundle) wxNullIconBundle;
extern WXDLLIMPEXP_DATA_CORE(wxColourDatabase*) wxTheColourDatabase;
extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize;
extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition;
// ---------------------------------------------------------------------------
// global functions
// ---------------------------------------------------------------------------
// resource management
extern void WXDLLIMPEXP_CORE wxInitializeStockLists();
extern void WXDLLIMPEXP_CORE wxDeleteStockLists();
// Note: all the display-related functions here exist for compatibility only,
// please use wxDisplay class in the new code
// is the display colour (or monochrome)?
extern bool WXDLLIMPEXP_CORE wxColourDisplay();
// Returns depth of screen
extern int WXDLLIMPEXP_CORE wxDisplayDepth();
#define wxGetDisplayDepth wxDisplayDepth
// get the display size
extern void WXDLLIMPEXP_CORE wxDisplaySize(int *width, int *height);
extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize();
extern void WXDLLIMPEXP_CORE wxDisplaySizeMM(int *width, int *height);
extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySizeMM();
extern wxSize WXDLLIMPEXP_CORE wxGetDisplayPPI();
// Get position and size of the display workarea
extern void WXDLLIMPEXP_CORE wxClientDisplayRect(int *x, int *y, int *width, int *height);
extern wxRect WXDLLIMPEXP_CORE wxGetClientDisplayRect();
// set global cursor
extern void WXDLLIMPEXP_CORE wxSetCursor(const wxCursor& cursor);
#endif
// _WX_GDICMNH__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/hyperlink.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/hyperlink.h
// Purpose: Hyperlink control
// Author: David Norris <[email protected]>, Otto Wyss
// Modified by: Ryan Norton, Francesco Montorsi
// Created: 04/02/2005
// Copyright: (c) 2005 David Norris
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HYPERLINK_H_
#define _WX_HYPERLINK_H_
#include "wx/defs.h"
#if wxUSE_HYPERLINKCTRL
#include "wx/control.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
#define wxHL_CONTEXTMENU 0x0001
#define wxHL_ALIGN_LEFT 0x0002
#define wxHL_ALIGN_RIGHT 0x0004
#define wxHL_ALIGN_CENTRE 0x0008
#define wxHL_DEFAULT_STYLE (wxHL_CONTEXTMENU|wxNO_BORDER|wxHL_ALIGN_CENTRE)
extern WXDLLIMPEXP_DATA_CORE(const char) wxHyperlinkCtrlNameStr[];
// ----------------------------------------------------------------------------
// wxHyperlinkCtrl
// ----------------------------------------------------------------------------
// A static text control that emulates a hyperlink. The link is displayed
// in an appropriate text style, derived from the control's normal font.
// When the mouse rolls over the link, the cursor changes to a hand and the
// link's color changes to the active color.
//
// Clicking on the link does not launch a web browser; instead, a
// HyperlinkEvent is fired. The event propagates upward until it is caught,
// just like a wxCommandEvent.
//
// Use the EVT_HYPERLINK() to catch link events.
class WXDLLIMPEXP_CORE wxHyperlinkCtrlBase : public wxControl
{
public:
// get/set
virtual wxColour GetHoverColour() const = 0;
virtual void SetHoverColour(const wxColour &colour) = 0;
virtual wxColour GetNormalColour() const = 0;
virtual void SetNormalColour(const wxColour &colour) = 0;
virtual wxColour GetVisitedColour() const = 0;
virtual void SetVisitedColour(const wxColour &colour) = 0;
virtual wxString GetURL() const = 0;
virtual void SetURL (const wxString &url) = 0;
virtual void SetVisited(bool visited = true) = 0;
virtual bool GetVisited() const = 0;
// NOTE: also wxWindow::Set/GetLabel, wxWindow::Set/GetBackgroundColour,
// wxWindow::Get/SetFont, wxWindow::Get/SetCursor are important !
virtual bool HasTransparentBackground() wxOVERRIDE { return true; }
protected:
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
// checks for validity some of the ctor/Create() function parameters
void CheckParams(const wxString& label, const wxString& url, long style);
public:
// Send wxHyperlinkEvent and open our link in the default browser if it
// wasn't handled.
//
// not part of the public API but needs to be public as used by
// GTK+ callbacks:
void SendEvent();
};
// ----------------------------------------------------------------------------
// wxHyperlinkEvent
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxHyperlinkEvent;
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HYPERLINK, wxHyperlinkEvent );
//
// An event fired when the user clicks on the label in a hyperlink control.
// See HyperlinkControl for details.
//
class WXDLLIMPEXP_CORE wxHyperlinkEvent : public wxCommandEvent
{
public:
wxHyperlinkEvent() {}
wxHyperlinkEvent(wxObject *generator, wxWindowID id, const wxString& url)
: wxCommandEvent(wxEVT_HYPERLINK, id),
m_url(url)
{
SetEventObject(generator);
}
// Returns the URL associated with the hyperlink control
// that the user clicked on.
wxString GetURL() const { return m_url; }
void SetURL(const wxString &url) { m_url=url; }
// default copy ctor, assignment operator and dtor are ok
virtual wxEvent *Clone() const wxOVERRIDE { return new wxHyperlinkEvent(*this); }
private:
// URL associated with the hyperlink control that the used clicked on.
wxString m_url;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHyperlinkEvent);
};
// ----------------------------------------------------------------------------
// event types and macros
// ----------------------------------------------------------------------------
typedef void (wxEvtHandler::*wxHyperlinkEventFunction)(wxHyperlinkEvent&);
#define wxHyperlinkEventHandler(func) \
wxEVENT_HANDLER_CAST(wxHyperlinkEventFunction, func)
#define EVT_HYPERLINK(id, fn) \
wx__DECLARE_EVT1(wxEVT_HYPERLINK, id, wxHyperlinkEventHandler(fn))
#if defined(__WXGTK210__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/hyperlink.h"
// Note that the native control is only available in Unicode version under MSW.
#elif defined(__WXMSW__) && wxUSE_UNICODE && !defined(__WXUNIVERSAL__)
#include "wx/msw/hyperlink.h"
#else
#include "wx/generic/hyperlink.h"
class WXDLLIMPEXP_CORE wxHyperlinkCtrl : public wxGenericHyperlinkCtrl
{
public:
wxHyperlinkCtrl() { }
wxHyperlinkCtrl(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxString& url,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHL_DEFAULT_STYLE,
const wxString& name = wxHyperlinkCtrlNameStr)
: wxGenericHyperlinkCtrl(parent, id, label, url, pos, size,
style, name)
{
}
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxHyperlinkCtrl );
};
#endif
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_HYPERLINK wxEVT_HYPERLINK
#endif // wxUSE_HYPERLINKCTRL
#endif // _WX_HYPERLINK_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/numformatter.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/numformatter.h
// Purpose: wxNumberFormatter class
// Author: Fulvio Senore, Vadim Zeitlin
// Created: 2010-11-06
// Copyright: (c) 2010 wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_NUMFORMATTER_H_
#define _WX_NUMFORMATTER_H_
#include "wx/string.h"
// Helper class for formatting numbers with thousands separators which also
// supports parsing the numbers formatted by it.
class WXDLLIMPEXP_BASE wxNumberFormatter
{
public:
// Bit masks for ToString()
enum Style
{
Style_None = 0x00,
Style_WithThousandsSep = 0x01,
Style_NoTrailingZeroes = 0x02 // Only for floating point numbers
};
// Format a number as a string. By default, the thousands separator is
// used, specify Style_None to prevent this. For floating point numbers,
// precision can also be specified.
static wxString ToString(long val,
int style = Style_WithThousandsSep);
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
static wxString ToString(wxLongLong_t val,
int style = Style_WithThousandsSep);
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
static wxString ToString(double val,
int precision,
int style = Style_WithThousandsSep);
// Parse a string representing a number, possibly with thousands separator.
//
// Return true on success and stores the result in the provided location
// which must be a valid non-NULL pointer.
static bool FromString(wxString s, long *val);
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
static bool FromString(wxString s, wxLongLong_t *val);
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
static bool FromString(wxString s, double *val);
// Get the decimal separator for the current locale. It is always defined
// and we fall back to returning '.' in case of an error.
static wxChar GetDecimalSeparator();
// Get the thousands separator if grouping of the digits is used by the
// current locale. The value returned in sep should be only used if the
// function returns true.
static bool GetThousandsSeparatorIfUsed(wxChar *sep);
private:
// Post-process the string representing an integer.
static wxString PostProcessIntString(wxString s, int style);
// Add the thousands separators to a string representing a number without
// the separators. This is used by ToString(Style_WithThousandsSep).
static void AddThousandsSeparators(wxString& s);
// Remove trailing zeroes and, if there is nothing left after it, the
// decimal separator itself from a string representing a floating point
// number. Also used by ToString().
static void RemoveTrailingZeroes(wxString& s);
// Remove all thousands separators from a string representing a number.
static void RemoveThousandsSeparators(wxString& s);
};
#endif // _WX_NUMFORMATTER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/position.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/position.h
// Purpose: Common structure and methods for positional information.
// Author: Vadim Zeitlin, Robin Dunn, Brad Anderson, Bryan Petty
// Created: 2007-03-13
// Copyright: (c) 2007 The wxWidgets Team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_POSITION_H_
#define _WX_POSITION_H_
#include "wx/gdicmn.h"
class WXDLLIMPEXP_CORE wxPosition
{
public:
wxPosition() : m_row(0), m_column(0) {}
wxPosition(int row, int col) : m_row(row), m_column(col) {}
// default copy ctor and assignment operator are okay.
int GetRow() const { return m_row; }
int GetColumn() const { return m_column; }
int GetCol() const { return GetColumn(); }
void SetRow(int row) { m_row = row; }
void SetColumn(int column) { m_column = column; }
void SetCol(int column) { SetColumn(column); }
bool operator==(const wxPosition& p) const
{ return m_row == p.m_row && m_column == p.m_column; }
bool operator!=(const wxPosition& p) const
{ return !(*this == p); }
wxPosition& operator+=(const wxPosition& p)
{ m_row += p.m_row; m_column += p.m_column; return *this; }
wxPosition& operator-=(const wxPosition& p)
{ m_row -= p.m_row; m_column -= p.m_column; return *this; }
wxPosition& operator+=(const wxSize& s)
{ m_row += s.y; m_column += s.x; return *this; }
wxPosition& operator-=(const wxSize& s)
{ m_row -= s.y; m_column -= s.x; return *this; }
wxPosition operator+(const wxPosition& p) const
{ return wxPosition(m_row + p.m_row, m_column + p.m_column); }
wxPosition operator-(const wxPosition& p) const
{ return wxPosition(m_row - p.m_row, m_column - p.m_column); }
wxPosition operator+(const wxSize& s) const
{ return wxPosition(m_row + s.y, m_column + s.x); }
wxPosition operator-(const wxSize& s) const
{ return wxPosition(m_row - s.y, m_column - s.x); }
private:
int m_row;
int m_column;
};
#endif // _WX_POSITION_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/module.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/module.h
// Purpose: Modules handling
// Author: Wolfram Gloger/adapted by Guilhem Lavaux
// Modified by:
// Created: 04/11/98
// Copyright: (c) Wolfram Gloger and Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MODULE_H_
#define _WX_MODULE_H_
#include "wx/object.h"
#include "wx/list.h"
#include "wx/arrstr.h"
#include "wx/dynarray.h"
// declare a linked list of modules
class WXDLLIMPEXP_FWD_BASE wxModule;
WX_DECLARE_USER_EXPORTED_LIST(wxModule, wxModuleList, WXDLLIMPEXP_BASE);
// and an array of class info objects
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxClassInfo *, wxArrayClassInfo,
class WXDLLIMPEXP_BASE);
// declaring a class derived from wxModule will automatically create an
// instance of this class on program startup, call its OnInit() method and call
// OnExit() on program termination (but only if OnInit() succeeded)
class WXDLLIMPEXP_BASE wxModule : public wxObject
{
public:
wxModule() {}
virtual ~wxModule() {}
// if module init routine returns false the application
// will fail to startup
bool Init() { return OnInit(); }
void Exit() { OnExit(); }
// Override both of these
// called on program startup
virtual bool OnInit() = 0;
// called just before program termination, but only if OnInit()
// succeeded
virtual void OnExit() = 0;
static void RegisterModule(wxModule *module);
static void RegisterModules();
static bool InitializeModules();
static void CleanUpModules() { DoCleanUpModules(m_modules); }
// used by wxObjectLoader when unloading shared libs's
static void UnregisterModule(wxModule *module);
protected:
static wxModuleList m_modules;
// the function to call from constructor of a deriving class add module
// dependency which will be initialized before the module and unloaded
// after that
void AddDependency(wxClassInfo *dep)
{
wxCHECK_RET( dep, wxT("NULL module dependency") );
m_dependencies.Add(dep);
}
// same as the version above except it will look up wxClassInfo by name on
// its own
void AddDependency(const char *className)
{
m_namedDependencies.Add(className);
}
private:
// initialize module and Append it to initializedModules list recursively
// calling itself to satisfy module dependencies if needed
static bool
DoInitializeModule(wxModule *module, wxModuleList &initializedModules);
// cleanup the modules in the specified list (which may not contain all
// modules if we're called during initialization because not all modules
// could be initialized) and also empty m_modules itself
static void DoCleanUpModules(const wxModuleList& modules);
// resolve all named dependencies and add them to the normal m_dependencies
bool ResolveNamedDependencies();
// module dependencies: contains wxClassInfo pointers for all modules which
// must be initialized before this one
wxArrayClassInfo m_dependencies;
// and the named dependencies: those will be resolved during run-time and
// added to m_dependencies
wxArrayString m_namedDependencies;
// used internally while initializing/cleaning up modules
enum
{
State_Registered, // module registered but not initialized yet
State_Initializing, // we're initializing this module but not done yet
State_Initialized // module initialized successfully
} m_state;
wxDECLARE_CLASS(wxModule);
};
#endif // _WX_MODULE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dynlib.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/dynlib.h
// Purpose: Dynamic library loading classes
// Author: Guilhem Lavaux, Vadim Zeitlin, Vaclav Slavik
// Modified by:
// Created: 20/07/98
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DYNLIB_H__
#define _WX_DYNLIB_H__
#include "wx/defs.h"
#if wxUSE_DYNLIB_CLASS
#include "wx/string.h"
#include "wx/dynarray.h"
// note that we have our own dlerror() implementation under Darwin
#if defined(HAVE_DLERROR) || defined(__DARWIN__)
#define wxHAVE_DYNLIB_ERROR
#endif
class WXDLLIMPEXP_FWD_BASE wxDynamicLibraryDetailsCreator;
// ----------------------------------------------------------------------------
// conditional compilation
// ----------------------------------------------------------------------------
#if defined(__WINDOWS__)
typedef WXHMODULE wxDllType;
#elif defined(__DARWIN__)
// Don't include dlfcn.h on Darwin, we may be using our own replacements.
typedef void *wxDllType;
#elif defined(HAVE_DLOPEN)
#include <dlfcn.h>
typedef void *wxDllType;
#elif defined(HAVE_SHL_LOAD)
#include <dl.h>
typedef shl_t wxDllType;
#elif defined(__WXMAC__)
#include <CodeFragments.h>
typedef CFragConnectionID wxDllType;
#else
#error "Dynamic Loading classes can't be compiled on this platform, sorry."
#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
enum wxDLFlags
{
wxDL_LAZY = 0x00000001, // resolve undefined symbols at first use
// (only works on some Unix versions)
wxDL_NOW = 0x00000002, // resolve undefined symbols on load
// (default, always the case under Win32)
wxDL_GLOBAL = 0x00000004, // export extern symbols to subsequently
// loaded libs.
wxDL_VERBATIM = 0x00000008, // attempt to load the supplied library
// name without appending the usual dll
// filename extension.
// this flag is obsolete, don't use
wxDL_NOSHARE = 0x00000010, // load new DLL, don't reuse already loaded
// (only for wxPluginManager)
wxDL_QUIET = 0x00000020, // don't log an error if failed to load
// this flag is dangerous, for internal use of wxMSW only, don't use at all
// and especially don't use directly, use wxLoadedDLL instead if you really
// do need it
wxDL_GET_LOADED = 0x00000040, // Win32 only: return handle of already
// loaded DLL or NULL otherwise; Unload()
// should not be called so don't forget to
// Detach() if you use this function
wxDL_DEFAULT = wxDL_NOW // default flags correspond to Win32
};
enum wxDynamicLibraryCategory
{
wxDL_LIBRARY, // standard library
wxDL_MODULE // loadable module/plugin
};
enum wxPluginCategory
{
wxDL_PLUGIN_GUI, // plugin that uses GUI classes
wxDL_PLUGIN_BASE // wxBase-only plugin
};
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
// when loading a function from a DLL you always have to cast the returned
// "void *" pointer to the correct type and, even more annoyingly, you have to
// repeat this type twice if you want to declare and define a function pointer
// all in one line
//
// this macro makes this slightly less painful by allowing you to specify the
// type only once, as the first parameter, and creating a variable of this type
// called "pfn<name>" initialized with the "name" from the "dynlib"
#define wxDYNLIB_FUNCTION(type, name, dynlib) \
type pfn ## name = (type)(dynlib).GetSymbol(wxT(#name))
// a more convenient function replacing wxDYNLIB_FUNCTION above
//
// it uses the convention that the type of the function is its name suffixed
// with "_t" but it doesn't define a variable but just assigns the loaded value
// to it and also allows to pass it the prefix to be used instead of hardcoding
// "pfn" (the prefix can be "m_" or "gs_pfn" or whatever)
//
// notice that this function doesn't generate error messages if the symbol
// couldn't be loaded, the caller should generate the appropriate message
#define wxDL_INIT_FUNC(pfx, name, dynlib) \
pfx ## name = (name ## _t)(dynlib).RawGetSymbol(#name)
#ifdef __WINDOWS__
// same as wxDL_INIT_FUNC() but appends 'A' or 'W' to the function name, see
// wxDynamicLibrary::GetSymbolAorW()
#define wxDL_INIT_FUNC_AW(pfx, name, dynlib) \
pfx ## name = (name ## _t)(dynlib).GetSymbolAorW(#name)
#endif // __WINDOWS__
// the following macros can be used to redirect a whole library to a class and
// check at run-time if the library is present and contains all required
// methods
//
// notice that they are supposed to be used inside a class which has "m_ok"
// member variable indicating if the library had been successfully loaded
// helper macros constructing the name of the variable storing the function
// pointer and the name of its type from the function name
#define wxDL_METHOD_NAME(name) m_pfn ## name
#define wxDL_METHOD_TYPE(name) name ## _t
// parameters are:
// - rettype: return type of the function, e.g. "int"
// - name: name of the function, e.g. "foo"
// - args: function signature in parentheses, e.g. "(int x, int y)"
// - argnames: the names of the parameters in parentheses, e.g. "(x, y)"
// - defret: the value to return if the library wasn't successfully loaded
#define wxDL_METHOD_DEFINE( rettype, name, args, argnames, defret ) \
typedef rettype (* wxDL_METHOD_TYPE(name)) args ; \
wxDL_METHOD_TYPE(name) wxDL_METHOD_NAME(name); \
rettype name args \
{ return m_ok ? wxDL_METHOD_NAME(name) argnames : defret; }
#define wxDL_VOIDMETHOD_DEFINE( name, args, argnames ) \
typedef void (* wxDL_METHOD_TYPE(name)) args ; \
wxDL_METHOD_TYPE(name) wxDL_METHOD_NAME(name); \
void name args \
{ if ( m_ok ) wxDL_METHOD_NAME(name) argnames ; }
#define wxDL_METHOD_LOAD(lib, name) \
wxDL_METHOD_NAME(name) = \
(wxDL_METHOD_TYPE(name)) lib.GetSymbol(#name, &m_ok); \
if ( !m_ok ) return false
// ----------------------------------------------------------------------------
// wxDynamicLibraryDetails: contains details about a loaded wxDynamicLibrary
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxDynamicLibraryDetails
{
public:
// ctor, normally never used as these objects are only created by
// wxDynamicLibrary::ListLoaded()
wxDynamicLibraryDetails() { m_address = NULL; m_length = 0; }
// get the (base) name
wxString GetName() const { return m_name; }
// get the full path of this object
wxString GetPath() const { return m_path; }
// get the load address and the extent, return true if this information is
// available
bool GetAddress(void **addr, size_t *len) const
{
if ( !m_address )
return false;
if ( addr )
*addr = m_address;
if ( len )
*len = m_length;
return true;
}
// return the version of the DLL (may be empty if no version info)
wxString GetVersion() const
{
return m_version;
}
private:
wxString m_name,
m_path,
m_version;
void *m_address;
size_t m_length;
friend class wxDynamicLibraryDetailsCreator;
};
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetails,
wxDynamicLibraryDetailsArray,
WXDLLIMPEXP_BASE);
// ----------------------------------------------------------------------------
// wxDynamicLibrary: represents a handle to a DLL/shared object
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxDynamicLibrary
{
public:
// return a valid handle for the main program itself or NULL if back
// linking is not supported by the current platform (e.g. Win32)
static wxDllType GetProgramHandle();
// return the platform standard DLL extension (with leading dot)
static wxString GetDllExt(wxDynamicLibraryCategory cat = wxDL_LIBRARY);
wxDynamicLibrary() : m_handle(0) { }
wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT)
: m_handle(0)
{
Load(libname, flags);
}
// NOTE: this class is (deliberately) not virtual, do not attempt
// to use it polymorphically.
~wxDynamicLibrary() { Unload(); }
// return true if the library was loaded successfully
bool IsLoaded() const { return m_handle != 0; }
// load the library with the given name (full or not), return true if ok
bool Load(const wxString& libname, int flags = wxDL_DEFAULT);
// raw function for loading dynamic libs: always behaves as if
// wxDL_VERBATIM were specified and doesn't log error message if the
// library couldn't be loaded but simply returns NULL
static wxDllType RawLoad(const wxString& libname, int flags = wxDL_DEFAULT);
// detach the library object from its handle, i.e. prevent the object from
// unloading the library in its dtor -- the caller is now responsible for
// doing this
wxDllType Detach() { wxDllType h = m_handle; m_handle = 0; return h; }
// unload the given library handle (presumably returned by Detach() before)
static void Unload(wxDllType handle);
// unload the library, also done automatically in dtor
void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = 0; } }
// Return the raw handle from dlopen and friends.
wxDllType GetLibHandle() const { return m_handle; }
// check if the given symbol is present in the library, useful to verify if
// a loadable module is our plugin, for example, without provoking error
// messages from GetSymbol()
bool HasSymbol(const wxString& name) const
{
bool ok;
DoGetSymbol(name, &ok);
return ok;
}
// resolve a symbol in a loaded DLL, such as a variable or function name.
// 'name' is the (possibly mangled) name of the symbol. (use extern "C" to
// export unmangled names)
//
// Since it is perfectly valid for the returned symbol to actually be NULL,
// that is not always indication of an error. Pass and test the parameter
// 'success' for a true indication of success or failure to load the
// symbol.
//
// Returns a pointer to the symbol on success, or NULL if an error occurred
// or the symbol wasn't found.
void *GetSymbol(const wxString& name, bool *success = NULL) const;
// low-level version of GetSymbol()
static void *RawGetSymbol(wxDllType handle, const wxString& name);
void *RawGetSymbol(const wxString& name) const
{
return RawGetSymbol(m_handle, name);
}
#ifdef __WINDOWS__
// this function is useful for loading functions from the standard Windows
// DLLs: such functions have an 'A' (in ANSI build) or 'W' (in Unicode, or
// wide character build) suffix if they take string parameters
static void *RawGetSymbolAorW(wxDllType handle, const wxString& name)
{
return RawGetSymbol
(
handle,
name +
#if wxUSE_UNICODE
L'W'
#else
'A'
#endif
);
}
void *GetSymbolAorW(const wxString& name) const
{
return RawGetSymbolAorW(m_handle, name);
}
#endif // __WINDOWS__
// return all modules/shared libraries in the address space of this process
//
// returns an empty array if not implemented or an error occurred
static wxDynamicLibraryDetailsArray ListLoaded();
// return platform-specific name of dynamic library with proper extension
// and prefix (e.g. "foo.dll" on Windows or "libfoo.so" on Linux)
static wxString CanonicalizeName(const wxString& name,
wxDynamicLibraryCategory cat = wxDL_LIBRARY);
// return name of wxWidgets plugin (adds compiler and version info
// to the filename):
static wxString
CanonicalizePluginName(const wxString& name,
wxPluginCategory cat = wxDL_PLUGIN_GUI);
// return plugin directory on platforms where it makes sense and empty
// string on others:
static wxString GetPluginsDirectory();
// Return the load address of the module containing the given address or
// NULL if not found.
//
// If path output parameter is non-NULL, fill it with the full path to this
// module disk file on success.
static void* GetModuleFromAddress(const void* addr, wxString* path = NULL);
#ifdef __WINDOWS__
// return the handle (HMODULE/HINSTANCE) of the DLL with the given name
// and/or containing the specified address: for XP and later systems only
// the address is used and the name is ignored but for the previous systems
// only the name (which may be either a full path to the DLL or just its
// base name, possibly even without extension) is used
//
// the returned handle reference count is not incremented so it doesn't
// need to be freed using FreeLibrary() but it also means that it can
// become invalid if the DLL is unloaded
static WXHMODULE MSWGetModuleHandle(const wxString& name, void *addr);
#endif // __WINDOWS__
protected:
// common part of GetSymbol() and HasSymbol()
void *DoGetSymbol(const wxString& name, bool *success = 0) const;
#ifdef wxHAVE_DYNLIB_ERROR
// log the error after a dlxxx() function failure
static void Error();
#endif // wxHAVE_DYNLIB_ERROR
// the handle to DLL or NULL
wxDllType m_handle;
// no copy ctor/assignment operators (or we'd try to unload the library
// twice)
wxDECLARE_NO_COPY_CLASS(wxDynamicLibrary);
};
#ifdef __WINDOWS__
// ----------------------------------------------------------------------------
// wxLoadedDLL is a MSW-only internal helper class allowing to dynamically bind
// to a DLL already loaded into the project address space
// ----------------------------------------------------------------------------
class wxLoadedDLL : public wxDynamicLibrary
{
public:
wxLoadedDLL(const wxString& dllname)
: wxDynamicLibrary(dllname, wxDL_GET_LOADED | wxDL_VERBATIM | wxDL_QUIET)
{
}
~wxLoadedDLL()
{
Detach();
}
};
#endif // __WINDOWS__
// ----------------------------------------------------------------------------
// Interesting defines
// ----------------------------------------------------------------------------
#define WXDLL_ENTRY_FUNCTION() \
extern "C" WXEXPORT const wxClassInfo *wxGetClassFirst(); \
const wxClassInfo *wxGetClassFirst() { \
return wxClassInfo::GetFirst(); \
}
#endif // wxUSE_DYNLIB_CLASS
#endif // _WX_DYNLIB_H__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/propdlg.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/propdlg.h
// Purpose: wxPropertySheetDialog base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PROPDLG_H_BASE_
#define _WX_PROPDLG_H_BASE_
#include "wx/generic/propdlg.h"
#endif
// _WX_PROPDLG_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/fileconf.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/fileconf.h
// Purpose: wxFileConfig derivation of wxConfigBase
// Author: Vadim Zeitlin
// Modified by:
// Created: 07.04.98 (adapted from appconf.cpp)
// Copyright: (c) 1997 Karsten Ballueder & Vadim Zeitlin
// [email protected] <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _FILECONF_H
#define _FILECONF_H
#include "wx/defs.h"
#if wxUSE_CONFIG
#include "wx/textfile.h"
#include "wx/string.h"
#include "wx/confbase.h"
#include "wx/filename.h"
// ----------------------------------------------------------------------------
// wxFileConfig
// ----------------------------------------------------------------------------
/*
wxFileConfig derives from base Config and implements file based config class,
i.e. it uses ASCII disk files to store the information. These files are
alternatively called INI, .conf or .rc in the documentation. They are
organized in groups or sections, which can nest (i.e. a group contains
subgroups, which contain their own subgroups &c). Each group has some
number of entries, which are "key = value" pairs. More precisely, the format
is:
# comments are allowed after either ';' or '#' (Win/UNIX standard)
# blank lines (as above) are ignored
# global entries are members of special (no name) top group
written_for = Windows
platform = Linux
# the start of the group 'Foo'
[Foo] # may put comments like this also
# following 3 lines are entries
key = value
another_key = " strings with spaces in the beginning should be quoted, \
otherwise the spaces are lost"
last_key = but you don't have to put " normally (nor quote them, like here)
# subgroup of the group 'Foo'
# (order is not important, only the name is: separator is '/', as in paths)
[Foo/Bar]
# entries prefixed with "!" are immutable, i.e. can't be changed if they are
# set in the system-wide config file
!special_key = value
bar_entry = whatever
[Foo/Bar/Fubar] # depth is (theoretically :-) unlimited
# may have the same name as key in another section
bar_entry = whatever not
You have {read/write/delete}Entry functions (guess what they do) and also
setCurrentPath to select current group. enum{Subgroups/Entries} allow you
to get all entries in the config file (in the current group). Finally,
flush() writes immediately all changed entries to disk (otherwise it would
be done automatically in dtor)
wxFileConfig manages not less than 2 config files for each program: global
and local (or system and user if you prefer). Entries are read from both of
them and the local entries override the global ones unless the latter is
immutable (prefixed with '!') in which case a warning message is generated
and local value is ignored. Of course, the changes are always written to local
file only.
The names of these files can be specified in a number of ways. First of all,
you can use the standard convention: using the ctor which takes 'strAppName'
parameter will probably be sufficient for 90% of cases. If, for whatever
reason you wish to use the files with some other names, you can always use the
second ctor.
wxFileConfig also may automatically expand the values of environment variables
in the entries it reads: for example, if you have an entry
score_file = $HOME/.score
a call to Read(&str, "score_file") will return a complete path to .score file
unless the expansion was previously disabled with SetExpandEnvVars(false) call
(it's on by default, the current status can be retrieved with
IsExpandingEnvVars function).
*/
class WXDLLIMPEXP_FWD_BASE wxFileConfigGroup;
class WXDLLIMPEXP_FWD_BASE wxFileConfigEntry;
class WXDLLIMPEXP_FWD_BASE wxFileConfigLineList;
#if wxUSE_STREAMS
class WXDLLIMPEXP_FWD_BASE wxInputStream;
class WXDLLIMPEXP_FWD_BASE wxOutputStream;
#endif // wxUSE_STREAMS
class WXDLLIMPEXP_BASE wxFileConfig : public wxConfigBase
{
public:
// construct the "standard" full name for global (system-wide) and
// local (user-specific) config files from the base file name.
//
// the following are the filenames returned by this functions:
// global local
// Unix /etc/file.ext ~/.file
// Win %windir%\file.ext %USERPROFILE%\file.ext
//
// where file is the basename of szFile, ext is its extension
// or .conf (Unix) or .ini (Win) if it has none
static wxFileName GetGlobalFile(const wxString& szFile);
static wxFileName GetLocalFile(const wxString& szFile, int style = 0);
static wxString GetGlobalFileName(const wxString& szFile)
{
return GetGlobalFile(szFile).GetFullPath();
}
static wxString GetLocalFileName(const wxString& szFile, int style = 0)
{
return GetLocalFile(szFile, style).GetFullPath();
}
// ctor & dtor
// New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or
// wxCONFIG_USE_GLOBAL_FILE to say which files should be used.
wxFileConfig(const wxString& appName = wxEmptyString,
const wxString& vendorName = wxEmptyString,
const wxString& localFilename = wxEmptyString,
const wxString& globalFilename = wxEmptyString,
long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE,
const wxMBConv& conv = wxConvAuto());
#if wxUSE_STREAMS
// ctor that takes an input stream.
wxFileConfig(wxInputStream &inStream, const wxMBConv& conv = wxConvAuto());
#endif // wxUSE_STREAMS
// dtor will save unsaved data
virtual ~wxFileConfig();
// under Unix, set the umask to be used for the file creation, do nothing
// under other systems
#ifdef __UNIX__
void SetUmask(int mode) { m_umask = mode; }
#else // !__UNIX__
void SetUmask(int WXUNUSED(mode)) { }
#endif // __UNIX__/!__UNIX__
// implement inherited pure virtual functions
virtual void SetPath(const wxString& strPath) wxOVERRIDE;
virtual const wxString& GetPath() const wxOVERRIDE;
virtual bool GetFirstGroup(wxString& str, long& lIndex) const wxOVERRIDE;
virtual bool GetNextGroup (wxString& str, long& lIndex) const wxOVERRIDE;
virtual bool GetFirstEntry(wxString& str, long& lIndex) const wxOVERRIDE;
virtual bool GetNextEntry (wxString& str, long& lIndex) const wxOVERRIDE;
virtual size_t GetNumberOfEntries(bool bRecursive = false) const wxOVERRIDE;
virtual size_t GetNumberOfGroups(bool bRecursive = false) const wxOVERRIDE;
virtual bool HasGroup(const wxString& strName) const wxOVERRIDE;
virtual bool HasEntry(const wxString& strName) const wxOVERRIDE;
virtual bool Flush(bool bCurrentOnly = false) wxOVERRIDE;
virtual bool RenameEntry(const wxString& oldName, const wxString& newName) wxOVERRIDE;
virtual bool RenameGroup(const wxString& oldName, const wxString& newName) wxOVERRIDE;
virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true) wxOVERRIDE;
virtual bool DeleteGroup(const wxString& szKey) wxOVERRIDE;
virtual bool DeleteAll() wxOVERRIDE;
// additional, wxFileConfig-specific, functionality
#if wxUSE_STREAMS
// save the entire config file text to the given stream, note that the text
// won't be saved again in dtor when Flush() is called if you use this method
// as it won't be "changed" any more
virtual bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto());
#endif // wxUSE_STREAMS
public:
// functions to work with this list
wxFileConfigLineList *LineListAppend(const wxString& str);
wxFileConfigLineList *LineListInsert(const wxString& str,
wxFileConfigLineList *pLine); // NULL => Prepend()
void LineListRemove(wxFileConfigLineList *pLine);
bool LineListIsEmpty();
protected:
virtual bool DoReadString(const wxString& key, wxString *pStr) const wxOVERRIDE;
virtual bool DoReadLong(const wxString& key, long *pl) const wxOVERRIDE;
#if wxUSE_BASE64
virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const wxOVERRIDE;
#endif // wxUSE_BASE64
virtual bool DoWriteString(const wxString& key, const wxString& szValue) wxOVERRIDE;
virtual bool DoWriteLong(const wxString& key, long lValue) wxOVERRIDE;
#if wxUSE_BASE64
virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf) wxOVERRIDE;
#endif // wxUSE_BASE64
private:
// GetXXXFileName helpers: return ('/' terminated) directory names
static wxString GetGlobalDir();
static wxString GetLocalDir(int style = 0);
// common part of all ctors (assumes that m_str{Local|Global}File are already
// initialized
void Init();
// common part of from dtor and DeleteAll
void CleanUp();
// parse the whole file
void Parse(const wxTextBuffer& buffer, bool bLocal);
// the same as SetPath("/")
void SetRootPath();
// real SetPath() implementation, returns true if path could be set or false
// if path doesn't exist and createMissingComponents == false
bool DoSetPath(const wxString& strPath, bool createMissingComponents);
// set/test the dirty flag
void SetDirty() { m_isDirty = true; }
void ResetDirty() { m_isDirty = false; }
bool IsDirty() const { return m_isDirty; }
// member variables
// ----------------
wxFileConfigLineList *m_linesHead, // head of the linked list
*m_linesTail; // tail
wxFileName m_fnLocalFile, // local file name passed to ctor
m_fnGlobalFile; // global
wxString m_strPath; // current path (not '/' terminated)
wxFileConfigGroup *m_pRootGroup, // the top (unnamed) group
*m_pCurrentGroup; // the current group
wxMBConv *m_conv;
#ifdef __UNIX__
int m_umask; // the umask to use for file creation
#endif // __UNIX__
bool m_isDirty; // if true, we have unsaved changes
wxDECLARE_NO_COPY_CLASS(wxFileConfig);
wxDECLARE_ABSTRACT_CLASS(wxFileConfig);
};
#endif
// wxUSE_CONFIG
#endif
//_FILECONF_H
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/beforestd.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/beforestd.h
// Purpose: #include before STL headers
// Author: Vadim Zeitlin
// Modified by:
// Created: 07/07/03
// Copyright: (c) 2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/**
Unfortunately, when compiling at maximum warning level, the standard
headers themselves may generate warnings -- and really lots of them. So
before including them, this header should be included to temporarily
suppress the warnings and after this the header afterstd.h should be
included to enable them back again.
Note that there are intentionally no inclusion guards in this file, because
it can be included several times.
*/
// VC 7.x isn't as bad as VC6 and doesn't give these warnings but eVC (which
// defines _MSC_VER as 1201) does need to be included as it's VC6-like
#if defined(__VISUALC__) && __VISUALC__ <= 1201
// these warning have to be disabled and not just temporarily disabled
// because they will be given at the end of the compilation of the
// current source and there is absolutely nothing we can do about them so
// disable them before warning(push) below
// 'foo': unreferenced inline function has been removed
#pragma warning(disable:4514)
// 'function' : function not inlined
#pragma warning(disable:4710)
// 'id': identifier was truncated to 'num' characters in the debug info
#pragma warning(disable:4786)
// we have to disable (and reenable in afterstd.h) this one because,
// even though it is of level 4, it is not disabled by warning(push, 1)
// below for VC7.1!
// unreachable code
#pragma warning(disable:4702)
#pragma warning(push, 1)
#endif // VC++ < 7
/**
GCC's visibility support is broken for libstdc++ in some older versions
(namely Debian/Ubuntu's GCC 4.1, see
https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/109262). We fix it
here by mimicking newer versions' behaviour of using default visibility
for libstdc++ code.
*/
#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY)
#pragma GCC visibility push(default)
#endif
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/stdpaths.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/stdpaths.h
// Purpose: declaration of wxStandardPaths class
// Author: Vadim Zeitlin
// Modified by:
// Created: 2004-10-17
// Copyright: (c) 2004 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STDPATHS_H_
#define _WX_STDPATHS_H_
#include "wx/defs.h"
#include "wx/string.h"
#include "wx/filefn.h"
class WXDLLIMPEXP_FWD_BASE wxStandardPaths;
// ----------------------------------------------------------------------------
// wxStandardPaths returns the standard locations in the file system
// ----------------------------------------------------------------------------
// NB: This is always compiled in, wxUSE_STDPATHS=0 only disables native
// wxStandardPaths class, but a minimal version is always available
class WXDLLIMPEXP_BASE wxStandardPathsBase
{
public:
// possible resources categories
enum ResourceCat
{
// no special category
ResourceCat_None,
// message catalog resources
ResourceCat_Messages,
// end of enum marker
ResourceCat_Max
};
// what should we use to construct paths unique to this application:
// (AppInfo_AppName and AppInfo_VendorName can be combined together)
enum
{
AppInfo_None = 0, // nothing
AppInfo_AppName = 1, // the application name
AppInfo_VendorName = 2 // the vendor name
};
enum Dir
{
Dir_Cache,
Dir_Documents,
Dir_Desktop,
Dir_Downloads,
Dir_Music,
Dir_Pictures,
Dir_Videos
};
// Layout to use for user config/data files under Unix.
enum FileLayout
{
FileLayout_Classic, // Default: use home directory.
FileLayout_XDG // Recommended: use XDG specification.
};
// Naming convention for the config files under Unix.
enum ConfigFileConv
{
ConfigFileConv_Dot, // Classic Unix dot-file convention.
ConfigFileConv_Ext // Use .conf extension.
};
// return the global standard paths object
static wxStandardPaths& Get();
// return the path (directory+filename) of the running executable or
// wxEmptyString if it couldn't be determined.
// The path is returned as an absolute path whenever possible.
// Default implementation only try to use wxApp->argv[0].
virtual wxString GetExecutablePath() const;
// return the directory with system config files:
// /etc under Unix, c:\Documents and Settings\All Users\Application Data
// under Windows, /Library/Preferences for Mac
virtual wxString GetConfigDir() const = 0;
// return the directory for the user config files:
// $HOME under Unix, c:\Documents and Settings\username under Windows,
// ~/Library/Preferences under Mac
//
// only use this if you have a single file to put there, otherwise
// GetUserDataDir() is more appropriate
virtual wxString GetUserConfigDir() const = 0;
// return the location of the applications global, i.e. not user-specific,
// data files
//
// prefix/share/appname under Unix, c:\Program Files\appname under Windows,
// appname.app/Contents/SharedSupport app bundle directory under Mac
virtual wxString GetDataDir() const = 0;
// return the location for application data files which are host-specific
//
// same as GetDataDir() except under Unix where it is /etc/appname
virtual wxString GetLocalDataDir() const;
// return the directory for the user-dependent application data files
//
// $HOME/.appname under Unix,
// c:\Documents and Settings\username\Application Data\appname under Windows
// and ~/Library/Application Support/appname under Mac
virtual wxString GetUserDataDir() const = 0;
// return the directory for user data files which shouldn't be shared with
// the other machines
//
// same as GetUserDataDir() for all platforms except Windows where it is
// the "Local Settings\Application Data\appname" directory
virtual wxString GetUserLocalDataDir() const;
// return the directory where the loadable modules (plugins) live
//
// prefix/lib/appname under Unix, program directory under Windows and
// Contents/Plugins app bundle subdirectory under Mac
virtual wxString GetPluginsDir() const = 0;
// get resources directory: resources are auxiliary files used by the
// application and include things like image and sound files
//
// same as GetDataDir() for all platforms except Mac where it returns
// Contents/Resources subdirectory of the app bundle
virtual wxString GetResourcesDir() const { return GetDataDir(); }
// get localized resources directory containing the resource files of the
// specified category for the given language
//
// in general this is just GetResourcesDir()/lang under Windows and Unix
// and GetResourcesDir()/lang.lproj under Mac but is something quite
// different under Unix for message catalog category (namely the standard
// prefix/share/locale/lang/LC_MESSAGES)
virtual wxString
GetLocalizedResourcesDir(const wxString& lang,
ResourceCat WXUNUSED(category)
= ResourceCat_None) const
{
return GetResourcesDir() + wxFILE_SEP_PATH + lang;
}
// return the "Documents" directory for the current user
//
// C:\Documents and Settings\username\My Documents under Windows,
// $HOME under Unix and ~/Documents under Mac
virtual wxString GetDocumentsDir() const
{
return GetUserDir(Dir_Documents);
}
// return the directory for the documents files used by this application:
// it's a subdirectory of GetDocumentsDir() constructed using the
// application name/vendor if it exists or just GetDocumentsDir() otherwise
virtual wxString GetAppDocumentsDir() const;
// return the temporary directory for the current user
virtual wxString GetTempDir() const;
virtual wxString GetUserDir(Dir userDir) const;
virtual wxString
MakeConfigFileName(const wxString& basename,
ConfigFileConv conv = ConfigFileConv_Ext) const = 0;
// virtual dtor for the base class
virtual ~wxStandardPathsBase();
// Information used by AppendAppInfo
void UseAppInfo(int info)
{
m_usedAppInfo = info;
}
bool UsesAppInfo(int info) const { return (m_usedAppInfo & info) != 0; }
void SetFileLayout(FileLayout layout)
{
m_fileLayout = layout;
}
FileLayout GetFileLayout() const
{
return m_fileLayout;
}
protected:
// Ctor is protected as this is a base class which should never be created
// directly.
wxStandardPathsBase();
// append the path component, with a leading path separator if a
// path separator or dot (.) is not already at the end of dir
static wxString AppendPathComponent(const wxString& dir, const wxString& component);
// append application information determined by m_usedAppInfo to dir
wxString AppendAppInfo(const wxString& dir) const;
// combination of AppInfo_XXX flags used by AppendAppInfo()
int m_usedAppInfo;
// The file layout to use, currently only used under Unix.
FileLayout m_fileLayout;
};
#if wxUSE_STDPATHS
#if defined(__WINDOWS__)
#include "wx/msw/stdpaths.h"
#define wxHAS_NATIVE_STDPATHS
#elif defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__) || defined(__DARWIN__)
#include "wx/osx/cocoa/stdpaths.h"
#define wxHAS_NATIVE_STDPATHS
#elif defined(__UNIX__)
#include "wx/unix/stdpaths.h"
#define wxHAS_NATIVE_STDPATHS
#define wxHAS_STDPATHS_INSTALL_PREFIX
#endif
#endif
// ----------------------------------------------------------------------------
// Minimal generic implementation
// ----------------------------------------------------------------------------
// NB: Note that this minimal implementation is compiled in even if
// wxUSE_STDPATHS=0, so that our code can still use wxStandardPaths.
#ifndef wxHAS_NATIVE_STDPATHS
#define wxHAS_STDPATHS_INSTALL_PREFIX
class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase
{
public:
void SetInstallPrefix(const wxString& prefix) { m_prefix = prefix; }
wxString GetInstallPrefix() const { return m_prefix; }
virtual wxString GetExecutablePath() const { return m_prefix; }
virtual wxString GetConfigDir() const { return m_prefix; }
virtual wxString GetUserConfigDir() const { return m_prefix; }
virtual wxString GetDataDir() const { return m_prefix; }
virtual wxString GetLocalDataDir() const { return m_prefix; }
virtual wxString GetUserDataDir() const { return m_prefix; }
virtual wxString GetPluginsDir() const { return m_prefix; }
virtual wxString GetUserDir(Dir WXUNUSED(userDir)) const { return m_prefix; }
virtual wxString
MakeConfigFileName(const wxString& basename,
ConfigFileConv WXUNUSED(conv) = ConfigFileConv_Ext) const
{
return m_prefix + wxS("/") + basename;
}
protected:
// Ctor is protected because wxStandardPaths::Get() should always be used
// to access the global wxStandardPaths object of the correct type instead
// of creating one of a possibly wrong type yourself.
wxStandardPaths() { }
private:
wxString m_prefix;
};
#endif // !wxHAS_NATIVE_STDPATHS
#endif // _WX_STDPATHS_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/defs.h | /*
* Name: wx/defs.h
* Purpose: Declarations/definitions common to all wx source files
* Author: Julian Smart and others
* Modified by: Ryan Norton (Converted to C)
* Created: 01/02/97
* Copyright: (c) Julian Smart
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
/*
We want to avoid compilation and, even more perniciously, link errors if
the user code includes <windows.h> before include wxWidgets headers. These
error happen because <windows.h> #define's many common symbols, such as
Yield or GetClassInfo, which are also used in wxWidgets API. Including our
"cleanup" header below un-#defines them to fix this.
Moreover, notice that it is also possible for the user code to include some
wx header (this including wx/defs.h), then include <windows.h> and then
include another wx header. To avoid the problem for the second header
inclusion, we must include wx/msw/winundef.h from here always and not just
during the first inclusion, so it has to be outside of _WX_DEFS_H_ guard
check below.
*/
#ifdef __cplusplus
/*
Test for _WINDOWS_, used as header guard by windows.h itself, not our
own __WINDOWS__, which is not defined yet.
*/
# ifdef _WINDOWS_
# include "wx/msw/winundef.h"
# endif /* WIN32 */
#endif /* __cplusplus */
#ifndef _WX_DEFS_H_
#define _WX_DEFS_H_
/* ---------------------------------------------------------------------------- */
/* compiler and OS identification */
/* ---------------------------------------------------------------------------- */
#include "wx/platform.h"
#ifdef __cplusplus
/* Make sure the environment is set correctly */
# if defined(__WXMSW__) && defined(__X__)
# error "Target can't be both X and MSW"
# elif !defined(__WXMOTIF__) && \
!defined(__WXMSW__) && \
!defined(__WXGTK__) && \
!defined(__WXOSX_COCOA__) && \
!defined(__WXOSX_IPHONE__) && \
!defined(__X__) && \
!defined(__WXDFB__) && \
!defined(__WXX11__) && \
!defined(__WXQT__) && \
wxUSE_GUI
# ifdef __UNIX__
# error "No Target! You should use wx-config program for compilation flags!"
# else /* !Unix */
# error "No Target! You should use supplied makefiles for compilation!"
# endif /* Unix/!Unix */
# endif
#endif /*__cplusplus*/
#ifndef __WXWINDOWS__
#define __WXWINDOWS__ 1
#endif
#ifndef wxUSE_BASE
/* by default consider that this is a monolithic build */
#define wxUSE_BASE 1
#endif
#if !wxUSE_GUI && !defined(__WXBASE__)
#define __WXBASE__
#endif
/* suppress some Visual C++ warnings */
#ifdef __VISUALC__
/* the only "real" warning here is 4244 but there are just too many of them */
/* in our code... one day someone should go and fix them but until then... */
# pragma warning(disable:4097) /* typedef used as class */
# pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union */
# pragma warning(disable:4244) /* conversion from double to float */
# pragma warning(disable:4355) /* 'this' used in base member initializer list */
# pragma warning(disable:4511) /* copy ctor couldn't be generated */
# pragma warning(disable:4512) /* operator=() couldn't be generated */
# pragma warning(disable:4514) /* unreferenced inline func has been removed */
# pragma warning(disable:4710) /* function not inlined */
/*
TODO: this warning should really be enabled as it can be genuinely
useful, check where does it occur in wxWidgets
*/
#pragma warning(disable: 4127) /* conditional expression is constant */
/* There are too many false positivies for this one, particularly when
using templates like wxVector<T> */
/* class 'foo' needs to have dll-interface to be used by clients of
class 'bar'" */
# pragma warning(disable:4251)
/*
This is a similar warning which occurs when deriving from standard
containers. MSDN even mentions that it can be ignored in this case
(albeit only in debug build while the warning is the same in release
too and seems equally harmless).
*/
#if wxUSE_STD_CONTAINERS
# pragma warning(disable:4275)
#endif /* wxUSE_STD_CONTAINERS */
# ifdef __VISUALC5__
/* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */
/* is buggy, and occurs for code that does actually get executed */
# ifndef __WXDEBUG__
# pragma warning(disable:4702) /* unreachable code */
# endif
/* The VC++ 5.0 warning 'C4003: not enough actual parameters for macro'
* is incompatible with the wxWidgets headers since it is given when
* parameters are empty but not missing. */
# pragma warning(disable:4003) /* not enough actual parameters for macro */
# endif
/*
When compiling with VC++ 7 /Wp64 option we get thousands of warnings for
conversion from size_t to int or long. Some precious few of them might
be worth looking into but unfortunately it seems infeasible to fix all
the other, harmless ones (e.g. inserting static_cast<int>(s.length())
everywhere this method is used though we are quite sure that using >4GB
strings is a bad idea anyhow) so just disable it globally for now.
*/
#if wxCHECK_VISUALC_VERSION(7)
/* conversion from 'size_t' to 'unsigned long', possible loss of data */
#pragma warning(disable:4267)
#endif /* VC++ 7 or later */
/*
VC++ 8 gives a warning when using standard functions such as sprintf,
localtime, ... -- stop this madness, unless the user had already done it
*/
#if wxCHECK_VISUALC_VERSION(8)
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#ifndef _CRT_NON_CONFORMING_SWPRINTFS
#define _CRT_NON_CONFORMING_SWPRINTFS 1
#endif
#ifndef _SCL_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS 1
#endif
#endif /* VC++ 8 */
#endif /* __VISUALC__ */
/* suppress some Borland C++ warnings */
#ifdef __BORLANDC__
# pragma warn -inl /* Functions containing reserved words and certain constructs are not expanded inline */
#endif /* __BORLANDC__ */
/*
g++ gives a warning when a class has private dtor if it has no friends but
this is a perfectly valid situation for a ref-counted class which destroys
itself when its ref count drops to 0, so provide a macro to suppress this
warning
*/
#ifdef __GNUG__
# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) \
friend class wxDummyFriendFor ## name;
#else /* !g++ */
# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name)
#endif
/*
Clang Support
*/
#ifndef WX_HAS_CLANG_FEATURE
# ifndef __has_feature
# define WX_HAS_CLANG_FEATURE(x) 0
# else
# define WX_HAS_CLANG_FEATURE(x) __has_feature(x)
# endif
#endif
/* ---------------------------------------------------------------------------- */
/* wxWidgets version and compatibility defines */
/* ---------------------------------------------------------------------------- */
#include "wx/version.h"
/* ============================================================================ */
/* non portable C++ features */
/* ============================================================================ */
/* ---------------------------------------------------------------------------- */
/* compiler defects workarounds */
/* ---------------------------------------------------------------------------- */
/*
Digital Unix C++ compiler only defines this symbol for .cxx and .hxx files,
so define it ourselves (newer versions do it for all files, though, and
don't allow it to be redefined)
*/
#if defined(__DECCXX) && !defined(__VMS) && !defined(__cplusplus)
#define __cplusplus
#endif /* __DECCXX */
/* Resolves linking problems under HP-UX when compiling with gcc/g++ */
#if defined(__HPUX__) && defined(__GNUG__)
#define va_list __gnuc_va_list
#endif /* HP-UX */
/* Prevents conflicts between sys/types.h and winsock.h with Cygwin, */
/* when using Windows sockets. */
#if defined(__CYGWIN__) && defined(__WINDOWS__)
#define __USE_W32_SOCKETS
#endif
/* ---------------------------------------------------------------------------- */
/* check for native bool type and TRUE/FALSE constants */
/* ---------------------------------------------------------------------------- */
/* for backwards compatibility, also define TRUE and FALSE */
/* */
/* note that these definitions should work both in C++ and C code, so don't */
/* use true/false below */
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
typedef short int WXTYPE;
/* ---------------------------------------------------------------------------- */
/* other feature tests */
/* ---------------------------------------------------------------------------- */
#ifdef __cplusplus
/* Every ride down a slippery slope begins with a single step.. */
/* */
/* Yes, using nested classes is indeed against our coding standards in */
/* general, but there are places where you can use them to advantage */
/* without totally breaking ports that cannot use them. If you do, then */
/* wrap it in this guard, but such cases should still be relatively rare. */
#define wxUSE_NESTED_CLASSES 1
/* This macro is obsolete, use the 'explicit' keyword in the new code. */
#define wxEXPLICIT explicit
/* check for override keyword support */
#ifndef HAVE_OVERRIDE
#if __cplusplus >= 201103L
/* All C++11 compilers should have it. */
#define HAVE_OVERRIDE
#elif wxCHECK_VISUALC_VERSION(11)
/*
VC++ supports override keyword since version 8 but doesn't define
__cplusplus as indicating C++11 support (at least up to and
including 12), so handle its case specially.
Also note that while the keyword is supported, using it with
versions 8, 9 and 10 results in C4481 compiler warning ("nonstandard
extension used") and so we avoid using it there, you could disable
this warning and predefine HAVE_OVERRIDE if you don't care about it.
*/
#define HAVE_OVERRIDE
#elif WX_HAS_CLANG_FEATURE(cxx_override_control)
#define HAVE_OVERRIDE
#endif
#endif /* !HAVE_OVERRIDE */
#ifdef HAVE_OVERRIDE
#define wxOVERRIDE override
#else /* !HAVE_OVERRIDE */
#define wxOVERRIDE
#endif /* HAVE_OVERRIDE */
/* wxFALLTHROUGH is used to notate explicit fallthroughs in switch statements */
#if __cplusplus >= 201703L
#define wxFALLTHROUGH [[fallthrough]]
#elif __cplusplus >= 201103L && defined(__has_warning) && WX_HAS_CLANG_FEATURE(cxx_attributes)
#define wxFALLTHROUGH [[clang::fallthrough]]
#elif wxCHECK_GCC_VERSION(7, 0)
#define wxFALLTHROUGH __attribute__ ((fallthrough))
#endif
#ifndef wxFALLTHROUGH
#define wxFALLTHROUGH ((void)0)
#endif
/* these macros are obsolete, use the standard C++ casts directly now */
#define wx_static_cast(t, x) static_cast<t>(x)
#define wx_const_cast(t, x) const_cast<t>(x)
#define wx_reinterpret_cast(t, x) reinterpret_cast<t>(x)
/*
This one is a wx invention: like static cast but used when we intentionally
truncate from a larger to smaller type, static_cast<> can't be used for it
as it results in warnings when using some compilers (SGI mipspro for example)
*/
#if defined(__INTELC__)
template <typename T, typename X>
inline T wx_truncate_cast_impl(X x)
{
#pragma warning(push)
/* implicit conversion of a 64-bit integral type to a smaller integral type */
#pragma warning(disable: 1682)
/* conversion from "X" to "T" may lose significant bits */
#pragma warning(disable: 810)
/* non-pointer conversion from "foo" to "bar" may lose significant bits */
#pragma warning(disable: 2259)
return x;
#pragma warning(pop)
}
#define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
#elif defined(__VISUALC__) && __VISUALC__ >= 1310
template <typename T, typename X>
inline T wx_truncate_cast_impl(X x)
{
#pragma warning(push)
/* conversion from 'size_t' to 'type', possible loss of data */
#pragma warning(disable: 4267)
/* conversion from 'type1' to 'type2', possible loss of data */
#pragma warning(disable: 4242)
return x;
#pragma warning(pop)
}
#define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
#else
#define wx_truncate_cast(t, x) ((t)(x))
#endif
/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
#define wxConstCast(obj, className) const_cast<className *>(obj)
#ifndef HAVE_STD_WSTRING
#if __cplusplus >= 201103L
#define HAVE_STD_WSTRING
#elif defined(__VISUALC__)
#define HAVE_STD_WSTRING
#elif defined(__MINGW32__)
#define HAVE_STD_WSTRING
#endif
#endif
#ifndef HAVE_STD_STRING_COMPARE
#if __cplusplus >= 201103L
#define HAVE_STD_STRING_COMPARE
#elif defined(__VISUALC__)
#define HAVE_STD_STRING_COMPARE
#elif defined(__MINGW32__) || defined(__CYGWIN32__)
#define HAVE_STD_STRING_COMPARE
#endif
#endif
#ifndef HAVE_TR1_TYPE_TRAITS
#if defined(__VISUALC__) && (_MSC_FULL_VER >= 150030729)
#define HAVE_TR1_TYPE_TRAITS
#endif
#endif
/*
If using configure, stick to the options detected by it even if different
compiler options could result in detecting something different here, as it
would cause ABI issues otherwise (see #18034).
*/
#ifndef __WX_SETUP_H__
/*
Check for C++11 compilers, it is important to do it before the
__has_include() checks because at least g++ 4.9.2+ __has_include() returns
true for C++11 headers which can't be compiled in non-C++11 mode.
*/
#if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(10)
#ifndef HAVE_TYPE_TRAITS
#define HAVE_TYPE_TRAITS
#endif
#ifndef HAVE_STD_UNORDERED_MAP
#define HAVE_STD_UNORDERED_MAP
#endif
#ifndef HAVE_STD_UNORDERED_SET
#define HAVE_STD_UNORDERED_SET
#endif
#elif defined(__has_include)
/*
We're in non-C++11 mode here, so only test for pre-C++11 headers. As
mentioned above, using __has_include() to test for C++11 would wrongly
detect them even though they can't be used in this case, don't do it.
*/
#if !defined(HAVE_TR1_TYPE_TRAITS) && __has_include(<tr1/type_traits>)
#define HAVE_TR1_TYPE_TRAITS
#endif
#if !defined(HAVE_TR1_UNORDERED_MAP) && __has_include(<tr1/unordered_map>)
#define HAVE_TR1_UNORDERED_MAP
#endif
#if !defined(HAVE_TR1_UNORDERED_SET) && __has_include(<tr1/unordered_set>)
#define HAVE_TR1_UNORDERED_SET
#endif
#endif /* defined(__has_include) */
#endif /* __cplusplus */
#endif /* __WX_SETUP_H__ */
/* provide replacement for C99 va_copy() if the compiler doesn't have it */
/* could be already defined by configure or the user */
#ifndef wxVaCopy
/* if va_copy is a macro or configure detected that we have it, use it */
#if defined(va_copy) || defined(HAVE_VA_COPY)
#define wxVaCopy va_copy
#else /* no va_copy, try to provide a replacement */
/*
configure tries to determine whether va_list is an array or struct
type, but it may not be used under Windows, so deal with a few
special cases.
*/
#if defined(__PPC__) && (defined(_CALL_SYSV) || defined (_WIN32))
/*
PPC using SysV ABI and NT/PPC are special in that they use an
extra level of indirection.
*/
#define VA_LIST_IS_POINTER
#endif /* SysV or Win32 on __PPC__ */
/*
note that we use memmove(), not memcpy(), in case anybody tries
to do wxVaCopy(ap, ap)
*/
#if defined(VA_LIST_IS_POINTER)
#define wxVaCopy(d, s) memmove(*(d), *(s), sizeof(va_list))
#elif defined(VA_LIST_IS_ARRAY)
#define wxVaCopy(d, s) memmove((d), (s), sizeof(va_list))
#else /* we can only hope that va_lists are simple lvalues */
#define wxVaCopy(d, s) ((d) = (s))
#endif
#endif /* va_copy/!va_copy */
#endif /* wxVaCopy */
#ifndef HAVE_WOSTREAM
/*
Mingw <= 3.4 and all versions of Cygwin don't have std::wostream
*/
#if (defined(__MINGW32__) && !wxCHECK_GCC_VERSION(4, 0)) || \
defined(__CYGWIN__)
#define wxNO_WOSTREAM
#endif
/* VC++ doesn't have it in the old iostream library */
#if defined(__VISUALC__) && wxUSE_IOSTREAMH
#define wxNO_WOSTREAM
#endif
#ifndef wxNO_WOSTREAM
#define HAVE_WOSTREAM
#endif
#undef wxNO_WOSTREAM
#endif /* HAVE_WOSTREAM */
/* ---------------------------------------------------------------------------- */
/* portable calling conventions macros */
/* ---------------------------------------------------------------------------- */
/* stdcall is used for all functions called by Windows under Windows */
#if defined(__WINDOWS__)
#if defined(__GNUWIN32__)
#define wxSTDCALL __attribute__((stdcall))
#else
/* both VC++ and Borland understand this */
#define wxSTDCALL _stdcall
#endif
#else /* Win */
/* no such stupidness under Unix */
#define wxSTDCALL
#endif /* platform */
/* LINKAGEMODE mode is most likely empty everywhere */
#ifndef LINKAGEMODE
#define LINKAGEMODE
#endif /* LINKAGEMODE */
/* wxCALLBACK should be used for the functions which are called back by */
/* Windows (such as compare function for wxListCtrl) */
#if defined(__WIN32__)
#define wxCALLBACK wxSTDCALL
#else
/* no stdcall under Unix nor Win16 */
#define wxCALLBACK
#endif /* platform */
/* generic calling convention for the extern "C" functions */
#if defined(__VISUALC__)
#define wxC_CALLING_CONV _cdecl
#else /* !Visual C++ */
#define wxC_CALLING_CONV
#endif /* compiler */
/* callling convention for the qsort(3) callback */
#define wxCMPFUNC_CONV wxC_CALLING_CONV
/* compatibility :-( */
#define CMPFUNC_CONV wxCMPFUNC_CONV
/* DLL import/export declarations */
#include "wx/dlimpexp.h"
/* ---------------------------------------------------------------------------- */
/* Very common macros */
/* ---------------------------------------------------------------------------- */
/* Printf-like attribute definitions to obtain warnings with GNU C/C++ */
#ifndef WX_ATTRIBUTE_PRINTF
# if defined(__GNUC__) && !wxUSE_UNICODE
# define WX_ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
# else
# define WX_ATTRIBUTE_PRINTF(m, n)
# endif
# define WX_ATTRIBUTE_PRINTF_1 WX_ATTRIBUTE_PRINTF(1, 2)
# define WX_ATTRIBUTE_PRINTF_2 WX_ATTRIBUTE_PRINTF(2, 3)
# define WX_ATTRIBUTE_PRINTF_3 WX_ATTRIBUTE_PRINTF(3, 4)
# define WX_ATTRIBUTE_PRINTF_4 WX_ATTRIBUTE_PRINTF(4, 5)
# define WX_ATTRIBUTE_PRINTF_5 WX_ATTRIBUTE_PRINTF(5, 6)
#endif /* !defined(WX_ATTRIBUTE_PRINTF) */
#ifndef WX_ATTRIBUTE_NORETURN
# if WX_HAS_CLANG_FEATURE(attribute_analyzer_noreturn)
# define WX_ATTRIBUTE_NORETURN __attribute__((analyzer_noreturn))
# elif defined( __GNUC__ )
# define WX_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
# elif defined(__VISUALC__)
# define WX_ATTRIBUTE_NORETURN __declspec(noreturn)
# else
# define WX_ATTRIBUTE_NORETURN
# endif
#endif
#if defined(__GNUC__)
#define WX_ATTRIBUTE_UNUSED __attribute__ ((unused))
#else
#define WX_ATTRIBUTE_UNUSED
#endif
/*
Macros for marking functions as being deprecated.
The preferred macro in the new code is wxDEPRECATED_MSG() which allows to
explain why is the function deprecated. Almost all the existing code uses
the older wxDEPRECATED() or its variants currently, but this will hopefully
change in the future.
*/
/* The basic compiler-specific construct to generate a deprecation warning. */
#ifdef __clang__
#define wxDEPRECATED_DECL __attribute__((deprecated))
#elif defined(__GNUC__)
#define wxDEPRECATED_DECL __attribute__((deprecated))
#elif defined(__VISUALC__)
#define wxDEPRECATED_DECL __declspec(deprecated)
#else
#define wxDEPRECATED_DECL
#endif
/*
Macro taking the deprecation message. It applies to the next declaration.
If the compiler doesn't support showing the message, this degrades to a
simple wxDEPRECATED(), i.e. at least gives a warning, if possible.
*/
#if defined(__clang__) && defined(__has_extension)
#if __has_extension(attribute_deprecated_with_message)
#define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
#else
#define wxDEPRECATED_MSG(msg) __attribute__((deprecated))
#endif
#elif wxCHECK_GCC_VERSION(4, 5)
#define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
#elif wxCHECK_VISUALC_VERSION(8)
#define wxDEPRECATED_MSG(msg) __declspec(deprecated("deprecated: " msg))
#else
#define wxDEPRECATED_MSG(msg) wxDEPRECATED_DECL
#endif
/*
Macro taking the declaration that it deprecates. Prefer to use
wxDEPRECATED_MSG() instead as it's simpler (wrapping the entire declaration
makes the code unclear) and allows to specify the explanation.
*/
#define wxDEPRECATED(x) wxDEPRECATED_DECL x
#if defined(__GNUC__) && !wxCHECK_GCC_VERSION(3, 4)
/*
We need to add dummy "inline" to allow gcc < 3.4 to handle the
deprecation attribute on the constructors.
*/
#define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED( inline x)
#else
#define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED(x)
#endif
/*
Macro which marks the function as being deprecated but also defines it
inline.
Currently it's defined in the same trivial way in all cases but it could
need a special definition with some other compilers in the future which
explains why do we have it.
*/
#define wxDEPRECATED_INLINE(func, body) wxDEPRECATED(func) { body }
/*
A macro to define a simple deprecated accessor.
*/
#define wxDEPRECATED_ACCESSOR(func, what) wxDEPRECATED_INLINE(func, return what;)
/*
Special variant of the macro above which should be used for the functions
which are deprecated but called by wx itself: this often happens with
deprecated virtual functions which are called by the library.
*/
#ifdef WXBUILDING
# define wxDEPRECATED_BUT_USED_INTERNALLY(x) x
#else
# define wxDEPRECATED_BUT_USED_INTERNALLY(x) wxDEPRECATED(x)
#endif
/*
Macros to suppress and restore gcc warnings, requires g++ >= 4.6 and don't
do anything otherwise.
Example of use:
wxGCC_WARNING_SUPPRESS(float-equal)
inline bool wxIsSameDouble(double x, double y) { return x == y; }
wxGCC_WARNING_RESTORE(float-equal)
*/
#if defined(__clang__) || wxCHECK_GCC_VERSION(4, 6)
# define wxGCC_WARNING_SUPPRESS(x) \
_Pragma (wxSTRINGIZE(GCC diagnostic push)) \
_Pragma (wxSTRINGIZE(GCC diagnostic ignored wxSTRINGIZE(wxCONCAT(-W,x))))
# define wxGCC_WARNING_RESTORE(x) \
_Pragma (wxSTRINGIZE(GCC diagnostic pop))
#else /* gcc < 4.6 or not gcc and not clang at all */
# define wxGCC_WARNING_SUPPRESS(x)
# define wxGCC_WARNING_RESTORE(x)
#endif
/* Specific macros for -Wcast-function-type warning new in gcc 8. */
#if wxCHECK_GCC_VERSION(8, 0)
#define wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() \
wxGCC_WARNING_SUPPRESS(cast-function-type)
#define wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE() \
wxGCC_WARNING_RESTORE(cast-function-type)
#else
#define wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE()
#define wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE()
#endif
/*
Macros to suppress and restore clang warning only when it is valid.
Example:
wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override)
virtual wxClassInfo *GetClassInfo() const
wxCLANG_WARNING_RESTORE(inconsistent-missing-override)
*/
#if defined(__clang__) && defined(__has_warning)
# define wxCLANG_HAS_WARNING(x) __has_warning(x) /* allow macro expansion for the warning name */
# define wxCLANG_IF_VALID_WARNING(x,y) \
wxCONCAT(wxCLANG_IF_VALID_WARNING_,wxCLANG_HAS_WARNING(wxSTRINGIZE(wxCONCAT(-W,x))))(y)
# define wxCLANG_IF_VALID_WARNING_0(x)
# define wxCLANG_IF_VALID_WARNING_1(x) x
# define wxCLANG_WARNING_SUPPRESS(x) \
wxCLANG_IF_VALID_WARNING(x,wxGCC_WARNING_SUPPRESS(x))
# define wxCLANG_WARNING_RESTORE(x) \
wxCLANG_IF_VALID_WARNING(x,wxGCC_WARNING_RESTORE(x))
#else
# define wxCLANG_WARNING_SUPPRESS(x)
# define wxCLANG_WARNING_RESTORE(x)
#endif
/*
Combination of the two variants above: should be used for deprecated
functions which are defined inline and are used by wxWidgets itself.
*/
#ifdef WXBUILDING
# define wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(func, body) func { body }
#else
# define wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(func, body) \
wxDEPRECATED(func) { body }
#endif
/* NULL declaration: it must be defined as 0 for C++ programs (in particular, */
/* it must not be defined as "(void *)0" which is standard for C but completely */
/* breaks C++ code) */
#include <stddef.h>
/* size of statically declared array */
#define WXSIZEOF(array) (sizeof(array)/sizeof(array[0]))
/* symbolic constant used by all Find()-like functions returning positive */
/* integer on success as failure indicator */
#define wxNOT_FOUND (-1)
/* the default value for some length parameters meaning that the string is */
/* NUL-terminated */
#define wxNO_LEN ((size_t)-1)
/* ---------------------------------------------------------------------------- */
/* macros dealing with comparison operators */
/* ---------------------------------------------------------------------------- */
/*
Expands into m(op, args...) for each op in the set { ==, !=, <, <=, >, >= }.
*/
#define wxFOR_ALL_COMPARISONS(m) \
m(==) m(!=) m(>=) m(<=) m(>) m(<)
#define wxFOR_ALL_COMPARISONS_1(m, x) \
m(==,x) m(!=,x) m(>=,x) m(<=,x) m(>,x) m(<,x)
#define wxFOR_ALL_COMPARISONS_2(m, x, y) \
m(==,x,y) m(!=,x,y) m(>=,x,y) m(<=,x,y) m(>,x,y) m(<,x,y)
#define wxFOR_ALL_COMPARISONS_3(m, x, y, z) \
m(==,x,y,z) m(!=,x,y,z) m(>=,x,y,z) m(<=,x,y,z) m(>,x,y,z) m(<,x,y,z)
/*
These are only used with wxDEFINE_COMPARISON_[BY_]REV: they pass both the
normal and the reversed comparison operators to the macro.
*/
#define wxFOR_ALL_COMPARISONS_2_REV(m, x, y) \
m(==,x,y,==) m(!=,x,y,!=) m(>=,x,y,<=) \
m(<=,x,y,>=) m(>,x,y,<) m(<,x,y,>)
#define wxFOR_ALL_COMPARISONS_3_REV(m, x, y, z) \
m(==,x,y,z,==) m(!=,x,y,z,!=) m(>=,x,y,z,<=) \
m(<=,x,y,z,>=) m(>,x,y,z,<) m(<,x,y,z,>)
#define wxDEFINE_COMPARISON(op, T1, T2, cmp) \
inline bool operator op(T1 x, T2 y) { return cmp(x, y, op); }
#define wxDEFINE_COMPARISON_REV(op, T1, T2, cmp, oprev) \
inline bool operator op(T2 y, T1 x) { return cmp(x, y, oprev); }
#define wxDEFINE_COMPARISON_BY_REV(op, T1, T2, oprev) \
inline bool operator op(T1 x, T2 y) { return y oprev x; }
/*
Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given
types in the specified order. The implementation is provided by the cmp
macro. Normally wxDEFINE_ALL_COMPARISONS should be used as comparison
operators are usually symmetric.
*/
#define wxDEFINE_COMPARISONS(T1, T2, cmp) \
wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp)
/*
Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given
types in the specified order, implemented in terms of existing operators
for the reverse order.
*/
#define wxDEFINE_COMPARISONS_BY_REV(T1, T2) \
wxFOR_ALL_COMPARISONS_2_REV(wxDEFINE_COMPARISON_BY_REV, T1, T2)
/*
This macro allows to define all 12 comparison operators (6 operators for
both orders of arguments) for the given types using the provided "cmp"
macro to implement the actual comparison: the macro is called with the 2
arguments names, the first of type T1 and the second of type T2, and the
comparison operator being implemented.
*/
#define wxDEFINE_ALL_COMPARISONS(T1, T2, cmp) \
wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp) \
wxFOR_ALL_COMPARISONS_3_REV(wxDEFINE_COMPARISON_REV, T1, T2, cmp)
/* ---------------------------------------------------------------------------- */
/* macros to avoid compiler warnings */
/* ---------------------------------------------------------------------------- */
/* Macro to cut down on compiler warnings. */
#if 1 /* there should be no more any compilers needing the "#else" version */
#define WXUNUSED(identifier) /* identifier */
#else /* stupid, broken compiler */
#define WXUNUSED(identifier) identifier
#endif
/* some arguments are not used in unicode mode */
#if wxUSE_UNICODE
#define WXUNUSED_IN_UNICODE(param) WXUNUSED(param)
#else
#define WXUNUSED_IN_UNICODE(param) param
#endif
/* unused parameters in non stream builds */
#if wxUSE_STREAMS
#define WXUNUSED_UNLESS_STREAMS(param) param
#else
#define WXUNUSED_UNLESS_STREAMS(param) WXUNUSED(param)
#endif
/* some compilers give warning about a possibly unused variable if it is */
/* initialized in both branches of if/else and shut up if it is initialized */
/* when declared, but other compilers then give warnings about unused variable */
/* value -- this should satisfy both of them */
#if defined(__VISUALC__)
#define wxDUMMY_INITIALIZE(val) = val
#else
#define wxDUMMY_INITIALIZE(val)
#endif
/* sometimes the value of a variable is *really* not used, to suppress the */
/* resulting warning you may pass it to this function */
#ifdef __cplusplus
# ifdef __BORLANDC__
# define wxUnusedVar(identifier) identifier
# else
template <class T>
inline void wxUnusedVar(const T& WXUNUSED(t)) { }
# endif
#endif
/* ---------------------------------------------------------------------------- */
/* compiler specific settings */
/* ---------------------------------------------------------------------------- */
/* where should i put this? we need to make sure of this as it breaks */
/* the <iostream> code. */
#if !wxUSE_IOSTREAMH && defined(__WXDEBUG__)
# undef wxUSE_DEBUG_NEW_ALWAYS
# define wxUSE_DEBUG_NEW_ALWAYS 0
#endif
#include "wx/types.h"
#ifdef __cplusplus
// everybody gets the assert and other debug macros
#include "wx/debug.h"
// delete pointer if it is not NULL and NULL it afterwards
template <typename T>
inline void wxDELETE(T*& ptr)
{
typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED;
if ( ptr != NULL )
{
delete ptr;
ptr = NULL;
}
}
// delete an array and NULL it (see comments above)
template <typename T>
inline void wxDELETEA(T*& ptr)
{
typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED;
if ( ptr != NULL )
{
delete [] ptr;
ptr = NULL;
}
}
// trivial implementation of std::swap() for primitive types
template <typename T>
inline void wxSwap(T& first, T& second)
{
T tmp(first);
first = second;
second = tmp;
}
/* And also define a couple of simple functions to cast pointer to/from it. */
inline wxUIntPtr wxPtrToUInt(const void *p)
{
/*
VC++ 7.1 gives warnings about casts such as below even when they're
explicit with /Wp64 option, suppress them as we really know what we're
doing here. Same thing with icc with -Wall.
*/
#ifdef __VISUALC__
#pragma warning(push)
/* pointer truncation from '' to '' */
#pragma warning(disable: 4311)
#elif defined(__INTELC__)
#pragma warning(push)
/* conversion from pointer to same-sized integral type */
#pragma warning(disable: 1684)
#endif
return reinterpret_cast<wxUIntPtr>(p);
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
inline void *wxUIntToPtr(wxUIntPtr p)
{
#ifdef __VISUALC__
#pragma warning(push)
/* conversion to type of greater size */
#pragma warning(disable: 4312)
#elif defined(__INTELC__)
#pragma warning(push)
/* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
#pragma warning(disable: 171)
#endif
return reinterpret_cast<void *>(p);
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
#endif /*__cplusplus*/
/* base floating point types */
/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits ) */
/* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits ) */
/* wxDouble: native fastest representation that has at least wxFloat64 */
/* precision, so use the IEEE types for storage, and this for */
/* calculations */
typedef float wxFloat32;
typedef double wxFloat64;
typedef double wxDouble;
/*
Some (non standard) compilers typedef wchar_t as an existing type instead
of treating it as a real fundamental type, set wxWCHAR_T_IS_REAL_TYPE to 0
for them and to 1 for all the others.
*/
#ifndef wxWCHAR_T_IS_REAL_TYPE
/*
VC++ typedefs wchar_t as unsigned short by default until VC8, that is
unless /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED
is defined.
*/
# if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED)
# define wxWCHAR_T_IS_REAL_TYPE 0
# else /* compiler having standard-conforming wchar_t */
# define wxWCHAR_T_IS_REAL_TYPE 1
# endif
#endif /* !defined(wxWCHAR_T_IS_REAL_TYPE) */
/* Helper macro for doing something dependent on whether wchar_t is or isn't a
typedef inside another macro. */
#if wxWCHAR_T_IS_REAL_TYPE
#define wxIF_WCHAR_T_TYPE(x) x
#else /* !wxWCHAR_T_IS_REAL_TYPE */
#define wxIF_WCHAR_T_TYPE(x)
#endif /* wxWCHAR_T_IS_REAL_TYPE/!wxWCHAR_T_IS_REAL_TYPE */
/*
This constant should be used instead of NULL in vararg functions taking
wxChar* arguments: passing NULL (which is the same as 0, unless the compiler
defines it specially, e.g. like gcc does with its __null built-in) doesn't
work in this case as va_arg() wouldn't interpret the integer 0 correctly
when trying to convert it to a pointer on architectures where sizeof(int) is
strictly less than sizeof(void *).
Examples of places where this must be used include wxFileTypeInfo ctor.
*/
#define wxNullPtr ((void *)NULL)
/* Define wxChar16 and wxChar32 */
#if SIZEOF_WCHAR_T == 2
#define wxWCHAR_T_IS_WXCHAR16
typedef wchar_t wxChar16;
#else
typedef wxUint16 wxChar16;
#endif
#if SIZEOF_WCHAR_T == 4
#define wxWCHAR_T_IS_WXCHAR32
typedef wchar_t wxChar32;
#else
typedef wxUint32 wxChar32;
#endif
/*
Helper macro expanding into the given "m" macro invoked with each of the
integer types as parameter (notice that this does not include char/unsigned
char and bool but does include wchar_t).
*/
#define wxDO_FOR_INT_TYPES(m) \
m(short) \
m(unsigned short) \
m(int) \
m(unsigned int) \
m(long) \
m(unsigned long) \
wxIF_LONG_LONG_TYPE( m(wxLongLong_t) ) \
wxIF_LONG_LONG_TYPE( m(wxULongLong_t) ) \
wxIF_WCHAR_T_TYPE( m(wchar_t) )
/*
Same as wxDO_FOR_INT_TYPES() but does include char and unsigned char.
Notice that we use "char" and "unsigned char" here but not "signed char"
which would be more correct as "char" could be unsigned by default. But
wxWidgets code currently supposes that char is signed and we'd need to
clean up assumptions about it, notably in wx/unichar.h, to be able to use
"signed char" here.
*/
#define wxDO_FOR_CHAR_INT_TYPES(m) \
m(char) \
m(unsigned char) \
wxDO_FOR_INT_TYPES(m)
/*
Same as wxDO_FOR_INT_TYPES() above except that m macro takes the
type as the first argument and some extra argument, passed from this macro
itself, as the second one.
*/
#define wxDO_FOR_INT_TYPES_1(m, arg) \
m(short, arg) \
m(unsigned short, arg) \
m(int, arg) \
m(unsigned int, arg) \
m(long, arg) \
m(unsigned long, arg) \
wxIF_LONG_LONG_TYPE( m(wxLongLong_t, arg) ) \
wxIF_LONG_LONG_TYPE( m(wxULongLong_t, arg) ) \
wxIF_WCHAR_T_TYPE( m(wchar_t, arg) )
/*
Combination of wxDO_FOR_CHAR_INT_TYPES() and wxDO_FOR_INT_TYPES_1():
invokes the given macro with the specified argument as its second parameter
for all char and int types.
*/
#define wxDO_FOR_CHAR_INT_TYPES_1(m, arg) \
m(char, arg) \
m(unsigned char, arg) \
wxDO_FOR_INT_TYPES_1(m, arg)
/* ---------------------------------------------------------------------------- */
/* byte ordering related definition and macros */
/* ---------------------------------------------------------------------------- */
/* byte sex */
#define wxBIG_ENDIAN 4321
#define wxLITTLE_ENDIAN 1234
#define wxPDP_ENDIAN 3412
#ifdef WORDS_BIGENDIAN
#define wxBYTE_ORDER wxBIG_ENDIAN
#else
#define wxBYTE_ORDER wxLITTLE_ENDIAN
#endif
/* byte swapping */
#define wxUINT16_SWAP_ALWAYS(val) \
((wxUint16) ( \
(((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \
(((wxUint16) (val) & (wxUint16) 0xff00U) >> 8)))
#define wxINT16_SWAP_ALWAYS(val) \
((wxInt16) ( \
(((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \
(((wxUint16) (val) & (wxUint16) 0xff00U) >> 8)))
#define wxUINT32_SWAP_ALWAYS(val) \
((wxUint32) ( \
(((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \
(((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \
(((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \
(((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24)))
#define wxINT32_SWAP_ALWAYS(val) \
((wxInt32) ( \
(((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \
(((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \
(((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \
(((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24)))
/* machine specific byte swapping */
#ifdef wxLongLong_t
#define wxUINT64_SWAP_ALWAYS(val) \
((wxUint64) ( \
(((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \
(((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56)))
#define wxINT64_SWAP_ALWAYS(val) \
((wxInt64) ( \
(((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \
(((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \
(((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56)))
#elif wxUSE_LONGLONG /* !wxLongLong_t */
#define wxUINT64_SWAP_ALWAYS(val) \
((wxUint64) ( \
((wxULongLong(val) & wxULongLong(0L, 0x000000ffU)) << 56) | \
((wxULongLong(val) & wxULongLong(0L, 0x0000ff00U)) << 40) | \
((wxULongLong(val) & wxULongLong(0L, 0x00ff0000U)) << 24) | \
((wxULongLong(val) & wxULongLong(0L, 0xff000000U)) << 8) | \
((wxULongLong(val) & wxULongLong(0x000000ffL, 0U)) >> 8) | \
((wxULongLong(val) & wxULongLong(0x0000ff00L, 0U)) >> 24) | \
((wxULongLong(val) & wxULongLong(0x00ff0000L, 0U)) >> 40) | \
((wxULongLong(val) & wxULongLong(0xff000000L, 0U)) >> 56)))
#define wxINT64_SWAP_ALWAYS(val) \
((wxInt64) ( \
((wxLongLong(val) & wxLongLong(0L, 0x000000ffU)) << 56) | \
((wxLongLong(val) & wxLongLong(0L, 0x0000ff00U)) << 40) | \
((wxLongLong(val) & wxLongLong(0L, 0x00ff0000U)) << 24) | \
((wxLongLong(val) & wxLongLong(0L, 0xff000000U)) << 8) | \
((wxLongLong(val) & wxLongLong(0x000000ffL, 0U)) >> 8) | \
((wxLongLong(val) & wxLongLong(0x0000ff00L, 0U)) >> 24) | \
((wxLongLong(val) & wxLongLong(0x00ff0000L, 0U)) >> 40) | \
((wxLongLong(val) & wxLongLong(0xff000000L, 0U)) >> 56)))
#endif /* wxLongLong_t/!wxLongLong_t */
#ifdef WORDS_BIGENDIAN
#define wxUINT16_SWAP_ON_BE(val) wxUINT16_SWAP_ALWAYS(val)
#define wxINT16_SWAP_ON_BE(val) wxINT16_SWAP_ALWAYS(val)
#define wxUINT16_SWAP_ON_LE(val) (val)
#define wxINT16_SWAP_ON_LE(val) (val)
#define wxUINT32_SWAP_ON_BE(val) wxUINT32_SWAP_ALWAYS(val)
#define wxINT32_SWAP_ON_BE(val) wxINT32_SWAP_ALWAYS(val)
#define wxUINT32_SWAP_ON_LE(val) (val)
#define wxINT32_SWAP_ON_LE(val) (val)
#if wxHAS_INT64
#define wxUINT64_SWAP_ON_BE(val) wxUINT64_SWAP_ALWAYS(val)
#define wxUINT64_SWAP_ON_LE(val) (val)
#define wxINT64_SWAP_ON_BE(val) wxINT64_SWAP_ALWAYS(val)
#define wxINT64_SWAP_ON_LE(val) (val)
#define wxUINT64_SWAP_ON_BE_IN_PLACE(val) val = wxUINT64_SWAP_ALWAYS(val)
#define wxINT64_SWAP_ON_BE_IN_PLACE(val) val = wxINT64_SWAP_ALWAYS(val)
#define wxUINT64_SWAP_ON_LE_IN_PLACE(val)
#define wxINT64_SWAP_ON_LE_IN_PLACE(val)
#endif
#define wxUINT16_SWAP_ON_BE_IN_PLACE(val) val = wxUINT16_SWAP_ALWAYS(val)
#define wxINT16_SWAP_ON_BE_IN_PLACE(val) val = wxINT16_SWAP_ALWAYS(val)
#define wxUINT16_SWAP_ON_LE_IN_PLACE(val)
#define wxINT16_SWAP_ON_LE_IN_PLACE(val)
#define wxUINT32_SWAP_ON_BE_IN_PLACE(val) val = wxUINT32_SWAP_ALWAYS(val)
#define wxINT32_SWAP_ON_BE_IN_PLACE(val) val = wxINT32_SWAP_ALWAYS(val)
#define wxUINT32_SWAP_ON_LE_IN_PLACE(val)
#define wxINT32_SWAP_ON_LE_IN_PLACE(val)
#else
#define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val)
#define wxINT16_SWAP_ON_LE(val) wxINT16_SWAP_ALWAYS(val)
#define wxUINT16_SWAP_ON_BE(val) (val)
#define wxINT16_SWAP_ON_BE(val) (val)
#define wxUINT32_SWAP_ON_LE(val) wxUINT32_SWAP_ALWAYS(val)
#define wxINT32_SWAP_ON_LE(val) wxINT32_SWAP_ALWAYS(val)
#define wxUINT32_SWAP_ON_BE(val) (val)
#define wxINT32_SWAP_ON_BE(val) (val)
#if wxHAS_INT64
#define wxUINT64_SWAP_ON_LE(val) wxUINT64_SWAP_ALWAYS(val)
#define wxUINT64_SWAP_ON_BE(val) (val)
#define wxINT64_SWAP_ON_LE(val) wxINT64_SWAP_ALWAYS(val)
#define wxINT64_SWAP_ON_BE(val) (val)
#define wxUINT64_SWAP_ON_BE_IN_PLACE(val)
#define wxINT64_SWAP_ON_BE_IN_PLACE(val)
#define wxUINT64_SWAP_ON_LE_IN_PLACE(val) val = wxUINT64_SWAP_ALWAYS(val)
#define wxINT64_SWAP_ON_LE_IN_PLACE(val) val = wxINT64_SWAP_ALWAYS(val)
#endif
#define wxUINT16_SWAP_ON_BE_IN_PLACE(val)
#define wxINT16_SWAP_ON_BE_IN_PLACE(val)
#define wxUINT16_SWAP_ON_LE_IN_PLACE(val) val = wxUINT16_SWAP_ALWAYS(val)
#define wxINT16_SWAP_ON_LE_IN_PLACE(val) val = wxINT16_SWAP_ALWAYS(val)
#define wxUINT32_SWAP_ON_BE_IN_PLACE(val)
#define wxINT32_SWAP_ON_BE_IN_PLACE(val)
#define wxUINT32_SWAP_ON_LE_IN_PLACE(val) val = wxUINT32_SWAP_ALWAYS(val)
#define wxINT32_SWAP_ON_LE_IN_PLACE(val) val = wxINT32_SWAP_ALWAYS(val)
#endif
/* ---------------------------------------------------------------------------- */
/* Geometric flags */
/* ---------------------------------------------------------------------------- */
enum wxGeometryCentre
{
wxCENTRE = 0x0001,
wxCENTER = wxCENTRE
};
/* centering into frame rather than screen (obsolete) */
#define wxCENTER_FRAME 0x0000
/* centre on screen rather than parent */
#define wxCENTRE_ON_SCREEN 0x0002
#define wxCENTER_ON_SCREEN wxCENTRE_ON_SCREEN
enum wxOrientation
{
/* don't change the values of these elements, they are used elsewhere */
wxHORIZONTAL = 0x0004,
wxVERTICAL = 0x0008,
wxBOTH = wxVERTICAL | wxHORIZONTAL,
/* a mask to extract orientation from the combination of flags */
wxORIENTATION_MASK = wxBOTH
};
enum wxDirection
{
wxLEFT = 0x0010,
wxRIGHT = 0x0020,
wxUP = 0x0040,
wxDOWN = 0x0080,
wxTOP = wxUP,
wxBOTTOM = wxDOWN,
wxNORTH = wxUP,
wxSOUTH = wxDOWN,
wxWEST = wxLEFT,
wxEAST = wxRIGHT,
wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT),
/* a mask to extract direction from the combination of flags */
wxDIRECTION_MASK = wxALL
};
enum wxAlignment
{
/*
0 is a valid wxAlignment value (both wxALIGN_LEFT and wxALIGN_TOP
use it) so define a symbolic name for an invalid alignment value
which can be assumed to be different from anything else
*/
wxALIGN_INVALID = -1,
wxALIGN_NOT = 0x0000,
wxALIGN_CENTER_HORIZONTAL = 0x0100,
wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL,
wxALIGN_LEFT = wxALIGN_NOT,
wxALIGN_TOP = wxALIGN_NOT,
wxALIGN_RIGHT = 0x0200,
wxALIGN_BOTTOM = 0x0400,
wxALIGN_CENTER_VERTICAL = 0x0800,
wxALIGN_CENTRE_VERTICAL = wxALIGN_CENTER_VERTICAL,
wxALIGN_CENTER = (wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL),
wxALIGN_CENTRE = wxALIGN_CENTER,
/* a mask to extract alignment from the combination of flags */
wxALIGN_MASK = 0x0f00
};
/* misc. flags for wxSizer items */
enum wxSizerFlagBits
{
/*
wxADJUST_MINSIZE doesn't do anything any more but we still define
it for compatibility. Notice that it may be also predefined (as 0,
hopefully) in the user code in order to use it even in
!WXWIN_COMPATIBILITY_2_8 builds so don't redefine it in such case.
*/
#if WXWIN_COMPATIBILITY_2_8 && !defined(wxADJUST_MINSIZE)
wxADJUST_MINSIZE = 0,
#endif
wxFIXED_MINSIZE = 0x8000,
wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002,
/* a mask to extract wxSizerFlagBits from combination of flags */
wxSIZER_FLAG_BITS_MASK = 0x8002
};
enum wxStretch
{
wxSTRETCH_NOT = 0x0000,
wxSHRINK = 0x1000,
wxGROW = 0x2000,
wxEXPAND = wxGROW,
wxSHAPED = 0x4000,
wxTILE = wxSHAPED | wxFIXED_MINSIZE,
/* a mask to extract stretch from the combination of flags */
wxSTRETCH_MASK = 0x7000 /* sans wxTILE */
};
/* border flags: the values are chosen for backwards compatibility */
enum wxBorder
{
/* this is different from wxBORDER_NONE as by default the controls do have */
/* border */
wxBORDER_DEFAULT = 0,
wxBORDER_NONE = 0x00200000,
wxBORDER_STATIC = 0x01000000,
wxBORDER_SIMPLE = 0x02000000,
wxBORDER_RAISED = 0x04000000,
wxBORDER_SUNKEN = 0x08000000,
wxBORDER_DOUBLE = 0x10000000, /* deprecated */
wxBORDER_THEME = wxBORDER_DOUBLE,
/* a mask to extract border style from the combination of flags */
wxBORDER_MASK = 0x1f200000
};
/* This makes it easier to specify a 'normal' border for a control */
#define wxDEFAULT_CONTROL_BORDER wxBORDER_SUNKEN
/* ---------------------------------------------------------------------------- */
/* Window style flags */
/* ---------------------------------------------------------------------------- */
/*
* Values are chosen so they can be |'ed in a bit list.
* Some styles are used across more than one group,
* so the values mustn't clash with others in the group.
* Otherwise, numbers can be reused across groups.
*/
/*
Summary of the bits used by various styles.
High word, containing styles which can be used with many windows:
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | \_ wxFULL_REPAINT_ON_RESIZE
| | | | | | | | | | | | | | \____ wxPOPUP_WINDOW
| | | | | | | | | | | | | \_______ wxWANTS_CHARS
| | | | | | | | | | | | \__________ wxTAB_TRAVERSAL
| | | | | | | | | | | \_____________ wxTRANSPARENT_WINDOW
| | | | | | | | | | \________________ wxBORDER_NONE
| | | | | | | | | \___________________ wxCLIP_CHILDREN
| | | | | | | | \______________________ wxALWAYS_SHOW_SB
| | | | | | | \_________________________ wxBORDER_STATIC
| | | | | | \____________________________ wxBORDER_SIMPLE
| | | | | \_______________________________ wxBORDER_RAISED
| | | | \__________________________________ wxBORDER_SUNKEN
| | | \_____________________________________ wxBORDER_{DOUBLE,THEME}
| | \________________________________________ wxCAPTION/wxCLIP_SIBLINGS
| \___________________________________________ wxHSCROLL
\______________________________________________ wxVSCROLL
Low word style bits is class-specific meaning that the same bit can have
different meanings for different controls (e.g. 0x10 is wxCB_READONLY
meaning that the control can't be modified for wxComboBox but wxLB_SORT
meaning that the control should be kept sorted for wxListBox, while
wxLB_SORT has a different value -- and this is just fine).
*/
/*
* Window (Frame/dialog/subwindow/panel item) style flags
*/
/* The cast is needed to avoid g++ -Wnarrowing warnings when initializing
* values of int type with wxVSCROLL on 32 bit platforms, where its value is
* greater than INT_MAX.
*/
#define wxVSCROLL ((int)0x80000000)
#define wxHSCROLL 0x40000000
#define wxCAPTION 0x20000000
/* New styles (border styles are now in their own enum) */
#define wxDOUBLE_BORDER wxBORDER_DOUBLE
#define wxSUNKEN_BORDER wxBORDER_SUNKEN
#define wxRAISED_BORDER wxBORDER_RAISED
#define wxBORDER wxBORDER_SIMPLE
#define wxSIMPLE_BORDER wxBORDER_SIMPLE
#define wxSTATIC_BORDER wxBORDER_STATIC
#define wxNO_BORDER wxBORDER_NONE
/* wxALWAYS_SHOW_SB: instead of hiding the scrollbar when it is not needed, */
/* disable it - but still show (see also wxLB_ALWAYS_SB style) */
/* */
/* NB: as this style is only supported by wxUniversal and wxMSW so far */
#define wxALWAYS_SHOW_SB 0x00800000
/* Clip children when painting, which reduces flicker in e.g. frames and */
/* splitter windows, but can't be used in a panel where a static box must be */
/* 'transparent' (panel paints the background for it) */
#define wxCLIP_CHILDREN 0x00400000
/* Note we're reusing the wxCAPTION style because we won't need captions */
/* for subwindows/controls */
#define wxCLIP_SIBLINGS 0x20000000
#define wxTRANSPARENT_WINDOW 0x00100000
/* Add this style to a panel to get tab traversal working outside of dialogs */
/* (on by default for wxPanel, wxDialog, wxScrolledWindow) */
#define wxTAB_TRAVERSAL 0x00080000
/* Add this style if the control wants to get all keyboard messages (under */
/* Windows, it won't normally get the dialog navigation key events) */
#define wxWANTS_CHARS 0x00040000
/* Make window retained (Motif only, see src/generic/scrolwing.cpp)
* This is non-zero only under wxMotif, to avoid a clash with wxPOPUP_WINDOW
* on other platforms
*/
#ifdef __WXMOTIF__
#define wxRETAINED 0x00020000
#else
#define wxRETAINED 0x00000000
#endif
#define wxBACKINGSTORE wxRETAINED
/* set this flag to create a special popup window: it will be always shown on */
/* top of other windows, will capture the mouse and will be dismissed when the */
/* mouse is clicked outside of it or if it loses focus in any other way */
#define wxPOPUP_WINDOW 0x00020000
/* force a full repaint when the window is resized (instead of repainting just */
/* the invalidated area) */
#define wxFULL_REPAINT_ON_RESIZE 0x00010000
/* obsolete: now this is the default behaviour */
/* */
/* don't invalidate the whole window (resulting in a PAINT event) when the */
/* window is resized (currently, makes sense for wxMSW only) */
#define wxNO_FULL_REPAINT_ON_RESIZE 0
/* A mask which can be used to filter (out) all wxWindow-specific styles.
*/
#define wxWINDOW_STYLE_MASK \
(wxVSCROLL|wxHSCROLL|wxBORDER_MASK|wxALWAYS_SHOW_SB|wxCLIP_CHILDREN| \
wxCLIP_SIBLINGS|wxTRANSPARENT_WINDOW|wxTAB_TRAVERSAL|wxWANTS_CHARS| \
wxRETAINED|wxPOPUP_WINDOW|wxFULL_REPAINT_ON_RESIZE)
/*
* Extra window style flags (use wxWS_EX prefix to make it clear that they
* should be passed to wxWindow::SetExtraStyle(), not SetWindowStyle())
*/
/* This flag is obsolete as recursive validation is now the default (and only
* possible) behaviour. Simply don't use it any more in the new code. */
#define wxWS_EX_VALIDATE_RECURSIVELY 0x00000000 /* used to be 1 */
/* wxCommandEvents and the objects of the derived classes are forwarded to the */
/* parent window and so on recursively by default. Using this flag for the */
/* given window allows to block this propagation at this window, i.e. prevent */
/* the events from being propagated further upwards. The dialogs have this */
/* flag on by default. */
#define wxWS_EX_BLOCK_EVENTS 0x00000002
/* don't use this window as an implicit parent for the other windows: this must */
/* be used with transient windows as otherwise there is the risk of creating a */
/* dialog/frame with this window as a parent which would lead to a crash if the */
/* parent is destroyed before the child */
#define wxWS_EX_TRANSIENT 0x00000004
/* don't paint the window background, we'll assume it will */
/* be done by a theming engine. This is not yet used but could */
/* possibly be made to work in the future, at least on Windows */
#define wxWS_EX_THEMED_BACKGROUND 0x00000008
/* this window should always process idle events */
#define wxWS_EX_PROCESS_IDLE 0x00000010
/* this window should always process UI update events */
#define wxWS_EX_PROCESS_UI_UPDATES 0x00000020
/* Draw the window in a metal theme on Mac */
#define wxFRAME_EX_METAL 0x00000040
#define wxDIALOG_EX_METAL 0x00000040
/* Use this style to add a context-sensitive help to the window (currently for */
/* Win32 only and it doesn't work if wxMINIMIZE_BOX or wxMAXIMIZE_BOX are used) */
#define wxWS_EX_CONTEXTHELP 0x00000080
/* synonyms for wxWS_EX_CONTEXTHELP for compatibility */
#define wxFRAME_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP
#define wxDIALOG_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP
/* Create a window which is attachable to another top level window */
#define wxFRAME_DRAWER 0x0020
/*
* MDI parent frame style flags
* Can overlap with some of the above.
*/
#define wxFRAME_NO_WINDOW_MENU 0x0100
/*
* wxMenuBar style flags
*/
/* use native docking */
#define wxMB_DOCKABLE 0x0001
/*
* wxMenu style flags
*/
#define wxMENU_TEAROFF 0x0001
/*
* Apply to all panel items
*/
#define wxCOLOURED 0x0800
#define wxFIXED_LENGTH 0x0400
/*
* Styles for wxListBox
*/
#define wxLB_SORT 0x0010
#define wxLB_SINGLE 0x0020
#define wxLB_MULTIPLE 0x0040
#define wxLB_EXTENDED 0x0080
/* wxLB_OWNERDRAW is Windows-only */
#define wxLB_NEEDED_SB 0x0000
#define wxLB_OWNERDRAW 0x0100
#define wxLB_ALWAYS_SB 0x0200
#define wxLB_NO_SB 0x0400
#define wxLB_HSCROLL wxHSCROLL
/* always show an entire number of rows */
#define wxLB_INT_HEIGHT 0x0800
/*
* wxComboBox style flags
*/
#define wxCB_SIMPLE 0x0004
#define wxCB_SORT 0x0008
#define wxCB_READONLY 0x0010
#define wxCB_DROPDOWN 0x0020
/*
* wxRadioBox style flags
*/
/* should we number the items from left to right or from top to bottom in a 2d */
/* radiobox? */
#define wxRA_LEFTTORIGHT 0x0001
#define wxRA_TOPTOBOTTOM 0x0002
/* New, more intuitive names to specify majorDim argument */
#define wxRA_SPECIFY_COLS wxHORIZONTAL
#define wxRA_SPECIFY_ROWS wxVERTICAL
/* Old names for compatibility */
#define wxRA_HORIZONTAL wxHORIZONTAL
#define wxRA_VERTICAL wxVERTICAL
/*
* wxRadioButton style flag
*/
#define wxRB_GROUP 0x0004
#define wxRB_SINGLE 0x0008
/*
* wxScrollBar flags
*/
#define wxSB_HORIZONTAL wxHORIZONTAL
#define wxSB_VERTICAL wxVERTICAL
/*
* wxSpinButton flags.
* Note that a wxSpinCtrl is sometimes defined as a wxTextCtrl, and so the
* flags shouldn't overlap with wxTextCtrl flags that can be used for a single
* line controls (currently we reuse wxTE_CHARWRAP and wxTE_RICH2 neither of
* which makes sense for them).
*/
#define wxSP_HORIZONTAL wxHORIZONTAL /* 4 */
#define wxSP_VERTICAL wxVERTICAL /* 8 */
#define wxSP_ARROW_KEYS 0x4000
#define wxSP_WRAP 0x8000
/*
* wxTabCtrl flags
*/
#define wxTC_RIGHTJUSTIFY 0x0010
#define wxTC_FIXEDWIDTH 0x0020
#define wxTC_TOP 0x0000 /* default */
#define wxTC_LEFT 0x0020
#define wxTC_RIGHT 0x0040
#define wxTC_BOTTOM 0x0080
#define wxTC_MULTILINE 0x0200 /* == wxNB_MULTILINE */
#define wxTC_OWNERDRAW 0x0400
/*
* wxStaticBitmap flags
*/
#define wxBI_EXPAND wxEXPAND
/*
* wxStaticLine flags
*/
#define wxLI_HORIZONTAL wxHORIZONTAL
#define wxLI_VERTICAL wxVERTICAL
/*
* extended dialog specifiers. these values are stored in a different
* flag and thus do not overlap with other style flags. note that these
* values do not correspond to the return values of the dialogs (for
* those values, look at the wxID_XXX defines).
*/
/* wxCENTRE already defined as 0x00000001 */
#define wxYES 0x00000002
#define wxOK 0x00000004
#define wxNO 0x00000008
#define wxYES_NO (wxYES | wxNO)
#define wxCANCEL 0x00000010
#define wxAPPLY 0x00000020
#define wxCLOSE 0x00000040
#define wxOK_DEFAULT 0x00000000 /* has no effect (default) */
#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */
#define wxNO_DEFAULT 0x00000080 /* only valid with wxYES_NO */
#define wxCANCEL_DEFAULT 0x80000000 /* only valid with wxCANCEL */
#define wxICON_WARNING 0x00000100
#define wxICON_ERROR 0x00000200
#define wxICON_QUESTION 0x00000400
#define wxICON_INFORMATION 0x00000800
#define wxICON_EXCLAMATION wxICON_WARNING
#define wxICON_HAND wxICON_ERROR
#define wxICON_STOP wxICON_ERROR
#define wxICON_ASTERISK wxICON_INFORMATION
#define wxHELP 0x00001000
#define wxFORWARD 0x00002000
#define wxBACKWARD 0x00004000
#define wxRESET 0x00008000
#define wxMORE 0x00010000
#define wxSETUP 0x00020000
#define wxICON_NONE 0x00040000
#define wxICON_AUTH_NEEDED 0x00080000
#define wxICON_MASK \
(wxICON_EXCLAMATION|wxICON_HAND|wxICON_QUESTION|wxICON_INFORMATION|wxICON_NONE|wxICON_AUTH_NEEDED)
/*
* Background styles. See wxWindow::SetBackgroundStyle
*/
enum wxBackgroundStyle
{
/*
background is erased in the EVT_ERASE_BACKGROUND handler or using
the system default background if no such handler is defined (this
is the default style)
*/
wxBG_STYLE_ERASE,
/*
background is erased by the system, no EVT_ERASE_BACKGROUND event
is generated at all
*/
wxBG_STYLE_SYSTEM,
/*
background is erased in EVT_PAINT handler and not erased at all
before it, this should be used if the paint handler paints over
the entire window to avoid flicker
*/
wxBG_STYLE_PAINT,
/*
Indicates that the window background is not erased, letting the parent
window show through.
*/
wxBG_STYLE_TRANSPARENT,
/* this style is deprecated and doesn't do anything, don't use */
wxBG_STYLE_COLOUR,
/*
this style is deprecated and is synonymous with
wxBG_STYLE_PAINT, use the new name
*/
wxBG_STYLE_CUSTOM = wxBG_STYLE_PAINT
};
/*
* Key types used by (old style) lists and hashes.
*/
enum wxKeyType
{
wxKEY_NONE,
wxKEY_INTEGER,
wxKEY_STRING
};
/* ---------------------------------------------------------------------------- */
/* standard IDs */
/* ---------------------------------------------------------------------------- */
/* Standard menu IDs */
enum wxStandardID
{
/*
These ids delimit the range used by automatically-generated ids
(i.e. those used when wxID_ANY is specified during construction).
*/
#if defined(__WXMSW__) || wxUSE_AUTOID_MANAGEMENT
/*
On MSW the range is always restricted no matter if id management
is used or not because the native window ids are limited to short
range. On other platforms the range is only restricted if id
management is used so the reference count buffer won't be so big.
*/
wxID_AUTO_LOWEST = -32000,
wxID_AUTO_HIGHEST = -2000,
#else
wxID_AUTO_LOWEST = -1000000,
wxID_AUTO_HIGHEST = -2000,
#endif
/* no id matches this one when compared to it */
wxID_NONE = -3,
/* id for a separator line in the menu (invalid for normal item) */
wxID_SEPARATOR = -2,
/* any id: means that we don't care about the id, whether when installing
* an event handler or when creating a new window */
wxID_ANY = -1,
/* all predefined ids are between wxID_LOWEST and wxID_HIGHEST */
wxID_LOWEST = 4999,
wxID_OPEN,
wxID_CLOSE,
wxID_NEW,
wxID_SAVE,
wxID_SAVEAS,
wxID_REVERT,
wxID_EXIT,
wxID_UNDO,
wxID_REDO,
wxID_HELP,
wxID_PRINT,
wxID_PRINT_SETUP,
wxID_PAGE_SETUP,
wxID_PREVIEW,
wxID_ABOUT,
wxID_HELP_CONTENTS,
wxID_HELP_INDEX,
wxID_HELP_SEARCH,
wxID_HELP_COMMANDS,
wxID_HELP_PROCEDURES,
wxID_HELP_CONTEXT,
wxID_CLOSE_ALL,
wxID_PREFERENCES,
wxID_EDIT = 5030,
wxID_CUT,
wxID_COPY,
wxID_PASTE,
wxID_CLEAR,
wxID_FIND,
wxID_DUPLICATE,
wxID_SELECTALL,
wxID_DELETE,
wxID_REPLACE,
wxID_REPLACE_ALL,
wxID_PROPERTIES,
wxID_VIEW_DETAILS,
wxID_VIEW_LARGEICONS,
wxID_VIEW_SMALLICONS,
wxID_VIEW_LIST,
wxID_VIEW_SORTDATE,
wxID_VIEW_SORTNAME,
wxID_VIEW_SORTSIZE,
wxID_VIEW_SORTTYPE,
wxID_FILE = 5050,
wxID_FILE1,
wxID_FILE2,
wxID_FILE3,
wxID_FILE4,
wxID_FILE5,
wxID_FILE6,
wxID_FILE7,
wxID_FILE8,
wxID_FILE9,
/* Standard button and menu IDs */
wxID_OK = 5100,
wxID_CANCEL,
wxID_APPLY,
wxID_YES,
wxID_NO,
wxID_STATIC,
wxID_FORWARD,
wxID_BACKWARD,
wxID_DEFAULT,
wxID_MORE,
wxID_SETUP,
wxID_RESET,
wxID_CONTEXT_HELP,
wxID_YESTOALL,
wxID_NOTOALL,
wxID_ABORT,
wxID_RETRY,
wxID_IGNORE,
wxID_ADD,
wxID_REMOVE,
wxID_UP,
wxID_DOWN,
wxID_HOME,
wxID_REFRESH,
wxID_STOP,
wxID_INDEX,
wxID_BOLD,
wxID_ITALIC,
wxID_JUSTIFY_CENTER,
wxID_JUSTIFY_FILL,
wxID_JUSTIFY_RIGHT,
wxID_JUSTIFY_LEFT,
wxID_UNDERLINE,
wxID_INDENT,
wxID_UNINDENT,
wxID_ZOOM_100,
wxID_ZOOM_FIT,
wxID_ZOOM_IN,
wxID_ZOOM_OUT,
wxID_UNDELETE,
wxID_REVERT_TO_SAVED,
wxID_CDROM,
wxID_CONVERT,
wxID_EXECUTE,
wxID_FLOPPY,
wxID_HARDDISK,
wxID_BOTTOM,
wxID_FIRST,
wxID_LAST,
wxID_TOP,
wxID_INFO,
wxID_JUMP_TO,
wxID_NETWORK,
wxID_SELECT_COLOR,
wxID_SELECT_FONT,
wxID_SORT_ASCENDING,
wxID_SORT_DESCENDING,
wxID_SPELL_CHECK,
wxID_STRIKETHROUGH,
/* System menu IDs (used by wxUniv): */
wxID_SYSTEM_MENU = 5200,
wxID_CLOSE_FRAME,
wxID_MOVE_FRAME,
wxID_RESIZE_FRAME,
wxID_MAXIMIZE_FRAME,
wxID_ICONIZE_FRAME,
wxID_RESTORE_FRAME,
/* MDI window menu ids */
wxID_MDI_WINDOW_FIRST = 5230,
wxID_MDI_WINDOW_CASCADE = wxID_MDI_WINDOW_FIRST,
wxID_MDI_WINDOW_TILE_HORZ,
wxID_MDI_WINDOW_TILE_VERT,
wxID_MDI_WINDOW_ARRANGE_ICONS,
wxID_MDI_WINDOW_PREV,
wxID_MDI_WINDOW_NEXT,
wxID_MDI_WINDOW_LAST = wxID_MDI_WINDOW_NEXT,
/* OS X system menu ids */
wxID_OSX_MENU_FIRST = 5250,
wxID_OSX_HIDE = wxID_OSX_MENU_FIRST,
wxID_OSX_HIDEOTHERS,
wxID_OSX_SHOWALL,
#if wxABI_VERSION >= 30001
wxID_OSX_SERVICES,
wxID_OSX_MENU_LAST = wxID_OSX_SERVICES,
#else
wxID_OSX_MENU_LAST = wxID_OSX_SHOWALL,
#endif
/* IDs used by generic file dialog (13 consecutive starting from this value) */
wxID_FILEDLGG = 5900,
/* IDs used by generic file ctrl (4 consecutive starting from this value) */
wxID_FILECTRL = 5950,
wxID_HIGHEST = 5999
};
/* ---------------------------------------------------------------------------- */
/* wxWindowID type */
/* ---------------------------------------------------------------------------- */
/*
* wxWindowID used to be just a typedef defined here, now it's a class, but we
* still continue to define it here for compatibility, so that the code using
* it continues to compile even if it includes just wx/defs.h.
*
* Notice that wx/windowid.h can only be included after wxID_XYZ definitions
* (as it uses them).
*/
#if defined(__cplusplus) && wxUSE_GUI
#include "wx/windowid.h"
#endif
/* ---------------------------------------------------------------------------- */
/* other constants */
/* ---------------------------------------------------------------------------- */
/* menu and toolbar item kinds */
enum wxItemKind
{
wxITEM_SEPARATOR = -1,
wxITEM_NORMAL,
wxITEM_CHECK,
wxITEM_RADIO,
wxITEM_DROPDOWN,
wxITEM_MAX
};
/*
* The possible states of a 3-state checkbox (Compatible
* with the 2-state checkbox).
*/
enum wxCheckBoxState
{
wxCHK_UNCHECKED,
wxCHK_CHECKED,
wxCHK_UNDETERMINED /* 3-state checkbox only */
};
/* hit test results */
enum wxHitTest
{
wxHT_NOWHERE,
/* scrollbar */
wxHT_SCROLLBAR_FIRST = wxHT_NOWHERE,
wxHT_SCROLLBAR_ARROW_LINE_1, /* left or upper arrow to scroll by line */
wxHT_SCROLLBAR_ARROW_LINE_2, /* right or down */
wxHT_SCROLLBAR_ARROW_PAGE_1, /* left or upper arrow to scroll by page */
wxHT_SCROLLBAR_ARROW_PAGE_2, /* right or down */
wxHT_SCROLLBAR_THUMB, /* on the thumb */
wxHT_SCROLLBAR_BAR_1, /* bar to the left/above the thumb */
wxHT_SCROLLBAR_BAR_2, /* bar to the right/below the thumb */
wxHT_SCROLLBAR_LAST,
/* window */
wxHT_WINDOW_OUTSIDE, /* not in this window at all */
wxHT_WINDOW_INSIDE, /* in the client area */
wxHT_WINDOW_VERT_SCROLLBAR, /* on the vertical scrollbar */
wxHT_WINDOW_HORZ_SCROLLBAR, /* on the horizontal scrollbar */
wxHT_WINDOW_CORNER, /* on the corner between 2 scrollbars */
wxHT_MAX
};
/* ---------------------------------------------------------------------------- */
/* Possible SetSize flags */
/* ---------------------------------------------------------------------------- */
/* Use internally-calculated width if -1 */
#define wxSIZE_AUTO_WIDTH 0x0001
/* Use internally-calculated height if -1 */
#define wxSIZE_AUTO_HEIGHT 0x0002
/* Use internally-calculated width and height if each is -1 */
#define wxSIZE_AUTO (wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT)
/* Ignore missing (-1) dimensions (use existing). */
/* For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code. */
#define wxSIZE_USE_EXISTING 0x0000
/* Allow -1 as a valid position */
#define wxSIZE_ALLOW_MINUS_ONE 0x0004
/* Don't do parent client adjustments (for implementation only) */
#define wxSIZE_NO_ADJUSTMENTS 0x0008
/* Change the window position even if it seems to be already correct */
#define wxSIZE_FORCE 0x0010
/* Emit size event even if size didn't change */
#define wxSIZE_FORCE_EVENT 0x0020
/* ---------------------------------------------------------------------------- */
/* GDI descriptions */
/* ---------------------------------------------------------------------------- */
// Hatch styles used by both pen and brush styles.
//
// NB: Do not use these constants directly, they're for internal use only, use
// wxBRUSHSTYLE_XXX_HATCH and wxPENSTYLE_XXX_HATCH instead.
enum wxHatchStyle
{
wxHATCHSTYLE_INVALID = -1,
/*
The value of the first style is chosen to fit with
wxDeprecatedGUIConstants values below, don't change it.
*/
wxHATCHSTYLE_FIRST = 111,
wxHATCHSTYLE_BDIAGONAL = wxHATCHSTYLE_FIRST,
wxHATCHSTYLE_CROSSDIAG,
wxHATCHSTYLE_FDIAGONAL,
wxHATCHSTYLE_CROSS,
wxHATCHSTYLE_HORIZONTAL,
wxHATCHSTYLE_VERTICAL,
wxHATCHSTYLE_LAST = wxHATCHSTYLE_VERTICAL
};
/*
WARNING: the following styles are deprecated; use the
wxFontFamily, wxFontStyle, wxFontWeight, wxBrushStyle,
wxPenStyle, wxPenCap, wxPenJoin enum values instead!
*/
/* don't use any elements of this enum in the new code */
enum wxDeprecatedGUIConstants
{
/* Text font families */
wxDEFAULT = 70,
wxDECORATIVE,
wxROMAN,
wxSCRIPT,
wxSWISS,
wxMODERN,
wxTELETYPE, /* @@@@ */
/* Proportional or Fixed width fonts (not yet used) */
wxVARIABLE = 80,
wxFIXED,
wxNORMAL = 90,
wxLIGHT,
wxBOLD,
/* Also wxNORMAL for normal (non-italic text) */
wxITALIC,
wxSLANT,
/* Pen styles */
wxSOLID = 100,
wxDOT,
wxLONG_DASH,
wxSHORT_DASH,
wxDOT_DASH,
wxUSER_DASH,
wxTRANSPARENT,
/* Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! */
/* Note also that stippling a Pen IS meaningful, because a Line is */
wxSTIPPLE_MASK_OPAQUE, /* mask is used for blitting monochrome using text fore and back ground colors */
wxSTIPPLE_MASK, /* mask is used for masking areas in the stipple bitmap (TO DO) */
/* drawn with a Pen, and without any Brush -- and it can be stippled. */
wxSTIPPLE = 110,
wxBDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL,
wxCROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG,
wxFDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL,
wxCROSS_HATCH = wxHATCHSTYLE_CROSS,
wxHORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL,
wxVERTICAL_HATCH = wxHATCHSTYLE_VERTICAL,
wxFIRST_HATCH = wxHATCHSTYLE_FIRST,
wxLAST_HATCH = wxHATCHSTYLE_LAST
};
/* ToolPanel in wxFrame (VZ: unused?) */
enum
{
wxTOOL_TOP = 1,
wxTOOL_BOTTOM,
wxTOOL_LEFT,
wxTOOL_RIGHT
};
/* the values of the format constants should be the same as corresponding */
/* CF_XXX constants in Windows API */
enum wxDataFormatId
{
wxDF_INVALID = 0,
wxDF_TEXT = 1, /* CF_TEXT */
wxDF_BITMAP = 2, /* CF_BITMAP */
wxDF_METAFILE = 3, /* CF_METAFILEPICT */
wxDF_SYLK = 4,
wxDF_DIF = 5,
wxDF_TIFF = 6,
wxDF_OEMTEXT = 7, /* CF_OEMTEXT */
wxDF_DIB = 8, /* CF_DIB */
wxDF_PALETTE = 9,
wxDF_PENDATA = 10,
wxDF_RIFF = 11,
wxDF_WAVE = 12,
wxDF_UNICODETEXT = 13,
wxDF_ENHMETAFILE = 14,
wxDF_FILENAME = 15, /* CF_HDROP */
wxDF_LOCALE = 16,
wxDF_PRIVATE = 20,
wxDF_HTML = 30, /* Note: does not correspond to CF_ constant */
wxDF_MAX
};
/* Key codes */
enum wxKeyCode
{
WXK_NONE = 0,
WXK_CONTROL_A = 1,
WXK_CONTROL_B,
WXK_CONTROL_C,
WXK_CONTROL_D,
WXK_CONTROL_E,
WXK_CONTROL_F,
WXK_CONTROL_G,
WXK_CONTROL_H,
WXK_CONTROL_I,
WXK_CONTROL_J,
WXK_CONTROL_K,
WXK_CONTROL_L,
WXK_CONTROL_M,
WXK_CONTROL_N,
WXK_CONTROL_O,
WXK_CONTROL_P,
WXK_CONTROL_Q,
WXK_CONTROL_R,
WXK_CONTROL_S,
WXK_CONTROL_T,
WXK_CONTROL_U,
WXK_CONTROL_V,
WXK_CONTROL_W,
WXK_CONTROL_X,
WXK_CONTROL_Y,
WXK_CONTROL_Z,
WXK_BACK = 8, /* backspace */
WXK_TAB = 9,
WXK_RETURN = 13,
WXK_ESCAPE = 27,
/* values from 33 to 126 are reserved for the standard ASCII characters */
WXK_SPACE = 32,
WXK_DELETE = 127,
/* values from 128 to 255 are reserved for ASCII extended characters
(note that there isn't a single fixed standard for the meaning
of these values; avoid them in portable apps!) */
/* These are not compatible with unicode characters.
If you want to get a unicode character from a key event, use
wxKeyEvent::GetUnicodeKey */
WXK_START = 300,
WXK_LBUTTON,
WXK_RBUTTON,
WXK_CANCEL,
WXK_MBUTTON,
WXK_CLEAR,
WXK_SHIFT,
WXK_ALT,
WXK_CONTROL,
WXK_MENU,
WXK_PAUSE,
WXK_CAPITAL,
WXK_END,
WXK_HOME,
WXK_LEFT,
WXK_UP,
WXK_RIGHT,
WXK_DOWN,
WXK_SELECT,
WXK_PRINT,
WXK_EXECUTE,
WXK_SNAPSHOT,
WXK_INSERT,
WXK_HELP,
WXK_NUMPAD0,
WXK_NUMPAD1,
WXK_NUMPAD2,
WXK_NUMPAD3,
WXK_NUMPAD4,
WXK_NUMPAD5,
WXK_NUMPAD6,
WXK_NUMPAD7,
WXK_NUMPAD8,
WXK_NUMPAD9,
WXK_MULTIPLY,
WXK_ADD,
WXK_SEPARATOR,
WXK_SUBTRACT,
WXK_DECIMAL,
WXK_DIVIDE,
WXK_F1,
WXK_F2,
WXK_F3,
WXK_F4,
WXK_F5,
WXK_F6,
WXK_F7,
WXK_F8,
WXK_F9,
WXK_F10,
WXK_F11,
WXK_F12,
WXK_F13,
WXK_F14,
WXK_F15,
WXK_F16,
WXK_F17,
WXK_F18,
WXK_F19,
WXK_F20,
WXK_F21,
WXK_F22,
WXK_F23,
WXK_F24,
WXK_NUMLOCK,
WXK_SCROLL,
WXK_PAGEUP,
WXK_PAGEDOWN,
WXK_NUMPAD_SPACE,
WXK_NUMPAD_TAB,
WXK_NUMPAD_ENTER,
WXK_NUMPAD_F1,
WXK_NUMPAD_F2,
WXK_NUMPAD_F3,
WXK_NUMPAD_F4,
WXK_NUMPAD_HOME,
WXK_NUMPAD_LEFT,
WXK_NUMPAD_UP,
WXK_NUMPAD_RIGHT,
WXK_NUMPAD_DOWN,
WXK_NUMPAD_PAGEUP,
WXK_NUMPAD_PAGEDOWN,
WXK_NUMPAD_END,
WXK_NUMPAD_BEGIN,
WXK_NUMPAD_INSERT,
WXK_NUMPAD_DELETE,
WXK_NUMPAD_EQUAL,
WXK_NUMPAD_MULTIPLY,
WXK_NUMPAD_ADD,
WXK_NUMPAD_SEPARATOR,
WXK_NUMPAD_SUBTRACT,
WXK_NUMPAD_DECIMAL,
WXK_NUMPAD_DIVIDE,
WXK_WINDOWS_LEFT,
WXK_WINDOWS_RIGHT,
WXK_WINDOWS_MENU ,
#ifdef __WXOSX__
WXK_RAW_CONTROL,
#else
WXK_RAW_CONTROL = WXK_CONTROL,
#endif
WXK_COMMAND = WXK_CONTROL,
/* Hardware-specific buttons */
WXK_SPECIAL1 = WXK_WINDOWS_MENU + 2, /* Skip WXK_RAW_CONTROL if necessary */
WXK_SPECIAL2,
WXK_SPECIAL3,
WXK_SPECIAL4,
WXK_SPECIAL5,
WXK_SPECIAL6,
WXK_SPECIAL7,
WXK_SPECIAL8,
WXK_SPECIAL9,
WXK_SPECIAL10,
WXK_SPECIAL11,
WXK_SPECIAL12,
WXK_SPECIAL13,
WXK_SPECIAL14,
WXK_SPECIAL15,
WXK_SPECIAL16,
WXK_SPECIAL17,
WXK_SPECIAL18,
WXK_SPECIAL19,
WXK_SPECIAL20,
WXK_BROWSER_BACK,
WXK_BROWSER_FORWARD,
WXK_BROWSER_REFRESH,
WXK_BROWSER_STOP,
WXK_BROWSER_SEARCH,
WXK_BROWSER_FAVORITES,
WXK_BROWSER_HOME,
WXK_VOLUME_MUTE,
WXK_VOLUME_DOWN,
WXK_VOLUME_UP,
WXK_MEDIA_NEXT_TRACK,
WXK_MEDIA_PREV_TRACK,
WXK_MEDIA_STOP,
WXK_MEDIA_PLAY_PAUSE,
WXK_LAUNCH_MAIL,
WXK_LAUNCH_APP1,
WXK_LAUNCH_APP2
};
/* This enum contains bit mask constants used in wxKeyEvent */
enum wxKeyModifier
{
wxMOD_NONE = 0x0000,
wxMOD_ALT = 0x0001,
wxMOD_CONTROL = 0x0002,
wxMOD_ALTGR = wxMOD_ALT | wxMOD_CONTROL,
wxMOD_SHIFT = 0x0004,
wxMOD_META = 0x0008,
wxMOD_WIN = wxMOD_META,
#if defined(__WXMAC__)
wxMOD_RAW_CONTROL = 0x0010,
#else
wxMOD_RAW_CONTROL = wxMOD_CONTROL,
#endif
wxMOD_CMD = wxMOD_CONTROL,
wxMOD_ALL = 0xffff
};
/* Shortcut for easier dialog-unit-to-pixel conversion */
#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
/* Paper types */
enum wxPaperSize
{
wxPAPER_NONE, /* Use specific dimensions */
wxPAPER_LETTER, /* Letter, 8 1/2 by 11 inches */
wxPAPER_LEGAL, /* Legal, 8 1/2 by 14 inches */
wxPAPER_A4, /* A4 Sheet, 210 by 297 millimeters */
wxPAPER_CSHEET, /* C Sheet, 17 by 22 inches */
wxPAPER_DSHEET, /* D Sheet, 22 by 34 inches */
wxPAPER_ESHEET, /* E Sheet, 34 by 44 inches */
wxPAPER_LETTERSMALL, /* Letter Small, 8 1/2 by 11 inches */
wxPAPER_TABLOID, /* Tabloid, 11 by 17 inches */
wxPAPER_LEDGER, /* Ledger, 17 by 11 inches */
wxPAPER_STATEMENT, /* Statement, 5 1/2 by 8 1/2 inches */
wxPAPER_EXECUTIVE, /* Executive, 7 1/4 by 10 1/2 inches */
wxPAPER_A3, /* A3 sheet, 297 by 420 millimeters */
wxPAPER_A4SMALL, /* A4 small sheet, 210 by 297 millimeters */
wxPAPER_A5, /* A5 sheet, 148 by 210 millimeters */
wxPAPER_B4, /* B4 sheet, 250 by 354 millimeters */
wxPAPER_B5, /* B5 sheet, 182-by-257-millimeter paper */
wxPAPER_FOLIO, /* Folio, 8-1/2-by-13-inch paper */
wxPAPER_QUARTO, /* Quarto, 215-by-275-millimeter paper */
wxPAPER_10X14, /* 10-by-14-inch sheet */
wxPAPER_11X17, /* 11-by-17-inch sheet */
wxPAPER_NOTE, /* Note, 8 1/2 by 11 inches */
wxPAPER_ENV_9, /* #9 Envelope, 3 7/8 by 8 7/8 inches */
wxPAPER_ENV_10, /* #10 Envelope, 4 1/8 by 9 1/2 inches */
wxPAPER_ENV_11, /* #11 Envelope, 4 1/2 by 10 3/8 inches */
wxPAPER_ENV_12, /* #12 Envelope, 4 3/4 by 11 inches */
wxPAPER_ENV_14, /* #14 Envelope, 5 by 11 1/2 inches */
wxPAPER_ENV_DL, /* DL Envelope, 110 by 220 millimeters */
wxPAPER_ENV_C5, /* C5 Envelope, 162 by 229 millimeters */
wxPAPER_ENV_C3, /* C3 Envelope, 324 by 458 millimeters */
wxPAPER_ENV_C4, /* C4 Envelope, 229 by 324 millimeters */
wxPAPER_ENV_C6, /* C6 Envelope, 114 by 162 millimeters */
wxPAPER_ENV_C65, /* C65 Envelope, 114 by 229 millimeters */
wxPAPER_ENV_B4, /* B4 Envelope, 250 by 353 millimeters */
wxPAPER_ENV_B5, /* B5 Envelope, 176 by 250 millimeters */
wxPAPER_ENV_B6, /* B6 Envelope, 176 by 125 millimeters */
wxPAPER_ENV_ITALY, /* Italy Envelope, 110 by 230 millimeters */
wxPAPER_ENV_MONARCH, /* Monarch Envelope, 3 7/8 by 7 1/2 inches */
wxPAPER_ENV_PERSONAL, /* 6 3/4 Envelope, 3 5/8 by 6 1/2 inches */
wxPAPER_FANFOLD_US, /* US Std Fanfold, 14 7/8 by 11 inches */
wxPAPER_FANFOLD_STD_GERMAN, /* German Std Fanfold, 8 1/2 by 12 inches */
wxPAPER_FANFOLD_LGL_GERMAN, /* German Legal Fanfold, 8 1/2 by 13 inches */
wxPAPER_ISO_B4, /* B4 (ISO) 250 x 353 mm */
wxPAPER_JAPANESE_POSTCARD, /* Japanese Postcard 100 x 148 mm */
wxPAPER_9X11, /* 9 x 11 in */
wxPAPER_10X11, /* 10 x 11 in */
wxPAPER_15X11, /* 15 x 11 in */
wxPAPER_ENV_INVITE, /* Envelope Invite 220 x 220 mm */
wxPAPER_LETTER_EXTRA, /* Letter Extra 9 \275 x 12 in */
wxPAPER_LEGAL_EXTRA, /* Legal Extra 9 \275 x 15 in */
wxPAPER_TABLOID_EXTRA, /* Tabloid Extra 11.69 x 18 in */
wxPAPER_A4_EXTRA, /* A4 Extra 9.27 x 12.69 in */
wxPAPER_LETTER_TRANSVERSE, /* Letter Transverse 8 \275 x 11 in */
wxPAPER_A4_TRANSVERSE, /* A4 Transverse 210 x 297 mm */
wxPAPER_LETTER_EXTRA_TRANSVERSE, /* Letter Extra Transverse 9\275 x 12 in */
wxPAPER_A_PLUS, /* SuperA/SuperA/A4 227 x 356 mm */
wxPAPER_B_PLUS, /* SuperB/SuperB/A3 305 x 487 mm */
wxPAPER_LETTER_PLUS, /* Letter Plus 8.5 x 12.69 in */
wxPAPER_A4_PLUS, /* A4 Plus 210 x 330 mm */
wxPAPER_A5_TRANSVERSE, /* A5 Transverse 148 x 210 mm */
wxPAPER_B5_TRANSVERSE, /* B5 (JIS) Transverse 182 x 257 mm */
wxPAPER_A3_EXTRA, /* A3 Extra 322 x 445 mm */
wxPAPER_A5_EXTRA, /* A5 Extra 174 x 235 mm */
wxPAPER_B5_EXTRA, /* B5 (ISO) Extra 201 x 276 mm */
wxPAPER_A2, /* A2 420 x 594 mm */
wxPAPER_A3_TRANSVERSE, /* A3 Transverse 297 x 420 mm */
wxPAPER_A3_EXTRA_TRANSVERSE, /* A3 Extra Transverse 322 x 445 mm */
wxPAPER_DBL_JAPANESE_POSTCARD,/* Japanese Double Postcard 200 x 148 mm */
wxPAPER_A6, /* A6 105 x 148 mm */
wxPAPER_JENV_KAKU2, /* Japanese Envelope Kaku #2 */
wxPAPER_JENV_KAKU3, /* Japanese Envelope Kaku #3 */
wxPAPER_JENV_CHOU3, /* Japanese Envelope Chou #3 */
wxPAPER_JENV_CHOU4, /* Japanese Envelope Chou #4 */
wxPAPER_LETTER_ROTATED, /* Letter Rotated 11 x 8 1/2 in */
wxPAPER_A3_ROTATED, /* A3 Rotated 420 x 297 mm */
wxPAPER_A4_ROTATED, /* A4 Rotated 297 x 210 mm */
wxPAPER_A5_ROTATED, /* A5 Rotated 210 x 148 mm */
wxPAPER_B4_JIS_ROTATED, /* B4 (JIS) Rotated 364 x 257 mm */
wxPAPER_B5_JIS_ROTATED, /* B5 (JIS) Rotated 257 x 182 mm */
wxPAPER_JAPANESE_POSTCARD_ROTATED,/* Japanese Postcard Rotated 148 x 100 mm */
wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED,/* Double Japanese Postcard Rotated 148 x 200 mm */
wxPAPER_A6_ROTATED, /* A6 Rotated 148 x 105 mm */
wxPAPER_JENV_KAKU2_ROTATED, /* Japanese Envelope Kaku #2 Rotated */
wxPAPER_JENV_KAKU3_ROTATED, /* Japanese Envelope Kaku #3 Rotated */
wxPAPER_JENV_CHOU3_ROTATED, /* Japanese Envelope Chou #3 Rotated */
wxPAPER_JENV_CHOU4_ROTATED, /* Japanese Envelope Chou #4 Rotated */
wxPAPER_B6_JIS, /* B6 (JIS) 128 x 182 mm */
wxPAPER_B6_JIS_ROTATED, /* B6 (JIS) Rotated 182 x 128 mm */
wxPAPER_12X11, /* 12 x 11 in */
wxPAPER_JENV_YOU4, /* Japanese Envelope You #4 */
wxPAPER_JENV_YOU4_ROTATED, /* Japanese Envelope You #4 Rotated */
wxPAPER_P16K, /* PRC 16K 146 x 215 mm */
wxPAPER_P32K, /* PRC 32K 97 x 151 mm */
wxPAPER_P32KBIG, /* PRC 32K(Big) 97 x 151 mm */
wxPAPER_PENV_1, /* PRC Envelope #1 102 x 165 mm */
wxPAPER_PENV_2, /* PRC Envelope #2 102 x 176 mm */
wxPAPER_PENV_3, /* PRC Envelope #3 125 x 176 mm */
wxPAPER_PENV_4, /* PRC Envelope #4 110 x 208 mm */
wxPAPER_PENV_5, /* PRC Envelope #5 110 x 220 mm */
wxPAPER_PENV_6, /* PRC Envelope #6 120 x 230 mm */
wxPAPER_PENV_7, /* PRC Envelope #7 160 x 230 mm */
wxPAPER_PENV_8, /* PRC Envelope #8 120 x 309 mm */
wxPAPER_PENV_9, /* PRC Envelope #9 229 x 324 mm */
wxPAPER_PENV_10, /* PRC Envelope #10 324 x 458 mm */
wxPAPER_P16K_ROTATED, /* PRC 16K Rotated */
wxPAPER_P32K_ROTATED, /* PRC 32K Rotated */
wxPAPER_P32KBIG_ROTATED, /* PRC 32K(Big) Rotated */
wxPAPER_PENV_1_ROTATED, /* PRC Envelope #1 Rotated 165 x 102 mm */
wxPAPER_PENV_2_ROTATED, /* PRC Envelope #2 Rotated 176 x 102 mm */
wxPAPER_PENV_3_ROTATED, /* PRC Envelope #3 Rotated 176 x 125 mm */
wxPAPER_PENV_4_ROTATED, /* PRC Envelope #4 Rotated 208 x 110 mm */
wxPAPER_PENV_5_ROTATED, /* PRC Envelope #5 Rotated 220 x 110 mm */
wxPAPER_PENV_6_ROTATED, /* PRC Envelope #6 Rotated 230 x 120 mm */
wxPAPER_PENV_7_ROTATED, /* PRC Envelope #7 Rotated 230 x 160 mm */
wxPAPER_PENV_8_ROTATED, /* PRC Envelope #8 Rotated 309 x 120 mm */
wxPAPER_PENV_9_ROTATED, /* PRC Envelope #9 Rotated 324 x 229 mm */
wxPAPER_PENV_10_ROTATED, /* PRC Envelope #10 Rotated 458 x 324 m */
wxPAPER_A0, /* A0 Sheet 841 x 1189 mm */
wxPAPER_A1 /* A1 Sheet 594 x 841 mm */
};
/* Printing orientation */
enum wxPrintOrientation
{
wxPORTRAIT = 1,
wxLANDSCAPE
};
/* Duplex printing modes
*/
enum wxDuplexMode
{
wxDUPLEX_SIMPLEX, /* Non-duplex */
wxDUPLEX_HORIZONTAL,
wxDUPLEX_VERTICAL
};
/* Print quality.
*/
#define wxPRINT_QUALITY_HIGH -1
#define wxPRINT_QUALITY_MEDIUM -2
#define wxPRINT_QUALITY_LOW -3
#define wxPRINT_QUALITY_DRAFT -4
typedef int wxPrintQuality;
/* Print mode (currently PostScript only)
*/
enum wxPrintMode
{
wxPRINT_MODE_NONE = 0,
wxPRINT_MODE_PREVIEW = 1, /* Preview in external application */
wxPRINT_MODE_FILE = 2, /* Print to file */
wxPRINT_MODE_PRINTER = 3, /* Send to printer */
wxPRINT_MODE_STREAM = 4 /* Send postscript data into a stream */
};
/* ---------------------------------------------------------------------------- */
/* UpdateWindowUI flags */
/* ---------------------------------------------------------------------------- */
enum wxUpdateUI
{
wxUPDATE_UI_NONE = 0x0000,
wxUPDATE_UI_RECURSE = 0x0001,
wxUPDATE_UI_FROMIDLE = 0x0002 /* Invoked from On(Internal)Idle */
};
/* ---------------------------------------------------------------------------- */
/* wxList types */
/* ---------------------------------------------------------------------------- */
/* type of compare function for list sort operation (as in 'qsort'): it should
return a negative value, 0 or positive value if the first element is less
than, equal or greater than the second */
typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2);
/* wxList iterator function */
typedef int (* LINKAGEMODE wxListIterateFunction)(void *current);
/* ---------------------------------------------------------------------------- */
/* miscellaneous */
/* ---------------------------------------------------------------------------- */
/* define this macro if font handling is done using the X font names */
#if (defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__X__)
#define _WX_X_FONTLIKE
#endif
/* macro to specify "All Files" on different platforms */
#if defined(__WXMSW__)
# define wxALL_FILES_PATTERN wxT("*.*")
# define wxALL_FILES gettext_noop("All files (*.*)|*.*")
#else
# define wxALL_FILES_PATTERN wxT("*")
# define wxALL_FILES gettext_noop("All files (*)|*")
#endif
#if defined(__CYGWIN__) && defined(__WXMSW__)
# if wxUSE_STD_CONTAINERS || defined(wxUSE_STD_STRING)
/*
NASTY HACK because the gethostname in sys/unistd.h which the gnu
stl includes and wx builds with by default clash with each other
(windows version 2nd param is int, sys/unistd.h version is unsigned
int).
*/
# define gethostname gethostnameHACK
# include <unistd.h>
# undef gethostname
# endif
#endif
/* --------------------------------------------------------------------------- */
/* macros that enable wxWidgets apps to be compiled in absence of the */
/* system headers, although some platform specific types are used in the */
/* platform specific (implementation) parts of the headers */
/* --------------------------------------------------------------------------- */
#ifdef __DARWIN__
#define DECLARE_WXOSX_OPAQUE_CFREF( name ) typedef struct __##name* name##Ref;
#define DECLARE_WXOSX_OPAQUE_CONST_CFREF( name ) typedef const struct __##name* name##Ref;
#endif
#ifdef __WXMAC__
#define WX_OPAQUE_TYPE( name ) struct wxOpaque##name
typedef void* WXHCURSOR;
typedef void* WXRECTPTR;
typedef void* WXPOINTPTR;
typedef void* WXHWND;
typedef void* WXEVENTREF;
typedef void* WXEVENTHANDLERREF;
typedef void* WXEVENTHANDLERCALLREF;
typedef void* WXAPPLEEVENTREF;
typedef unsigned int WXUINT;
typedef unsigned long WXDWORD;
typedef unsigned short WXWORD;
typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ;
typedef void* WXDisplay;
/*
* core frameworks
*/
typedef const void * CFTypeRef;
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFData )
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFString )
typedef struct __CFString * CFMutableStringRef;
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFDictionary )
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFArray )
typedef struct __CFArray * CFMutableArrayRef;
DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopSource )
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFont )
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFontDescriptor )
#define DECLARE_WXOSX_OPAQUE_CGREF( name ) typedef struct name* name##Ref;
DECLARE_WXOSX_OPAQUE_CGREF( CGColor )
DECLARE_WXOSX_OPAQUE_CGREF( CGImage )
DECLARE_WXOSX_OPAQUE_CGREF( CGContext )
DECLARE_WXOSX_OPAQUE_CGREF( CGFont )
typedef CGColorRef WXCOLORREF;
typedef CGImageRef WXCGIMAGEREF;
typedef CGContextRef WXHDC;
typedef CGContextRef WXHBITMAP;
/*
* carbon
*/
typedef const struct __HIShape * HIShapeRef;
typedef struct __HIShape * HIMutableShapeRef;
#define DECLARE_WXMAC_OPAQUE_REF( name ) typedef struct Opaque##name* name;
DECLARE_WXMAC_OPAQUE_REF( PasteboardRef )
DECLARE_WXMAC_OPAQUE_REF( IconRef )
DECLARE_WXMAC_OPAQUE_REF( MenuRef )
typedef IconRef WXHICON ;
typedef HIShapeRef WXHRGN;
#endif // __WXMAC__
#if defined(__WXMAC__)
/* Definitions of 32-bit/64-bit types
* These are typedef'd exactly the same way in newer OS X headers so
* redefinition when real headers are included should not be a problem. If
* it is, the types are being defined wrongly here.
* The purpose of these types is so they can be used from public wx headers.
* and also because the older (pre-Leopard) headers don't define them.
*/
/* NOTE: We don't pollute namespace with CGFLOAT_MIN/MAX/IS_DOUBLE macros
* since they are unlikely to be needed in a public header.
*/
#if defined(__LP64__) && __LP64__
typedef double CGFloat;
#else
typedef float CGFloat;
#endif
#if (defined(__LP64__) && __LP64__) || (defined(NS_BUILD_32_LIKE_64) && NS_BUILD_32_LIKE_64)
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
/* Objective-C type declarations.
* These are to be used in public headers in lieu of NSSomething* because
* Objective-C class names are not available in C/C++ code.
*/
/* NOTE: This ought to work with other compilers too, but I'm being cautious */
#if (defined(__GNUC__) && defined(__APPLE__))
/* It's desirable to have type safety for Objective-C(++) code as it does
at least catch typos of method names among other things. However, it
is not possible to declare an Objective-C class from plain old C or C++
code. Furthermore, because of C++ name mangling, the type name must
be the same for both C++ and Objective-C++ code. Therefore, we define
what should be a pointer to an Objective-C class as a pointer to a plain
old C struct with the same name. Unfortunately, because the compiler
does not see a struct as an Objective-C class we cannot declare it
as a struct in Objective-C(++) mode.
*/
#if defined(__OBJC__)
#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \
@class klass; \
typedef klass *WX_##klass
#else /* not defined(__OBJC__) */
#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \
typedef struct klass *WX_##klass
#endif /* defined(__OBJC__) */
#else /* not Apple's gcc */
#warning "Objective-C types will not be checked by the compiler."
/* NOTE: typedef struct objc_object *id; */
/* IOW, we're declaring these using the id type without using that name, */
/* since "id" is used extensively not only within wxWidgets itself, but */
/* also in wxWidgets application code. The following works fine when */
/* compiling C(++) code, and works without typesafety for Obj-C(++) code */
#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \
typedef struct objc_object *WX_##klass
#endif /* (defined(__GNUC__) && defined(__APPLE__)) */
DECLARE_WXCOCOA_OBJC_CLASS(NSArray);
DECLARE_WXCOCOA_OBJC_CLASS(NSData);
DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray);
DECLARE_WXCOCOA_OBJC_CLASS(NSString);
#if wxOSX_USE_COCOA
DECLARE_WXCOCOA_OBJC_CLASS(NSApplication);
DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep);
DECLARE_WXCOCOA_OBJC_CLASS(NSBox);
DECLARE_WXCOCOA_OBJC_CLASS(NSButton);
DECLARE_WXCOCOA_OBJC_CLASS(NSColor);
DECLARE_WXCOCOA_OBJC_CLASS(NSColorPanel);
DECLARE_WXCOCOA_OBJC_CLASS(NSControl);
DECLARE_WXCOCOA_OBJC_CLASS(NSCursor);
DECLARE_WXCOCOA_OBJC_CLASS(NSEvent);
DECLARE_WXCOCOA_OBJC_CLASS(NSFont);
DECLARE_WXCOCOA_OBJC_CLASS(NSFontDescriptor);
DECLARE_WXCOCOA_OBJC_CLASS(NSFontPanel);
DECLARE_WXCOCOA_OBJC_CLASS(NSImage);
DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager);
DECLARE_WXCOCOA_OBJC_CLASS(NSMenu);
DECLARE_WXCOCOA_OBJC_CLASS(NSMenuExtra);
DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem);
DECLARE_WXCOCOA_OBJC_CLASS(NSNotification);
DECLARE_WXCOCOA_OBJC_CLASS(NSObject);
DECLARE_WXCOCOA_OBJC_CLASS(NSPanel);
DECLARE_WXCOCOA_OBJC_CLASS(NSResponder);
DECLARE_WXCOCOA_OBJC_CLASS(NSScrollView);
DECLARE_WXCOCOA_OBJC_CLASS(NSSound);
DECLARE_WXCOCOA_OBJC_CLASS(NSStatusItem);
DECLARE_WXCOCOA_OBJC_CLASS(NSTableColumn);
DECLARE_WXCOCOA_OBJC_CLASS(NSTableView);
DECLARE_WXCOCOA_OBJC_CLASS(NSTextContainer);
DECLARE_WXCOCOA_OBJC_CLASS(NSTextField);
DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage);
DECLARE_WXCOCOA_OBJC_CLASS(NSThread);
DECLARE_WXCOCOA_OBJC_CLASS(NSWindow);
DECLARE_WXCOCOA_OBJC_CLASS(NSView);
DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext);
DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLPixelFormat);
DECLARE_WXCOCOA_OBJC_CLASS(NSPrintInfo);
DECLARE_WXCOCOA_OBJC_CLASS(NSGestureRecognizer);
DECLARE_WXCOCOA_OBJC_CLASS(NSPanGestureRecognizer);
DECLARE_WXCOCOA_OBJC_CLASS(NSMagnificationGestureRecognizer);
DECLARE_WXCOCOA_OBJC_CLASS(NSRotationGestureRecognizer);
DECLARE_WXCOCOA_OBJC_CLASS(NSPressGestureRecognizer);
DECLARE_WXCOCOA_OBJC_CLASS(NSTouch);
DECLARE_WXCOCOA_OBJC_CLASS(NSPasteboard);
typedef WX_NSWindow WXWindow;
typedef WX_NSView WXWidget;
typedef WX_NSImage WXImage;
typedef WX_NSMenu WXHMENU;
typedef WX_NSOpenGLPixelFormat WXGLPixelFormat;
typedef WX_NSOpenGLContext WXGLContext;
typedef WX_NSPasteboard OSXPasteboard;
#elif wxOSX_USE_IPHONE
DECLARE_WXCOCOA_OBJC_CLASS(UIWindow);
DECLARE_WXCOCOA_OBJC_CLASS(UImage);
DECLARE_WXCOCOA_OBJC_CLASS(UIView);
DECLARE_WXCOCOA_OBJC_CLASS(UIFont);
DECLARE_WXCOCOA_OBJC_CLASS(UIImage);
DECLARE_WXCOCOA_OBJC_CLASS(UIEvent);
DECLARE_WXCOCOA_OBJC_CLASS(NSSet);
DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext);
DECLARE_WXCOCOA_OBJC_CLASS(UIWebView);
DECLARE_WXCOCOA_OBJC_CLASS(UIPasteboard);
typedef WX_UIWindow WXWindow;
typedef WX_UIView WXWidget;
typedef WX_UIImage WXImage;
typedef WX_EAGLContext WXGLContext;
typedef WX_NSString WXGLPixelFormat;
typedef WX_UIWebView OSXWebViewPtr;
typedef WX_UIPasteboard OSXPasteboard;
#endif
#if wxOSX_USE_COCOA_OR_CARBON
DECLARE_WXCOCOA_OBJC_CLASS(WebView);
typedef WX_WebView OSXWebViewPtr;
#endif
#endif /* __WXMAC__ */
/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
#if defined(__WIN32__)
/* Stand-ins for Windows types to avoid #including all of windows.h */
#ifndef NO_STRICT
#define WX_MSW_DECLARE_HANDLE(type) typedef struct type##__ * WX##type
#else
#define WX_MSW_DECLARE_HANDLE(type) typedef void * WX##type
#endif
typedef void* WXHANDLE;
WX_MSW_DECLARE_HANDLE(HWND);
WX_MSW_DECLARE_HANDLE(HICON);
WX_MSW_DECLARE_HANDLE(HFONT);
WX_MSW_DECLARE_HANDLE(HMENU);
WX_MSW_DECLARE_HANDLE(HPEN);
WX_MSW_DECLARE_HANDLE(HBRUSH);
WX_MSW_DECLARE_HANDLE(HPALETTE);
WX_MSW_DECLARE_HANDLE(HCURSOR);
WX_MSW_DECLARE_HANDLE(HRGN);
WX_MSW_DECLARE_HANDLE(RECTPTR);
WX_MSW_DECLARE_HANDLE(HACCEL);
WX_MSW_DECLARE_HANDLE(HINSTANCE);
WX_MSW_DECLARE_HANDLE(HBITMAP);
WX_MSW_DECLARE_HANDLE(HIMAGELIST);
WX_MSW_DECLARE_HANDLE(HGLOBAL);
WX_MSW_DECLARE_HANDLE(HDC);
typedef WXHINSTANCE WXHMODULE;
#undef WX_MSW_DECLARE_HANDLE
typedef unsigned int WXUINT;
typedef unsigned long WXDWORD;
typedef unsigned short WXWORD;
typedef unsigned long WXCOLORREF;
typedef void * WXRGNDATA;
typedef struct tagMSG WXMSG;
typedef void * WXHCONV;
typedef void * WXHKEY;
typedef void * WXHTREEITEM;
typedef void * WXDRAWITEMSTRUCT;
typedef void * WXMEASUREITEMSTRUCT;
typedef void * WXLPCREATESTRUCT;
#ifdef __WXMSW__
typedef WXHWND WXWidget;
#endif
#ifdef __WIN64__
typedef wxUint64 WXWPARAM;
typedef wxInt64 WXLPARAM;
typedef wxInt64 WXLRESULT;
#else
typedef wxW64 unsigned int WXWPARAM;
typedef wxW64 long WXLPARAM;
typedef wxW64 long WXLRESULT;
#endif
/*
This is defined for compatibility only, it's not really the same thing as
FARPROC.
*/
#if defined(__GNUWIN32__)
typedef int (*WXFARPROC)();
#else
typedef int (__stdcall *WXFARPROC)();
#endif
typedef WXLRESULT (wxSTDCALL *WXWNDPROC)(WXHWND, WXUINT, WXWPARAM, WXLPARAM);
#endif /* __WIN32__ */
#if defined(__WXMOTIF__) || defined(__WXX11__)
/* Stand-ins for X/Xt/Motif types */
typedef void* WXWindow;
typedef void* WXWidget;
typedef void* WXAppContext;
typedef void* WXColormap;
typedef void* WXColor;
typedef void WXDisplay;
typedef void WXEvent;
typedef void* WXCursor;
typedef void* WXPixmap;
typedef void* WXFontStructPtr;
typedef void* WXGC;
typedef void* WXRegion;
typedef void* WXFont;
typedef void* WXImage;
typedef void* WXFontList;
typedef void* WXFontSet;
typedef void* WXRendition;
typedef void* WXRenderTable;
typedef void* WXFontType; /* either a XmFontList or XmRenderTable */
typedef void* WXString;
typedef unsigned long Atom; /* this might fail on a few architectures */
typedef long WXPixel; /* safety catch in src/motif/colour.cpp */
#endif /* Motif */
#ifdef __WXGTK__
/* Stand-ins for GLIB types */
typedef struct _GSList GSList;
/* Stand-ins for GDK types */
typedef struct _GdkColor GdkColor;
typedef struct _GdkCursor GdkCursor;
typedef struct _GdkDragContext GdkDragContext;
#if defined(__WXGTK20__)
typedef struct _GdkAtom* GdkAtom;
#else
typedef unsigned long GdkAtom;
#endif
#if !defined(__WXGTK3__)
typedef struct _GdkColormap GdkColormap;
typedef struct _GdkFont GdkFont;
typedef struct _GdkGC GdkGC;
typedef struct _GdkRegion GdkRegion;
#endif
#if defined(__WXGTK3__)
typedef struct _GdkWindow GdkWindow;
typedef struct _GdkEventSequence GdkEventSequence;
#elif defined(__WXGTK20__)
typedef struct _GdkDrawable GdkWindow;
typedef struct _GdkDrawable GdkPixmap;
#else
typedef struct _GdkWindow GdkWindow;
typedef struct _GdkWindow GdkBitmap;
typedef struct _GdkWindow GdkPixmap;
#endif
/* Stand-ins for GTK types */
typedef struct _GtkWidget GtkWidget;
typedef struct _GtkRcStyle GtkRcStyle;
typedef struct _GtkAdjustment GtkAdjustment;
typedef struct _GtkToolbar GtkToolbar;
typedef struct _GtkNotebook GtkNotebook;
typedef struct _GtkNotebookPage GtkNotebookPage;
typedef struct _GtkAccelGroup GtkAccelGroup;
typedef struct _GtkSelectionData GtkSelectionData;
typedef struct _GtkTextBuffer GtkTextBuffer;
typedef struct _GtkRange GtkRange;
typedef struct _GtkCellRenderer GtkCellRenderer;
typedef GtkWidget *WXWidget;
#ifndef __WXGTK20__
#define GTK_OBJECT_GET_CLASS(object) (GTK_OBJECT(object)->klass)
#define GTK_CLASS_TYPE(klass) ((klass)->type)
#endif
#endif /* __WXGTK__ */
#if defined(__WXGTK20__) || (defined(__WXX11__) && wxUSE_UNICODE)
#define wxUSE_PANGO 1
#else
#define wxUSE_PANGO 0
#endif
#if wxUSE_PANGO
/* Stand-ins for Pango types */
typedef struct _PangoContext PangoContext;
typedef struct _PangoLayout PangoLayout;
typedef struct _PangoFontDescription PangoFontDescription;
#endif
#ifdef __WXDFB__
/* DirectFB doesn't have the concept of non-TLW window, so use
something arbitrary */
typedef const void* WXWidget;
#endif /* DFB */
#ifdef __WXQT__
#include "wx/qt/defs.h"
#endif
/* include the feature test macros */
#include "wx/features.h"
/* --------------------------------------------------------------------------- */
/* macros to define a class without copy ctor nor assignment operator */
/* --------------------------------------------------------------------------- */
#define wxDECLARE_NO_COPY_CLASS(classname) \
private: \
classname(const classname&); \
classname& operator=(const classname&)
#define wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \
private: \
classname(const classname<arg>&); \
classname& operator=(const classname<arg>&)
#define wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(classname, arg1, arg2) \
private: \
classname(const classname<arg1, arg2>&); \
classname& operator=(const classname<arg1, arg2>&)
#define wxDECLARE_NO_ASSIGN_CLASS(classname) \
private: \
classname& operator=(const classname&)
/* deprecated variants _not_ requiring a semicolon after them */
#define DECLARE_NO_COPY_CLASS(classname) \
wxDECLARE_NO_COPY_CLASS(classname);
#define DECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \
wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg);
#define DECLARE_NO_ASSIGN_CLASS(classname) \
wxDECLARE_NO_ASSIGN_CLASS(classname);
/* --------------------------------------------------------------------------- */
/* If a manifest is being automatically generated, add common controls 6 to it */
/* --------------------------------------------------------------------------- */
#if wxUSE_GUI && \
(!defined wxUSE_NO_MANIFEST || wxUSE_NO_MANIFEST == 0 ) && \
( defined _MSC_FULL_VER && _MSC_FULL_VER >= 140040130 )
#define WX_CC_MANIFEST(cpu) \
"/manifestdependency:\"type='win32' \
name='Microsoft.Windows.Common-Controls' \
version='6.0.0.0' \
processorArchitecture='" cpu "' \
publicKeyToken='6595b64144ccf1df' \
language='*'\""
#if defined _M_IX86
#pragma comment(linker, WX_CC_MANIFEST("x86"))
#elif defined _M_X64
#pragma comment(linker, WX_CC_MANIFEST("amd64"))
#elif defined _M_ARM64
#pragma comment(linker, WX_CC_MANIFEST("arm64"))
#elif defined _M_IA64
#pragma comment(linker, WX_CC_MANIFEST("ia64"))
#else
#pragma comment(linker, WX_CC_MANIFEST("*"))
#endif
#endif /* !wxUSE_NO_MANIFEST && _MSC_FULL_VER >= 140040130 */
/* wxThread and wxProcess priorities */
enum
{
wxPRIORITY_MIN = 0u, /* lowest possible priority */
wxPRIORITY_DEFAULT = 50u, /* normal priority */
wxPRIORITY_MAX = 100u /* highest possible priority */
};
#endif
/* _WX_DEFS_H_ */
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/checklst.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/checklst.h
// Purpose: wxCheckListBox class interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 12.09.00
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CHECKLST_H_BASE_
#define _WX_CHECKLST_H_BASE_
#include "wx/defs.h"
#if wxUSE_CHECKLISTBOX
#include "wx/listbox.h"
// ----------------------------------------------------------------------------
// wxCheckListBox: a listbox whose items may be checked
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCheckListBoxBase : public wxListBox
{
public:
wxCheckListBoxBase() { }
// check list box specific methods
virtual bool IsChecked(unsigned int item) const = 0;
virtual void Check(unsigned int item, bool check = true) = 0;
virtual unsigned int GetCheckedItems(wxArrayInt& checkedItems) const;
wxDECLARE_NO_COPY_CLASS(wxCheckListBoxBase);
};
#if defined(__WXUNIVERSAL__)
#include "wx/univ/checklst.h"
#elif defined(__WXMSW__)
#include "wx/msw/checklst.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/checklst.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/checklst.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/checklst.h"
#elif defined(__WXMAC__)
#include "wx/osx/checklst.h"
#elif defined(__WXQT__)
#include "wx/qt/checklst.h"
#endif
#endif // wxUSE_CHECKLISTBOX
#endif
// _WX_CHECKLST_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/secretstore.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/secretstore.h
// Purpose: Storing and retrieving secrets using OS-provided facilities.
// Author: Vadim Zeitlin
// Created: 2016-05-27
// Copyright: (c) 2016 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SECRETSTORE_H_
#define _WX_SECRETSTORE_H_
#include "wx/defs.h"
#if wxUSE_SECRETSTORE
#include "wx/string.h"
// Initial version of wxSecretStore required passing user name to Load(), which
// didn't make much sense without support for multiple usernames per service,
// so the API was changed to load the username too. Test for this symbol to
// distinguish between the old and the new API, it wasn't defined before the
// API change.
#define wxHAS_SECRETSTORE_LOAD_USERNAME
class wxSecretStoreImpl;
class wxSecretValueImpl;
// ----------------------------------------------------------------------------
// Represents a secret value, e.g. a password string.
// ----------------------------------------------------------------------------
// This is an immutable value-like class which tries to ensure that the secret
// value will be wiped out from memory once it's not needed any more.
class WXDLLIMPEXP_BASE wxSecretValue
{
public:
// Creates an empty secret value (not the same as an empty password).
wxSecretValue() : m_impl(NULL) { }
// Creates a secret value from the given data.
wxSecretValue(size_t size, const void *data)
: m_impl(NewImpl(size, data))
{
}
// Creates a secret value from string.
explicit wxSecretValue(const wxString& secret)
{
const wxScopedCharBuffer buf(secret.utf8_str());
m_impl = NewImpl(buf.length(), buf.data());
}
wxSecretValue(const wxSecretValue& other);
wxSecretValue& operator=(const wxSecretValue& other);
~wxSecretValue();
// Check if a secret is not empty.
bool IsOk() const { return m_impl != NULL; }
// Compare with another secret.
bool operator==(const wxSecretValue& other) const;
bool operator!=(const wxSecretValue& other) const
{
return !(*this == other);
}
// Get the size, in bytes, of the secret data.
size_t GetSize() const;
// Get read-only access to the secret data.
//
// Don't assume it is NUL-terminated, use GetSize() instead.
const void *GetData() const;
// Get the secret data as a string.
//
// Notice that you may want to overwrite the string contents after using it
// by calling WipeString().
wxString GetAsString(const wxMBConv& conv = wxConvWhateverWorks) const;
// Erase the given area of memory overwriting its presumably sensitive
// content.
static void Wipe(size_t size, void *data);
// Overwrite the contents of the given wxString.
static void WipeString(wxString& str);
private:
// This method is implemented in platform-specific code and must return a
// new heap-allocated object initialized with the given data.
static wxSecretValueImpl* NewImpl(size_t size, const void *data);
// This ctor is only used by wxSecretStore and takes ownership of the
// provided existing impl pointer.
explicit wxSecretValue(wxSecretValueImpl* impl) : m_impl(impl) { }
wxSecretValueImpl* m_impl;
friend class wxSecretStore;
};
// ----------------------------------------------------------------------------
// A collection of secrets, sometimes called a key chain.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxSecretStore
{
public:
// Returns the default secrets collection to use.
//
// Currently this is the only way to create a secret store object. In the
// future we could add more factory functions to e.g. create non-persistent
// stores or allow creating stores corresponding to the native facilities
// being used (e.g. specify schema name under Linux or a SecKeychainRef
// under OS X).
static wxSecretStore GetDefault();
// This class has no default ctor, use GetDefault() instead.
// But it can be copied, a copy refers to the same store as the original.
wxSecretStore(const wxSecretStore& store);
// Dtor is not virtual, this class is not supposed to be derived from.
~wxSecretStore();
// Check if this object is valid.
bool IsOk() const { return m_impl != NULL; }
// Store a username/password combination.
//
// The service name should be user readable and unique.
//
// If a secret with the same service name already exists, it will be
// overwritten with the new value.
//
// Returns false after logging an error message if an error occurs,
// otherwise returns true indicating that the secret has been stored.
bool Save(const wxString& service,
const wxString& username,
const wxSecretValue& password);
// Look up the username/password for the given service.
//
// If no username/password is found for the given service, false is
// returned.
//
// Otherwise the function returns true and updates the provided user name
// and password arguments.
bool Load(const wxString& service,
wxString& username,
wxSecretValue& password) const;
// Delete a previously stored username/password combination.
//
// If anything was deleted, returns true. Otherwise returns false and
// logs an error if any error other than not finding any matches occurred.
bool Delete(const wxString& service);
private:
// Ctor takes ownership of the passed pointer.
explicit wxSecretStore(wxSecretStoreImpl* impl) : m_impl(impl) { }
wxSecretStoreImpl* const m_impl;
};
#endif // wxUSE_SECRETSTORE
#endif // _WX_SECRETSTORE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/gdiobj.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/gdiobj.h
// Purpose: wxGDIObject base header
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GDIOBJ_H_BASE_
#define _WX_GDIOBJ_H_BASE_
#include "wx/object.h"
// ----------------------------------------------------------------------------
// wxGDIRefData is the base class for wxXXXData structures which contain the
// real data for the GDI object and are shared among all wxWin objects sharing
// the same native GDI object
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGDIRefData : public wxObjectRefData
{
public:
// Default ctor which needs to be defined just because we use
// wxDECLARE_NO_COPY_CLASS() below.
wxGDIRefData() { }
// override this in the derived classes to check if this data object is
// really fully initialized
virtual bool IsOk() const { return true; }
private:
wxDECLARE_NO_COPY_CLASS(wxGDIRefData);
};
// ----------------------------------------------------------------------------
// wxGDIObject: base class for bitmaps, pens, brushes, ...
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGDIObject : public wxObject
{
public:
// checks if the object can be used
virtual bool IsOk() const
{
// the cast here is safe because the derived classes always create
// wxGDIRefData objects
return m_refData && static_cast<wxGDIRefData *>(m_refData)->IsOk();
}
// don't use in the new code, use IsOk() instead
bool IsNull() const { return m_refData == NULL; }
// older version, for backwards compatibility only (but not deprecated
// because it's still widely used)
bool Ok() const { return IsOk(); }
#if defined(__WXMSW__)
// Creates the resource
virtual bool RealizeResource() { return false; }
// Frees the resource
virtual bool FreeResource(bool WXUNUSED(force) = false) { return false; }
virtual bool IsFree() const { return false; }
// Returns handle.
virtual WXHANDLE GetResourceHandle() const { return 0; }
#endif // defined(__WXMSW__)
protected:
// replace base class functions using wxObjectRefData with our own which
// use wxGDIRefData to ensure that we always work with data objects of the
// correct type (i.e. derived from wxGDIRefData)
virtual wxObjectRefData *CreateRefData() const wxOVERRIDE
{
return CreateGDIRefData();
}
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE
{
return CloneGDIRefData(static_cast<const wxGDIRefData *>(data));
}
virtual wxGDIRefData *CreateGDIRefData() const = 0;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const = 0;
wxDECLARE_DYNAMIC_CLASS(wxGDIObject);
};
#endif // _WX_GDIOBJ_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/listbox.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/listbox.h
// Purpose: wxListBox class interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 22.10.99
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LISTBOX_H_BASE_
#define _WX_LISTBOX_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_LISTBOX
#include "wx/ctrlsub.h" // base class
// forward declarations are enough here
class WXDLLIMPEXP_FWD_BASE wxArrayInt;
class WXDLLIMPEXP_FWD_BASE wxArrayString;
// ----------------------------------------------------------------------------
// global data
// ----------------------------------------------------------------------------
extern WXDLLIMPEXP_DATA_CORE(const char) wxListBoxNameStr[];
// ----------------------------------------------------------------------------
// wxListBox interface is defined by the class wxListBoxBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxListBoxBase : public wxControlWithItems
{
public:
wxListBoxBase() { }
virtual ~wxListBoxBase();
void InsertItems(unsigned int nItems, const wxString *items, unsigned int pos)
{ Insert(nItems, items, pos); }
void InsertItems(const wxArrayString& items, unsigned int pos)
{ Insert(items, pos); }
// multiple selection logic
virtual bool IsSelected(int n) const = 0;
virtual void SetSelection(int n) wxOVERRIDE;
void SetSelection(int n, bool select) { DoSetSelection(n, select); }
void Deselect(int n) { DoSetSelection(n, false); }
void DeselectAll(int itemToLeaveSelected = -1);
virtual bool SetStringSelection(const wxString& s, bool select);
virtual bool SetStringSelection(const wxString& s)
{
return SetStringSelection(s, true);
}
// works for single as well as multiple selection listboxes (unlike
// GetSelection which only works for listboxes with single selection)
virtual int GetSelections(wxArrayInt& aSelections) const = 0;
// set the specified item at the first visible item or scroll to max
// range.
void SetFirstItem(int n) { DoSetFirstItem(n); }
void SetFirstItem(const wxString& s);
// ensures that the given item is visible scrolling the listbox if
// necessary
virtual void EnsureVisible(int n);
virtual int GetTopItem() const { return wxNOT_FOUND; }
virtual int GetCountPerPage() const { return -1; }
// a combination of Append() and EnsureVisible(): appends the item to the
// listbox and ensures that it is visible i.e. not scrolled out of view
void AppendAndEnsureVisible(const wxString& s);
// return true if the listbox allows multiple selection
bool HasMultipleSelection() const
{
return (m_windowStyle & wxLB_MULTIPLE) ||
(m_windowStyle & wxLB_EXTENDED);
}
// override wxItemContainer::IsSorted
virtual bool IsSorted() const wxOVERRIDE { return HasFlag( wxLB_SORT ); }
// emulate selecting or deselecting the item event.GetInt() (depending on
// event.GetExtraLong())
void Command(wxCommandEvent& event) wxOVERRIDE;
// return the index of the item at this position or wxNOT_FOUND
int HitTest(const wxPoint& point) const { return DoListHitTest(point); }
int HitTest(int x, int y) const { return DoListHitTest(wxPoint(x, y)); }
protected:
virtual void DoSetFirstItem(int n) = 0;
virtual void DoSetSelection(int n, bool select) = 0;
// there is already wxWindow::DoHitTest() so call this one differently
virtual int DoListHitTest(const wxPoint& WXUNUSED(point)) const
{ return wxNOT_FOUND; }
// Helper for the code generating events in single selection mode: updates
// m_oldSelections and return true if the selection really changed.
// Otherwise just returns false.
bool DoChangeSingleSelection(int item);
// Helper for generating events in multiple and extended mode: compare the
// current selections with the previously recorded ones (in
// m_oldSelections) and send the appropriate event if they differ,
// otherwise just return false.
bool CalcAndSendEvent();
// Send a listbox (de)selection or double click event.
//
// Returns true if the event was processed.
bool SendEvent(wxEventType evtType, int item, bool selected);
// Array storing the indices of all selected items that we already notified
// the user code about for multi selection list boxes.
//
// For single selection list boxes, we reuse this array to store the single
// currently selected item, this is used by DoChangeSingleSelection().
//
// TODO-OPT: wxSelectionStore would be more efficient for big list boxes.
wxArrayInt m_oldSelections;
// Update m_oldSelections with currently selected items (does nothing in
// single selection mode on platforms other than MSW).
void UpdateOldSelections();
private:
wxDECLARE_NO_COPY_CLASS(wxListBoxBase);
};
// ----------------------------------------------------------------------------
// include the platform-specific class declaration
// ----------------------------------------------------------------------------
#if defined(__WXUNIVERSAL__)
#include "wx/univ/listbox.h"
#elif defined(__WXMSW__)
#include "wx/msw/listbox.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/listbox.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/listbox.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/listbox.h"
#elif defined(__WXMAC__)
#include "wx/osx/listbox.h"
#elif defined(__WXQT__)
#include "wx/qt/listbox.h"
#endif
#endif // wxUSE_LISTBOX
#endif
// _WX_LISTBOX_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/sharedptr.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/sharedptr.h
// Purpose: Shared pointer based on the counted_ptr<> template, which
// is in the public domain
// Author: Robert Roebling, Yonat Sharon
// Copyright: Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SHAREDPTR_H_
#define _WX_SHAREDPTR_H_
#include "wx/defs.h"
#include "wx/atomic.h"
// ----------------------------------------------------------------------------
// wxSharedPtr: A smart pointer with non-intrusive reference counting.
// ----------------------------------------------------------------------------
template <class T>
class wxSharedPtr
{
public:
typedef T element_type;
explicit wxSharedPtr( T* ptr = NULL )
: m_ref(NULL)
{
if (ptr)
m_ref = new reftype(ptr);
}
template<typename Deleter>
explicit wxSharedPtr(T* ptr, Deleter d)
: m_ref(NULL)
{
if (ptr)
m_ref = new reftype_with_deleter<Deleter>(ptr, d);
}
~wxSharedPtr() { Release(); }
wxSharedPtr(const wxSharedPtr& tocopy) { Acquire(tocopy.m_ref); }
wxSharedPtr& operator=( const wxSharedPtr& tocopy )
{
if (this != &tocopy)
{
Release();
Acquire(tocopy.m_ref);
}
return *this;
}
wxSharedPtr& operator=( T* ptr )
{
if (get() != ptr)
{
Release();
if (ptr)
m_ref = new reftype(ptr);
}
return *this;
}
// test for pointer validity: defining conversion to unspecified_bool_type
// and not more obvious bool to avoid implicit conversions to integer types
typedef T *(wxSharedPtr<T>::*unspecified_bool_type)() const;
operator unspecified_bool_type() const
{
if (m_ref && m_ref->m_ptr)
return &wxSharedPtr<T>::get;
else
return NULL;
}
T& operator*() const
{
wxASSERT(m_ref != NULL);
wxASSERT(m_ref->m_ptr != NULL);
return *(m_ref->m_ptr);
}
T* operator->() const
{
wxASSERT(m_ref != NULL);
wxASSERT(m_ref->m_ptr != NULL);
return m_ref->m_ptr;
}
T* get() const
{
return m_ref ? m_ref->m_ptr : NULL;
}
void reset( T* ptr = NULL )
{
Release();
if (ptr)
m_ref = new reftype(ptr);
}
template<typename Deleter>
void reset(T* ptr, Deleter d)
{
Release();
if (ptr)
m_ref = new reftype_with_deleter<Deleter>(ptr, d);
}
bool unique() const { return (m_ref ? m_ref->m_count == 1 : true); }
long use_count() const { return (m_ref ? (long)m_ref->m_count : 0); }
private:
struct reftype
{
reftype(T* ptr) : m_ptr(ptr), m_count(1) {}
virtual ~reftype() {}
virtual void delete_ptr() { delete m_ptr; }
T* m_ptr;
wxAtomicInt m_count;
};
template<typename Deleter>
struct reftype_with_deleter : public reftype
{
reftype_with_deleter(T* ptr, Deleter d) : reftype(ptr), m_deleter(d) {}
virtual void delete_ptr() { m_deleter(this->m_ptr); }
Deleter m_deleter;
};
reftype* m_ref;
void Acquire(reftype* ref)
{
m_ref = ref;
if (ref)
wxAtomicInc( ref->m_count );
}
void Release()
{
if (m_ref)
{
if (!wxAtomicDec( m_ref->m_count ))
{
m_ref->delete_ptr();
delete m_ref;
}
m_ref = NULL;
}
}
};
template <class T, class U>
bool operator == (wxSharedPtr<T> const &a, wxSharedPtr<U> const &b )
{
return a.get() == b.get();
}
template <class T, class U>
bool operator != (wxSharedPtr<T> const &a, wxSharedPtr<U> const &b )
{
return a.get() != b.get();
}
#endif // _WX_SHAREDPTR_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/textentry.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/textentry.h
// Purpose: declares wxTextEntry interface defining a simple text entry
// Author: Vadim Zeitlin
// Created: 2007-09-24
// Copyright: (c) 2007 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TEXTENTRY_H_
#define _WX_TEXTENTRY_H_
// wxTextPos is the position in the text (currently it's hardly used anywhere
// and should probably be replaced with int anyhow)
typedef long wxTextPos;
class WXDLLIMPEXP_FWD_BASE wxArrayString;
class WXDLLIMPEXP_FWD_CORE wxTextCompleter;
class WXDLLIMPEXP_FWD_CORE wxTextEntryHintData;
class WXDLLIMPEXP_FWD_CORE wxWindow;
#include "wx/filefn.h" // for wxFILE and wxDIR only
#include "wx/gdicmn.h" // for wxPoint
// ----------------------------------------------------------------------------
// wxTextEntryBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTextEntryBase
{
public:
wxTextEntryBase() { m_eventsBlock = 0; m_hintData = NULL; }
virtual ~wxTextEntryBase();
// accessing the value
// -------------------
// SetValue() generates a text change event, ChangeValue() doesn't
virtual void SetValue(const wxString& value)
{ DoSetValue(value, SetValue_SendEvent); }
virtual void ChangeValue(const wxString& value);
// writing text inserts it at the current position replacing any current
// selection, appending always inserts it at the end and doesn't remove any
// existing text (but it will reset the selection if there is any)
virtual void WriteText(const wxString& text) = 0;
virtual void AppendText(const wxString& text);
virtual wxString GetValue() const;
virtual wxString GetRange(long from, long to) const;
bool IsEmpty() const { return GetLastPosition() <= 0; }
// editing operations
// ------------------
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to) = 0;
virtual void Clear() { Remove(0, -1); }
void RemoveSelection();
// clipboard operations
// --------------------
virtual void Copy() = 0;
virtual void Cut() = 0;
virtual void Paste() = 0;
virtual bool CanCopy() const;
virtual bool CanCut() const;
virtual bool CanPaste() const;
// undo/redo
// ---------
virtual void Undo() = 0;
virtual void Redo() = 0;
virtual bool CanUndo() const = 0;
virtual bool CanRedo() const = 0;
// insertion point
// ---------------
// note that moving insertion point removes any current selection
virtual void SetInsertionPoint(long pos) = 0;
virtual void SetInsertionPointEnd() { SetInsertionPoint(-1); }
virtual long GetInsertionPoint() const = 0;
virtual long GetLastPosition() const = 0;
// selection
// ---------
virtual void SetSelection(long from, long to) = 0;
virtual void SelectAll() { SetSelection(-1, -1); }
virtual void SelectNone()
{ const long pos = GetInsertionPoint(); SetSelection(pos, pos); }
virtual void GetSelection(long *from, long *to) const = 0;
bool HasSelection() const;
virtual wxString GetStringSelection() const;
// auto-completion
// ---------------
// these functions allow to auto-complete the text already entered into the
// control using either the given fixed list of strings, the paths from the
// file system or an arbitrary user-defined completer
//
// they all return true if completion was enabled or false on error (most
// commonly meaning that this functionality is not available under the
// current platform)
bool AutoComplete(const wxArrayString& choices)
{ return DoAutoCompleteStrings(choices); }
bool AutoCompleteFileNames()
{ return DoAutoCompleteFileNames(wxFILE); }
bool AutoCompleteDirectories()
{ return DoAutoCompleteFileNames(wxDIR); }
// notice that we take ownership of the pointer and will delete it
//
// if the pointer is NULL auto-completion is disabled
bool AutoComplete(wxTextCompleter *completer)
{ return DoAutoCompleteCustom(completer); }
// status
// ------
virtual bool IsEditable() const = 0;
virtual void SetEditable(bool editable) = 0;
// input restrictions
// ------------------
// set the max number of characters which may be entered in a single line
// text control
virtual void SetMaxLength(unsigned long WXUNUSED(len)) { }
// convert any lower-case characters to upper-case on the fly in this entry
virtual void ForceUpper();
// hints
// -----
// hint is the (usually greyed out) text shown in the control as long as
// it's empty and doesn't have focus, it is typically used in controls used
// for searching to let the user know what is supposed to be entered there
virtual bool SetHint(const wxString& hint);
virtual wxString GetHint() const;
// margins
// -------
// margins are the empty space between borders of control and the text
// itself. When setting margin, use value -1 to indicate that specific
// margin should not be changed.
bool SetMargins(const wxPoint& pt)
{ return DoSetMargins(pt); }
bool SetMargins(wxCoord left, wxCoord top = -1)
{ return DoSetMargins(wxPoint(left, top)); }
wxPoint GetMargins() const
{ return DoGetMargins(); }
// implementation only
// -------------------
// generate the wxEVT_TEXT event for GetEditableWindow(),
// like SetValue() does and return true if the event was processed
//
// NB: this is public for wxRichTextCtrl use only right now, do not call it
static bool SendTextUpdatedEvent(wxWindow *win);
// generate the wxEVT_TEXT event for this window
bool SendTextUpdatedEvent()
{
return SendTextUpdatedEvent(GetEditableWindow());
}
// generate the wxEVT_TEXT event for this window if the
// events are not currently disabled
void SendTextUpdatedEventIfAllowed()
{
if ( EventsAllowed() )
SendTextUpdatedEvent();
}
// this function is provided solely for the purpose of forwarding text
// change notifications state from one control to another, e.g. it can be
// used by a wxComboBox which derives from wxTextEntry if it delegates all
// of its methods to another wxTextCtrl
void ForwardEnableTextChangedEvents(bool enable)
{
// it's important to call the functions which update m_eventsBlock here
// and not just our own EnableTextChangedEvents() because our state
// (i.e. the result of EventsAllowed()) must change as well
if ( enable )
ResumeTextChangedEvents();
else
SuppressTextChangedEvents();
}
// change the entry value to be in upper case only, if needed (i.e. if it's
// not already the case)
void ConvertToUpperCase();
protected:
// flags for DoSetValue(): common part of SetValue() and ChangeValue() and
// also used to implement WriteText() in wxMSW
enum
{
SetValue_NoEvent = 0,
SetValue_SendEvent = 1,
SetValue_SelectionOnly = 2
};
virtual void DoSetValue(const wxString& value, int flags);
virtual wxString DoGetValue() const = 0;
// override this to return the associated window, it will be used for event
// generation and also by generic hints implementation
virtual wxWindow *GetEditableWindow() = 0;
// margins functions
virtual bool DoSetMargins(const wxPoint& pt);
virtual wxPoint DoGetMargins() const;
// the derived classes should override these virtual methods to implement
// auto-completion, they do the same thing as their public counterparts but
// have different names to allow overriding just one of them without hiding
// the other one(s)
virtual bool DoAutoCompleteStrings(const wxArrayString& WXUNUSED(choices))
{ return false; }
virtual bool DoAutoCompleteFileNames(int WXUNUSED(flags)) // wxFILE | wxDIR
{ return false; }
virtual bool DoAutoCompleteCustom(wxTextCompleter *completer);
// class which should be used to temporarily disable text change events
//
// if suppress argument in ctor is false, nothing is done
class EventsSuppressor
{
public:
EventsSuppressor(wxTextEntryBase *text, bool suppress = true)
: m_text(text),
m_suppress(suppress)
{
if ( m_suppress )
m_text->SuppressTextChangedEvents();
}
~EventsSuppressor()
{
if ( m_suppress )
m_text->ResumeTextChangedEvents();
}
private:
wxTextEntryBase *m_text;
bool m_suppress;
};
friend class EventsSuppressor;
private:
// suppress or resume the text changed events generation: don't use these
// functions directly, use EventsSuppressor class above instead
void SuppressTextChangedEvents()
{
if ( !m_eventsBlock++ )
EnableTextChangedEvents(false);
}
void ResumeTextChangedEvents()
{
if ( !--m_eventsBlock )
EnableTextChangedEvents(true);
}
// this must be overridden in the derived classes if our implementation of
// SetValue() or Replace() is used to disable (and enable back) generation
// of the text changed events
//
// initially the generation of the events is enabled
virtual void EnableTextChangedEvents(bool WXUNUSED(enable)) { }
// return true if the events are currently not suppressed
bool EventsAllowed() const { return m_eventsBlock == 0; }
// if this counter is non-null, events are blocked
unsigned m_eventsBlock;
// hint-related stuff, only allocated if/when SetHint() is used
wxTextEntryHintData *m_hintData;
// It needs to call our Do{Get,Set}Value() to work with the real control
// contents.
friend class wxTextEntryHintData;
};
#ifdef __WXUNIVERSAL__
// TODO: we need to use wxTextEntryDelegate here, but for now just prevent
// the GTK/MSW classes from being used in wxUniv build
class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
{
};
#elif defined(__WXGTK20__)
#include "wx/gtk/textentry.h"
#elif defined(__WXMAC__)
#include "wx/osx/textentry.h"
#elif defined(__WXMSW__)
#include "wx/msw/textentry.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/textentry.h"
#elif defined(__WXQT__)
#include "wx/qt/textentry.h"
#else
// no platform-specific implementation of wxTextEntry yet
class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
{
};
#endif
#endif // _WX_TEXTENTRY_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/xtictor.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/xtictor.h
// Purpose: XTI constructors
// Author: Stefan Csomor
// Modified by: Francesco Montorsi
// Created: 27/07/03
// Copyright: (c) 1997 Julian Smart
// (c) 2003 Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _XTICTOR_H_
#define _XTICTOR_H_
#include "wx/defs.h"
#if wxUSE_EXTENDED_RTTI
#include "wx/xti.h"
// ----------------------------------------------------------------------------
// Constructor Bridges
// ----------------------------------------------------------------------------
// A constructor bridge allows to call a ctor with an arbitrary number
// or parameters during runtime
class WXDLLIMPEXP_BASE wxObjectAllocatorAndCreator
{
public:
virtual ~wxObjectAllocatorAndCreator() { }
virtual bool Create(wxObject * &o, wxAny *args) = 0;
};
// a direct constructor bridge calls the operator new for this class and
// passes all params to the constructor. Needed for classes that cannot be
// instantiated using alloc-create semantics
class WXDLLIMPEXP_BASE wxObjectAllocator : public wxObjectAllocatorAndCreator
{
public:
virtual bool Create(wxObject * &o, wxAny *args) = 0;
};
// ----------------------------------------------------------------------------
// Constructor Bridges for all Numbers of Params
// ----------------------------------------------------------------------------
// no params
template<typename Class>
struct wxObjectAllocatorAndCreator_0 : public wxObjectAllocatorAndCreator
{
bool Create(wxObject * &o, wxAny *)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create();
}
};
struct wxObjectAllocatorAndCreator_Dummy : public wxObjectAllocatorAndCreator
{
bool Create(wxObject *&, wxAny *)
{
return true;
}
};
#define wxCONSTRUCTOR_0(klass) \
wxObjectAllocatorAndCreator_0<klass> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { NULL }; \
const int klass::ms_constructorPropertiesCount = 0;
#define wxCONSTRUCTOR_DUMMY(klass) \
wxObjectAllocatorAndCreator_Dummy constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { NULL }; \
const int klass::ms_constructorPropertiesCount = 0;
// direct constructor version
template<typename Class>
struct wxDirectConstructorBridge_0 : public wxObjectAllocator
{
bool Create(wxObject * &o, wxAny *args)
{
o = new Class( );
return o != NULL;
}
};
#define wxDIRECT_CONSTRUCTOR_0(klass) \
wxDirectConstructorBridge_0<klass> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { NULL }; \
const int klass::ms_constructorPropertiesCount = 0;
// 1 param
template<typename Class, typename T0>
struct wxObjectAllocatorAndCreator_1 : public wxObjectAllocatorAndCreator
{
bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
(args[0]).As(static_cast<T0*>(NULL))
);
}
};
#define wxCONSTRUCTOR_1(klass,t0,v0) \
wxObjectAllocatorAndCreator_1<klass,t0> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) }; \
const int klass::ms_constructorPropertiesCount = 1;
// direct constructor version
template<typename Class, typename T0>
struct wxDirectConstructorBridge_1 : public wxObjectAllocator
{
bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
(args[0]).As(static_cast<T0*>(NULL))
);
return o != NULL;
}
};
#define wxDIRECT_CONSTRUCTOR_1(klass,t0,v0) \
wxDirectConstructorBridge_1<klass,t0,t1> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) }; \
const int klass::ms_constructorPropertiesCount = 1;
// 2 params
template<typename Class,
typename T0, typename T1>
struct wxObjectAllocatorAndCreator_2 : public wxObjectAllocatorAndCreator
{
bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL))
);
}
};
#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \
wxObjectAllocatorAndCreator_2<klass,t0,t1> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1) }; \
const int klass::ms_constructorPropertiesCount = 2;
// direct constructor version
template<typename Class,
typename T0, typename T1>
struct wxDirectConstructorBridge_2 : public wxObjectAllocator
{
bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL))
);
return o != NULL;
}
};
#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \
wxDirectConstructorBridge_2<klass,t0,t1> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1) }; \
const int klass::ms_constructorPropertiesCount = 2;
// 3 params
template<typename Class,
typename T0, typename T1, typename T2>
struct wxObjectAllocatorAndCreator_3 : public wxObjectAllocatorAndCreator
{
bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL))
);
}
};
#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
wxObjectAllocatorAndCreator_3<klass,t0,t1,t2> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), wxT(#v2) }; \
const int klass::ms_constructorPropertiesCount = 3;
// direct constructor version
template<typename Class,
typename T0, typename T1, typename T2>
struct wxDirectConstructorBridge_3 : public wxObjectAllocator
{
bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL))
);
return o != NULL;
}
};
#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
wxDirectConstructorBridge_3<klass,t0,t1,t2> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), wxT(#v2) }; \
const int klass::ms_constructorPropertiesCount = 3;
// 4 params
template<typename Class,
typename T0, typename T1, typename T2, typename T3>
struct wxObjectAllocatorAndCreator_4 : public wxObjectAllocatorAndCreator
{
bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL)),
(args[3]).As(static_cast<T3*>(NULL))
);
}
};
#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \
wxObjectAllocatorAndCreator_4<klass,t0,t1,t2,t3> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = \
{ wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3) }; \
const int klass::ms_constructorPropertiesCount = 4;
// direct constructor version
template<typename Class,
typename T0, typename T1, typename T2, typename T3>
struct wxDirectConstructorBridge_4 : public wxObjectAllocator
{
bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL)),
(args[3]).As(static_cast<T3*>(NULL))
);
return o != NULL;
}
};
#define wxDIRECT_CONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \
wxDirectConstructorBridge_4<klass,t0,t1,t2,t3> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = \
{ wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3) }; \
const int klass::ms_constructorPropertiesCount = 4;
// 5 params
template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4>
struct wxObjectAllocatorAndCreator_5 : public wxObjectAllocatorAndCreator
{
bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL)),
(args[3]).As(static_cast<T3*>(NULL)),
(args[4]).As(static_cast<T4*>(NULL))
);
}
};
#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
wxObjectAllocatorAndCreator_5<klass,t0,t1,t2,t3,t4> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = \
{ wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4) }; \
const int klass::ms_constructorPropertiesCount = 5;
// direct constructor version
template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4>
struct wxDirectConstructorBridge_5 : public wxObjectAllocator
{
bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL)),
(args[3]).As(static_cast<T3*>(NULL)),
(args[4]).As(static_cast<T4*>(NULL))
);
return o != NULL;
}
};
#define wxDIRECT_CONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
wxDirectConstructorBridge_5<klass,t0,t1,t2,t3,t4> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = \
{ wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4) }; \
const int klass::ms_constructorPropertiesCount = 5;
// 6 params
template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
struct wxObjectAllocatorAndCreator_6 : public wxObjectAllocatorAndCreator
{
bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL)),
(args[3]).As(static_cast<T3*>(NULL)),
(args[4]).As(static_cast<T4*>(NULL)),
(args[5]).As(static_cast<T5*>(NULL))
);
}
};
#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
wxObjectAllocatorAndCreator_6<klass,t0,t1,t2,t3,t4,t5> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = \
{ wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5) }; \
const int klass::ms_constructorPropertiesCount = 6;
// direct constructor version
template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
struct wxDirectConstructorBridge_6 : public wxObjectAllocator
{
bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL)),
(args[3]).As(static_cast<T3*>(NULL)),
(args[4]).As(static_cast<T4*>(NULL)),
(args[5]).As(static_cast<T5*>(NULL))
);
return o != NULL;
}
};
#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
wxDirectConstructorBridge_6<klass,t0,t1,t2,t3,t4,t5> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), \
wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5) }; \
const int klass::ms_constructorPropertiesCount = 6;
// 7 params
template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
struct wxObjectAllocatorAndCreator_7 : public wxObjectAllocatorAndCreator
{
bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL)),
(args[3]).As(static_cast<T3*>(NULL)),
(args[4]).As(static_cast<T4*>(NULL)),
(args[5]).As(static_cast<T5*>(NULL)),
(args[6]).As(static_cast<T6*>(NULL))
);
}
};
#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
wxObjectAllocatorAndCreator_7<klass,t0,t1,t2,t3,t4,t5,t6> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), \
wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6) }; \
const int klass::ms_constructorPropertiesCount = 7;
// direct constructor version
template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
struct wxDirectConstructorBridge_7 : public wxObjectAllocator
{
bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL)),
(args[3]).As(static_cast<T3*>(NULL)),
(args[4]).As(static_cast<T4*>(NULL)),
(args[5]).As(static_cast<T5*>(NULL)),
(args[6]).As(static_cast<T6*>(NULL))
);
return o != NULL;
}
};
#define wxDIRECT_CONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
wxDirectConstructorBridge_7<klass,t0,t1,t2,t3,t4,t5,t6> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = \
{ wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6) }; \
const int klass::ms_constructorPropertiesCount = 7;
// 8 params
template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, \
typename T6, typename T7>
struct wxObjectAllocatorAndCreator_8 : public wxObjectAllocatorAndCreator
{
bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL)),
(args[3]).As(static_cast<T3*>(NULL)),
(args[4]).As(static_cast<T4*>(NULL)),
(args[5]).As(static_cast<T5*>(NULL)),
(args[6]).As(static_cast<T6*>(NULL)),
(args[7]).As(static_cast<T7*>(NULL))
);
}
};
#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
wxObjectAllocatorAndCreator_8<klass,t0,t1,t2,t3,t4,t5,t6,t7> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = \
{ wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6), wxT(#v7) }; \
const int klass::ms_constructorPropertiesCount = 8;
// direct constructor version
template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, \
typename T6, typename T7>
struct wxDirectConstructorBridge_8 : public wxObjectAllocator
{
bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
(args[0]).As(static_cast<T0*>(NULL)),
(args[1]).As(static_cast<T1*>(NULL)),
(args[2]).As(static_cast<T2*>(NULL)),
(args[3]).As(static_cast<T3*>(NULL)),
(args[4]).As(static_cast<T4*>(NULL)),
(args[5]).As(static_cast<T5*>(NULL)),
(args[6]).As(static_cast<T6*>(NULL)),
(args[7]).As(static_cast<T7*>(NULL))
);
return o != NULL;
}
};
#define wxDIRECT_CONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
wxDirectConstructorBridge_8<klass,t0,t1,t2,t3,t4,t5,t6,t7> constructor##klass; \
wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \
const wxChar *klass::ms_constructorProperties[] = \
{ wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6), wxT(#v7) }; \
const int klass::ms_constructorPropertiesCount = 8;
#endif // wxUSE_EXTENDED_RTTI
#endif // _XTICTOR_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/nativewin.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/nativewin.h
// Purpose: classes allowing to wrap a native window handle
// Author: Vadim Zeitlin
// Created: 2008-03-05
// Copyright: (c) 2008 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_NATIVEWIN_H_
#define _WX_NATIVEWIN_H_
#include "wx/toplevel.h"
// These symbols can be tested in the user code to see if the current wx port
// has support for creating wxNativeContainerWindow and wxNativeWindow from
// native windows.
//
// Be optimistic by default, we undefine them below if necessary.
#define wxHAS_NATIVE_CONTAINER_WINDOW
#define wxHAS_NATIVE_WINDOW
// we define the following typedefs for each of the platform supporting native
// windows wrapping:
//
// - wxNativeContainerWindowHandle is the toolkit-level handle of the native
// window, i.e. HWND/GdkWindow*/NSWindow
//
// - wxNativeContainerWindowId is the lowest level identifier of the native
// window, i.e. HWND/GdkNativeWindow/NSWindow (so it's the same as above for
// all platforms except GTK where we also can work with Window/XID)
//
// - wxNativeWindowHandle for child windows, i.e. HWND/GtkWidget*/NSControl
#if defined(__WXMSW__)
#include "wx/msw/wrapwin.h"
typedef HWND wxNativeContainerWindowId;
typedef HWND wxNativeContainerWindowHandle;
typedef HWND wxNativeWindowHandle;
#elif defined(__WXGTK__)
// GdkNativeWindow is guint32 under GDK/X11 and gpointer under GDK/WIN32
#ifdef __UNIX__
typedef unsigned long wxNativeContainerWindowId;
#else
typedef void *wxNativeContainerWindowId;
#endif
typedef GdkWindow *wxNativeContainerWindowHandle;
typedef GtkWidget *wxNativeWindowHandle;
#elif defined(__WXOSX_COCOA__)
typedef NSView *wxNativeWindowHandle;
// no support for using native TLWs yet
#undef wxHAS_NATIVE_CONTAINER_WINDOW
#else
// no support for using native windows under this platform yet
#undef wxHAS_NATIVE_CONTAINER_WINDOW
#undef wxHAS_NATIVE_WINDOW
#endif
#ifdef wxHAS_NATIVE_WINDOW
// ----------------------------------------------------------------------------
// wxNativeWindow: for using native windows inside wxWidgets windows
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNativeWindow : public wxWindow
{
public:
// Default ctor, Create() must be called later to really create the window.
wxNativeWindow()
{
Init();
}
// Create a window from an existing native window handle.
//
// Notice that this ctor doesn't take the usual pos and size parameters,
// they're taken from the window handle itself.
//
// Use GetHandle() to check if the creation was successful, it will return
// 0 if the handle was invalid.
wxNativeWindow(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle handle)
{
Init();
Create(parent, winid, handle);
}
// Same as non-default ctor, but with a return code.
bool Create(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle handle);
// By default the native window with which this wxWindow is associated is
// owned by the user code and needs to be destroyed by it in a platform
// specific way, however this function can be called to let wxNativeWindow
// dtor take care of destroying the native window instead of having to do
// it from the user code.
void Disown()
{
wxCHECK_RET( m_ownedByUser, wxS("Can't disown more than once") );
m_ownedByUser = false;
DoDisown();
}
#ifdef __WXMSW__
// Prevent the native window, not owned by us, from being destroyed by the
// base class dtor, unless Disown() had been called.
virtual ~wxNativeWindow();
#endif // __WXMSW__
private:
void Init()
{
m_ownedByUser = true;
}
// This is implemented in platform-specific code.
void DoDisown();
// If the native widget owned by the user code.
bool m_ownedByUser;
wxDECLARE_NO_COPY_CLASS(wxNativeWindow);
};
#endif // wxHAS_NATIVE_WINDOW
#ifdef wxHAS_NATIVE_CONTAINER_WINDOW
// ----------------------------------------------------------------------------
// wxNativeContainerWindow: can be used for creating other wxWindows inside it
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNativeContainerWindow : public wxTopLevelWindow
{
public:
// default ctor, call Create() later
wxNativeContainerWindow() { }
// create a window from an existing native window handle
//
// use GetHandle() to check if the creation was successful, it will return
// 0 if the handle was invalid
wxNativeContainerWindow(wxNativeContainerWindowHandle handle)
{
Create(handle);
}
// same as ctor above but with a return code
bool Create(wxNativeContainerWindowHandle handle);
#if defined(__WXGTK__)
// this is a convenient ctor for wxGTK applications which can also create
// the objects of this class from the really native window handles and not
// only the GdkWindow objects
//
// wxNativeContainerWindowId is Window (i.e. an XID, i.e. an int) under X11
// (when GDK_WINDOWING_X11 is defined) or HWND under Win32
wxNativeContainerWindow(wxNativeContainerWindowId winid) { Create(winid); }
bool Create(wxNativeContainerWindowId winid);
#endif // wxGTK
// unlike for the normal windows, dtor will not destroy the native window
// as it normally doesn't belong to us
virtual ~wxNativeContainerWindow();
// provide (trivial) implementation of the base class pure virtuals
virtual void SetTitle(const wxString& WXUNUSED(title)) wxOVERRIDE
{
wxFAIL_MSG( "not implemented for native windows" );
}
virtual wxString GetTitle() const wxOVERRIDE
{
wxFAIL_MSG( "not implemented for native windows" );
return wxString();
}
virtual void Maximize(bool WXUNUSED(maximize) = true) wxOVERRIDE
{
wxFAIL_MSG( "not implemented for native windows" );
}
virtual bool IsMaximized() const wxOVERRIDE
{
wxFAIL_MSG( "not implemented for native windows" );
return false;
}
virtual void Iconize(bool WXUNUSED(iconize) = true) wxOVERRIDE
{
wxFAIL_MSG( "not implemented for native windows" );
}
virtual bool IsIconized() const wxOVERRIDE
{
// this is called by wxGTK implementation so don't assert
return false;
}
virtual void Restore() wxOVERRIDE
{
wxFAIL_MSG( "not implemented for native windows" );
}
virtual bool ShowFullScreen(bool WXUNUSED(show),
long WXUNUSED(style) = wxFULLSCREEN_ALL) wxOVERRIDE
{
wxFAIL_MSG( "not implemented for native windows" );
return false;
}
virtual bool IsFullScreen() const wxOVERRIDE
{
wxFAIL_MSG( "not implemented for native windows" );
return false;
}
#ifdef __WXMSW__
virtual bool IsShown() const wxOVERRIDE;
#endif // __WXMSW__
// this is an implementation detail: called when the native window is
// destroyed by an outside agency; deletes the C++ object too but can in
// principle be overridden to something else (knowing that the window
// handle of this object and all of its children is invalid any more)
virtual void OnNativeDestroyed();
protected:
#ifdef __WXMSW__
virtual WXLRESULT
MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE;
#endif // __WXMSW__
private:
wxDECLARE_NO_COPY_CLASS(wxNativeContainerWindow);
};
#endif // wxHAS_NATIVE_CONTAINER_WINDOW
#endif // _WX_NATIVEWIN_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dynarray.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/dynarray.h
// Purpose: auto-resizable (i.e. dynamic) array support
// Author: Vadim Zeitlin
// Modified by:
// Created: 12.09.97
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _DYNARRAY_H
#define _DYNARRAY_H
#include "wx/defs.h"
#include "wx/vector.h"
/*
This header defines legacy dynamic arrays and object arrays (i.e. arrays
which own their elements) classes.
Do *NOT* use them in the new code, these classes exist for compatibility
only. Simply use standard container, e.g. std::vector<>, in your own code.
*/
#define _WX_ERROR_REMOVE "removing inexistent element in wxArray::Remove"
// ----------------------------------------------------------------------------
// types
// ----------------------------------------------------------------------------
/*
Callback compare function for quick sort.
It must return negative value, 0 or positive value if the first item is
less than, equal to or greater than the second one.
*/
extern "C"
{
typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2);
}
// ----------------------------------------------------------------------------
// Array class providing legacy dynamic arrays API on top of wxVector<>
// ----------------------------------------------------------------------------
// For some reasons lost in the depths of time, sort functions with different
// signatures are used to sort normal arrays and to keep sorted arrays sorted.
// These two functors can be used as predicates with std::sort() adapting the
// sort function to it, whichever signature it uses.
template<class T>
class wxArray_SortFunction
{
public:
typedef int (wxCMPFUNC_CONV *CMPFUNC)(T* pItem1, T* pItem2);
wxArray_SortFunction(CMPFUNC f) : m_f(f) { }
bool operator()(const T& i1, const T& i2)
{ return m_f(const_cast<T*>(&i1), const_cast<T*>(&i2)) < 0; }
private:
CMPFUNC m_f;
};
template<class T>
class wxSortedArray_SortFunction
{
public:
typedef int (wxCMPFUNC_CONV *CMPFUNC)(T, T);
wxSortedArray_SortFunction(CMPFUNC f) : m_f(f) { }
bool operator()(const T& i1, const T& i2)
{ return m_f(i1, i2) < 0; }
private:
CMPFUNC m_f;
};
template <typename T, typename Sorter = wxSortedArray_SortFunction<T> >
class wxBaseArray : public wxVector<T>
{
public:
typedef typename Sorter::CMPFUNC SCMPFUNC;
typedef typename wxArray_SortFunction<T>::CMPFUNC CMPFUNC;
typedef wxVector<T> base_vec;
typedef typename base_vec::value_type value_type;
typedef typename base_vec::reference reference;
typedef typename base_vec::const_reference const_reference;
typedef typename base_vec::iterator iterator;
typedef typename base_vec::const_iterator const_iterator;
typedef typename base_vec::const_reverse_iterator const_reverse_iterator;
typedef typename base_vec::difference_type difference_type;
typedef typename base_vec::size_type size_type;
public:
typedef T base_type;
wxBaseArray() : base_vec() { }
explicit wxBaseArray(size_t n) : base_vec(n) { }
wxBaseArray(size_t n, const_reference v) : base_vec(n, v) { }
template <class InputIterator>
wxBaseArray(InputIterator first, InputIterator last)
: base_vec(first, last)
{ }
void Empty() { this->clear(); }
void Clear() { this->clear(); }
void Alloc(size_t uiSize) { this->reserve(uiSize); }
void Shrink()
{
wxShrinkToFit(*this);
}
size_t GetCount() const { return this->size(); }
void SetCount(size_t n, T v = T()) { this->resize(n, v); }
bool IsEmpty() const { return this->empty(); }
size_t Count() const { return this->size(); }
T& Item(size_t uiIndex) const
{
wxASSERT( uiIndex < this->size() );
return const_cast<T&>((*this)[uiIndex]);
}
T& Last() const { return Item(this->size() - 1); }
int Index(T item, bool bFromEnd = false) const
{
if ( bFromEnd )
{
const const_reverse_iterator b = this->rbegin(),
e = this->rend();
for ( const_reverse_iterator i = b; i != e; ++i )
if ( *i == item )
return (int)(e - i - 1);
}
else
{
const const_iterator b = this->begin(),
e = this->end();
for ( const_iterator i = b; i != e; ++i )
if ( *i == item )
return (int)(i - b);
}
return wxNOT_FOUND;
}
int Index(T lItem, SCMPFUNC fnCompare) const
{
Sorter p(fnCompare);
const_iterator i = std::lower_bound(this->begin(), this->end(), lItem, p);
return i != this->end() && !p(lItem, *i) ? (int)(i - this->begin())
: wxNOT_FOUND;
}
size_t IndexForInsert(T lItem, SCMPFUNC fnCompare) const
{
Sorter p(fnCompare);
const_iterator i = std::lower_bound(this->begin(), this->end(), lItem, p);
return i - this->begin();
}
void Add(T lItem, size_t nInsert = 1)
{
this->insert(this->end(), nInsert, lItem);
}
size_t Add(T lItem, SCMPFUNC fnCompare)
{
size_t n = IndexForInsert(lItem, fnCompare);
Insert(lItem, n);
return n;
}
void Insert(T lItem, size_t uiIndex, size_t nInsert = 1)
{
this->insert(this->begin() + uiIndex, nInsert, lItem);
}
void Remove(T lItem)
{
int n = Index(lItem);
wxCHECK_RET( n != wxNOT_FOUND, _WX_ERROR_REMOVE );
RemoveAt((size_t)n);
}
void RemoveAt(size_t uiIndex, size_t nRemove = 1)
{
this->erase(this->begin() + uiIndex, this->begin() + uiIndex + nRemove);
}
void Sort(CMPFUNC fCmp)
{
wxArray_SortFunction<T> p(fCmp);
std::sort(this->begin(), this->end(), p);
}
void Sort(SCMPFUNC fCmp)
{
Sorter p(fCmp);
std::sort(this->begin(), this->end(), p);
}
};
// ============================================================================
// The private helper macros containing the core of the array classes
// ============================================================================
// ----------------------------------------------------------------------------
// _WX_DEFINE_SORTED_TYPEARRAY: sorted array for simple data types
// cannot handle types with size greater than pointer because of sorting
// ----------------------------------------------------------------------------
// Note that "classdecl" here is intentionally not used because this class has
// only inline methods and so never needs to be exported from a DLL.
#define _WX_DEFINE_SORTED_TYPEARRAY_2(T, name, base, defcomp, classdecl) \
typedef wxBaseSortedArray<T> wxBaseSortedArrayFor##name; \
class name : public wxBaseSortedArrayFor##name \
{ \
public: \
name(wxBaseSortedArrayFor##name::SCMPFUNC fn defcomp) \
: wxBaseSortedArrayFor##name(fn) { } \
}
template <typename T, typename Sorter = wxSortedArray_SortFunction<T> >
class wxBaseSortedArray : public wxBaseArray<T, Sorter>
{
public:
typedef typename Sorter::CMPFUNC SCMPFUNC;
explicit wxBaseSortedArray(SCMPFUNC fn) : m_fnCompare(fn) { }
wxBaseSortedArray& operator=(const wxBaseSortedArray& src)
{
wxBaseArray<T, Sorter>::operator=(src);
m_fnCompare = src.m_fnCompare;
return *this;
}
size_t IndexForInsert(T item) const
{
return this->wxBaseArray<T, Sorter>::IndexForInsert(item, m_fnCompare);
}
void AddAt(T item, size_t index)
{
this->insert(this->begin() + index, item);
}
size_t Add(T item)
{
return this->wxBaseArray<T, Sorter>::Add(item, m_fnCompare);
}
void push_back(T item)
{
Add(item);
}
private:
SCMPFUNC m_fnCompare;
};
// ----------------------------------------------------------------------------
// _WX_DECLARE_OBJARRAY: an array for pointers to type T with owning semantics
// ----------------------------------------------------------------------------
// This class must be able to be declared with incomplete types, so it doesn't
// actually use type T in its definition, and relies on a helper template
// parameter, which is declared by WX_DECLARE_OBJARRAY() and defined by
// WX_DEFINE_OBJARRAY(), for providing a way to create and destroy objects of
// type T
template <typename T, typename Traits>
class wxBaseObjectArray : private wxBaseArray<T*>
{
typedef wxBaseArray<T*> base;
public:
typedef T value_type;
typedef int (wxCMPFUNC_CONV *CMPFUNC)(T **pItem1, T **pItem2);
wxBaseObjectArray()
{
}
wxBaseObjectArray(const wxBaseObjectArray& src) : base()
{
DoCopy(src);
}
wxBaseObjectArray& operator=(const wxBaseObjectArray& src)
{
Empty();
DoCopy(src);
return *this;
}
~wxBaseObjectArray()
{
Empty();
}
void Alloc(size_t count) { base::reserve(count); }
void reserve(size_t count) { base::reserve(count); }
size_t GetCount() const { return base::size(); }
size_t size() const { return base::size(); }
bool IsEmpty() const { return base::empty(); }
bool empty() const { return base::empty(); }
size_t Count() const { return base::size(); }
void Shrink() { base::Shrink(); }
T& operator[](size_t uiIndex) const
{
return *base::operator[](uiIndex);
}
T& Item(size_t uiIndex) const
{
return *base::operator[](uiIndex);
}
T& Last() const
{
return *(base::operator[](size() - 1));
}
int Index(const T& item, bool bFromEnd = false) const
{
if ( bFromEnd )
{
if ( size() > 0 )
{
size_t ui = size() - 1;
do
{
if ( base::operator[](ui) == &item )
return static_cast<int>(ui);
ui--;
}
while ( ui != 0 );
}
}
else
{
for ( size_t ui = 0; ui < size(); ++ui )
{
if( base::operator[](ui) == &item )
return static_cast<int>(ui);
}
}
return wxNOT_FOUND;
}
void Add(const T& item, size_t nInsert = 1)
{
if ( nInsert == 0 )
return;
T* const pItem = Traits::Clone(item);
const size_t nOldSize = size();
if ( pItem != NULL )
base::insert(this->end(), nInsert, pItem);
for ( size_t i = 1; i < nInsert; i++ )
base::operator[](nOldSize + i) = Traits::Clone(item);
}
void Add(const T* pItem)
{
base::push_back(const_cast<T*>(pItem));
}
void push_back(const T* pItem) { Add(pItem); }
void push_back(const T& item) { Add(item); }
void Insert(const T& item, size_t uiIndex, size_t nInsert = 1)
{
if ( nInsert == 0 )
return;
T* const pItem = Traits::Clone(item);
if ( pItem != NULL )
base::insert(this->begin() + uiIndex, nInsert, pItem);
for ( size_t i = 1; i < nInsert; ++i )
base::operator[](uiIndex + i) = Traits::Clone(item);
}
void Insert(const T* pItem, size_t uiIndex)
{
base::insert(this->begin() + uiIndex, (T*)pItem);
}
void Empty() { DoEmpty(); base::clear(); }
void Clear() { DoEmpty(); base::clear(); }
T* Detach(size_t uiIndex)
{
T* const p = base::operator[](uiIndex);
base::erase(this->begin() + uiIndex);
return p;
}
void RemoveAt(size_t uiIndex, size_t nRemove = 1)
{
wxCHECK_RET( uiIndex < size(), "bad index in RemoveAt()" );
for ( size_t i = 0; i < nRemove; ++i )
Traits::Free(base::operator[](uiIndex + i));
base::erase(this->begin() + uiIndex, this->begin() + uiIndex + nRemove);
}
void Sort(CMPFUNC fCmp) { base::Sort(fCmp); }
private:
void DoEmpty()
{
for ( size_t n = 0; n < size(); ++n )
Traits::Free(base::operator[](n));
}
void DoCopy(const wxBaseObjectArray& src)
{
reserve(src.size());
for ( size_t n = 0; n < src.size(); ++n )
Add(src[n]);
}
};
// ============================================================================
// The public macros for declaration and definition of the dynamic arrays
// ============================================================================
// Please note that for each macro WX_FOO_ARRAY we also have
// WX_FOO_EXPORTED_ARRAY and WX_FOO_USER_EXPORTED_ARRAY which are exactly the
// same except that they use an additional __declspec(dllexport) or equivalent
// under Windows if needed.
//
// The first (just EXPORTED) macros do it if wxWidgets was compiled as a DLL
// and so must be used used inside the library. The second kind (USER_EXPORTED)
// allow the user code to do it when it wants. This is needed if you have a dll
// that wants to export a wxArray daubed with your own import/export goo.
//
// Finally, you can define the macro below as something special to modify the
// arrays defined by a simple WX_FOO_ARRAY as well. By default is empty.
#define wxARRAY_DEFAULT_EXPORT
// ----------------------------------------------------------------------------
// WX_DECLARE_BASEARRAY(T, name): now is the same as WX_DEFINE_TYPEARRAY()
// below, only preserved for compatibility.
// ----------------------------------------------------------------------------
#define wxARRAY_DUMMY_BASE
#define WX_DECLARE_BASEARRAY(T, name) \
WX_DEFINE_TYPEARRAY(T, name)
#define WX_DECLARE_EXPORTED_BASEARRAY(T, name) \
WX_DEFINE_EXPORTED_TYPEARRAY(T, name, WXDLLIMPEXP_CORE)
#define WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, expmode) \
WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, wxARRAY_DUMMY_BASE, class expmode)
// ----------------------------------------------------------------------------
// WX_DEFINE_TYPEARRAY(T, name, base) define an array class named "name"
// containing the elements of type T. Note that the argument "base" is unused
// and is preserved for compatibility only. Also, macros with and without
// "_PTR" suffix are identical, and the latter ones are also kept only for
// compatibility.
// ----------------------------------------------------------------------------
#define WX_DEFINE_TYPEARRAY(T, name, base) \
WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class wxARRAY_DEFAULT_EXPORT)
#define WX_DEFINE_TYPEARRAY_PTR(T, name, base) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class wxARRAY_DEFAULT_EXPORT)
#define WX_DEFINE_EXPORTED_TYPEARRAY(T, name, base) \
WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class WXDLLIMPEXP_CORE)
#define WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, base) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class WXDLLIMPEXP_CORE)
#define WX_DEFINE_USER_EXPORTED_TYPEARRAY(T, name, base, expdecl) \
WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class expdecl)
#define WX_DEFINE_USER_EXPORTED_TYPEARRAY_PTR(T, name, base, expdecl) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class expdecl)
// This is the only non-trivial macro, which actually defines the array class
// with the given name containing the elements of the specified type.
//
// Note that "name" must be a class and not just a typedef because it can be
// (and is) forward declared in the existing code.
//
// As mentioned above, "base" is unused and so is "classdecl" as this class has
// only inline methods and so never needs to be exported from MSW DLLs.
//
// Note about apparently redundant wxBaseArray##name typedef: this is needed to
// avoid clashes between T and symbols defined in wxBaseArray<> scope, e.g. if
// we didn't do this, we would have compilation problems with arrays of type
// "Item" (which is also the name of a method in wxBaseArray<>).
#define WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, classdecl) \
typedef wxBaseArray<T> wxBaseArrayFor##name; \
class name : public wxBaseArrayFor##name \
{ \
typedef wxBaseArrayFor##name Base; \
public: \
name() : Base() { } \
explicit name(size_t n) : Base(n) { } \
name(size_t n, Base::const_reference v) : Base(n, v) { } \
template <class InputIterator> \
name(InputIterator first, InputIterator last) : Base(first, last) { } \
}
#define WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, classdecl) \
WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, classdecl)
// ----------------------------------------------------------------------------
// WX_DEFINE_SORTED_TYPEARRAY: this is the same as the previous macro, but it
// defines a sorted array.
//
// Differences:
// 1) it must be given a COMPARE function in ctor which takes 2 items of type
// T* and should return -1, 0 or +1 if the first one is less/greater
// than/equal to the second one.
// 2) the Add() method inserts the item in such was that the array is always
// sorted (it uses the COMPARE function)
// 3) it has no Sort() method because it's always sorted
// 4) Index() method is much faster (the sorted arrays use binary search
// instead of linear one), but Add() is slower.
// 5) there is no Insert() method because you can't insert an item into the
// given position in a sorted array but there is IndexForInsert()/AddAt()
// pair which may be used to optimize a common operation of "insert only if
// not found"
//
// Note that you have to specify the comparison function when creating the
// objects of this array type. If, as in 99% of cases, the comparison function
// is the same for all objects of a class, WX_DEFINE_SORTED_TYPEARRAY_CMP below
// is more convenient.
//
// Summary: use this class when the speed of Index() function is important, use
// the normal arrays otherwise.
// ----------------------------------------------------------------------------
// we need a macro which expands to nothing to pass correct number of
// parameters to a nested macro invocation even when we don't have anything to
// pass it
#define wxARRAY_EMPTY
#define WX_DEFINE_SORTED_TYPEARRAY(T, name, base) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, \
wxARRAY_DEFAULT_EXPORT)
#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, base) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, WXDLLIMPEXP_CORE)
#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, expmode) \
typedef T _wxArray##name; \
_WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, \
wxARRAY_EMPTY, class expmode)
// ----------------------------------------------------------------------------
// WX_DEFINE_SORTED_TYPEARRAY_CMP: exactly the same as above but the comparison
// function is provided by this macro and the objects of this class have a
// default constructor which just uses it.
//
// The arguments are: the element type, the comparison function and the array
// name
//
// NB: this is, of course, how WX_DEFINE_SORTED_TYPEARRAY() should have worked
// from the very beginning - unfortunately I didn't think about this earlier
// ----------------------------------------------------------------------------
#define WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \
wxARRAY_DEFAULT_EXPORT)
#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \
WXDLLIMPEXP_CORE)
#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \
expmode) \
typedef T _wxArray##name; \
_WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, = cmpfunc, \
class expmode)
// ----------------------------------------------------------------------------
// WX_DECLARE_OBJARRAY(T, name): this macro generates a new array class
// named "name" which owns the objects of type T it contains, i.e. it will
// delete them when it is destroyed.
//
// An element is of type T*, but arguments of type T& are taken (see below!)
// and T& is returned.
//
// Don't use this for simple types such as "int" or "long"!
//
// Note on Add/Insert functions:
// 1) function(T*) gives the object to the array, i.e. it will delete the
// object when it's removed or in the array's dtor
// 2) function(T&) will create a copy of the object and work with it
//
// Also:
// 1) Remove() will delete the object after removing it from the array
// 2) Detach() just removes the object from the array (returning pointer to it)
//
// NB1: Base type T should have an accessible copy ctor if Add(T&) is used
// NB2: Never ever cast a array to it's base type: as dtor is not virtual
// and so you risk having at least the memory leaks and probably worse
//
// Some functions of this class are not inline, so it takes some space to
// define new class from this template even if you don't use it - which is not
// the case for the simple (non-object) array classes
//
// To use an objarray class you must
// #include "dynarray.h"
// WX_DECLARE_OBJARRAY(element_type, list_class_name)
// #include "arrimpl.cpp"
// WX_DEFINE_OBJARRAY(list_class_name) // name must be the same as above!
//
// This is necessary because at the moment of DEFINE_OBJARRAY class parsing the
// element_type must be fully defined (i.e. forward declaration is not
// enough), while WX_DECLARE_OBJARRAY may be done anywhere. The separation of
// two allows to break cicrcular dependencies with classes which have member
// variables of objarray type.
// ----------------------------------------------------------------------------
#define WX_DECLARE_OBJARRAY(T, name) \
WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, wxARRAY_DEFAULT_EXPORT)
#define WX_DECLARE_EXPORTED_OBJARRAY(T, name) \
WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, WXDLLIMPEXP_CORE)
#define WX_DECLARE_OBJARRAY_WITH_DECL(T, name, classdecl) \
classdecl wxObjectArrayTraitsFor##name \
{ \
public: \
static T* Clone(T const& item); \
static void Free(T* p); \
}; \
typedef wxBaseObjectArray<T, wxObjectArrayTraitsFor##name> \
wxBaseObjectArrayFor##name; \
classdecl name : public wxBaseObjectArrayFor##name \
{ \
public: \
name() : wxBaseObjectArrayFor##name() { } \
name(const name& src) : wxBaseObjectArrayFor##name(src) { } \
}
#define WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, expmode) \
WX_DECLARE_OBJARRAY_WITH_DECL(T, name, class expmode)
// WX_DEFINE_OBJARRAY is going to be redefined when arrimpl.cpp is included,
// try to provoke a human-understandable error if it used incorrectly.
//
// there is no real need for 3 different macros in the DEFINE case but do it
// anyhow for consistency
#define WX_DEFINE_OBJARRAY(name) DidYouIncludeArrimplCpp
#define WX_DEFINE_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name)
#define WX_DEFINE_USER_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name)
// ----------------------------------------------------------------------------
// Some commonly used predefined base arrays
// ----------------------------------------------------------------------------
WX_DECLARE_USER_EXPORTED_BASEARRAY(const void *, wxBaseArrayPtrVoid,
WXDLLIMPEXP_BASE);
WX_DECLARE_USER_EXPORTED_BASEARRAY(char, wxBaseArrayChar, WXDLLIMPEXP_BASE);
WX_DECLARE_USER_EXPORTED_BASEARRAY(short, wxBaseArrayShort, WXDLLIMPEXP_BASE);
WX_DECLARE_USER_EXPORTED_BASEARRAY(int, wxBaseArrayInt, WXDLLIMPEXP_BASE);
WX_DECLARE_USER_EXPORTED_BASEARRAY(long, wxBaseArrayLong, WXDLLIMPEXP_BASE);
WX_DECLARE_USER_EXPORTED_BASEARRAY(size_t, wxBaseArraySizeT, WXDLLIMPEXP_BASE);
WX_DECLARE_USER_EXPORTED_BASEARRAY(double, wxBaseArrayDouble, WXDLLIMPEXP_BASE);
// ----------------------------------------------------------------------------
// Convenience macros to define arrays from base arrays
// ----------------------------------------------------------------------------
#define WX_DEFINE_ARRAY(T, name) \
WX_DEFINE_TYPEARRAY(T, name, wxBaseArrayPtrVoid)
#define WX_DEFINE_ARRAY_PTR(T, name) \
WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid)
#define WX_DEFINE_EXPORTED_ARRAY(T, name) \
WX_DEFINE_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid)
#define WX_DEFINE_EXPORTED_ARRAY_PTR(T, name) \
WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid)
#define WX_DEFINE_ARRAY_WITH_DECL_PTR(T, name, decl) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, decl)
#define WX_DEFINE_USER_EXPORTED_ARRAY(T, name, expmode) \
WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode)
#define WX_DEFINE_USER_EXPORTED_ARRAY_PTR(T, name, expmode) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode)
#define WX_DEFINE_ARRAY_CHAR(T, name) \
WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayChar)
#define WX_DEFINE_EXPORTED_ARRAY_CHAR(T, name) \
WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayChar)
#define WX_DEFINE_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode)
#define WX_DEFINE_ARRAY_SHORT(T, name) \
WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayShort)
#define WX_DEFINE_EXPORTED_ARRAY_SHORT(T, name) \
WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayShort)
#define WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode)
#define WX_DEFINE_ARRAY_INT(T, name) \
WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayInt)
#define WX_DEFINE_EXPORTED_ARRAY_INT(T, name) \
WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayInt)
#define WX_DEFINE_USER_EXPORTED_ARRAY_INT(T, name, expmode) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayInt, wxARRAY_EMPTY expmode)
#define WX_DEFINE_ARRAY_LONG(T, name) \
WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayLong)
#define WX_DEFINE_EXPORTED_ARRAY_LONG(T, name) \
WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayLong)
#define WX_DEFINE_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayLong, wxARRAY_EMPTY expmode)
#define WX_DEFINE_ARRAY_SIZE_T(T, name) \
WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArraySizeT)
#define WX_DEFINE_EXPORTED_ARRAY_SIZE_T(T, name) \
WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArraySizeT)
#define WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode)
#define WX_DEFINE_ARRAY_DOUBLE(T, name) \
WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayDouble)
#define WX_DEFINE_EXPORTED_ARRAY_DOUBLE(T, name) \
WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayDouble)
#define WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(T, name, expmode) \
WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayDouble, wxARRAY_EMPTY expmode)
// ----------------------------------------------------------------------------
// Convenience macros to define sorted arrays from base arrays
// ----------------------------------------------------------------------------
#define WX_DEFINE_SORTED_ARRAY(T, name) \
WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode)
#define WX_DEFINE_SORTED_ARRAY_CHAR(T, name) \
WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayChar)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CHAR(T, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode)
#define WX_DEFINE_SORTED_ARRAY_SHORT(T, name) \
WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayShort)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SHORT(T, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode)
#define WX_DEFINE_SORTED_ARRAY_INT(T, name) \
WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayInt)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_INT(T, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_INT(T, name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt, expmode)
#define WX_DEFINE_SORTED_ARRAY_LONG(T, name) \
WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayLong)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_LONG(T, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong, expmode)
#define WX_DEFINE_SORTED_ARRAY_SIZE_T(T, name) \
WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArraySizeT)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SIZE_T(T, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode)
// ----------------------------------------------------------------------------
// Convenience macros to define sorted arrays from base arrays
// ----------------------------------------------------------------------------
#define WX_DEFINE_SORTED_ARRAY_CMP(T, cmpfunc, name) \
WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP(T, cmpfunc, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP(T, cmpfunc, \
name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
wxBaseArrayPtrVoid, \
wxARRAY_EMPTY expmode)
#define WX_DEFINE_SORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \
WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, \
name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
wxBaseArrayChar, \
wxARRAY_EMPTY expmode)
#define WX_DEFINE_SORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \
WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, \
name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
wxBaseArrayShort, \
wxARRAY_EMPTY expmode)
#define WX_DEFINE_SORTED_ARRAY_CMP_INT(T, cmpfunc, name) \
WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, \
name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
wxBaseArrayInt, \
wxARRAY_EMPTY expmode)
#define WX_DEFINE_SORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \
WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, \
name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
wxBaseArrayLong, \
wxARRAY_EMPTY expmode)
#define WX_DEFINE_SORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \
WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \
WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, \
name, expmode) \
WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \
wxBaseArraySizeT, \
wxARRAY_EMPTY expmode)
// ----------------------------------------------------------------------------
// Some commonly used predefined arrays
// ----------------------------------------------------------------------------
WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(short, wxArrayShort, class WXDLLIMPEXP_BASE);
WX_DEFINE_USER_EXPORTED_ARRAY_INT(int, wxArrayInt, class WXDLLIMPEXP_BASE);
WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(double, wxArrayDouble, class WXDLLIMPEXP_BASE);
WX_DEFINE_USER_EXPORTED_ARRAY_LONG(long, wxArrayLong, class WXDLLIMPEXP_BASE);
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE);
// -----------------------------------------------------------------------------
// convenience functions: they used to be macros, hence the naming convention
// -----------------------------------------------------------------------------
// prepend all element of one array to another one; e.g. if first array contains
// elements X,Y,Z and the second contains A,B,C (in those orders), then the
// first array will be result as A,B,C,X,Y,Z
template <typename A1, typename A2>
inline void WX_PREPEND_ARRAY(A1& array, const A2& other)
{
const size_t size = other.size();
array.reserve(size);
for ( size_t n = 0; n < size; n++ )
{
array.Insert(other[n], n);
}
}
// append all element of one array to another one
template <typename A1, typename A2>
inline void WX_APPEND_ARRAY(A1& array, const A2& other)
{
size_t size = other.size();
array.reserve(size);
for ( size_t n = 0; n < size; n++ )
{
array.push_back(other[n]);
}
}
// delete all array elements
//
// NB: the class declaration of the array 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)!
template <typename A>
inline void WX_CLEAR_ARRAY(A& array)
{
size_t size = array.size();
for ( size_t n = 0; n < size; n++ )
{
delete array[n];
}
array.clear();
}
#endif // _DYNARRAY_H
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/treelist.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/treelist.h
// Purpose: wxTreeListCtrl class declaration.
// Author: Vadim Zeitlin
// Created: 2011-08-17
// Copyright: (c) 2011 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TREELIST_H_
#define _WX_TREELIST_H_
#include "wx/defs.h"
#if wxUSE_TREELISTCTRL
#include "wx/compositewin.h"
#include "wx/containr.h"
#include "wx/headercol.h"
#include "wx/itemid.h"
#include "wx/vector.h"
#include "wx/window.h"
#include "wx/withimages.h"
class WXDLLIMPEXP_FWD_CORE wxDataViewCtrl;
class WXDLLIMPEXP_FWD_CORE wxDataViewEvent;
extern WXDLLIMPEXP_DATA_CORE(const char) wxTreeListCtrlNameStr[];
class wxTreeListCtrl;
class wxTreeListModel;
class wxTreeListModelNode;
// ----------------------------------------------------------------------------
// Constants.
// ----------------------------------------------------------------------------
// wxTreeListCtrl styles.
//
// Notice that using wxTL_USER_3STATE implies wxTL_3STATE and wxTL_3STATE in
// turn implies wxTL_CHECKBOX.
enum
{
wxTL_SINGLE = 0x0000, // This is the default anyhow.
wxTL_MULTIPLE = 0x0001, // Allow multiple selection.
wxTL_CHECKBOX = 0x0002, // Show checkboxes in the first column.
wxTL_3STATE = 0x0004, // Allow 3rd state in checkboxes.
wxTL_USER_3STATE = 0x0008, // Allow user to set 3rd state.
wxTL_NO_HEADER = 0x0010, // Column titles not visible.
wxTL_DEFAULT_STYLE = wxTL_SINGLE,
wxTL_STYLE_MASK = wxTL_SINGLE |
wxTL_MULTIPLE |
wxTL_CHECKBOX |
wxTL_3STATE |
wxTL_USER_3STATE
};
// ----------------------------------------------------------------------------
// wxTreeListItem: unique identifier of an item in wxTreeListCtrl.
// ----------------------------------------------------------------------------
// Make wxTreeListItem a forward-declarable class even though it's simple
// enough to possibly be declared as a simple typedef.
class wxTreeListItem : public wxItemId<wxTreeListModelNode*>
{
public:
wxTreeListItem(wxTreeListModelNode* item = NULL)
: wxItemId<wxTreeListModelNode*>(item)
{
}
};
// Container of multiple items.
typedef wxVector<wxTreeListItem> wxTreeListItems;
// Some special "items" that can be used with InsertItem():
extern WXDLLIMPEXP_DATA_CORE(const wxTreeListItem) wxTLI_FIRST;
extern WXDLLIMPEXP_DATA_CORE(const wxTreeListItem) wxTLI_LAST;
// ----------------------------------------------------------------------------
// wxTreeListItemComparator: defines order of wxTreeListCtrl items.
// ----------------------------------------------------------------------------
class wxTreeListItemComparator
{
public:
wxTreeListItemComparator() { }
// The comparison function should return negative, null or positive value
// depending on whether the first item is less than, equal to or greater
// than the second one. The items should be compared using their values for
// the given column.
virtual int
Compare(wxTreeListCtrl* treelist,
unsigned column,
wxTreeListItem first,
wxTreeListItem second) = 0;
// Although this class is not used polymorphically by wxWidgets itself,
// provide virtual dtor in case it's used like this in the user code.
virtual ~wxTreeListItemComparator() { }
private:
wxDECLARE_NO_COPY_CLASS(wxTreeListItemComparator);
};
// ----------------------------------------------------------------------------
// wxTreeListCtrl: a control combining wxTree- and wxListCtrl features.
// ----------------------------------------------------------------------------
// This control also provides easy to use high level interface. Although the
// implementation uses wxDataViewCtrl internally, this class is intentionally
// simpler than wxDataViewCtrl and doesn't provide all of its functionality.
//
// If you need extra features you can always use GetDataView() accessor to work
// with wxDataViewCtrl directly but doing this makes your unportable to possible
// future non-wxDataViewCtrl-based implementations of this class.
class WXDLLIMPEXP_CORE wxTreeListCtrl
: public wxCompositeWindow< wxNavigationEnabled<wxWindow> >,
public wxWithImages
{
public:
// Constructors and such
// ---------------------
wxTreeListCtrl() { Init(); }
wxTreeListCtrl(wxWindow* parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTL_DEFAULT_STYLE,
const wxString& name = wxTreeListCtrlNameStr)
{
Init();
Create(parent, id, pos, size, style, name);
}
bool Create(wxWindow* parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTL_DEFAULT_STYLE,
const wxString& name = wxTreeListCtrlNameStr);
virtual ~wxTreeListCtrl();
// Columns methods
// ---------------
// Add a column with the given title and attributes, returns the index of
// the new column or -1 on failure.
int AppendColumn(const wxString& title,
int width = wxCOL_WIDTH_AUTOSIZE,
wxAlignment align = wxALIGN_LEFT,
int flags = wxCOL_RESIZABLE)
{
return DoInsertColumn(title, -1, width, align, flags);
}
// Return the total number of columns.
unsigned GetColumnCount() const;
// Delete the column with the given index, returns false if index is
// invalid or deleting the column failed for some other reason.
bool DeleteColumn(unsigned col);
// Delete all columns.
void ClearColumns();
// Set column width to either the given value in pixels or to the value
// large enough to fit all of the items if width == wxCOL_WIDTH_AUTOSIZE.
void SetColumnWidth(unsigned col, int width);
// Get the current width of the given column in pixels.
int GetColumnWidth(unsigned col) const;
// Get the width appropriate for showing the given text. This is typically
// used as second argument for AppendColumn() or with SetColumnWidth().
int WidthFor(const wxString& text) const;
// Item methods
// ------------
// Adding items. The parent and text of the first column of the new item
// must always be specified, the rest is optional.
//
// Each item can have two images: one used for closed state and another for
// opened one. Only the first one is ever used for the items that don't
// have children. And both are not set by default.
//
// It is also possible to associate arbitrary client data pointer with the
// new item. It will be deleted by the control when the item is deleted
// (either by an explicit DeleteItem() call or because the entire control
// is destroyed).
wxTreeListItem AppendItem(wxTreeListItem parent,
const wxString& text,
int imageClosed = NO_IMAGE,
int imageOpened = NO_IMAGE,
wxClientData* data = NULL)
{
return DoInsertItem(parent, wxTLI_LAST, text,
imageClosed, imageOpened, data);
}
wxTreeListItem InsertItem(wxTreeListItem parent,
wxTreeListItem previous,
const wxString& text,
int imageClosed = NO_IMAGE,
int imageOpened = NO_IMAGE,
wxClientData* data = NULL)
{
return DoInsertItem(parent, previous, text,
imageClosed, imageOpened, data);
}
wxTreeListItem PrependItem(wxTreeListItem parent,
const wxString& text,
int imageClosed = NO_IMAGE,
int imageOpened = NO_IMAGE,
wxClientData* data = NULL)
{
return DoInsertItem(parent, wxTLI_FIRST, text,
imageClosed, imageOpened, data);
}
// Deleting items.
void DeleteItem(wxTreeListItem item);
void DeleteAllItems();
// Tree navigation
// ---------------
// Return the (never shown) root item.
wxTreeListItem GetRootItem() const;
// The parent item may be invalid for the root-level items.
wxTreeListItem GetItemParent(wxTreeListItem item) const;
// Iterate over the given item children: start by calling GetFirstChild()
// and then call GetNextSibling() for as long as it returns valid item.
wxTreeListItem GetFirstChild(wxTreeListItem item) const;
wxTreeListItem GetNextSibling(wxTreeListItem item) const;
// Return the first child of the root item, which is also the first item of
// the tree in depth-first traversal order.
wxTreeListItem GetFirstItem() const { return GetFirstChild(GetRootItem()); }
// Get item after the given one in the depth-first tree-traversal order.
// Calling this function starting with the result of GetFirstItem() allows
// iterating over all items in the tree.
wxTreeListItem GetNextItem(wxTreeListItem item) const;
// Items attributes
// ----------------
const wxString& GetItemText(wxTreeListItem item, unsigned col = 0) const;
// The convenience overload below sets the text for the first column.
void SetItemText(wxTreeListItem item, unsigned col, const wxString& text);
void SetItemText(wxTreeListItem item, const wxString& text)
{
SetItemText(item, 0, text);
}
// By default the opened image is the same as the normal, closed one (if
// it's used at all).
void SetItemImage(wxTreeListItem item, int closed, int opened = NO_IMAGE);
// Retrieve or set the data associated with the item.
wxClientData* GetItemData(wxTreeListItem item) const;
void SetItemData(wxTreeListItem item, wxClientData* data);
// Expanding and collapsing
// ------------------------
void Expand(wxTreeListItem item);
void Collapse(wxTreeListItem item);
bool IsExpanded(wxTreeListItem item) const;
// Selection handling
// ------------------
// This function can be used with single selection controls, use
// GetSelections() with the multi-selection ones.
wxTreeListItem GetSelection() const;
// This one can be used with either single or multi-selection controls.
unsigned GetSelections(wxTreeListItems& selections) const;
// In single selection mode Select() deselects any other selected items, in
// multi-selection case it adds to the selection.
void Select(wxTreeListItem item);
// Can be used in multiple selection mode only, single selected item in the
// single selection mode can't be unselected.
void Unselect(wxTreeListItem item);
// Return true if the item is selected, can be used in both single and
// multiple selection modes.
bool IsSelected(wxTreeListItem item) const;
// Select or unselect all items, only valid in multiple selection mode.
void SelectAll();
void UnselectAll();
void EnsureVisible(wxTreeListItem item);
// Checkbox handling
// -----------------
// Methods in this section can only be used with the controls created with
// wxTL_CHECKBOX style.
// Simple set, unset or query the checked state.
void CheckItem(wxTreeListItem item, wxCheckBoxState state = wxCHK_CHECKED);
void UncheckItem(wxTreeListItem item) { CheckItem(item, wxCHK_UNCHECKED); }
// The same but do it recursively for this item itself and its children.
void CheckItemRecursively(wxTreeListItem item,
wxCheckBoxState state = wxCHK_CHECKED);
// Update the parent of this item recursively: if this item and all its
// siblings are checked, the parent will become checked as well. If this
// item and all its siblings are unchecked, the parent will be unchecked.
// And if the siblings of this item are not all in the same state, the
// parent will be switched to indeterminate state. And then the same logic
// will be applied to the parents parent and so on recursively.
//
// This is typically called when the state of the given item has changed
// from EVT_TREELIST_ITEM_CHECKED() handler in the controls which have
// wxTL_3STATE flag. Notice that without this flag this function can't work
// as it would be unable to set the state of a parent with both checked and
// unchecked items so it's only allowed to call it when this flag is set.
void UpdateItemParentStateRecursively(wxTreeListItem item);
// Return the current state.
wxCheckBoxState GetCheckedState(wxTreeListItem item) const;
// Return true if all item children (if any) are in the given state.
bool AreAllChildrenInState(wxTreeListItem item,
wxCheckBoxState state) const;
// Sorting.
// --------
// Sort by the given column, either in ascending (default) or descending
// sort order.
//
// By default, simple alphabetical sorting is done by this column contents
// but SetItemComparator() may be called to perform comparison in some
// other way.
void SetSortColumn(unsigned col, bool ascendingOrder = true);
// If the control contents is sorted, return true and fill the output
// parameters with the column which is currently used for sorting and
// whether we sort using ascending or descending order. Otherwise, i.e. if
// the control contents is unsorted, simply return false.
bool GetSortColumn(unsigned* col, bool* ascendingOrder = NULL);
// Set the object to use for comparing the items. It will be called when
// the control is being sorted because the user clicked on a sortable
// column.
//
// The provided pointer is stored by the control so the object it points to
// must have a life-time equal or greater to that of the control itself. In
// addition, the pointer can be NULL to stop using custom comparator and
// revert to the default alphabetical comparison.
void SetItemComparator(wxTreeListItemComparator* comparator);
// View window functions.
// ----------------------
// This control itself is entirely covered by the "view window" which is
// currently a wxDataViewCtrl but if you want to avoid relying on this to
// allow your code to work with later versions which might not be
// wxDataViewCtrl-based, use the first function only and only use the
// second one if you really need to call wxDataViewCtrl methods on it.
wxWindow* GetView() const;
wxDataViewCtrl* GetDataView() const { return m_view; }
private:
// Common part of all ctors.
void Init();
// Pure virtual method inherited from wxCompositeWindow.
virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE;
// Implementation of AppendColumn().
int DoInsertColumn(const wxString& title,
int pos, // May be -1 meaning "append".
int width,
wxAlignment align,
int flags);
// Common part of {Append,Insert,Prepend}Item().
wxTreeListItem DoInsertItem(wxTreeListItem parent,
wxTreeListItem previous,
const wxString& text,
int imageClosed,
int imageOpened,
wxClientData* data);
// Send wxTreeListEvent corresponding to the given wxDataViewEvent for an
// item (as opposed for column-oriented events).
//
// Also updates the original event "skipped" and "vetoed" flags.
void SendItemEvent(wxEventType evt, wxDataViewEvent& event);
// Send wxTreeListEvent corresponding to the given column wxDataViewEvent.
void SendColumnEvent(wxEventType evt, wxDataViewEvent& event);
// Called by wxTreeListModel when an item is toggled by the user.
void OnItemToggled(wxTreeListItem item, wxCheckBoxState stateOld);
// Event handlers.
void OnSelectionChanged(wxDataViewEvent& event);
void OnItemExpanding(wxDataViewEvent& event);
void OnItemExpanded(wxDataViewEvent& event);
void OnItemActivated(wxDataViewEvent& event);
void OnItemContextMenu(wxDataViewEvent& event);
void OnColumnSorted(wxDataViewEvent& event);
void OnSize(wxSizeEvent& event);
wxDECLARE_EVENT_TABLE();
wxDataViewCtrl* m_view;
wxTreeListModel* m_model;
wxTreeListItemComparator* m_comparator;
// It calls our inherited protected wxWithImages::GetImage() method.
friend class wxTreeListModel;
wxDECLARE_NO_COPY_CLASS(wxTreeListCtrl);
};
// ----------------------------------------------------------------------------
// wxTreeListEvent: event generated by wxTreeListCtrl.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTreeListEvent : public wxNotifyEvent
{
public:
// Default ctor is provided for wxRTTI needs only but should never be used.
wxTreeListEvent() { Init(); }
// The item affected by the event. Valid for all events except
// column-specific ones such as COLUMN_SORTED.
wxTreeListItem GetItem() const { return m_item; }
// The previous state of the item checkbox for ITEM_CHECKED events only.
wxCheckBoxState GetOldCheckedState() const { return m_oldCheckedState; }
// The index of the column affected by the event. Currently only used by
// COLUMN_SORTED event.
unsigned GetColumn() const { return m_column; }
virtual wxEvent* Clone() const wxOVERRIDE { return new wxTreeListEvent(*this); }
private:
// Common part of all ctors.
void Init()
{
m_column = static_cast<unsigned>(-1);
m_oldCheckedState = wxCHK_UNDETERMINED;
}
// Ctor is private, only wxTreeListCtrl can create events of this type.
wxTreeListEvent(wxEventType evtType,
wxTreeListCtrl* treelist,
wxTreeListItem item)
: wxNotifyEvent(evtType, treelist->GetId()),
m_item(item)
{
SetEventObject(treelist);
Init();
}
// Set the checkbox state before this event for ITEM_CHECKED events.
void SetOldCheckedState(wxCheckBoxState state)
{
m_oldCheckedState = state;
}
// Set the column affected by this event for COLUMN_SORTED events.
void SetColumn(unsigned column)
{
m_column = column;
}
const wxTreeListItem m_item;
wxCheckBoxState m_oldCheckedState;
unsigned m_column;
friend class wxTreeListCtrl;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTreeListEvent);
};
// Event types and event table macros.
typedef void (wxEvtHandler::*wxTreeListEventFunction)(wxTreeListEvent&);
#define wxTreeListEventHandler(func) \
wxEVENT_HANDLER_CAST(wxTreeListEventFunction, func)
#define wxEVT_TREELIST_GENERIC(name, id, fn) \
wx__DECLARE_EVT1(wxEVT_TREELIST_##name, id, wxTreeListEventHandler(fn))
#define wxDECLARE_TREELIST_EVENT(name) \
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, \
wxEVT_TREELIST_##name, \
wxTreeListEvent)
wxDECLARE_TREELIST_EVENT(SELECTION_CHANGED);
#define EVT_TREELIST_SELECTION_CHANGED(id, fn) \
wxEVT_TREELIST_GENERIC(SELECTION_CHANGED, id, fn)
wxDECLARE_TREELIST_EVENT(ITEM_EXPANDING);
#define EVT_TREELIST_ITEM_EXPANDING(id, fn) \
wxEVT_TREELIST_GENERIC(ITEM_EXPANDING, id, fn)
wxDECLARE_TREELIST_EVENT(ITEM_EXPANDED);
#define EVT_TREELIST_ITEM_EXPANDED(id, fn) \
wxEVT_TREELIST_GENERIC(ITEM_EXPANDED, id, fn)
wxDECLARE_TREELIST_EVENT(ITEM_CHECKED);
#define EVT_TREELIST_ITEM_CHECKED(id, fn) \
wxEVT_TREELIST_GENERIC(ITEM_CHECKED, id, fn)
wxDECLARE_TREELIST_EVENT(ITEM_ACTIVATED);
#define EVT_TREELIST_ITEM_ACTIVATED(id, fn) \
wxEVT_TREELIST_GENERIC(ITEM_ACTIVATED, id, fn)
wxDECLARE_TREELIST_EVENT(ITEM_CONTEXT_MENU);
#define EVT_TREELIST_ITEM_CONTEXT_MENU(id, fn) \
wxEVT_TREELIST_GENERIC(ITEM_CONTEXT_MENU, id, fn)
wxDECLARE_TREELIST_EVENT(COLUMN_SORTED);
#define EVT_TREELIST_COLUMN_SORTED(id, fn) \
wxEVT_TREELIST_GENERIC(COLUMN_SORTED, id, fn)
#undef wxDECLARE_TREELIST_EVENT
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_TREELIST_SELECTION_CHANGED wxEVT_TREELIST_SELECTION_CHANGED
#define wxEVT_COMMAND_TREELIST_ITEM_EXPANDING wxEVT_TREELIST_ITEM_EXPANDING
#define wxEVT_COMMAND_TREELIST_ITEM_EXPANDED wxEVT_TREELIST_ITEM_EXPANDED
#define wxEVT_COMMAND_TREELIST_ITEM_CHECKED wxEVT_TREELIST_ITEM_CHECKED
#define wxEVT_COMMAND_TREELIST_ITEM_ACTIVATED wxEVT_TREELIST_ITEM_ACTIVATED
#define wxEVT_COMMAND_TREELIST_ITEM_CONTEXT_MENU wxEVT_TREELIST_ITEM_CONTEXT_MENU
#define wxEVT_COMMAND_TREELIST_COLUMN_SORTED wxEVT_TREELIST_COLUMN_SORTED
#endif // wxUSE_TREELISTCTRL
#endif // _WX_TREELIST_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/fontdlg.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/fontdlg.h
// Purpose: common interface for different wxFontDialog classes
// Author: Vadim Zeitlin
// Modified by:
// Created: 12.05.02
// Copyright: (c) 1997-2002 wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FONTDLG_H_BASE_
#define _WX_FONTDLG_H_BASE_
#include "wx/defs.h" // for wxUSE_FONTDLG
#if wxUSE_FONTDLG
#include "wx/dialog.h" // the base class
#include "wx/fontdata.h"
// ----------------------------------------------------------------------------
// wxFontDialog interface
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFontDialogBase : public wxDialog
{
public:
// create the font dialog
wxFontDialogBase() { }
wxFontDialogBase(wxWindow *parent) { m_parent = parent; }
wxFontDialogBase(wxWindow *parent, const wxFontData& data)
{ m_parent = parent; InitFontData(&data); }
bool Create(wxWindow *parent)
{ return DoCreate(parent); }
bool Create(wxWindow *parent, const wxFontData& data)
{ InitFontData(&data); return Create(parent); }
// retrieve the font data
const wxFontData& GetFontData() const { return m_fontData; }
wxFontData& GetFontData() { return m_fontData; }
protected:
virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; }
void InitFontData(const wxFontData *data = NULL)
{ if ( data ) m_fontData = *data; }
wxFontData m_fontData;
wxDECLARE_NO_COPY_CLASS(wxFontDialogBase);
};
// ----------------------------------------------------------------------------
// platform-specific wxFontDialog implementation
// ----------------------------------------------------------------------------
#if defined( __WXOSX_MAC__ )
//set to 1 to use native mac font and color dialogs
#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 1
#else
//not supported on these platforms, leave 0
#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0
#endif
#if defined(__WXUNIVERSAL__) || \
defined(__WXMOTIF__) || \
defined(__WXGPE__)
#include "wx/generic/fontdlgg.h"
#define wxFontDialog wxGenericFontDialog
#elif defined(__WXMSW__)
#include "wx/msw/fontdlg.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/fontdlg.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/fontdlg.h"
#elif defined(__WXMAC__)
#include "wx/osx/fontdlg.h"
#elif defined(__WXQT__)
#include "wx/qt/fontdlg.h"
#endif
// ----------------------------------------------------------------------------
// global public functions
// ----------------------------------------------------------------------------
// get the font from user and return it, returns wxNullFont if the dialog was
// cancelled
WXDLLIMPEXP_CORE wxFont wxGetFontFromUser(wxWindow *parent = NULL,
const wxFont& fontInit = wxNullFont,
const wxString& caption = wxEmptyString);
#endif // wxUSE_FONTDLG
#endif
// _WX_FONTDLG_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/filedlg.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/filedlg.h
// Purpose: wxFileDialog base header
// Author: Robert Roebling
// Modified by:
// Created: 8/17/99
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FILEDLG_H_BASE_
#define _WX_FILEDLG_H_BASE_
#include "wx/defs.h"
#if wxUSE_FILEDLG
#include "wx/dialog.h"
#include "wx/arrstr.h"
// this symbol is defined for the platforms which support multiple
// ('|'-separated) filters in the file dialog
#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXMAC__)
#define wxHAS_MULTIPLE_FILEDLG_FILTERS
#endif
//----------------------------------------------------------------------------
// wxFileDialog data
//----------------------------------------------------------------------------
/*
The flags below must coexist with the following flags in m_windowStyle
#define wxCAPTION 0x20000000
#define wxMAXIMIZE 0x00002000
#define wxCLOSE_BOX 0x00001000
#define wxSYSTEM_MENU 0x00000800
wxBORDER_NONE = 0x00200000
#define wxRESIZE_BORDER 0x00000040
#define wxDIALOG_NO_PARENT 0x00000020
*/
enum
{
wxFD_OPEN = 0x0001,
wxFD_SAVE = 0x0002,
wxFD_OVERWRITE_PROMPT = 0x0004,
wxFD_NO_FOLLOW = 0x0008,
wxFD_FILE_MUST_EXIST = 0x0010,
wxFD_CHANGE_DIR = 0x0080,
wxFD_PREVIEW = 0x0100,
wxFD_MULTIPLE = 0x0200
};
#define wxFD_DEFAULT_STYLE wxFD_OPEN
extern WXDLLIMPEXP_DATA_CORE(const char) wxFileDialogNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorPromptStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[];
//----------------------------------------------------------------------------
// wxFileDialogBase
//----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFileDialogBase: public wxDialog
{
public:
wxFileDialogBase () { Init(); }
wxFileDialogBase(wxWindow *parent,
const wxString& message = wxFileSelectorPromptStr,
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxFileDialogNameStr)
{
Init();
Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name);
}
virtual ~wxFileDialogBase() {}
bool Create(wxWindow *parent,
const wxString& message = wxFileSelectorPromptStr,
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxFileDialogNameStr);
bool HasFdFlag(int flag) const { return HasFlag(flag); }
virtual void SetMessage(const wxString& message) { m_message = message; }
virtual void SetPath(const wxString& path);
virtual void SetDirectory(const wxString& dir);
virtual void SetFilename(const wxString& name);
virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
virtual wxString GetMessage() const { return m_message; }
virtual wxString GetPath() const { return m_path; }
virtual void GetPaths(wxArrayString& paths) const { paths.Empty(); paths.Add(m_path); }
virtual wxString GetDirectory() const { return m_dir; }
virtual wxString GetFilename() const { return m_fileName; }
virtual void GetFilenames(wxArrayString& files) const { files.Empty(); files.Add(m_fileName); }
virtual wxString GetWildcard() const { return m_wildCard; }
virtual int GetFilterIndex() const { return m_filterIndex; }
virtual wxString GetCurrentlySelectedFilename() const
{ return m_currentlySelectedFilename; }
// this function is called with wxFileDialog as parameter and should
// create the window containing the extra controls we want to show in it
typedef wxWindow *(*ExtraControlCreatorFunction)(wxWindow*);
virtual bool SupportsExtraControl() const { return false; }
bool SetExtraControlCreator(ExtraControlCreatorFunction creator);
wxWindow *GetExtraControl() const { return m_extraControl; }
// Utility functions
// Append first extension to filePath from a ';' separated extensionList
// if filePath = "path/foo.bar" just return it as is
// if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg"
// if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath
static wxString AppendExtension(const wxString &filePath,
const wxString &extensionList);
// Set the filter index to match the given extension.
//
// This is always valid to call, even if the extension is empty or the
// filter list doesn't contain it, the function will just do nothing in
// these cases.
void SetFilterIndexFromExt(const wxString& ext);
protected:
wxString m_message;
wxString m_dir;
wxString m_path; // Full path
wxString m_fileName;
wxString m_wildCard;
int m_filterIndex;
// Currently selected, but not yet necessarily accepted by the user, file.
// This should be updated whenever the selection in the control changes by
// the platform-specific code to provide a useful implementation of
// GetCurrentlySelectedFilename().
wxString m_currentlySelectedFilename;
wxWindow* m_extraControl;
// returns true if control is created (if it already exists returns false)
bool CreateExtraControl();
// return true if SetExtraControlCreator() was called
bool HasExtraControlCreator() const
{ return m_extraControlCreator != NULL; }
// get the size of the extra control by creating and deleting it
wxSize GetExtraControlSize();
private:
ExtraControlCreatorFunction m_extraControlCreator;
void Init();
wxDECLARE_DYNAMIC_CLASS(wxFileDialogBase);
wxDECLARE_NO_COPY_CLASS(wxFileDialogBase);
};
//----------------------------------------------------------------------------
// wxFileDialog convenience functions
//----------------------------------------------------------------------------
// File selector - backward compatibility
WXDLLIMPEXP_CORE wxString
wxFileSelector(const wxString& message = wxFileSelectorPromptStr,
const wxString& default_path = wxEmptyString,
const wxString& default_filename = wxEmptyString,
const wxString& default_extension = wxEmptyString,
const wxString& wildcard = wxFileSelectorDefaultWildcardStr,
int flags = 0,
wxWindow *parent = NULL,
int x = wxDefaultCoord, int y = wxDefaultCoord);
// An extended version of wxFileSelector
WXDLLIMPEXP_CORE wxString
wxFileSelectorEx(const wxString& message = wxFileSelectorPromptStr,
const wxString& default_path = wxEmptyString,
const wxString& default_filename = wxEmptyString,
int *indexDefaultExtension = NULL,
const wxString& wildcard = wxFileSelectorDefaultWildcardStr,
int flags = 0,
wxWindow *parent = NULL,
int x = wxDefaultCoord, int y = wxDefaultCoord);
// Ask for filename to load
WXDLLIMPEXP_CORE wxString
wxLoadFileSelector(const wxString& what,
const wxString& extension,
const wxString& default_name = wxEmptyString,
wxWindow *parent = NULL);
// Ask for filename to save
WXDLLIMPEXP_CORE wxString
wxSaveFileSelector(const wxString& what,
const wxString& extension,
const wxString& default_name = wxEmptyString,
wxWindow *parent = NULL);
#if defined (__WXUNIVERSAL__)
#define wxHAS_GENERIC_FILEDIALOG
#include "wx/generic/filedlgg.h"
#elif defined(__WXMSW__)
#include "wx/msw/filedlg.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/filedlg.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version
#elif defined(__WXGTK__)
#include "wx/gtk1/filedlg.h"
#elif defined(__WXMAC__)
#include "wx/osx/filedlg.h"
#elif defined(__WXQT__)
#include "wx/qt/filedlg.h"
#endif
#endif // wxUSE_FILEDLG
#endif // _WX_FILEDLG_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/stdstream.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/stdstream.h
// Purpose: Header of std::istream and std::ostream derived wrappers for
// wxInputStream and wxOutputStream
// Author: Jonathan Liu <[email protected]>
// Created: 2009-05-02
// Copyright: (c) 2009 Jonathan Liu
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STDSTREAM_H_
#define _WX_STDSTREAM_H_
#include "wx/defs.h" // wxUSE_STD_IOSTREAM
#if wxUSE_STREAMS && wxUSE_STD_IOSTREAM
#include "wx/defs.h"
#include "wx/stream.h"
#include "wx/ioswrap.h"
// ==========================================================================
// wxStdInputStreamBuffer
// ==========================================================================
class WXDLLIMPEXP_BASE wxStdInputStreamBuffer : public std::streambuf
{
public:
wxStdInputStreamBuffer(wxInputStream& stream);
virtual ~wxStdInputStreamBuffer() { }
protected:
virtual std::streambuf *setbuf(char *s, std::streamsize n) wxOVERRIDE;
virtual std::streampos seekoff(std::streamoff off,
std::ios_base::seekdir way,
std::ios_base::openmode which =
std::ios_base::in |
std::ios_base::out) wxOVERRIDE;
virtual std::streampos seekpos(std::streampos sp,
std::ios_base::openmode which =
std::ios_base::in |
std::ios_base::out) wxOVERRIDE;
virtual std::streamsize showmanyc() wxOVERRIDE;
virtual std::streamsize xsgetn(char *s, std::streamsize n) wxOVERRIDE;
virtual int underflow() wxOVERRIDE;
virtual int uflow() wxOVERRIDE;
virtual int pbackfail(int c = EOF) wxOVERRIDE;
// Special work around for VC8/9 (this bug was fixed in VC10 and later):
// these versions have non-standard _Xsgetn_s() that it being called from
// the stream code instead of xsgetn() and so our overridden implementation
// never actually gets used. To work around this, forward to it explicitly.
#if defined(__VISUALC8__) || defined(__VISUALC9__)
virtual std::streamsize
_Xsgetn_s(char *s, size_t WXUNUSED(size), std::streamsize n)
{
return xsgetn(s, n);
}
#endif // VC8 or VC9
wxInputStream& m_stream;
int m_lastChar;
};
// ==========================================================================
// wxStdInputStream
// ==========================================================================
class WXDLLIMPEXP_BASE wxStdInputStream : public std::istream
{
public:
wxStdInputStream(wxInputStream& stream);
virtual ~wxStdInputStream() { }
protected:
wxStdInputStreamBuffer m_streamBuffer;
};
// ==========================================================================
// wxStdOutputStreamBuffer
// ==========================================================================
class WXDLLIMPEXP_BASE wxStdOutputStreamBuffer : public std::streambuf
{
public:
wxStdOutputStreamBuffer(wxOutputStream& stream);
virtual ~wxStdOutputStreamBuffer() { }
protected:
virtual std::streambuf *setbuf(char *s, std::streamsize n) wxOVERRIDE;
virtual std::streampos seekoff(std::streamoff off,
std::ios_base::seekdir way,
std::ios_base::openmode which =
std::ios_base::in |
std::ios_base::out) wxOVERRIDE;
virtual std::streampos seekpos(std::streampos sp,
std::ios_base::openmode which =
std::ios_base::in |
std::ios_base::out) wxOVERRIDE;
virtual std::streamsize xsputn(const char *s, std::streamsize n) wxOVERRIDE;
virtual int overflow(int c) wxOVERRIDE;
wxOutputStream& m_stream;
};
// ==========================================================================
// wxStdOutputStream
// ==========================================================================
class WXDLLIMPEXP_BASE wxStdOutputStream : public std::ostream
{
public:
wxStdOutputStream(wxOutputStream& stream);
virtual ~wxStdOutputStream() { }
protected:
wxStdOutputStreamBuffer m_streamBuffer;
};
#endif // wxUSE_STREAMS && wxUSE_STD_IOSTREAM
#endif // _WX_STDSTREAM_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/apptrait.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/apptrait.h
// Purpose: declaration of wxAppTraits and derived classes
// Author: Vadim Zeitlin
// Modified by:
// Created: 19.06.2003
// Copyright: (c) 2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_APPTRAIT_H_
#define _WX_APPTRAIT_H_
#include "wx/string.h"
#include "wx/platinfo.h"
class WXDLLIMPEXP_FWD_BASE wxArrayString;
class WXDLLIMPEXP_FWD_BASE wxConfigBase;
class WXDLLIMPEXP_FWD_BASE wxEventLoopBase;
#if wxUSE_FONTMAP
class WXDLLIMPEXP_FWD_CORE wxFontMapper;
#endif // wxUSE_FONTMAP
class WXDLLIMPEXP_FWD_BASE wxLog;
class WXDLLIMPEXP_FWD_BASE wxMessageOutput;
class WXDLLIMPEXP_FWD_BASE wxObject;
class WXDLLIMPEXP_FWD_CORE wxRendererNative;
class WXDLLIMPEXP_FWD_BASE wxStandardPaths;
class WXDLLIMPEXP_FWD_BASE wxString;
class WXDLLIMPEXP_FWD_BASE wxTimer;
class WXDLLIMPEXP_FWD_BASE wxTimerImpl;
class wxSocketManager;
// ----------------------------------------------------------------------------
// wxAppTraits: this class defines various configurable aspects of wxApp
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxAppTraitsBase
{
public:
// needed since this class declares virtual members
virtual ~wxAppTraitsBase() { }
// hooks for working with the global objects, may be overridden by the user
// ------------------------------------------------------------------------
#if wxUSE_CONFIG
// create the default configuration object (base class version is
// implemented in config.cpp and creates wxRegConfig for wxMSW and
// wxFileConfig for all the other platforms)
virtual wxConfigBase *CreateConfig();
#endif // wxUSE_CONFIG
#if wxUSE_LOG
// create the default log target
virtual wxLog *CreateLogTarget() = 0;
#endif // wxUSE_LOG
// create the global object used for printing out messages
virtual wxMessageOutput *CreateMessageOutput() = 0;
#if wxUSE_FONTMAP
// create the global font mapper object used for encodings/charset mapping
virtual wxFontMapper *CreateFontMapper() = 0;
#endif // wxUSE_FONTMAP
// get the renderer to use for drawing the generic controls (return value
// may be NULL in which case the default renderer for the current platform
// is used); this is used in GUI only and always returns NULL in console
//
// NB: returned pointer will be deleted by the caller
virtual wxRendererNative *CreateRenderer() = 0;
// wxStandardPaths object is normally the same for wxBase and wxGUI
virtual wxStandardPaths& GetStandardPaths();
// functions abstracting differences between GUI and console modes
// ------------------------------------------------------------------------
// show the assert dialog with the specified message in GUI or just print
// the string to stderr in console mode
//
// base class version has an implementation (in spite of being pure
// virtual) in base/appbase.cpp which can be called as last resort.
//
// return true to suppress subsequent asserts, false to continue as before
virtual bool ShowAssertDialog(const wxString& msg) = 0;
// return true if fprintf(stderr) goes somewhere, false otherwise
virtual bool HasStderr() = 0;
#if wxUSE_SOCKETS
// this function is used by wxNet library to set the default socket manager
// to use: doing it like this allows us to keep all socket-related code in
// wxNet instead of having to pull it in wxBase itself as we'd have to do
// if we really implemented wxSocketManager here
//
// we don't take ownership of this pointer, it should have a lifetime
// greater than that of any socket (e.g. be a pointer to a static object)
static void SetDefaultSocketManager(wxSocketManager *manager)
{
ms_manager = manager;
}
// return socket manager: this is usually different for console and GUI
// applications (although some ports use the same implementation for both)
virtual wxSocketManager *GetSocketManager() { return ms_manager; }
#endif
// create a new, port specific, instance of the event loop used by wxApp
virtual wxEventLoopBase *CreateEventLoop() = 0;
#if wxUSE_TIMER
// return platform and toolkit dependent wxTimer implementation
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) = 0;
#endif
#if wxUSE_THREADS
virtual void MutexGuiEnter();
virtual void MutexGuiLeave();
#endif
// functions returning port-specific information
// ------------------------------------------------------------------------
// return information about the (native) toolkit currently used and its
// runtime (not compile-time) version.
// returns wxPORT_BASE for console applications and one of the remaining
// wxPORT_* values for GUI applications.
virtual wxPortId GetToolkitVersion(int *majVer = NULL,
int *minVer = NULL,
int *microVer = NULL) const = 0;
// return true if the port is using wxUniversal for the GUI, false if not
virtual bool IsUsingUniversalWidgets() const = 0;
// return the name of the Desktop Environment such as
// "KDE" or "GNOME". May return an empty string.
virtual wxString GetDesktopEnvironment() const = 0;
// returns a short string to identify the block of the standard command
// line options parsed automatically by current port: if this string is
// empty, there are no such options, otherwise the function also fills
// passed arrays with the names and the descriptions of those options.
virtual wxString GetStandardCmdLineOptions(wxArrayString& names,
wxArrayString& desc) const
{
wxUnusedVar(names);
wxUnusedVar(desc);
return wxEmptyString;
}
protected:
#if wxUSE_STACKWALKER
// utility function: returns the stack frame as a plain wxString
virtual wxString GetAssertStackTrace();
#endif
private:
static wxSocketManager *ms_manager;
};
// ----------------------------------------------------------------------------
// include the platform-specific version of the class
// ----------------------------------------------------------------------------
// NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the
// Unix code (and otherwise __UNIX__ wouldn't be defined)
// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port
#if defined(__WIN32__)
#include "wx/msw/apptbase.h"
#elif defined(__UNIX__)
#include "wx/unix/apptbase.h"
#else // no platform-specific methods to add to wxAppTraits
// wxAppTraits must be a class because it was forward declared as class
class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase
{
};
#endif // platform
// ============================================================================
// standard traits for console and GUI applications
// ============================================================================
// ----------------------------------------------------------------------------
// wxConsoleAppTraitsBase: wxAppTraits implementation for the console apps
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits
{
public:
#if !wxUSE_CONSOLE_EVENTLOOP
virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE { return NULL; }
#endif // !wxUSE_CONSOLE_EVENTLOOP
#if wxUSE_LOG
virtual wxLog *CreateLogTarget() wxOVERRIDE;
#endif // wxUSE_LOG
virtual wxMessageOutput *CreateMessageOutput() wxOVERRIDE;
#if wxUSE_FONTMAP
virtual wxFontMapper *CreateFontMapper() wxOVERRIDE;
#endif // wxUSE_FONTMAP
virtual wxRendererNative *CreateRenderer() wxOVERRIDE;
virtual bool ShowAssertDialog(const wxString& msg) wxOVERRIDE;
virtual bool HasStderr() wxOVERRIDE;
// the GetToolkitVersion for console application is always the same
wxPortId GetToolkitVersion(int *verMaj = NULL,
int *verMin = NULL,
int *verMicro = NULL) const wxOVERRIDE
{
// no toolkits (wxBase is for console applications without GUI support)
// NB: zero means "no toolkit", -1 means "not initialized yet"
// so we must use zero here!
if (verMaj) *verMaj = 0;
if (verMin) *verMin = 0;
if (verMicro) *verMicro = 0;
return wxPORT_BASE;
}
virtual bool IsUsingUniversalWidgets() const wxOVERRIDE { return false; }
virtual wxString GetDesktopEnvironment() const wxOVERRIDE { return wxEmptyString; }
};
// ----------------------------------------------------------------------------
// wxGUIAppTraitsBase: wxAppTraits implementation for the GUI apps
// ----------------------------------------------------------------------------
#if wxUSE_GUI
class WXDLLIMPEXP_CORE wxGUIAppTraitsBase : public wxAppTraits
{
public:
#if wxUSE_LOG
virtual wxLog *CreateLogTarget() wxOVERRIDE;
#endif // wxUSE_LOG
virtual wxMessageOutput *CreateMessageOutput() wxOVERRIDE;
#if wxUSE_FONTMAP
virtual wxFontMapper *CreateFontMapper() wxOVERRIDE;
#endif // wxUSE_FONTMAP
virtual wxRendererNative *CreateRenderer() wxOVERRIDE;
virtual bool ShowAssertDialog(const wxString& msg) wxOVERRIDE;
virtual bool HasStderr() wxOVERRIDE;
virtual bool IsUsingUniversalWidgets() const wxOVERRIDE
{
#ifdef __WXUNIVERSAL__
return true;
#else
return false;
#endif
}
virtual wxString GetDesktopEnvironment() const wxOVERRIDE { return wxEmptyString; }
};
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// include the platform-specific version of the classes above
// ----------------------------------------------------------------------------
// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port
#if defined(__WIN32__)
#include "wx/msw/apptrait.h"
#elif defined(__UNIX__)
#include "wx/unix/apptrait.h"
#else
#if wxUSE_GUI
class wxGUIAppTraits : public wxGUIAppTraitsBase
{
};
#endif // wxUSE_GUI
class wxConsoleAppTraits: public wxConsoleAppTraitsBase
{
};
#endif // platform
#endif // _WX_APPTRAIT_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/link.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/link.h
// Purpose: macros to force linking modules which might otherwise be
// discarded by the linker
// Author: Vaclav Slavik
// Copyright: (c) Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LINK_H_
#define _WX_LINK_H_
// This must be part of the module you want to force:
#define wxFORCE_LINK_THIS_MODULE(module_name) \
extern void _wx_link_dummy_func_##module_name (); \
void _wx_link_dummy_func_##module_name () { }
// And this must be somewhere where it certainly will be linked:
#define wxFORCE_LINK_MODULE(module_name) \
extern void _wx_link_dummy_func_##module_name (); \
static struct wxForceLink##module_name \
{ \
wxForceLink##module_name() \
{ \
_wx_link_dummy_func_##module_name (); \
} \
} _wx_link_dummy_var_##module_name;
#endif // _WX_LINK_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/access.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/access.h
// Purpose: Accessibility classes
// Author: Julian Smart
// Modified by:
// Created: 2003-02-12
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ACCESSBASE_H_
#define _WX_ACCESSBASE_H_
// ----------------------------------------------------------------------------
// headers we have to include here
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_ACCESSIBILITY
#include "wx/variant.h"
enum wxAccStatus
{
wxACC_FAIL,
wxACC_FALSE,
wxACC_OK,
wxACC_NOT_IMPLEMENTED,
wxACC_NOT_SUPPORTED,
wxACC_INVALID_ARG
};
// Child ids are integer identifiers from 1 up.
// So zero represents 'this' object.
#define wxACC_SELF 0
// Navigation constants
enum wxNavDir
{
wxNAVDIR_DOWN,
wxNAVDIR_FIRSTCHILD,
wxNAVDIR_LASTCHILD,
wxNAVDIR_LEFT,
wxNAVDIR_NEXT,
wxNAVDIR_PREVIOUS,
wxNAVDIR_RIGHT,
wxNAVDIR_UP
};
// Role constants
enum wxAccRole {
wxROLE_NONE,
wxROLE_SYSTEM_ALERT,
wxROLE_SYSTEM_ANIMATION,
wxROLE_SYSTEM_APPLICATION,
wxROLE_SYSTEM_BORDER,
wxROLE_SYSTEM_BUTTONDROPDOWN,
wxROLE_SYSTEM_BUTTONDROPDOWNGRID,
wxROLE_SYSTEM_BUTTONMENU,
wxROLE_SYSTEM_CARET,
wxROLE_SYSTEM_CELL,
wxROLE_SYSTEM_CHARACTER,
wxROLE_SYSTEM_CHART,
wxROLE_SYSTEM_CHECKBUTTON,
wxROLE_SYSTEM_CLIENT,
wxROLE_SYSTEM_CLOCK,
wxROLE_SYSTEM_COLUMN,
wxROLE_SYSTEM_COLUMNHEADER,
wxROLE_SYSTEM_COMBOBOX,
wxROLE_SYSTEM_CURSOR,
wxROLE_SYSTEM_DIAGRAM,
wxROLE_SYSTEM_DIAL,
wxROLE_SYSTEM_DIALOG,
wxROLE_SYSTEM_DOCUMENT,
wxROLE_SYSTEM_DROPLIST,
wxROLE_SYSTEM_EQUATION,
wxROLE_SYSTEM_GRAPHIC,
wxROLE_SYSTEM_GRIP,
wxROLE_SYSTEM_GROUPING,
wxROLE_SYSTEM_HELPBALLOON,
wxROLE_SYSTEM_HOTKEYFIELD,
wxROLE_SYSTEM_INDICATOR,
wxROLE_SYSTEM_LINK,
wxROLE_SYSTEM_LIST,
wxROLE_SYSTEM_LISTITEM,
wxROLE_SYSTEM_MENUBAR,
wxROLE_SYSTEM_MENUITEM,
wxROLE_SYSTEM_MENUPOPUP,
wxROLE_SYSTEM_OUTLINE,
wxROLE_SYSTEM_OUTLINEITEM,
wxROLE_SYSTEM_PAGETAB,
wxROLE_SYSTEM_PAGETABLIST,
wxROLE_SYSTEM_PANE,
wxROLE_SYSTEM_PROGRESSBAR,
wxROLE_SYSTEM_PROPERTYPAGE,
wxROLE_SYSTEM_PUSHBUTTON,
wxROLE_SYSTEM_RADIOBUTTON,
wxROLE_SYSTEM_ROW,
wxROLE_SYSTEM_ROWHEADER,
wxROLE_SYSTEM_SCROLLBAR,
wxROLE_SYSTEM_SEPARATOR,
wxROLE_SYSTEM_SLIDER,
wxROLE_SYSTEM_SOUND,
wxROLE_SYSTEM_SPINBUTTON,
wxROLE_SYSTEM_STATICTEXT,
wxROLE_SYSTEM_STATUSBAR,
wxROLE_SYSTEM_TABLE,
wxROLE_SYSTEM_TEXT,
wxROLE_SYSTEM_TITLEBAR,
wxROLE_SYSTEM_TOOLBAR,
wxROLE_SYSTEM_TOOLTIP,
wxROLE_SYSTEM_WHITESPACE,
wxROLE_SYSTEM_WINDOW
};
// Object types
enum wxAccObject {
wxOBJID_WINDOW = 0x00000000,
wxOBJID_SYSMENU = 0xFFFFFFFF,
wxOBJID_TITLEBAR = 0xFFFFFFFE,
wxOBJID_MENU = 0xFFFFFFFD,
wxOBJID_CLIENT = 0xFFFFFFFC,
wxOBJID_VSCROLL = 0xFFFFFFFB,
wxOBJID_HSCROLL = 0xFFFFFFFA,
wxOBJID_SIZEGRIP = 0xFFFFFFF9,
wxOBJID_CARET = 0xFFFFFFF8,
wxOBJID_CURSOR = 0xFFFFFFF7,
wxOBJID_ALERT = 0xFFFFFFF6,
wxOBJID_SOUND = 0xFFFFFFF5
};
// Accessible states
#define wxACC_STATE_SYSTEM_ALERT_HIGH 0x00000001
#define wxACC_STATE_SYSTEM_ALERT_MEDIUM 0x00000002
#define wxACC_STATE_SYSTEM_ALERT_LOW 0x00000004
#define wxACC_STATE_SYSTEM_ANIMATED 0x00000008
#define wxACC_STATE_SYSTEM_BUSY 0x00000010
#define wxACC_STATE_SYSTEM_CHECKED 0x00000020
#define wxACC_STATE_SYSTEM_COLLAPSED 0x00000040
#define wxACC_STATE_SYSTEM_DEFAULT 0x00000080
#define wxACC_STATE_SYSTEM_EXPANDED 0x00000100
#define wxACC_STATE_SYSTEM_EXTSELECTABLE 0x00000200
#define wxACC_STATE_SYSTEM_FLOATING 0x00000400
#define wxACC_STATE_SYSTEM_FOCUSABLE 0x00000800
#define wxACC_STATE_SYSTEM_FOCUSED 0x00001000
#define wxACC_STATE_SYSTEM_HOTTRACKED 0x00002000
#define wxACC_STATE_SYSTEM_INVISIBLE 0x00004000
#define wxACC_STATE_SYSTEM_MARQUEED 0x00008000
#define wxACC_STATE_SYSTEM_MIXED 0x00010000
#define wxACC_STATE_SYSTEM_MULTISELECTABLE 0x00020000
#define wxACC_STATE_SYSTEM_OFFSCREEN 0x00040000
#define wxACC_STATE_SYSTEM_PRESSED 0x00080000
#define wxACC_STATE_SYSTEM_PROTECTED 0x00100000
#define wxACC_STATE_SYSTEM_READONLY 0x00200000
#define wxACC_STATE_SYSTEM_SELECTABLE 0x00400000
#define wxACC_STATE_SYSTEM_SELECTED 0x00800000
#define wxACC_STATE_SYSTEM_SELFVOICING 0x01000000
#define wxACC_STATE_SYSTEM_UNAVAILABLE 0x02000000
// Selection flag
enum wxAccSelectionFlags
{
wxACC_SEL_NONE = 0,
wxACC_SEL_TAKEFOCUS = 1,
wxACC_SEL_TAKESELECTION = 2,
wxACC_SEL_EXTENDSELECTION = 4,
wxACC_SEL_ADDSELECTION = 8,
wxACC_SEL_REMOVESELECTION = 16
};
// Accessibility event identifiers
#define wxACC_EVENT_SYSTEM_SOUND 0x0001
#define wxACC_EVENT_SYSTEM_ALERT 0x0002
#define wxACC_EVENT_SYSTEM_FOREGROUND 0x0003
#define wxACC_EVENT_SYSTEM_MENUSTART 0x0004
#define wxACC_EVENT_SYSTEM_MENUEND 0x0005
#define wxACC_EVENT_SYSTEM_MENUPOPUPSTART 0x0006
#define wxACC_EVENT_SYSTEM_MENUPOPUPEND 0x0007
#define wxACC_EVENT_SYSTEM_CAPTURESTART 0x0008
#define wxACC_EVENT_SYSTEM_CAPTUREEND 0x0009
#define wxACC_EVENT_SYSTEM_MOVESIZESTART 0x000A
#define wxACC_EVENT_SYSTEM_MOVESIZEEND 0x000B
#define wxACC_EVENT_SYSTEM_CONTEXTHELPSTART 0x000C
#define wxACC_EVENT_SYSTEM_CONTEXTHELPEND 0x000D
#define wxACC_EVENT_SYSTEM_DRAGDROPSTART 0x000E
#define wxACC_EVENT_SYSTEM_DRAGDROPEND 0x000F
#define wxACC_EVENT_SYSTEM_DIALOGSTART 0x0010
#define wxACC_EVENT_SYSTEM_DIALOGEND 0x0011
#define wxACC_EVENT_SYSTEM_SCROLLINGSTART 0x0012
#define wxACC_EVENT_SYSTEM_SCROLLINGEND 0x0013
#define wxACC_EVENT_SYSTEM_SWITCHSTART 0x0014
#define wxACC_EVENT_SYSTEM_SWITCHEND 0x0015
#define wxACC_EVENT_SYSTEM_MINIMIZESTART 0x0016
#define wxACC_EVENT_SYSTEM_MINIMIZEEND 0x0017
#define wxACC_EVENT_OBJECT_CREATE 0x8000
#define wxACC_EVENT_OBJECT_DESTROY 0x8001
#define wxACC_EVENT_OBJECT_SHOW 0x8002
#define wxACC_EVENT_OBJECT_HIDE 0x8003
#define wxACC_EVENT_OBJECT_REORDER 0x8004
#define wxACC_EVENT_OBJECT_FOCUS 0x8005
#define wxACC_EVENT_OBJECT_SELECTION 0x8006
#define wxACC_EVENT_OBJECT_SELECTIONADD 0x8007
#define wxACC_EVENT_OBJECT_SELECTIONREMOVE 0x8008
#define wxACC_EVENT_OBJECT_SELECTIONWITHIN 0x8009
#define wxACC_EVENT_OBJECT_STATECHANGE 0x800A
#define wxACC_EVENT_OBJECT_LOCATIONCHANGE 0x800B
#define wxACC_EVENT_OBJECT_NAMECHANGE 0x800C
#define wxACC_EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D
#define wxACC_EVENT_OBJECT_VALUECHANGE 0x800E
#define wxACC_EVENT_OBJECT_PARENTCHANGE 0x800F
#define wxACC_EVENT_OBJECT_HELPCHANGE 0x8010
#define wxACC_EVENT_OBJECT_DEFACTIONCHANGE 0x8011
#define wxACC_EVENT_OBJECT_ACCELERATORCHANGE 0x8012
// ----------------------------------------------------------------------------
// wxAccessible
// All functions return an indication of success, failure, or not implemented.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxAccessible;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxPoint;
class WXDLLIMPEXP_FWD_CORE wxRect;
class WXDLLIMPEXP_CORE wxAccessibleBase : public wxObject
{
wxDECLARE_NO_COPY_CLASS(wxAccessibleBase);
public:
wxAccessibleBase(wxWindow* win): m_window(win) {}
virtual ~wxAccessibleBase() {}
// Overridables
// Can return either a child object, or an integer
// representing the child element, starting from 1.
// pt is in screen coordinates.
virtual wxAccStatus HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
virtual wxAccStatus GetLocation(wxRect& WXUNUSED(rect), int WXUNUSED(elementId))
{ return wxACC_NOT_IMPLEMENTED; }
// Navigates from fromId to toId/toObject.
virtual wxAccStatus Navigate(wxNavDir WXUNUSED(navDir), int WXUNUSED(fromId),
int* WXUNUSED(toId), wxAccessible** WXUNUSED(toObject))
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the name of the specified object.
virtual wxAccStatus GetName(int WXUNUSED(childId), wxString* WXUNUSED(name))
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the number of children.
virtual wxAccStatus GetChildCount(int* WXUNUSED(childCount))
{ return wxACC_NOT_IMPLEMENTED; }
// 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 WXUNUSED(childId), wxAccessible** WXUNUSED(child))
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the parent, or NULL.
virtual wxAccStatus GetParent(wxAccessible** WXUNUSED(parent))
{ return wxACC_NOT_IMPLEMENTED; }
// 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 WXUNUSED(childId))
{ return wxACC_NOT_IMPLEMENTED; }
// 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 WXUNUSED(childId), wxString* WXUNUSED(actionName))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns the description for this object or a child.
virtual wxAccStatus GetDescription(int WXUNUSED(childId), wxString* WXUNUSED(description))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns help text for this object or a child, similar to tooltip text.
virtual wxAccStatus GetHelpText(int WXUNUSED(childId), wxString* WXUNUSED(helpText))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns the keyboard shortcut for this object or child.
// Return e.g. ALT+K
virtual wxAccStatus GetKeyboardShortcut(int WXUNUSED(childId), wxString* WXUNUSED(shortcut))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns a role constant.
virtual wxAccStatus GetRole(int WXUNUSED(childId), wxAccRole* WXUNUSED(role))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns a state constant.
virtual wxAccStatus GetState(int WXUNUSED(childId), long* WXUNUSED(state))
{ return wxACC_NOT_IMPLEMENTED; }
// Returns a localized string representing the value for the object
// or child.
virtual wxAccStatus GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue))
{ return wxACC_NOT_IMPLEMENTED; }
// Selects the object or child.
virtual wxAccStatus Select(int WXUNUSED(childId), wxAccSelectionFlags WXUNUSED(selectFlags))
{ return wxACC_NOT_IMPLEMENTED; }
// 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* WXUNUSED(childId), wxAccessible** WXUNUSED(child))
{ return wxACC_NOT_IMPLEMENTED; }
#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* WXUNUSED(selections))
{ return wxACC_NOT_IMPLEMENTED; }
#endif // wxUSE_VARIANT
// Accessors
// Returns the window associated with this object.
wxWindow* GetWindow() { return m_window; }
// Sets the window associated with this object.
void SetWindow(wxWindow* window) { m_window = window; }
// Operations
// Each platform's implementation must define this
// static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType,
// int objectId);
private:
// Data members
wxWindow* m_window;
};
// ----------------------------------------------------------------------------
// now include the declaration of the real class
// ----------------------------------------------------------------------------
#if defined(__WXMSW__)
#include "wx/msw/ole/access.h"
#endif
#endif // wxUSE_ACCESSIBILITY
#endif // _WX_ACCESSBASE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/volume.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/volume.h
// Purpose: wxFSVolume - encapsulates system volume information
// Author: George Policello
// Modified by:
// Created: 28 Jan 02
// Copyright: (c) 2002 George Policello
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// wxFSVolume represents a volume/drive in a file system
// ----------------------------------------------------------------------------
#ifndef _WX_FSVOLUME_H_
#define _WX_FSVOLUME_H_
#include "wx/defs.h"
#if wxUSE_FSVOLUME
#include "wx/arrstr.h"
// the volume flags
enum wxFSVolumeFlags
{
// is the volume mounted?
wxFS_VOL_MOUNTED = 0x0001,
// is the volume removable (floppy, CD, ...)?
wxFS_VOL_REMOVABLE = 0x0002,
// read only? (otherwise read write)
wxFS_VOL_READONLY = 0x0004,
// network resources
wxFS_VOL_REMOTE = 0x0008
};
// the volume types
enum wxFSVolumeKind
{
wxFS_VOL_FLOPPY,
wxFS_VOL_DISK,
wxFS_VOL_CDROM,
wxFS_VOL_DVDROM,
wxFS_VOL_NETWORK,
wxFS_VOL_OTHER,
wxFS_VOL_MAX
};
class WXDLLIMPEXP_BASE wxFSVolumeBase
{
public:
// return the array containing the names of the volumes
//
// only the volumes with the flags such that
// (flags & flagsSet) == flagsSet && !(flags & flagsUnset)
// are returned (by default, all mounted ones)
static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED,
int flagsUnset = 0);
// stop execution of GetVolumes() called previously (should be called from
// another thread, of course)
static void CancelSearch();
// create the volume object with this name (should be one of those returned
// by GetVolumes()).
wxFSVolumeBase();
wxFSVolumeBase(const wxString& name);
bool Create(const wxString& name);
// accessors
// ---------
// is this a valid volume?
bool IsOk() const;
// kind of this volume?
wxFSVolumeKind GetKind() const;
// flags of this volume?
int GetFlags() const;
// can we write to this volume?
bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); }
// get the name of the volume and the name which should be displayed to the
// user
wxString GetName() const { return m_volName; }
wxString GetDisplayName() const { return m_dispName; }
// TODO: operatios (Mount(), Unmount(), Eject(), ...)?
protected:
// the internal volume name
wxString m_volName;
// the volume name as it is displayed to the user
wxString m_dispName;
// have we been initialized correctly?
bool m_isOk;
};
#if wxUSE_GUI
#include "wx/icon.h"
#include "wx/iconbndl.h" // only for wxIconArray
enum wxFSIconType
{
wxFS_VOL_ICO_SMALL = 0,
wxFS_VOL_ICO_LARGE,
wxFS_VOL_ICO_SEL_SMALL,
wxFS_VOL_ICO_SEL_LARGE,
wxFS_VOL_ICO_MAX
};
// wxFSVolume adds GetIcon() to wxFSVolumeBase
class WXDLLIMPEXP_CORE wxFSVolume : public wxFSVolumeBase
{
public:
wxFSVolume() : wxFSVolumeBase() { InitIcons(); }
wxFSVolume(const wxString& name) : wxFSVolumeBase(name) { InitIcons(); }
wxIcon GetIcon(wxFSIconType type) const;
private:
void InitIcons();
// the different icons for this volume (created on demand)
wxIconArray m_icons;
};
#else // !wxUSE_GUI
// wxFSVolume is the same thing as wxFSVolume in wxBase
typedef wxFSVolumeBase wxFSVolume;
#endif // wxUSE_GUI/!wxUSE_GUI
#endif // wxUSE_FSVOLUME
#endif // _WX_FSVOLUME_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/fontutil.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/fontutil.h
// Purpose: font-related helper functions
// Author: Vadim Zeitlin
// Modified by:
// Created: 05.11.99
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// General note: this header is private to wxWidgets and is not supposed to be
// included by user code. The functions declared here are implemented in
// msw/fontutil.cpp for Windows, unix/fontutil.cpp for GTK/Motif &c.
#ifndef _WX_FONTUTIL_H_
#define _WX_FONTUTIL_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/font.h" // for wxFont and wxFontEncoding
#if defined(__WXMSW__)
#include "wx/msw/wrapwin.h"
#endif
#if defined(__WXQT__)
#include <QtGui/QFont>
#endif
#if defined(__WXOSX__)
#include "wx/osx/core/cfref.h"
#endif
class WXDLLIMPEXP_FWD_BASE wxArrayString;
struct WXDLLIMPEXP_FWD_CORE wxNativeEncodingInfo;
#if defined(_WX_X_FONTLIKE)
// the symbolic names for the XLFD fields (with examples for their value)
//
// NB: we suppose that the font always starts with the empty token (font name
// registry field) as we never use nor generate it anyhow
enum wxXLFDField
{
wxXLFD_FOUNDRY, // adobe
wxXLFD_FAMILY, // courier, times, ...
wxXLFD_WEIGHT, // black, bold, demibold, medium, regular, light
wxXLFD_SLANT, // r/i/o (roman/italique/oblique)
wxXLFD_SETWIDTH, // condensed, expanded, ...
wxXLFD_ADDSTYLE, // whatever - usually nothing
wxXLFD_PIXELSIZE, // size in pixels
wxXLFD_POINTSIZE, // size in points
wxXLFD_RESX, // 72, 75, 100, ...
wxXLFD_RESY,
wxXLFD_SPACING, // m/p/c (monospaced/proportional/character cell)
wxXLFD_AVGWIDTH, // average width in 1/10 pixels
wxXLFD_REGISTRY, // iso8859, rawin, koi8, ...
wxXLFD_ENCODING, // 1, r, r, ...
wxXLFD_MAX
};
#endif // _WX_X_FONTLIKE
// ----------------------------------------------------------------------------
// types
// ----------------------------------------------------------------------------
// wxNativeFontInfo is platform-specific font representation: this struct
// should be considered as opaque font description only used by the native
// functions, the user code can only get the objects of this type from
// somewhere and pass it somewhere else (possibly save them somewhere using
// ToString() and restore them using FromString())
class WXDLLIMPEXP_CORE wxNativeFontInfo
{
public:
#if wxUSE_PANGO
PangoFontDescription *description;
// Pango font description doesn't have these attributes, so we store them
// separately and handle them ourselves in {To,From}String() methods.
bool m_underlined;
bool m_strikethrough;
#elif defined(_WX_X_FONTLIKE)
// the members can't be accessed directly as we only parse the
// xFontName on demand
private:
// the components of the XLFD
wxString fontElements[wxXLFD_MAX];
// the full XLFD
wxString xFontName;
// true until SetXFontName() is called
bool m_isDefault;
// return true if we have already initialized fontElements
inline bool HasElements() const;
public:
// init the elements from an XLFD, return true if ok
bool FromXFontName(const wxString& xFontName);
// return false if we were never initialized with a valid XLFD
bool IsDefault() const { return m_isDefault; }
// return the XLFD (using the fontElements if necessary)
wxString GetXFontName() const;
// get the given XFLD component
wxString GetXFontComponent(wxXLFDField field) const;
// change the font component
void SetXFontComponent(wxXLFDField field, const wxString& value);
// set the XFLD
void SetXFontName(const wxString& xFontName);
#elif defined(__WXMSW__)
wxNativeFontInfo(const LOGFONT& lf_) : lf(lf_), pointSize(0.0f) { }
LOGFONT lf;
// MSW only has limited support for fractional point sizes and we need to
// store the fractional point size separately if it was initially specified
// as we can't losslessly recover it from LOGFONT later.
float pointSize;
#elif defined(__WXOSX__)
public:
wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); }
~wxNativeFontInfo() { Free(); }
wxNativeFontInfo& operator=(const wxNativeFontInfo& info)
{
if (this != &info)
{
Free();
Init(info);
}
return *this;
}
void InitFromFont(CTFontRef font);
void InitFromFontDescriptor(CTFontDescriptorRef font);
void Init(const wxNativeFontInfo& info);
void Free();
wxString GetFamilyName() const;
wxString GetStyleName() const;
static void UpdateNamesMap(const wxString& familyname, CTFontDescriptorRef descr);
static void UpdateNamesMap(const wxString& familyname, CTFontRef font);
static CGFloat GetCTWeight( CTFontRef font );
static CGFloat GetCTWeight( CTFontDescriptorRef font );
static CGFloat GetCTSlant( CTFontDescriptorRef font );
CTFontDescriptorRef GetCTFontDescriptor() const;
private:
// attributes for regenerating a CTFontDescriptor, stay close to native values
// for better roundtrip fidelity
CGFloat m_ctWeight;
wxFontStyle m_style;
CGFloat m_ctSize;
wxFontFamily m_family;
wxString m_styleName;
wxString m_familyName;
// native font description
wxCFRef<CTFontDescriptorRef> m_descriptor;
void CreateCTFontDescriptor();
// these attributes are not part of a CTFont
bool m_underlined;
bool m_strikethrough;
wxFontEncoding m_encoding;
public :
#elif defined(__WXQT__)
QFont m_qtFont;
#else // other platforms
//
// This is a generic implementation that should work on all ports
// without specific support by the port.
//
#define wxNO_NATIVE_FONTINFO
float pointSize;
wxFontFamily family;
wxFontStyle style;
int weight;
bool underlined;
bool strikethrough;
wxString faceName;
wxFontEncoding encoding;
#endif // platforms
// default ctor (default copy ctor is ok)
wxNativeFontInfo() { Init(); }
#if wxUSE_PANGO
private:
void Init(const wxNativeFontInfo& info);
void Free();
public:
wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); }
~wxNativeFontInfo() { Free(); }
wxNativeFontInfo& operator=(const wxNativeFontInfo& info)
{
if (this != &info)
{
Free();
Init(info);
}
return *this;
}
#endif // wxUSE_PANGO
// reset to the default state
void Init();
// init with the parameters of the given font
void InitFromFont(const wxFont& font)
{
#if wxUSE_PANGO || defined(__WXOSX__)
Init(*font.GetNativeFontInfo());
#else
// translate all font parameters
SetStyle((wxFontStyle)font.GetStyle());
SetNumericWeight(font.GetNumericWeight());
SetUnderlined(font.GetUnderlined());
SetStrikethrough(font.GetStrikethrough());
#if defined(__WXMSW__)
if ( font.IsUsingSizeInPixels() )
SetPixelSize(font.GetPixelSize());
else
SetFractionalPointSize(font.GetFractionalPointSize());
#else
SetFractionalPointSize(font.GetFractionalPointSize());
#endif
// set the family/facename
SetFamily((wxFontFamily)font.GetFamily());
const wxString& facename = font.GetFaceName();
if ( !facename.empty() )
{
SetFaceName(facename);
}
// deal with encoding now (it may override the font family and facename
// so do it after setting them)
SetEncoding(font.GetEncoding());
#endif // !wxUSE_PANGO
}
// accessors and modifiers for the font elements
int GetPointSize() const;
float GetFractionalPointSize() const;
wxSize GetPixelSize() const;
wxFontStyle GetStyle() const;
wxFontWeight GetWeight() const;
int GetNumericWeight() const;
bool GetUnderlined() const;
bool GetStrikethrough() const;
wxString GetFaceName() const;
wxFontFamily GetFamily() const;
wxFontEncoding GetEncoding() const;
void SetPointSize(int pointsize);
void SetFractionalPointSize(float pointsize);
void SetPixelSize(const wxSize& pixelSize);
void SetStyle(wxFontStyle style);
void SetNumericWeight(int weight);
void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined);
void SetStrikethrough(bool strikethrough);
bool SetFaceName(const wxString& facename);
void SetFamily(wxFontFamily family);
void SetEncoding(wxFontEncoding encoding);
// Helper used in many ports: use the normal font size if the input is
// negative, as we handle -1 as meaning this for compatibility.
void SetSizeOrDefault(float size)
{
SetFractionalPointSize
(
size < 0 ? wxNORMAL_FONT->GetFractionalPointSize()
: size
);
}
// sets the first facename in the given array which is found
// to be valid. If no valid facename is given, sets the
// first valid facename returned by wxFontEnumerator::GetFacenames().
// Does not return a bool since it cannot fail.
void SetFaceName(const wxArrayString &facenames);
// it is important to be able to serialize wxNativeFontInfo objects to be
// able to store them (in config file, for example)
bool FromString(const wxString& s);
wxString ToString() const;
// we also want to present the native font descriptions to the user in some
// human-readable form (it is not platform independent neither, but can
// hopefully be understood by the user)
bool FromUserString(const wxString& s);
wxString ToUserString() const;
};
// ----------------------------------------------------------------------------
// font-related functions (common)
// ----------------------------------------------------------------------------
// translate a wxFontEncoding into native encoding parameter (defined above),
// returning true if an (exact) macth could be found, false otherwise (without
// attempting any substitutions)
WXDLLIMPEXP_CORE bool wxGetNativeFontEncoding(wxFontEncoding encoding,
wxNativeEncodingInfo *info);
// test for the existence of the font described by this facename/encoding,
// return true if such font(s) exist, false otherwise
WXDLLIMPEXP_CORE bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
// ----------------------------------------------------------------------------
// font-related functions (X and GTK)
// ----------------------------------------------------------------------------
#ifdef _WX_X_FONTLIKE
#include "wx/unix/fontutil.h"
#endif // X || GDK
#endif // _WX_FONTUTIL_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/addremovectrl.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/addremovectrl.h
// Purpose: wxAddRemoveCtrl declaration.
// Author: Vadim Zeitlin
// Created: 2015-01-29
// Copyright: (c) 2015 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ADDREMOVECTRL_H_
#define _WX_ADDREMOVECTRL_H_
#include "wx/panel.h"
#if wxUSE_ADDREMOVECTRL
extern WXDLLIMPEXP_DATA_CORE(const char) wxAddRemoveCtrlNameStr[];
// ----------------------------------------------------------------------------
// wxAddRemoveAdaptor: used by wxAddRemoveCtrl to work with the list control
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxAddRemoveAdaptor
{
public:
// Default ctor and trivial but virtual dtor.
wxAddRemoveAdaptor() { }
virtual ~wxAddRemoveAdaptor() { }
// Override to return the associated control.
virtual wxWindow* GetItemsCtrl() const = 0;
// Override to return whether a new item can be added to the control.
virtual bool CanAdd() const = 0;
// Override to return whether the currently selected item (if any) can be
// removed from the control.
virtual bool CanRemove() const = 0;
// Called when an item should be added, can only be called if CanAdd()
// currently returns true.
virtual void OnAdd() = 0;
// Called when the current item should be removed, can only be called if
// CanRemove() currently returns true.
virtual void OnRemove() = 0;
private:
wxDECLARE_NO_COPY_CLASS(wxAddRemoveAdaptor);
};
// ----------------------------------------------------------------------------
// wxAddRemoveCtrl: a list-like control combined with add/remove buttons
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxAddRemoveCtrl : public wxPanel
{
public:
wxAddRemoveCtrl()
{
Init();
}
wxAddRemoveCtrl(wxWindow* parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxAddRemoveCtrlNameStr)
{
Init();
Create(parent, winid, pos, size, style, name);
}
bool Create(wxWindow* parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxAddRemoveCtrlNameStr);
virtual ~wxAddRemoveCtrl();
// Must be called for the control to be usable, takes ownership of the
// pointer.
void SetAdaptor(wxAddRemoveAdaptor* adaptor);
// Set tooltips to use for the add and remove buttons.
void SetButtonsToolTips(const wxString& addtip, const wxString& removetip);
protected:
virtual wxSize DoGetBestClientSize() const wxOVERRIDE;
private:
// Common part of all ctors.
void Init()
{
m_impl = NULL;
}
class wxAddRemoveImpl* m_impl;
wxDECLARE_NO_COPY_CLASS(wxAddRemoveCtrl);
};
#endif // wxUSE_ADDREMOVECTRL
#endif // _WX_ADDREMOVECTRL_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/spinbutt.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/spinbutt.h
// Purpose: wxSpinButtonBase class
// Author: Julian Smart, Vadim Zeitlin
// Modified by:
// Created: 23.07.99
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SPINBUTT_H_BASE_
#define _WX_SPINBUTT_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_SPINBTN
#include "wx/control.h"
#include "wx/event.h"
#include "wx/range.h"
#define wxSPIN_BUTTON_NAME wxT("wxSpinButton")
// ----------------------------------------------------------------------------
// The wxSpinButton is like a small scrollbar than is often placed next
// to a text control.
//
// Styles:
// wxSP_HORIZONTAL: horizontal spin button
// wxSP_VERTICAL: vertical spin button (the default)
// wxSP_ARROW_KEYS: arrow keys increment/decrement value
// wxSP_WRAP: value wraps at either end
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSpinButtonBase : public wxControl
{
public:
// ctor initializes the range with the default (0..100) values
wxSpinButtonBase() { m_min = 0; m_max = 100; }
// accessors
virtual int GetValue() const = 0;
virtual int GetMin() const { return m_min; }
virtual int GetMax() const { return m_max; }
wxRange GetRange() const { return wxRange( GetMin(), GetMax() );}
// operations
virtual void SetValue(int val) = 0;
virtual void SetMin(int minVal) { SetRange ( minVal , m_max ) ; }
virtual void SetMax(int maxVal) { SetRange ( m_min , maxVal ) ; }
virtual void SetRange(int minVal, int maxVal)
{
m_min = minVal;
m_max = maxVal;
}
void SetRange( const wxRange& range) { SetRange( range.GetMin(), range.GetMax()); }
// is this spin button vertically oriented?
bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; }
protected:
// the range value
int m_min;
int m_max;
wxDECLARE_NO_COPY_CLASS(wxSpinButtonBase);
};
// ----------------------------------------------------------------------------
// include the declaration of the real class
// ----------------------------------------------------------------------------
#if defined(__WXUNIVERSAL__)
#include "wx/univ/spinbutt.h"
#elif defined(__WXMSW__)
#include "wx/msw/spinbutt.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/spinbutt.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/spinbutt.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/spinbutt.h"
#elif defined(__WXMAC__)
#include "wx/osx/spinbutt.h"
#elif defined(__WXQT__)
#include "wx/qt/spinbutt.h"
#endif
// ----------------------------------------------------------------------------
// the wxSpinButton event
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSpinEvent : public wxNotifyEvent
{
public:
wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
: wxNotifyEvent(commandType, winid)
{
}
wxSpinEvent(const wxSpinEvent& event) : wxNotifyEvent(event) {}
// get the current value of the control
int GetValue() const { return m_commandInt; }
void SetValue(int value) { m_commandInt = value; }
int GetPosition() const { return m_commandInt; }
void SetPosition(int pos) { m_commandInt = pos; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxSpinEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinEvent);
};
typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
#define wxSpinEventHandler(func) \
wxEVENT_HANDLER_CAST(wxSpinEventFunction, func)
// macros for handling spin events: notice that we must use the real values of
// the event type constants and not their references (wxEVT_SPIN[_UP/DOWN])
// here as otherwise the event tables could end up with non-initialized
// (because of undefined initialization order of the globals defined in
// different translation units) references in them
#define EVT_SPIN_UP(winid, func) \
wx__DECLARE_EVT1(wxEVT_SPIN_UP, winid, wxSpinEventHandler(func))
#define EVT_SPIN_DOWN(winid, func) \
wx__DECLARE_EVT1(wxEVT_SPIN_DOWN, winid, wxSpinEventHandler(func))
#define EVT_SPIN(winid, func) \
wx__DECLARE_EVT1(wxEVT_SPIN, winid, wxSpinEventHandler(func))
#endif // wxUSE_SPINBTN
#endif
// _WX_SPINBUTT_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/stream.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/stream.h
// Purpose: stream classes
// Author: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin
// Modified by:
// Created: 11/07/98
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WXSTREAM_H__
#define _WX_WXSTREAM_H__
#include "wx/defs.h"
#if wxUSE_STREAMS
#include <stdio.h>
#include "wx/object.h"
#include "wx/string.h"
#include "wx/filefn.h" // for wxFileOffset, wxInvalidOffset and wxSeekMode
class WXDLLIMPEXP_FWD_BASE wxStreamBase;
class WXDLLIMPEXP_FWD_BASE wxInputStream;
class WXDLLIMPEXP_FWD_BASE wxOutputStream;
typedef wxInputStream& (*__wxInputManip)(wxInputStream&);
typedef wxOutputStream& (*__wxOutputManip)(wxOutputStream&);
WXDLLIMPEXP_BASE wxOutputStream& wxEndL(wxOutputStream& o_stream);
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
enum wxStreamError
{
wxSTREAM_NO_ERROR = 0, // stream is in good state
wxSTREAM_EOF, // EOF reached in Read() or similar
wxSTREAM_WRITE_ERROR, // generic write error
wxSTREAM_READ_ERROR // generic read error
};
const int wxEOF = -1;
// ============================================================================
// base stream classes: wxInputStream and wxOutputStream
// ============================================================================
// ---------------------------------------------------------------------------
// wxStreamBase: common (but non virtual!) base for all stream classes
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxStreamBase : public wxObject
{
public:
wxStreamBase();
virtual ~wxStreamBase();
// error testing
wxStreamError GetLastError() const { return m_lasterror; }
virtual bool IsOk() const { return GetLastError() == wxSTREAM_NO_ERROR; }
bool operator!() const { return !IsOk(); }
// reset the stream state
void Reset(wxStreamError error = wxSTREAM_NO_ERROR) { m_lasterror = error; }
// this doesn't make sense for all streams, always test its return value
virtual size_t GetSize() const;
virtual wxFileOffset GetLength() const { return wxInvalidOffset; }
// returns true if the streams supports seeking to arbitrary offsets
virtual bool IsSeekable() const { return false; }
protected:
virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
virtual wxFileOffset OnSysTell() const;
size_t m_lastcount;
wxStreamError m_lasterror;
friend class wxStreamBuffer;
wxDECLARE_ABSTRACT_CLASS(wxStreamBase);
wxDECLARE_NO_COPY_CLASS(wxStreamBase);
};
// ----------------------------------------------------------------------------
// wxInputStream: base class for the input streams
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxInputStream : public wxStreamBase
{
public:
// ctor and dtor, nothing exciting
wxInputStream();
virtual ~wxInputStream();
// IO functions
// ------------
// return a character from the stream without removing it, i.e. it will
// still be returned by the next call to GetC()
//
// blocks until something appears in the stream if necessary, if nothing
// ever does (i.e. EOF) LastRead() will return 0 (and the return value is
// undefined), otherwise 1
virtual char Peek();
// return one byte from the stream, blocking until it appears if
// necessary
//
// on success returns a value between 0 - 255, or wxEOF on EOF or error.
int GetC();
// read at most the given number of bytes from the stream
//
// there are 2 possible situations here: either there is nothing at all in
// the stream right now in which case Read() blocks until something appears
// (use CanRead() to avoid this) or there is already some data available in
// the stream and then Read() doesn't block but returns just the data it
// can read without waiting for more
//
// in any case, if there are not enough bytes in the stream right now,
// LastRead() value will be less than size but greater than 0. If it is 0,
// it means that EOF has been reached.
virtual wxInputStream& Read(void *buffer, size_t size);
// Read exactly the given number of bytes, unlike Read(), which may read
// less than the requested amount of data without returning an error, this
// method either reads all the data or returns false.
bool ReadAll(void *buffer, size_t size);
// copy the entire contents of this stream into streamOut, stopping only
// when EOF is reached or an error occurs
wxInputStream& Read(wxOutputStream& streamOut);
// status functions
// ----------------
// returns the number of bytes read by the last call to Read(), GetC() or
// Peek()
//
// this should be used to discover whether that call succeeded in reading
// all the requested data or not
virtual size_t LastRead() const { return wxStreamBase::m_lastcount; }
// returns true if some data is available in the stream right now, so that
// calling Read() wouldn't block
virtual bool CanRead() const;
// is the stream at EOF?
//
// note that this cannot be really implemented for all streams and
// CanRead() is more reliable than Eof()
virtual bool Eof() const;
// write back buffer
// -----------------
// put back the specified number of bytes into the stream, they will be
// fetched by the next call to the read functions
//
// returns the number of bytes really stuffed back
size_t Ungetch(const void *buffer, size_t size);
// put back the specified character in the stream
//
// returns true if ok, false on error
bool Ungetch(char c);
// position functions
// ------------------
// move the stream pointer to the given position (if the stream supports
// it)
//
// returns wxInvalidOffset on error
virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart);
// return the current position of the stream pointer or wxInvalidOffset
virtual wxFileOffset TellI() const;
// stream-like operators
// ---------------------
wxInputStream& operator>>(wxOutputStream& out) { return Read(out); }
wxInputStream& operator>>(__wxInputManip func) { return func(*this); }
protected:
// do read up to size bytes of data into the provided buffer
//
// this method should return 0 if EOF has been reached or an error occurred
// (m_lasterror should be set accordingly as well) or the number of bytes
// read
virtual size_t OnSysRead(void *buffer, size_t size) = 0;
// write-back buffer support
// -------------------------
// return the pointer to a buffer big enough to hold sizeNeeded bytes
char *AllocSpaceWBack(size_t sizeNeeded);
// read up to size data from the write back buffer, return the number of
// bytes read
size_t GetWBack(void *buf, size_t size);
// write back buffer or NULL if none
char *m_wback;
// the size of the buffer
size_t m_wbacksize;
// the current position in the buffer
size_t m_wbackcur;
friend class wxStreamBuffer;
wxDECLARE_ABSTRACT_CLASS(wxInputStream);
wxDECLARE_NO_COPY_CLASS(wxInputStream);
};
// ----------------------------------------------------------------------------
// wxOutputStream: base for the output streams
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxOutputStream : public wxStreamBase
{
public:
wxOutputStream();
virtual ~wxOutputStream();
void PutC(char c);
virtual wxOutputStream& Write(const void *buffer, size_t size);
// This is ReadAll() equivalent for Write(): it either writes exactly the
// given number of bytes or returns false, unlike Write() which can write
// less data than requested but still return without error.
bool WriteAll(const void *buffer, size_t size);
wxOutputStream& Write(wxInputStream& stream_in);
virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart);
virtual wxFileOffset TellO() const;
virtual size_t LastWrite() const { return wxStreamBase::m_lastcount; }
virtual void Sync();
virtual bool Close() { return true; }
wxOutputStream& operator<<(wxInputStream& out) { return Write(out); }
wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); }
protected:
// to be implemented in the derived classes (it should have been pure
// virtual)
virtual size_t OnSysWrite(const void *buffer, size_t bufsize);
friend class wxStreamBuffer;
wxDECLARE_ABSTRACT_CLASS(wxOutputStream);
wxDECLARE_NO_COPY_CLASS(wxOutputStream);
};
// ============================================================================
// helper stream classes
// ============================================================================
// ---------------------------------------------------------------------------
// A stream for measuring streamed output
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxCountingOutputStream : public wxOutputStream
{
public:
wxCountingOutputStream();
virtual wxFileOffset GetLength() const wxOVERRIDE;
bool Ok() const { return IsOk(); }
virtual bool IsOk() const wxOVERRIDE { return true; }
protected:
virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE;
virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE;
virtual wxFileOffset OnSysTell() const wxOVERRIDE;
size_t m_currentPos,
m_lastPos;
wxDECLARE_DYNAMIC_CLASS(wxCountingOutputStream);
wxDECLARE_NO_COPY_CLASS(wxCountingOutputStream);
};
// ---------------------------------------------------------------------------
// "Filter" streams
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxFilterInputStream : public wxInputStream
{
public:
wxFilterInputStream();
wxFilterInputStream(wxInputStream& stream);
wxFilterInputStream(wxInputStream *stream);
virtual ~wxFilterInputStream();
virtual char Peek() wxOVERRIDE { return m_parent_i_stream->Peek(); }
virtual wxFileOffset GetLength() const wxOVERRIDE { return m_parent_i_stream->GetLength(); }
wxInputStream *GetFilterInputStream() const { return m_parent_i_stream; }
protected:
wxInputStream *m_parent_i_stream;
bool m_owns;
wxDECLARE_ABSTRACT_CLASS(wxFilterInputStream);
wxDECLARE_NO_COPY_CLASS(wxFilterInputStream);
};
class WXDLLIMPEXP_BASE wxFilterOutputStream : public wxOutputStream
{
public:
wxFilterOutputStream();
wxFilterOutputStream(wxOutputStream& stream);
wxFilterOutputStream(wxOutputStream *stream);
virtual ~wxFilterOutputStream();
virtual wxFileOffset GetLength() const wxOVERRIDE { return m_parent_o_stream->GetLength(); }
wxOutputStream *GetFilterOutputStream() const { return m_parent_o_stream; }
bool Close() wxOVERRIDE;
protected:
wxOutputStream *m_parent_o_stream;
bool m_owns;
wxDECLARE_ABSTRACT_CLASS(wxFilterOutputStream);
wxDECLARE_NO_COPY_CLASS(wxFilterOutputStream);
};
enum wxStreamProtocolType
{
wxSTREAM_PROTOCOL, // wxFileSystem protocol (should be only one)
wxSTREAM_MIMETYPE, // MIME types the stream handles
wxSTREAM_ENCODING, // The HTTP Content-Encodings the stream handles
wxSTREAM_FILEEXT // File extensions the stream handles
};
void WXDLLIMPEXP_BASE wxUseFilterClasses();
class WXDLLIMPEXP_BASE wxFilterClassFactoryBase : public wxObject
{
public:
virtual ~wxFilterClassFactoryBase() { }
wxString GetProtocol() const { return wxString(*GetProtocols()); }
wxString PopExtension(const wxString& location) const;
virtual const wxChar * const *GetProtocols(wxStreamProtocolType type
= wxSTREAM_PROTOCOL) const = 0;
bool CanHandle(const wxString& protocol,
wxStreamProtocolType type
= wxSTREAM_PROTOCOL) const;
protected:
wxString::size_type FindExtension(const wxString& location) const;
wxDECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase);
};
class WXDLLIMPEXP_BASE wxFilterClassFactory : public wxFilterClassFactoryBase
{
public:
virtual ~wxFilterClassFactory() { }
virtual wxFilterInputStream *NewStream(wxInputStream& stream) const = 0;
virtual wxFilterOutputStream *NewStream(wxOutputStream& stream) const = 0;
virtual wxFilterInputStream *NewStream(wxInputStream *stream) const = 0;
virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0;
static const wxFilterClassFactory *Find(const wxString& protocol,
wxStreamProtocolType type
= wxSTREAM_PROTOCOL);
static const wxFilterClassFactory *GetFirst();
const wxFilterClassFactory *GetNext() const { return m_next; }
void PushFront() { Remove(); m_next = sm_first; sm_first = this; }
void Remove();
protected:
wxFilterClassFactory() : m_next(this) { }
wxFilterClassFactory& operator=(const wxFilterClassFactory&)
{ return *this; }
private:
static wxFilterClassFactory *sm_first;
wxFilterClassFactory *m_next;
wxDECLARE_ABSTRACT_CLASS(wxFilterClassFactory);
};
// ============================================================================
// buffered streams
// ============================================================================
// ---------------------------------------------------------------------------
// Stream buffer: this class can be derived from and passed to
// wxBufferedStreams to implement custom buffering
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxStreamBuffer
{
public:
enum BufMode
{
read,
write,
read_write
};
wxStreamBuffer(wxStreamBase& stream, BufMode mode)
{
InitWithStream(stream, mode);
}
wxStreamBuffer(size_t bufsize, wxInputStream& stream)
{
InitWithStream(stream, read);
SetBufferIO(bufsize);
}
wxStreamBuffer(size_t bufsize, wxOutputStream& stream)
{
InitWithStream(stream, write);
SetBufferIO(bufsize);
}
wxStreamBuffer(const wxStreamBuffer& buf);
virtual ~wxStreamBuffer();
// Filtered IO
virtual size_t Read(void *buffer, size_t size);
size_t Read(wxStreamBuffer *buf);
virtual size_t Write(const void *buffer, size_t size);
size_t Write(wxStreamBuffer *buf);
virtual char Peek();
virtual char GetChar();
virtual void PutChar(char c);
virtual wxFileOffset Tell() const;
virtual wxFileOffset Seek(wxFileOffset pos, wxSeekMode mode);
// Buffer control
void ResetBuffer();
void Truncate();
// NB: the buffer must always be allocated with malloc() if takeOwn is
// true as it will be deallocated by free()
void SetBufferIO(void *start, void *end, bool takeOwnership = false);
void SetBufferIO(void *start, size_t len, bool takeOwnership = false);
void SetBufferIO(size_t bufsize);
void *GetBufferStart() const { return m_buffer_start; }
void *GetBufferEnd() const { return m_buffer_end; }
void *GetBufferPos() const { return m_buffer_pos; }
size_t GetBufferSize() const { return m_buffer_end - m_buffer_start; }
size_t GetIntPosition() const { return m_buffer_pos - m_buffer_start; }
void SetIntPosition(size_t pos) { m_buffer_pos = m_buffer_start + pos; }
size_t GetLastAccess() const { return m_buffer_end - m_buffer_start; }
size_t GetBytesLeft() const { return m_buffer_end - m_buffer_pos; }
void Fixed(bool fixed) { m_fixed = fixed; }
void Flushable(bool f) { m_flushable = f; }
bool FlushBuffer();
bool FillBuffer();
size_t GetDataLeft();
// misc accessors
wxStreamBase *GetStream() const { return m_stream; }
bool HasBuffer() const { return m_buffer_start != m_buffer_end; }
bool IsFixed() const { return m_fixed; }
bool IsFlushable() const { return m_flushable; }
// only for input/output buffers respectively, returns NULL otherwise
wxInputStream *GetInputStream() const;
wxOutputStream *GetOutputStream() const;
// this constructs a dummy wxStreamBuffer, used by (and exists for)
// wxMemoryStreams only, don't use!
wxStreamBuffer(BufMode mode);
protected:
void GetFromBuffer(void *buffer, size_t size);
void PutToBuffer(const void *buffer, size_t size);
// set the last error to the specified value if we didn't have it before
void SetError(wxStreamError err);
// common part of several ctors
void Init();
// common part of ctors taking wxStreamBase parameter
void InitWithStream(wxStreamBase& stream, BufMode mode);
// init buffer variables to be empty
void InitBuffer();
// free the buffer (always safe to call)
void FreeBuffer();
// the buffer itself: the pointers to its start and end and the current
// position in the buffer
char *m_buffer_start,
*m_buffer_end,
*m_buffer_pos;
// the stream we're associated with
wxStreamBase *m_stream;
// its mode
BufMode m_mode;
// flags
bool m_destroybuf, // deallocate buffer?
m_fixed,
m_flushable;
wxDECLARE_NO_ASSIGN_CLASS(wxStreamBuffer);
};
// ---------------------------------------------------------------------------
// wxBufferedInputStream
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxBufferedInputStream : public wxFilterInputStream
{
public:
// create a buffered stream on top of the specified low-level stream
//
// if a non NULL buffer is given to the stream, it will be deleted by it,
// otherwise a default 1KB buffer will be used
wxBufferedInputStream(wxInputStream& stream,
wxStreamBuffer *buffer = NULL);
// ctor allowing to specify the buffer size, it's just a more convenient
// alternative to creating wxStreamBuffer, calling its SetBufferIO(bufsize)
// and using the ctor above
wxBufferedInputStream(wxInputStream& stream, size_t bufsize);
virtual ~wxBufferedInputStream();
virtual char Peek() wxOVERRIDE;
virtual wxInputStream& Read(void *buffer, size_t size) wxOVERRIDE;
// Position functions
virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart) wxOVERRIDE;
virtual wxFileOffset TellI() const wxOVERRIDE;
virtual bool IsSeekable() const wxOVERRIDE { return m_parent_i_stream->IsSeekable(); }
// the buffer given to the stream will be deleted by it
void SetInputStreamBuffer(wxStreamBuffer *buffer);
wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; }
protected:
virtual size_t OnSysRead(void *buffer, size_t bufsize) wxOVERRIDE;
virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) wxOVERRIDE;
virtual wxFileOffset OnSysTell() const wxOVERRIDE;
wxStreamBuffer *m_i_streambuf;
wxDECLARE_NO_COPY_CLASS(wxBufferedInputStream);
};
// ----------------------------------------------------------------------------
// wxBufferedOutputStream
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxBufferedOutputStream : public wxFilterOutputStream
{
public:
// create a buffered stream on top of the specified low-level stream
//
// if a non NULL buffer is given to the stream, it will be deleted by it,
// otherwise a default 1KB buffer will be used
wxBufferedOutputStream(wxOutputStream& stream,
wxStreamBuffer *buffer = NULL);
// ctor allowing to specify the buffer size, it's just a more convenient
// alternative to creating wxStreamBuffer, calling its SetBufferIO(bufsize)
// and using the ctor above
wxBufferedOutputStream(wxOutputStream& stream, size_t bufsize);
virtual ~wxBufferedOutputStream();
virtual wxOutputStream& Write(const void *buffer, size_t size) wxOVERRIDE;
// Position functions
virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart) wxOVERRIDE;
virtual wxFileOffset TellO() const wxOVERRIDE;
virtual bool IsSeekable() const wxOVERRIDE { return m_parent_o_stream->IsSeekable(); }
void Sync() wxOVERRIDE;
bool Close() wxOVERRIDE;
virtual wxFileOffset GetLength() const wxOVERRIDE;
// the buffer given to the stream will be deleted by it
void SetOutputStreamBuffer(wxStreamBuffer *buffer);
wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; }
protected:
virtual size_t OnSysWrite(const void *buffer, size_t bufsize) wxOVERRIDE;
virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) wxOVERRIDE;
virtual wxFileOffset OnSysTell() const wxOVERRIDE;
wxStreamBuffer *m_o_streambuf;
wxDECLARE_NO_COPY_CLASS(wxBufferedOutputStream);
};
// ---------------------------------------------------------------------------
// wxWrapperInputStream: forwards all IO to another stream.
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxWrapperInputStream : public wxFilterInputStream
{
public:
// Constructor fully initializing the stream. The overload taking pointer
// takes ownership of the parent stream, the one taking reference does not.
//
// Notice that this class also has a default ctor but it's protected as the
// derived class is supposed to take care of calling InitParentStream() if
// it's used.
wxWrapperInputStream(wxInputStream& stream);
wxWrapperInputStream(wxInputStream* stream);
// Override the base class methods to forward to the wrapped stream.
virtual wxFileOffset GetLength() const wxOVERRIDE;
virtual bool IsSeekable() const wxOVERRIDE;
protected:
virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE;
virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE;
virtual wxFileOffset OnSysTell() const wxOVERRIDE;
// Ensure that our own last error is the same as that of the real stream.
//
// This method is const because the error must be updated even from const
// methods (in other words, it really should have been mutable in the first
// place).
void SynchronizeLastError() const
{
const_cast<wxWrapperInputStream*>(this)->
Reset(m_parent_i_stream->GetLastError());
}
// Default constructor, use InitParentStream() later.
wxWrapperInputStream();
// Set up the wrapped stream for an object initialized using the default
// constructor. The ownership logic is the same as above.
void InitParentStream(wxInputStream& stream);
void InitParentStream(wxInputStream* stream);
wxDECLARE_NO_COPY_CLASS(wxWrapperInputStream);
};
#endif // wxUSE_STREAMS
#endif // _WX_WXSTREAM_H__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/setup_redirect.h | /*
* wx/setup.h
*
* This file should not normally be used, except where makefiles
* have not yet been adjusted to take into account of the new scheme
* whereby a setup.h is created under the lib directory.
*
* Copyright: (c) Vadim Zeitlin
* Licence: wxWindows Licence
*/
#ifdef __WXMSW__
#include "wx/msw/setup.h"
#else
#error Please adjust your include path to pick up the wx/setup.h file under lib first.
#endif
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/docview.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/docview.h
// Purpose: Doc/View classes
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DOCH__
#define _WX_DOCH__
#include "wx/defs.h"
#if wxUSE_DOC_VIEW_ARCHITECTURE
#include "wx/list.h"
#include "wx/dlist.h"
#include "wx/string.h"
#include "wx/frame.h"
#include "wx/filehistory.h"
#include "wx/vector.h"
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/print.h"
#endif
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxDocument;
class WXDLLIMPEXP_FWD_CORE wxView;
class WXDLLIMPEXP_FWD_CORE wxDocTemplate;
class WXDLLIMPEXP_FWD_CORE wxDocManager;
class WXDLLIMPEXP_FWD_CORE wxPrintInfo;
class WXDLLIMPEXP_FWD_CORE wxCommandProcessor;
class WXDLLIMPEXP_FWD_BASE wxConfigBase;
class wxDocChildFrameAnyBase;
#if wxUSE_STD_IOSTREAM
#include "wx/iosfwrap.h"
#else
#include "wx/stream.h"
#endif
// Flags for wxDocManager (can be combined).
enum
{
wxDOC_NEW = 1,
wxDOC_SILENT = 2
};
// Document template flags
enum
{
wxTEMPLATE_VISIBLE = 1,
wxTEMPLATE_INVISIBLE = 2,
wxDEFAULT_TEMPLATE_FLAGS = wxTEMPLATE_VISIBLE
};
#define wxMAX_FILE_HISTORY 9
typedef wxVector<wxDocument*> wxDocVector;
typedef wxVector<wxView*> wxViewVector;
typedef wxVector<wxDocTemplate*> wxDocTemplateVector;
class WXDLLIMPEXP_CORE wxDocument : public wxEvtHandler
{
public:
wxDocument(wxDocument *parent = NULL);
virtual ~wxDocument();
// accessors
void SetFilename(const wxString& filename, bool notifyViews = false);
wxString GetFilename() const { return m_documentFile; }
void SetTitle(const wxString& title) { m_documentTitle = title; }
wxString GetTitle() const { return m_documentTitle; }
void SetDocumentName(const wxString& name) { m_documentTypeName = name; }
wxString GetDocumentName() const { return m_documentTypeName; }
// access the flag indicating whether this document had been already saved,
// SetDocumentSaved() is only used internally, don't call it
bool GetDocumentSaved() const { return m_savedYet; }
void SetDocumentSaved(bool saved = true) { m_savedYet = saved; }
// activate the first view of the document if any
void Activate();
// return true if the document hasn't been modified since the last time it
// was saved (implying that it returns false if it was never saved, even if
// the document is not modified)
bool AlreadySaved() const { return !IsModified() && GetDocumentSaved(); }
virtual bool Close();
virtual bool Save();
virtual bool SaveAs();
virtual bool Revert();
#if wxUSE_STD_IOSTREAM
virtual wxSTD ostream& SaveObject(wxSTD ostream& stream);
virtual wxSTD istream& LoadObject(wxSTD istream& stream);
#else
virtual wxOutputStream& SaveObject(wxOutputStream& stream);
virtual wxInputStream& LoadObject(wxInputStream& stream);
#endif
// Called by wxWidgets
virtual bool OnSaveDocument(const wxString& filename);
virtual bool OnOpenDocument(const wxString& filename);
virtual bool OnNewDocument();
virtual bool OnCloseDocument();
// Prompts for saving if about to close a modified document. Returns true
// if ok to close the document (may have saved in the meantime, or set
// modified to false)
virtual bool OnSaveModified();
// if you override, remember to call the default
// implementation (wxDocument::OnChangeFilename)
virtual void OnChangeFilename(bool notifyViews);
// Called by framework if created automatically by the default document
// manager: gives document a chance to initialise and (usually) create a
// view
virtual bool OnCreate(const wxString& path, long flags);
// By default, creates a base wxCommandProcessor.
virtual wxCommandProcessor *OnCreateCommandProcessor();
virtual wxCommandProcessor *GetCommandProcessor() const
{ return m_commandProcessor; }
virtual void SetCommandProcessor(wxCommandProcessor *proc)
{ m_commandProcessor = proc; }
// Called after a view is added or removed. The default implementation
// deletes the document if this is there are no more views.
virtual void OnChangedViewList();
// Called from OnCloseDocument(), does nothing by default but may be
// overridden. Return value is ignored.
virtual bool DeleteContents();
virtual bool Draw(wxDC&);
virtual bool IsModified() const { return m_documentModified; }
virtual void Modify(bool mod);
virtual bool AddView(wxView *view);
virtual bool RemoveView(wxView *view);
wxViewVector GetViewsVector() const;
wxList& GetViews() { return m_documentViews; }
const wxList& GetViews() const { return m_documentViews; }
wxView *GetFirstView() const;
virtual void UpdateAllViews(wxView *sender = NULL, wxObject *hint = NULL);
virtual void NotifyClosing();
// Remove all views (because we're closing the document)
virtual bool DeleteAllViews();
// Other stuff
virtual wxDocManager *GetDocumentManager() const;
virtual wxDocTemplate *GetDocumentTemplate() const
{ return m_documentTemplate; }
virtual void SetDocumentTemplate(wxDocTemplate *temp)
{ m_documentTemplate = temp; }
// Get the document name to be shown to the user: the title if there is
// any, otherwise the filename if the document was saved and, finally,
// "unnamed" otherwise
virtual wxString GetUserReadableName() const;
#if WXWIN_COMPATIBILITY_2_8
// use GetUserReadableName() instead
wxDEPRECATED_BUT_USED_INTERNALLY(
virtual bool GetPrintableName(wxString& buf) const
);
#endif // WXWIN_COMPATIBILITY_2_8
// Returns a window that can be used as a parent for document-related
// dialogs. Override if necessary.
virtual wxWindow *GetDocumentWindow() const;
// Returns true if this document is a child document corresponding to a
// part of the parent document and not a disk file as usual.
bool IsChildDocument() const { return m_documentParent != NULL; }
protected:
wxList m_documentViews;
wxString m_documentFile;
wxString m_documentTitle;
wxString m_documentTypeName;
wxDocTemplate* m_documentTemplate;
bool m_documentModified;
// if the document parent is non-NULL, it's a pseudo-document corresponding
// to a part of the parent document which can't be saved or loaded
// independently of its parent and is always closed when its parent is
wxDocument* m_documentParent;
wxCommandProcessor* m_commandProcessor;
bool m_savedYet;
// Called by OnSaveDocument and OnOpenDocument to implement standard
// Save/Load behaviour. Re-implement in derived class for custom
// behaviour.
virtual bool DoSaveDocument(const wxString& file);
virtual bool DoOpenDocument(const wxString& file);
// the default implementation of GetUserReadableName()
wxString DoGetUserReadableName() const;
private:
// list of all documents whose m_documentParent is this one
typedef wxDList<wxDocument> DocsList;
DocsList m_childDocuments;
wxDECLARE_ABSTRACT_CLASS(wxDocument);
wxDECLARE_NO_COPY_CLASS(wxDocument);
};
class WXDLLIMPEXP_CORE wxView: public wxEvtHandler
{
public:
wxView();
virtual ~wxView();
wxDocument *GetDocument() const { return m_viewDocument; }
virtual void SetDocument(wxDocument *doc);
wxString GetViewName() const { return m_viewTypeName; }
void SetViewName(const wxString& name) { m_viewTypeName = name; }
wxWindow *GetFrame() const { return m_viewFrame ; }
void SetFrame(wxWindow *frame) { m_viewFrame = frame; }
virtual void OnActivateView(bool activate,
wxView *activeView,
wxView *deactiveView);
virtual void OnDraw(wxDC *dc) = 0;
virtual void OnPrint(wxDC *dc, wxObject *info);
virtual void OnUpdate(wxView *sender, wxObject *hint = NULL);
virtual void OnClosingDocument() {}
virtual void OnChangeFilename();
// Called by framework if created automatically by the default document
// manager class: gives view a chance to initialise
virtual bool OnCreate(wxDocument *WXUNUSED(doc), long WXUNUSED(flags))
{ return true; }
// Checks if the view is the last one for the document; if so, asks user
// to confirm save data (if modified). If ok, deletes itself and returns
// true.
virtual bool Close(bool deleteWindow = true);
// Override to do cleanup/veto close
virtual bool OnClose(bool deleteWindow);
// A view's window can call this to notify the view it is (in)active.
// The function then notifies the document manager.
virtual void Activate(bool activate);
wxDocManager *GetDocumentManager() const
{ return m_viewDocument->GetDocumentManager(); }
#if wxUSE_PRINTING_ARCHITECTURE
virtual wxPrintout *OnCreatePrintout();
#endif
// implementation only
// -------------------
// set the associated frame, it is used to reset its view when we're
// destroyed
void SetDocChildFrame(wxDocChildFrameAnyBase *docChildFrame);
// get the associated frame, may be NULL during destruction
wxDocChildFrameAnyBase* GetDocChildFrame() const { return m_docChildFrame; }
protected:
// hook the document into event handlers chain here
virtual bool TryBefore(wxEvent& event) wxOVERRIDE;
wxDocument* m_viewDocument;
wxString m_viewTypeName;
wxWindow* m_viewFrame;
wxDocChildFrameAnyBase *m_docChildFrame;
private:
wxDECLARE_ABSTRACT_CLASS(wxView);
wxDECLARE_NO_COPY_CLASS(wxView);
};
// Represents user interface (and other) properties of documents and views
class WXDLLIMPEXP_CORE wxDocTemplate: public wxObject
{
friend class WXDLLIMPEXP_FWD_CORE wxDocManager;
public:
// Associate document and view types. They're for identifying what view is
// associated with what template/document type
wxDocTemplate(wxDocManager *manager,
const wxString& descr,
const wxString& filter,
const wxString& dir,
const wxString& ext,
const wxString& docTypeName,
const wxString& viewTypeName,
wxClassInfo *docClassInfo = NULL,
wxClassInfo *viewClassInfo = NULL,
long flags = wxDEFAULT_TEMPLATE_FLAGS);
virtual ~wxDocTemplate();
// By default, these two member functions dynamically creates document and
// view using dynamic instance construction. Override these if you need a
// different method of construction.
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
virtual wxView *CreateView(wxDocument *doc, long flags = 0);
// Helper method for CreateDocument; also allows you to do your own document
// creation
virtual bool InitDocument(wxDocument* doc,
const wxString& path,
long flags = 0);
wxString GetDefaultExtension() const { return m_defaultExt; }
wxString GetDescription() const { return m_description; }
wxString GetDirectory() const { return m_directory; }
wxDocManager *GetDocumentManager() const { return m_documentManager; }
void SetDocumentManager(wxDocManager *manager)
{ m_documentManager = manager; }
wxString GetFileFilter() const { return m_fileFilter; }
long GetFlags() const { return m_flags; }
virtual wxString GetViewName() const { return m_viewTypeName; }
virtual wxString GetDocumentName() const { return m_docTypeName; }
void SetFileFilter(const wxString& filter) { m_fileFilter = filter; }
void SetDirectory(const wxString& dir) { m_directory = dir; }
void SetDescription(const wxString& descr) { m_description = descr; }
void SetDefaultExtension(const wxString& ext) { m_defaultExt = ext; }
void SetFlags(long flags) { m_flags = flags; }
bool IsVisible() const { return (m_flags & wxTEMPLATE_VISIBLE) != 0; }
wxClassInfo* GetDocClassInfo() const { return m_docClassInfo; }
wxClassInfo* GetViewClassInfo() const { return m_viewClassInfo; }
virtual bool FileMatchesTemplate(const wxString& path);
protected:
long m_flags;
wxString m_fileFilter;
wxString m_directory;
wxString m_description;
wxString m_defaultExt;
wxString m_docTypeName;
wxString m_viewTypeName;
wxDocManager* m_documentManager;
// For dynamic creation of appropriate instances.
wxClassInfo* m_docClassInfo;
wxClassInfo* m_viewClassInfo;
// Called by CreateDocument and CreateView to create the actual
// document/view object.
//
// By default uses the ClassInfo provided to the constructor. Override
// these functions to provide a different method of creation.
virtual wxDocument *DoCreateDocument();
virtual wxView *DoCreateView();
private:
wxDECLARE_CLASS(wxDocTemplate);
wxDECLARE_NO_COPY_CLASS(wxDocTemplate);
};
// One object of this class may be created in an application, to manage all
// the templates and documents.
class WXDLLIMPEXP_CORE wxDocManager: public wxEvtHandler
{
public:
// NB: flags are unused, don't pass wxDOC_XXX to this ctor
wxDocManager(long flags = 0, bool initialize = true);
virtual ~wxDocManager();
virtual bool Initialize();
// Handlers for common user commands
void OnFileClose(wxCommandEvent& event);
void OnFileCloseAll(wxCommandEvent& event);
void OnFileNew(wxCommandEvent& event);
void OnFileOpen(wxCommandEvent& event);
void OnFileRevert(wxCommandEvent& event);
void OnFileSave(wxCommandEvent& event);
void OnFileSaveAs(wxCommandEvent& event);
void OnMRUFile(wxCommandEvent& event);
#if wxUSE_PRINTING_ARCHITECTURE
void OnPrint(wxCommandEvent& event);
void OnPreview(wxCommandEvent& event);
void OnPageSetup(wxCommandEvent& event);
#endif // wxUSE_PRINTING_ARCHITECTURE
void OnUndo(wxCommandEvent& event);
void OnRedo(wxCommandEvent& event);
// Handlers for UI update commands
void OnUpdateFileOpen(wxUpdateUIEvent& event);
void OnUpdateDisableIfNoDoc(wxUpdateUIEvent& event);
void OnUpdateFileRevert(wxUpdateUIEvent& event);
void OnUpdateFileNew(wxUpdateUIEvent& event);
void OnUpdateFileSave(wxUpdateUIEvent& event);
void OnUpdateFileSaveAs(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
// called when file format detection didn't work, can be overridden to do
// something in this case
virtual void OnOpenFileFailure() { }
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
// wrapper around CreateDocument() with a more clear name
wxDocument *CreateNewDocument()
{ return CreateDocument(wxString(), wxDOC_NEW); }
virtual wxView *CreateView(wxDocument *doc, long flags = 0);
virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0);
virtual bool FlushDoc(wxDocument *doc);
virtual wxDocTemplate *MatchTemplate(const wxString& path);
virtual wxDocTemplate *SelectDocumentPath(wxDocTemplate **templates,
int noTemplates, wxString& path, long flags, bool save = false);
virtual wxDocTemplate *SelectDocumentType(wxDocTemplate **templates,
int noTemplates, bool sort = false);
virtual wxDocTemplate *SelectViewType(wxDocTemplate **templates,
int noTemplates, bool sort = false);
virtual wxDocTemplate *FindTemplateForPath(const wxString& path);
void AssociateTemplate(wxDocTemplate *temp);
void DisassociateTemplate(wxDocTemplate *temp);
// Find template from document class info, may return NULL.
wxDocTemplate* FindTemplate(const wxClassInfo* documentClassInfo);
// Find document from file name, may return NULL.
wxDocument* FindDocumentByPath(const wxString& path) const;
wxDocument *GetCurrentDocument() const;
void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; }
int GetMaxDocsOpen() const { return m_maxDocsOpen; }
// Add and remove a document from the manager's list
void AddDocument(wxDocument *doc);
void RemoveDocument(wxDocument *doc);
// closes all currently open documents
bool CloseDocuments(bool force = true);
// closes the specified document
bool CloseDocument(wxDocument* doc, bool force = false);
// Clear remaining documents and templates
bool Clear(bool force = true);
// Views or windows should inform the document manager
// when a view is going in or out of focus
virtual void ActivateView(wxView *view, bool activate = true);
virtual wxView *GetCurrentView() const { return m_currentView; }
// This method tries to find an active view harder than GetCurrentView():
// if the latter is NULL, it also checks if we don't have just a single
// view and returns it then.
wxView *GetAnyUsableView() const;
wxDocVector GetDocumentsVector() const;
wxDocTemplateVector GetTemplatesVector() const;
wxList& GetDocuments() { return m_docs; }
wxList& GetTemplates() { return m_templates; }
// Return the default name for a new document (by default returns strings
// in the form "unnamed <counter>" but can be overridden)
virtual wxString MakeNewDocumentName();
// Make a frame title (override this to do something different)
virtual wxString MakeFrameTitle(wxDocument* doc);
virtual wxFileHistory *OnCreateFileHistory();
virtual wxFileHistory *GetFileHistory() const { return m_fileHistory; }
// File history management
virtual void AddFileToHistory(const wxString& file);
virtual void RemoveFileFromHistory(size_t i);
virtual size_t GetHistoryFilesCount() const;
virtual wxString GetHistoryFile(size_t i) const;
virtual void FileHistoryUseMenu(wxMenu *menu);
virtual void FileHistoryRemoveMenu(wxMenu *menu);
#if wxUSE_CONFIG
virtual void FileHistoryLoad(const wxConfigBase& config);
virtual void FileHistorySave(wxConfigBase& config);
#endif // wxUSE_CONFIG
virtual void FileHistoryAddFilesToMenu();
virtual void FileHistoryAddFilesToMenu(wxMenu* menu);
wxString GetLastDirectory() const;
void SetLastDirectory(const wxString& dir) { m_lastDirectory = dir; }
// Get the current document manager
static wxDocManager* GetDocumentManager() { return sm_docManager; }
#if wxUSE_PRINTING_ARCHITECTURE
wxPageSetupDialogData& GetPageSetupDialogData()
{ return m_pageSetupDialogData; }
const wxPageSetupDialogData& GetPageSetupDialogData() const
{ return m_pageSetupDialogData; }
#endif // wxUSE_PRINTING_ARCHITECTURE
#if WXWIN_COMPATIBILITY_2_8
// deprecated, override GetDefaultName() instead
wxDEPRECATED_BUT_USED_INTERNALLY(
virtual bool MakeDefaultName(wxString& buf)
);
#endif
protected:
// Called when a file selected from the MRU list doesn't exist any more.
// The default behaviour is to remove the file from the MRU and notify the
// user about it but this method can be overridden to customize it.
virtual void OnMRUFileNotExist(unsigned n, const wxString& filename);
// Open the MRU file with the given index in our associated file history.
void DoOpenMRUFile(unsigned n);
#if wxUSE_PRINTING_ARCHITECTURE
virtual wxPreviewFrame* CreatePreviewFrame(wxPrintPreviewBase* preview,
wxWindow *parent,
const wxString& title);
#endif // wxUSE_PRINTING_ARCHITECTURE
// hook the currently active view into event handlers chain here
virtual bool TryBefore(wxEvent& event) wxOVERRIDE;
// return the command processor for the current document, if any
wxCommandProcessor *GetCurrentCommandProcessor() const;
int m_defaultDocumentNameCounter;
int m_maxDocsOpen;
wxList m_docs;
wxList m_templates;
wxView* m_currentView;
wxFileHistory* m_fileHistory;
wxString m_lastDirectory;
static wxDocManager* sm_docManager;
#if wxUSE_PRINTING_ARCHITECTURE
wxPageSetupDialogData m_pageSetupDialogData;
#endif // wxUSE_PRINTING_ARCHITECTURE
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS(wxDocManager);
wxDECLARE_NO_COPY_CLASS(wxDocManager);
};
// ----------------------------------------------------------------------------
// Base class for child frames -- this is what wxView renders itself into
//
// Notice that this is a mix-in class so it doesn't derive from wxWindow, only
// wxDocChildFrameAny does
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDocChildFrameAnyBase
{
public:
// default ctor, use Create() after it
wxDocChildFrameAnyBase()
{
m_childDocument = NULL;
m_childView = NULL;
m_win = NULL;
m_lastEvent = NULL;
}
// full ctor equivalent to using the default one and Create()
wxDocChildFrameAnyBase(wxDocument *doc, wxView *view, wxWindow *win)
{
Create(doc, view, win);
}
// method which must be called for an object created using the default ctor
//
// note that it returns bool just for consistency with Create() methods in
// other classes, we never return false from here
bool Create(wxDocument *doc, wxView *view, wxWindow *win)
{
m_childDocument = doc;
m_childView = view;
m_win = win;
if ( view )
view->SetDocChildFrame(this);
return true;
}
// dtor doesn't need to be virtual, an object should never be destroyed via
// a pointer to this class
~wxDocChildFrameAnyBase()
{
// prevent the view from deleting us if we're being deleted directly
// (and not via Close() + Destroy())
if ( m_childView )
m_childView->SetDocChildFrame(NULL);
}
wxDocument *GetDocument() const { return m_childDocument; }
wxView *GetView() const { return m_childView; }
void SetDocument(wxDocument *doc) { m_childDocument = doc; }
void SetView(wxView *view) { m_childView = view; }
wxWindow *GetWindow() const { return m_win; }
// implementation only
// Check if this event had been just processed in this frame.
bool HasAlreadyProcessed(wxEvent& event) const
{
return m_lastEvent == &event;
}
protected:
// we're not a wxEvtHandler but we provide this wxEvtHandler-like function
// which is called from TryBefore() of the derived classes to give our view
// a chance to process the message before the frame event handlers are used
bool TryProcessEvent(wxEvent& event);
// called from EVT_CLOSE handler in the frame: check if we can close and do
// cleanup if so; veto the event otherwise
bool CloseView(wxCloseEvent& event);
wxDocument* m_childDocument;
wxView* m_childView;
// the associated window: having it here is not terribly elegant but it
// allows us to avoid having any virtual functions in this class
wxWindow* m_win;
private:
// Pointer to the last processed event used to avoid sending the same event
// twice to wxDocManager, from here and from wxDocParentFrameAnyBase.
wxEvent* m_lastEvent;
wxDECLARE_NO_COPY_CLASS(wxDocChildFrameAnyBase);
};
// ----------------------------------------------------------------------------
// Template implementing child frame concept using the given wxFrame-like class
//
// This is used to define wxDocChildFrame and wxDocMDIChildFrame: ChildFrame is
// a wxFrame or wxMDIChildFrame (although in theory it could be any wxWindow-
// derived class as long as it provided a ctor with the same signature as
// wxFrame and OnActivate() method) and ParentFrame is either wxFrame or
// wxMDIParentFrame.
// ----------------------------------------------------------------------------
// Note that we intentionally do not use WXDLLIMPEXP_CORE for this class as it
// has only inline methods.
template <class ChildFrame, class ParentFrame>
class wxDocChildFrameAny : public ChildFrame,
public wxDocChildFrameAnyBase
{
public:
typedef ChildFrame BaseClass;
// default ctor, use Create after it
wxDocChildFrameAny() { }
// ctor for a frame showing the given view of the specified document
wxDocChildFrameAny(wxDocument *doc,
wxView *view,
ParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
{
Create(doc, view, parent, id, title, pos, size, style, name);
}
bool Create(wxDocument *doc,
wxView *view,
ParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
{
if ( !wxDocChildFrameAnyBase::Create(doc, view, this) )
return false;
if ( !BaseClass::Create(parent, id, title, pos, size, style, name) )
return false;
this->Bind(wxEVT_ACTIVATE, &wxDocChildFrameAny::OnActivate, this);
this->Bind(wxEVT_CLOSE_WINDOW, &wxDocChildFrameAny::OnCloseWindow, this);
return true;
}
protected:
// hook the child view into event handlers chain here
virtual bool TryBefore(wxEvent& event) wxOVERRIDE
{
return TryProcessEvent(event) || BaseClass::TryBefore(event);
}
private:
void OnActivate(wxActivateEvent& event)
{
BaseClass::OnActivate(event);
if ( m_childView )
m_childView->Activate(event.GetActive());
}
void OnCloseWindow(wxCloseEvent& event)
{
if ( CloseView(event) )
BaseClass::Destroy();
//else: vetoed
}
wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(wxDocChildFrameAny,
ChildFrame, ParentFrame);
};
// ----------------------------------------------------------------------------
// A default child frame: we need to define it as a class just for wxRTTI,
// otherwise we could simply typedef it
// ----------------------------------------------------------------------------
typedef wxDocChildFrameAny<wxFrame, wxFrame> wxDocChildFrameBase;
class WXDLLIMPEXP_CORE wxDocChildFrame : public wxDocChildFrameBase
{
public:
wxDocChildFrame()
{
}
wxDocChildFrame(wxDocument *doc,
wxView *view,
wxFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
: wxDocChildFrameBase(doc, view,
parent, id, title, pos, size, style, name)
{
}
bool Create(wxDocument *doc,
wxView *view,
wxFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
{
return wxDocChildFrameBase::Create
(
doc, view,
parent, id, title, pos, size, style, name
);
}
private:
wxDECLARE_CLASS(wxDocChildFrame);
wxDECLARE_NO_COPY_CLASS(wxDocChildFrame);
};
// ----------------------------------------------------------------------------
// wxDocParentFrame and related classes.
//
// As with wxDocChildFrame we define a template base class used by both normal
// and MDI versions
// ----------------------------------------------------------------------------
// Base class containing type-independent code of wxDocParentFrameAny
//
// Similarly to wxDocChildFrameAnyBase, this class is a mix-in and doesn't
// derive from wxWindow.
class WXDLLIMPEXP_CORE wxDocParentFrameAnyBase
{
public:
wxDocParentFrameAnyBase(wxWindow* frame)
: m_frame(frame)
{
m_docManager = NULL;
}
wxDocManager *GetDocumentManager() const { return m_docManager; }
protected:
// This is similar to wxDocChildFrameAnyBase method with the same name:
// while we're not an event handler ourselves and so can't override
// TryBefore(), we provide a helper that the derived template class can use
// from its TryBefore() implementation.
bool TryProcessEvent(wxEvent& event);
wxWindow* const m_frame;
wxDocManager *m_docManager;
wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAnyBase);
};
// This is similar to wxDocChildFrameAny and is used to provide common
// implementation for both wxDocParentFrame and wxDocMDIParentFrame
template <class BaseFrame>
class wxDocParentFrameAny : public BaseFrame,
public wxDocParentFrameAnyBase
{
public:
wxDocParentFrameAny() : wxDocParentFrameAnyBase(this) { }
wxDocParentFrameAny(wxDocManager *manager,
wxFrame *frame,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
: wxDocParentFrameAnyBase(this)
{
Create(manager, frame, id, title, pos, size, style, name);
}
bool Create(wxDocManager *manager,
wxFrame *frame,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
{
m_docManager = manager;
if ( !BaseFrame::Create(frame, id, title, pos, size, style, name) )
return false;
this->Bind(wxEVT_MENU, &wxDocParentFrameAny::OnExit, this, wxID_EXIT);
this->Bind(wxEVT_CLOSE_WINDOW, &wxDocParentFrameAny::OnCloseWindow, this);
return true;
}
protected:
// hook the document manager into event handling chain here
virtual bool TryBefore(wxEvent& event) wxOVERRIDE
{
// It is important to send the event to the base class first as
// wxMDIParentFrame overrides its TryBefore() to send the menu events
// to the currently active child frame and the child must get them
// before our own TryProcessEvent() is executed, not afterwards.
return BaseFrame::TryBefore(event) || TryProcessEvent(event);
}
private:
void OnExit(wxCommandEvent& WXUNUSED(event))
{
this->Close();
}
void OnCloseWindow(wxCloseEvent& event)
{
if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) )
{
// The user decided not to close finally, abort.
event.Veto();
}
else
{
// Just skip the event, base class handler will destroy the window.
event.Skip();
}
}
wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAny);
};
typedef wxDocParentFrameAny<wxFrame> wxDocParentFrameBase;
class WXDLLIMPEXP_CORE wxDocParentFrame : public wxDocParentFrameBase
{
public:
wxDocParentFrame() : wxDocParentFrameBase() { }
wxDocParentFrame(wxDocManager *manager,
wxFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
: wxDocParentFrameBase(manager,
parent, id, title, pos, size, style, name)
{
}
bool Create(wxDocManager *manager,
wxFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
{
return wxDocParentFrameBase::Create(manager,
parent, id, title,
pos, size, style, name);
}
private:
wxDECLARE_CLASS(wxDocParentFrame);
wxDECLARE_NO_COPY_CLASS(wxDocParentFrame);
};
// ----------------------------------------------------------------------------
// Provide simple default printing facilities
// ----------------------------------------------------------------------------
#if wxUSE_PRINTING_ARCHITECTURE
class WXDLLIMPEXP_CORE wxDocPrintout : public wxPrintout
{
public:
wxDocPrintout(wxView *view = NULL, const wxString& title = wxString());
// implement wxPrintout methods
virtual bool OnPrintPage(int page) wxOVERRIDE;
virtual bool HasPage(int page) wxOVERRIDE;
virtual bool OnBeginDocument(int startPage, int endPage) wxOVERRIDE;
virtual void GetPageInfo(int *minPage, int *maxPage,
int *selPageFrom, int *selPageTo) wxOVERRIDE;
virtual wxView *GetView() { return m_printoutView; }
protected:
wxView* m_printoutView;
private:
wxDECLARE_DYNAMIC_CLASS(wxDocPrintout);
wxDECLARE_NO_COPY_CLASS(wxDocPrintout);
};
#endif // wxUSE_PRINTING_ARCHITECTURE
// For compatibility with existing file formats:
// converts from/to a stream to/from a temporary file.
#if wxUSE_STD_IOSTREAM
bool WXDLLIMPEXP_CORE
wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream);
bool WXDLLIMPEXP_CORE
wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename);
#else
bool WXDLLIMPEXP_CORE
wxTransferFileToStream(const wxString& filename, wxOutputStream& stream);
bool WXDLLIMPEXP_CORE
wxTransferStreamToFile(wxInputStream& stream, const wxString& filename);
#endif // wxUSE_STD_IOSTREAM
// these flags are not used anywhere by wxWidgets and kept only for an unlikely
// case of existing user code using them for its own purposes
#if WXWIN_COMPATIBILITY_2_8
enum
{
wxDOC_SDI = 1,
wxDOC_MDI,
wxDEFAULT_DOCMAN_FLAGS = wxDOC_SDI
};
#endif // WXWIN_COMPATIBILITY_2_8
inline wxViewVector wxDocument::GetViewsVector() const
{
return m_documentViews.AsVector<wxView*>();
}
inline wxDocVector wxDocManager::GetDocumentsVector() const
{
return m_docs.AsVector<wxDocument*>();
}
inline wxDocTemplateVector wxDocManager::GetTemplatesVector() const
{
return m_templates.AsVector<wxDocTemplate*>();
}
#endif // wxUSE_DOC_VIEW_ARCHITECTURE
#endif // _WX_DOCH__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/srchctrl.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/srchctrl.h
// Purpose: wxSearchCtrlBase class
// Author: Vince Harron
// Created: 2006-02-18
// Copyright: (c) Vince Harron
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SEARCHCTRL_H_BASE_
#define _WX_SEARCHCTRL_H_BASE_
#include "wx/defs.h"
#if wxUSE_SEARCHCTRL
#include "wx/textctrl.h"
#if !defined(__WXUNIVERSAL__) && defined(__WXMAC__)
// search control was introduced in Mac OS X 10.3 Panther
#define wxUSE_NATIVE_SEARCH_CONTROL 1
#define wxSearchCtrlBaseBaseClass wxTextCtrl
#else
// no native version, use the generic one
#define wxUSE_NATIVE_SEARCH_CONTROL 0
#include "wx/compositewin.h"
#include "wx/containr.h"
class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass
: public wxCompositeWindow< wxNavigationEnabled<wxControl> >,
public wxTextCtrlIface
{
};
#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr[];
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SEARCH_CANCEL, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SEARCH, wxCommandEvent);
// ----------------------------------------------------------------------------
// a search ctrl is a text control with a search button and a cancel button
// it is based on the MacOSX 10.3 control HISearchFieldCreate
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass
{
public:
wxSearchCtrlBase() { }
virtual ~wxSearchCtrlBase() { }
// search control
#if wxUSE_MENUS
virtual void SetMenu(wxMenu *menu) = 0;
virtual wxMenu *GetMenu() = 0;
#endif // wxUSE_MENUS
// get/set options
virtual void ShowSearchButton( bool show ) = 0;
virtual bool IsSearchButtonVisible() const = 0;
virtual void ShowCancelButton( bool show ) = 0;
virtual bool IsCancelButtonVisible() const = 0;
virtual void SetDescriptiveText(const wxString& text) = 0;
virtual wxString GetDescriptiveText() const = 0;
private:
// implement wxTextEntry pure virtual method
virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; }
};
// include the platform-dependent class implementation
#if wxUSE_NATIVE_SEARCH_CONTROL
#if defined(__WXMAC__)
#include "wx/osx/srchctrl.h"
#endif
#else
#include "wx/generic/srchctlg.h"
#endif
// ----------------------------------------------------------------------------
// macros for handling search events
// ----------------------------------------------------------------------------
#define EVT_SEARCH_CANCEL(id, fn) \
wx__DECLARE_EVT1(wxEVT_SEARCH_CANCEL, id, wxCommandEventHandler(fn))
#define EVT_SEARCH(id, fn) \
wx__DECLARE_EVT1(wxEVT_SEARCH, id, wxCommandEventHandler(fn))
// old synonyms
#define wxEVT_SEARCHCTRL_CANCEL_BTN wxEVT_SEARCH_CANCEL
#define wxEVT_SEARCHCTRL_SEARCH_BTN wxEVT_SEARCH
#define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) EVT_SEARCH_CANCEL(id, fn)
#define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) EVT_SEARCH(id, fn)
// even older wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN wxEVT_SEARCHCTRL_CANCEL_BTN
#define wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN wxEVT_SEARCHCTRL_SEARCH_BTN
#endif // wxUSE_SEARCHCTRL
#endif // _WX_SEARCHCTRL_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/weakref.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/weakref.h
// Purpose: wxWeakRef - Generic weak references for wxWidgets
// Author: Arne Steinarson
// Created: 27 Dec 07
// Copyright: (c) 2007 Arne Steinarson
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WEAKREF_H_
#define _WX_WEAKREF_H_
#include "wx/tracker.h"
#include "wx/meta/convertible.h"
#include "wx/meta/int2type.h"
template <class T>
struct wxIsStaticTrackable
{
enum { value = wxIsPubliclyDerived<T, wxTrackable>::value };
};
// A weak reference to an object of type T (which must inherit from wxTrackable)
template <class T>
class wxWeakRef : public wxTrackerNode
{
public:
typedef T element_type;
// Default ctor
wxWeakRef() : m_pobj(NULL), m_ptbase(NULL) { }
// Ctor from the object of this type: this is needed as the template ctor
// below is not used by at least g++4 when a literal NULL is used
wxWeakRef(T *pobj) : m_pobj(NULL), m_ptbase(NULL)
{
this->Assign(pobj);
}
// When we have the full type here, static_cast<> will always work
// (or give a straight compiler error).
template <class TDerived>
wxWeakRef(TDerived* pobj) : m_pobj(NULL), m_ptbase(NULL)
{
this->Assign(pobj);
}
// We need this copy ctor, since otherwise a default compiler (binary) copy
// happens (if embedded as an object member).
wxWeakRef(const wxWeakRef<T>& wr) : m_pobj(NULL), m_ptbase(NULL)
{
this->Assign(wr.get());
}
wxWeakRef<T>& operator=(const wxWeakRef<T>& wr)
{
this->AssignCopy(wr);
return *this;
}
virtual ~wxWeakRef() { this->Release(); }
// Smart pointer functions
T& operator*() const { return *this->m_pobj; }
T* operator->() const { return this->m_pobj; }
T* get() const { return this->m_pobj; }
operator T*() const { return this->m_pobj; }
public:
void Release()
{
// Release old object if any
if ( m_pobj )
{
// Remove ourselves from object tracker list
m_ptbase->RemoveNode(this);
m_pobj = NULL;
m_ptbase = NULL;
}
}
virtual void OnObjectDestroy() wxOVERRIDE
{
// Tracked object itself removes us from list of trackers
wxASSERT(m_pobj != NULL);
m_pobj = NULL;
m_ptbase = NULL;
}
protected:
// Assign receives most derived class here and can use that
template <class TDerived>
void Assign( TDerived* pobj )
{
wxCOMPILE_TIME_ASSERT( wxIsStaticTrackable<TDerived>::value,
Tracked_class_should_inherit_from_wxTrackable );
wxTrackable *ptbase = static_cast<wxTrackable*>(pobj);
DoAssign(pobj, ptbase);
}
void AssignCopy(const wxWeakRef& wr)
{
DoAssign(wr.m_pobj, wr.m_ptbase);
}
void DoAssign(T* pobj, wxTrackable *ptbase)
{
if ( m_pobj == pobj )
return;
Release();
// Now set new trackable object
if ( pobj )
{
// Add ourselves to object tracker list
wxASSERT( ptbase );
ptbase->AddNode( this );
m_pobj = pobj;
m_ptbase = ptbase;
}
}
T *m_pobj;
wxTrackable *m_ptbase;
};
#ifndef wxNO_RTTI
// Weak ref implementation assign objects are queried for wxTrackable
// using dynamic_cast<>
template <class T>
class wxWeakRefDynamic : public wxTrackerNode
{
public:
wxWeakRefDynamic() : m_pobj(NULL) { }
wxWeakRefDynamic(T* pobj) : m_pobj(pobj)
{
Assign(pobj);
}
wxWeakRefDynamic(const wxWeakRef<T>& wr)
{
Assign(wr.get());
}
virtual ~wxWeakRefDynamic() { Release(); }
// Smart pointer functions
T& operator*() const { wxASSERT(m_pobj); return *m_pobj; }
T* operator->() const { wxASSERT(m_pobj); return m_pobj; }
T* get() const { return m_pobj; }
operator T* () const { return m_pobj; }
T* operator = (T* pobj) { Assign(pobj); return m_pobj; }
// Assign from another weak ref, point to same object
T* operator = (const wxWeakRef<T> &wr) { Assign( wr.get() ); return m_pobj; }
void Release()
{
// Release old object if any
if( m_pobj )
{
// Remove ourselves from object tracker list
wxTrackable *pt = dynamic_cast<wxTrackable*>(m_pobj);
wxASSERT(pt);
pt->RemoveNode(this);
m_pobj = NULL;
}
}
virtual void OnObjectDestroy() wxOVERRIDE
{
wxASSERT_MSG(m_pobj, "tracked object should have removed us itself");
m_pobj = NULL;
}
protected:
void Assign(T *pobj)
{
if ( m_pobj == pobj )
return;
Release();
// Now set new trackable object
if ( pobj )
{
// Add ourselves to object tracker list
wxTrackable *pt = dynamic_cast<wxTrackable*>(pobj);
if ( pt )
{
pt->AddNode(this);
m_pobj = pobj;
}
else
{
// If the object we want to track does not support wxTackable, then
// log a message and keep the NULL object pointer.
wxFAIL_MSG( "Tracked class should inherit from wxTrackable" );
}
}
}
T *m_pobj;
};
#endif // RTTI enabled
// Provide some basic types of weak references
class WXDLLIMPEXP_FWD_BASE wxEvtHandler;
class WXDLLIMPEXP_FWD_CORE wxWindow;
typedef wxWeakRef<wxEvtHandler> wxEvtHandlerRef;
typedef wxWeakRef<wxWindow> wxWindowRef;
#endif // _WX_WEAKREF_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/treebook.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/treebook.h
// Purpose: wxTreebook: wxNotebook-like control presenting pages in a tree
// Author: Evgeniy Tarassov, Vadim Zeitlin
// Modified by:
// Created: 2005-09-15
// Copyright: (c) 2005 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TREEBOOK_H_
#define _WX_TREEBOOK_H_
#include "wx/defs.h"
#if wxUSE_TREEBOOK
#include "wx/bookctrl.h"
#include "wx/containr.h"
#include "wx/treebase.h" // for wxTreeItemId
#include "wx/vector.h"
typedef wxWindow wxTreebookPage;
class WXDLLIMPEXP_FWD_CORE wxTreeCtrl;
class WXDLLIMPEXP_FWD_CORE wxTreeEvent;
// ----------------------------------------------------------------------------
// wxTreebook
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTreebook : public wxNavigationEnabled<wxBookCtrlBase>
{
public:
// Constructors and such
// ---------------------
// Default ctor doesn't create the control, use Create() afterwards
wxTreebook()
{
}
// This ctor creates the tree book control
wxTreebook(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxBK_DEFAULT,
const wxString& name = wxEmptyString)
{
(void)Create(parent, id, pos, size, style, name);
}
// Really creates the control
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxBK_DEFAULT,
const wxString& name = wxEmptyString);
// Page insertion operations
// -------------------------
// Notice that page pointer may be NULL in which case the next non NULL
// page (usually the first child page of a node) is shown when this page is
// selected
// Inserts a new page just before the page indicated by page.
// The new page is placed on the same level as page.
virtual bool InsertPage(size_t pos,
wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = NO_IMAGE) wxOVERRIDE;
// Inserts a new sub-page to the end of children of the page at given pos.
virtual bool InsertSubPage(size_t pos,
wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = NO_IMAGE);
// Adds a new page at top level after all other pages.
virtual bool AddPage(wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = NO_IMAGE) wxOVERRIDE;
// Adds a new child-page to the last top-level page inserted.
// Useful when constructing 1 level tree structure.
virtual bool AddSubPage(wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = NO_IMAGE);
// Deletes the page and ALL its children. Could trigger page selection
// change in a case when selected page is removed. In that case its parent
// is selected (or the next page if no parent).
virtual bool DeletePage(size_t pos) wxOVERRIDE;
// Tree operations
// ---------------
// Gets the page node state -- node is expanded or collapsed
virtual bool IsNodeExpanded(size_t pos) const;
// Expands or collapses the page node. Returns the previous state.
// May generate page changing events (if selected page
// is under the collapsed branch, then parent is autoselected).
virtual bool ExpandNode(size_t pos, bool expand = true);
// shortcut for ExpandNode(pos, false)
bool CollapseNode(size_t pos) { return ExpandNode(pos, false); }
// get the parent page or wxNOT_FOUND if this is a top level page
int GetPageParent(size_t pos) const;
// the tree control we use for showing the pages index tree
wxTreeCtrl* GetTreeCtrl() const { return (wxTreeCtrl*)m_bookctrl; }
// Standard operations inherited from wxBookCtrlBase
// -------------------------------------------------
virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE;
virtual wxString GetPageText(size_t n) const wxOVERRIDE;
virtual int GetPageImage(size_t n) const wxOVERRIDE;
virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE;
virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); }
virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); }
virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE;
virtual void SetImageList(wxImageList *imageList) wxOVERRIDE;
virtual void AssignImageList(wxImageList *imageList);
virtual bool DeleteAllPages() wxOVERRIDE;
protected:
// Implementation of a page removal. See DeletPage for comments.
wxTreebookPage *DoRemovePage(size_t pos) wxOVERRIDE;
// This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages)
virtual bool AllowNullPage() const wxOVERRIDE { return true; }
virtual wxWindow *TryGetNonNullPage(size_t page) wxOVERRIDE;
// event handlers
void OnTreeSelectionChange(wxTreeEvent& event);
void OnTreeNodeExpandedCollapsed(wxTreeEvent& event);
// array of tree item ids corresponding to the page indices
wxVector<wxTreeItemId> m_treeIds;
private:
// The real implementations of page insertion functions
// ------------------------------------------------------
// All DoInsert/Add(Sub)Page functions add the page into :
// - the base class
// - the tree control
// - update the index/TreeItemId corespondance array
bool DoInsertPage(size_t pos,
wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = NO_IMAGE);
bool DoInsertSubPage(size_t pos,
wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = NO_IMAGE);
bool DoAddSubPage(wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = NO_IMAGE);
// Overridden methods used by the base class DoSetSelection()
// implementation.
void UpdateSelectedPage(size_t newsel) wxOVERRIDE;
wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE;
void MakeChangedEvent(wxBookCtrlEvent &event) wxOVERRIDE;
// Does the selection update. Called from page insertion functions
// to update selection if the selected page was pushed by the newly inserted
void DoUpdateSelection(bool bSelect, int page);
// Operations on the internal private members of the class
// -------------------------------------------------------
// Returns the page TreeItemId for the page.
// Or, if the page index is incorrect, a fake one (fakePage.IsOk() == false)
wxTreeItemId DoInternalGetPage(size_t pos) const;
// Linear search for a page with the id specified. If no page
// found wxNOT_FOUND is returned. The function is used when we catch an event
// from m_tree (wxTreeCtrl) component.
int DoInternalFindPageById(wxTreeItemId page) const;
// Updates page and wxTreeItemId correspondance.
void DoInternalAddPage(size_t newPos, wxWindow *page, wxTreeItemId pageId);
// Removes the page from internal structure.
void DoInternalRemovePage(size_t pos)
{ DoInternalRemovePageRange(pos, 0); }
// Removes the page and all its children designated by subCount
// from internal structures of the control.
void DoInternalRemovePageRange(size_t pos, size_t subCount);
// Returns internal number of pages which can be different from
// GetPageCount() while performing a page insertion or removal.
size_t DoInternalGetPageCount() const { return m_treeIds.size(); }
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTreebook);
};
// ----------------------------------------------------------------------------
// treebook event class and related stuff
// ----------------------------------------------------------------------------
// wxTreebookEvent is obsolete and defined for compatibility only
#define wxTreebookEvent wxBookCtrlEvent
typedef wxBookCtrlEventFunction wxTreebookEventFunction;
#define wxTreebookEventHandler(func) wxBookCtrlEventHandler(func)
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_PAGE_CHANGED, wxBookCtrlEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_PAGE_CHANGING, wxBookCtrlEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_NODE_COLLAPSED, wxBookCtrlEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_NODE_EXPANDED, wxBookCtrlEvent );
#define EVT_TREEBOOK_PAGE_CHANGED(winid, fn) \
wx__DECLARE_EVT1(wxEVT_TREEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
#define EVT_TREEBOOK_PAGE_CHANGING(winid, fn) \
wx__DECLARE_EVT1(wxEVT_TREEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
#define EVT_TREEBOOK_NODE_COLLAPSED(winid, fn) \
wx__DECLARE_EVT1(wxEVT_TREEBOOK_NODE_COLLAPSED, winid, wxBookCtrlEventHandler(fn))
#define EVT_TREEBOOK_NODE_EXPANDED(winid, fn) \
wx__DECLARE_EVT1(wxEVT_TREEBOOK_NODE_EXPANDED, winid, wxBookCtrlEventHandler(fn))
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED wxEVT_TREEBOOK_PAGE_CHANGED
#define wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING wxEVT_TREEBOOK_PAGE_CHANGING
#define wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED wxEVT_TREEBOOK_NODE_COLLAPSED
#define wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED wxEVT_TREEBOOK_NODE_EXPANDED
#endif // wxUSE_TREEBOOK
#endif // _WX_TREEBOOK_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/notifmsg.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/notifmsg.h
// Purpose: class allowing to show notification messages to the user
// Author: Vadim Zeitlin
// Created: 2007-11-19
// Copyright: (c) 2007 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_NOTIFMSG_H_
#define _WX_NOTIFMSG_H_
#include "wx/event.h"
#if wxUSE_NOTIFICATION_MESSAGE
// ----------------------------------------------------------------------------
// wxNotificationMessage: allows to show the user a message non intrusively
// ----------------------------------------------------------------------------
// notice that this class is not a window and so doesn't derive from wxWindow
class WXDLLIMPEXP_CORE wxNotificationMessageBase : public wxEvtHandler
{
public:
// ctors and initializers
// ----------------------
// default ctor, use setters below to initialize it later
wxNotificationMessageBase()
{
Init();
}
// create a notification object with the given title and message (the
// latter may be empty in which case only the title will be shown)
wxNotificationMessageBase(const wxString& title,
const wxString& message = wxEmptyString,
wxWindow *parent = NULL,
int flags = wxICON_INFORMATION)
{
Init();
Create(title, message, parent, flags);
}
virtual ~wxNotificationMessageBase();
// note that the setters must be called before Show()
// set the title: short string, markup not allowed
void SetTitle(const wxString& title);
// set the text of the message: this is a longer string than the title and
// some platforms allow simple HTML-like markup in it
void SetMessage(const wxString& message);
// set the parent for this notification: we'll be associated with the top
// level parent of this window or, if this method is not called, with the
// main application window by default
void SetParent(wxWindow *parent);
// this method can currently be used to choose a standard icon to use: the
// parameter may be one of wxICON_INFORMATION, wxICON_WARNING or
// wxICON_ERROR only (but not wxICON_QUESTION)
void SetFlags(int flags);
// set a custom icon to use instead of the system provided specified via SetFlags
virtual void SetIcon(const wxIcon& icon);
// Add a button to the notification, returns false if the platform does not support
// actions in notifications
virtual bool AddAction(wxWindowID actionid, const wxString &label = wxString());
// showing and hiding
// ------------------
// possible values for Show() timeout
enum
{
Timeout_Auto = -1, // notification will be hidden automatically
Timeout_Never = 0 // notification will never time out
};
// show the notification to the user and hides it after timeout seconds
// pass (special values Timeout_Auto and Timeout_Never can be used)
//
// returns false if an error occurred
bool Show(int timeout = Timeout_Auto);
// hide the notification, returns true if it was hidden or false if it
// couldn't be done (e.g. on some systems automatically hidden
// notifications can't be hidden manually)
bool Close();
protected:
// Common part of all ctors.
void Create(const wxString& title = wxEmptyString,
const wxString& message = wxEmptyString,
wxWindow *parent = NULL,
int flags = wxICON_INFORMATION)
{
SetTitle(title);
SetMessage(message);
SetParent(parent);
SetFlags(flags);
}
class wxNotificationMessageImpl* m_impl;
private:
void Init()
{
m_impl = NULL;
}
wxDECLARE_NO_COPY_CLASS(wxNotificationMessageBase);
};
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTIFICATION_MESSAGE_CLICK, wxCommandEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTIFICATION_MESSAGE_DISMISSED, wxCommandEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTIFICATION_MESSAGE_ACTION, wxCommandEvent );
#if (defined(__WXGTK__) && wxUSE_LIBNOTIFY) || \
(defined(__WXMSW__) && wxUSE_TASKBARICON && wxUSE_TASKBARICON_BALLOONS) || \
(defined(__WXOSX_COCOA__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8))
#define wxHAS_NATIVE_NOTIFICATION_MESSAGE
#endif
// ----------------------------------------------------------------------------
// wxNotificationMessage
// ----------------------------------------------------------------------------
#ifdef wxHAS_NATIVE_NOTIFICATION_MESSAGE
#if defined(__WXMSW__)
class WXDLLIMPEXP_FWD_CORE wxTaskBarIcon;
#endif // defined(__WXMSW__)
#else
#include "wx/generic/notifmsg.h"
#endif // wxHAS_NATIVE_NOTIFICATION_MESSAGE
class WXDLLIMPEXP_CORE wxNotificationMessage : public
#ifdef wxHAS_NATIVE_NOTIFICATION_MESSAGE
wxNotificationMessageBase
#else
wxGenericNotificationMessage
#endif
{
public:
wxNotificationMessage() { Init(); }
wxNotificationMessage(const wxString& title,
const wxString& message = wxString(),
wxWindow *parent = NULL,
int flags = wxICON_INFORMATION)
{
Init();
Create(title, message, parent, flags);
}
#if defined(__WXMSW__) && defined(wxHAS_NATIVE_NOTIFICATION_MESSAGE)
static bool MSWUseToasts(
const wxString& shortcutPath = wxString(),
const wxString& appId = wxString());
// returns the task bar icon which was used previously (may be NULL)
static wxTaskBarIcon *UseTaskBarIcon(wxTaskBarIcon *icon);
#endif // defined(__WXMSW__) && defined(wxHAS_NATIVE_NOTIFICATION_MESSAGE)
private:
// common part of all ctors
void Init();
wxDECLARE_NO_COPY_CLASS(wxNotificationMessage);
};
#endif // wxUSE_NOTIFICATION_MESSAGE
#endif // _WX_NOTIFMSG_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dlist.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/dlist.h
// Purpose: wxDList<T> which is a template version of wxList
// Author: Robert Roebling
// Created: 18.09.2008
// Copyright: (c) 2008 wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DLIST_H_
#define _WX_DLIST_H_
#include "wx/defs.h"
#include "wx/utils.h"
#if wxUSE_STD_CONTAINERS
#include "wx/beforestd.h"
#include <algorithm>
#include <iterator>
#include <list>
#include "wx/afterstd.h"
template<typename T>
class wxDList: public std::list<T*>
{
private:
bool m_destroy;
typedef std::list<T*> BaseListType;
typedef wxDList<T> ListType;
public:
typedef typename BaseListType::iterator iterator;
class compatibility_iterator
{
private:
friend class wxDList<T>;
iterator m_iter;
ListType *m_list;
public:
compatibility_iterator()
: m_iter(), m_list( NULL ) {}
compatibility_iterator( ListType* li, iterator i )
: m_iter( i ), m_list( li ) {}
compatibility_iterator( const ListType* li, iterator i )
: m_iter( i ), m_list( const_cast<ListType*>(li) ) {}
compatibility_iterator* operator->() { return this; }
const compatibility_iterator* operator->() const { return this; }
bool operator==(const compatibility_iterator& i) const
{
wxASSERT_MSG( m_list && i.m_list,
"comparing invalid iterators is illegal" );
return (m_list == i.m_list) && (m_iter == i.m_iter);
}
bool operator!=(const compatibility_iterator& i) const
{ return !( operator==( i ) ); }
operator bool() const
{ return m_list ? m_iter != m_list->end() : false; }
bool operator !() const
{ return !( operator bool() ); }
T* GetData() const { return *m_iter; }
void SetData( T* e ) { *m_iter = e; }
compatibility_iterator GetNext() const
{
iterator i = m_iter;
return compatibility_iterator( m_list, ++i );
}
compatibility_iterator GetPrevious() const
{
if ( m_iter == m_list->begin() )
return compatibility_iterator();
iterator i = m_iter;
return compatibility_iterator( m_list, --i );
}
int IndexOf() const
{
return *this ? std::distance( m_list->begin(), m_iter )
: wxNOT_FOUND;
}
};
public:
wxDList() : m_destroy( false ) {}
~wxDList() { Clear(); }
compatibility_iterator Find( const T* e ) const
{
return compatibility_iterator( this,
std::find( const_cast<ListType*>(this)->begin(),
const_cast<ListType*>(this)->end(), e ) );
}
bool IsEmpty() const
{ return this->empty(); }
size_t GetCount() const
{ return this->size(); }
compatibility_iterator Item( size_t idx ) const
{
iterator i = const_cast<ListType*>(this)->begin();
std::advance( i, idx );
return compatibility_iterator( this, i );
}
T* operator[](size_t idx) const
{
return Item(idx).GetData();
}
compatibility_iterator GetFirst() const
{
return compatibility_iterator( this, const_cast<ListType*>(this)->begin() );
}
compatibility_iterator GetLast() const
{
iterator i = const_cast<ListType*>(this)->end();
return compatibility_iterator( this, !(this->empty()) ? --i : i );
}
compatibility_iterator Member( T* e ) const
{ return Find( e ); }
compatibility_iterator Nth( int n ) const
{ return Item( n ); }
int IndexOf( T* e ) const
{ return Find( e ).IndexOf(); }
compatibility_iterator Append( T* e )
{
this->push_back( e );
return GetLast();
}
compatibility_iterator Insert( T* e )
{
this->push_front( e );
return compatibility_iterator( this, this->begin() );
}
compatibility_iterator Insert( compatibility_iterator & i, T* e )
{
return compatibility_iterator( this, this->insert( i.m_iter, e ) );
}
compatibility_iterator Insert( size_t idx, T* e )
{
return compatibility_iterator( this,
this->insert( Item( idx ).m_iter, e ) );
}
void DeleteContents( bool destroy )
{ m_destroy = destroy; }
bool GetDeleteContents() const
{ return m_destroy; }
void Erase( const compatibility_iterator& i )
{
if ( m_destroy )
delete i->GetData();
this->erase( i.m_iter );
}
bool DeleteNode( const compatibility_iterator& i )
{
if( i )
{
Erase( i );
return true;
}
return false;
}
bool DeleteObject( T* e )
{
return DeleteNode( Find( e ) );
}
void Clear()
{
if ( m_destroy )
{
iterator it, en;
for ( it = this->begin(), en = this->end(); it != en; ++it )
delete *it;
}
this->clear();
}
};
#else // !wxUSE_STD_CONTAINERS
template <typename T>
class wxDList
{
public:
class Node
{
public:
Node(wxDList<T> *list = NULL,
Node *previous = NULL,
Node *next = NULL,
T *data = NULL)
{
m_list = list;
m_previous = previous;
m_next = next;
m_data = data;
if (previous)
previous->m_next = this;
if (next)
next->m_previous = this;
}
~Node()
{
// handle the case when we're being deleted from the list by
// the user (i.e. not by the list itself from DeleteNode) -
// we must do it for compatibility with old code
if (m_list != NULL)
m_list->DetachNode(this);
}
void DeleteData()
{
delete m_data;
}
Node *GetNext() const { return m_next; }
Node *GetPrevious() const { return m_previous; }
T *GetData() const { return m_data; }
T **GetDataPtr() const { return &(const_cast<nodetype*>(this)->m_data); }
void SetData( T *data ) { m_data = data; }
int IndexOf() const
{
wxCHECK_MSG( m_list, wxNOT_FOUND,
"node doesn't belong to a list in IndexOf" );
int i;
Node *prev = m_previous;
for( i = 0; prev; i++ )
prev = prev->m_previous;
return i;
}
private:
T *m_data; // user data
Node *m_next, // next and previous nodes in the list
*m_previous;
wxDList<T> *m_list; // list we belong to
friend class wxDList<T>;
};
typedef Node nodetype;
class compatibility_iterator
{
public:
compatibility_iterator(nodetype *ptr = NULL) : m_ptr(ptr) { }
nodetype *operator->() const { return m_ptr; }
operator nodetype *() const { return m_ptr; }
private:
nodetype *m_ptr;
};
private:
void Init()
{
m_nodeFirst =
m_nodeLast = NULL;
m_count = 0;
m_destroy = false;
}
void DoDeleteNode( nodetype *node )
{
if ( m_destroy )
node->DeleteData();
// so that the node knows that it's being deleted by the list
node->m_list = NULL;
delete node;
}
size_t m_count; // number of elements in the list
bool m_destroy; // destroy user data when deleting list items?
nodetype *m_nodeFirst, // pointers to the head and tail of the list
*m_nodeLast;
public:
wxDList()
{
Init();
}
wxDList( const wxDList<T>& list )
{
Init();
Assign(list);
}
wxDList( size_t count, T *elements[] )
{
Init();
size_t n;
for (n = 0; n < count; n++)
Append( elements[n] );
}
wxDList& operator=( const wxDList<T>& list )
{
if (&list != this)
Assign(list);
return *this;
}
~wxDList()
{
nodetype *each = m_nodeFirst;
while ( each != NULL )
{
nodetype *next = each->GetNext();
DoDeleteNode(each);
each = next;
}
}
void Assign(const wxDList<T> &list)
{
wxASSERT_MSG( !list.m_destroy,
"copying list which owns it's elements is a bad idea" );
Clear();
m_destroy = list.m_destroy;
m_nodeFirst = NULL;
m_nodeLast = NULL;
nodetype* node;
for (node = list.GetFirst(); node; node = node->GetNext() )
Append(node->GetData());
wxASSERT_MSG( m_count == list.m_count, "logic error in Assign()" );
}
nodetype *Append( T *object )
{
nodetype *node = new nodetype( this, m_nodeLast, NULL, object );
if ( !m_nodeFirst )
{
m_nodeFirst = node;
m_nodeLast = m_nodeFirst;
}
else
{
m_nodeLast->m_next = node;
m_nodeLast = node;
}
m_count++;
return node;
}
nodetype *Insert( T* object )
{
return Insert( NULL, object );
}
nodetype *Insert( size_t pos, T* object )
{
if (pos == m_count)
return Append( object );
else
return Insert( Item(pos), object );
}
nodetype *Insert( nodetype *position, T* object )
{
wxCHECK_MSG( !position || position->m_list == this, NULL,
"can't insert before a node from another list" );
// previous and next node for the node being inserted
nodetype *prev, *next;
if ( position )
{
prev = position->GetPrevious();
next = position;
}
else
{
// inserting in the beginning of the list
prev = NULL;
next = m_nodeFirst;
}
nodetype *node = new nodetype( this, prev, next, object );
if ( !m_nodeFirst )
m_nodeLast = node;
if ( prev == NULL )
m_nodeFirst = node;
m_count++;
return node;
}
nodetype *GetFirst() const { return m_nodeFirst; }
nodetype *GetLast() const { return m_nodeLast; }
size_t GetCount() const { return m_count; }
bool IsEmpty() const { return m_count == 0; }
void DeleteContents(bool destroy) { m_destroy = destroy; }
bool GetDeleteContents() const { return m_destroy; }
nodetype *Item(size_t index) const
{
for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
{
if ( index-- == 0 )
return current;
}
wxFAIL_MSG( "invalid index in Item()" );
return NULL;
}
T *operator[](size_t index) const
{
nodetype *node = Item(index);
return node ? node->GetData() : NULL;
}
nodetype *DetachNode( nodetype *node )
{
wxCHECK_MSG( node, NULL, "detaching NULL wxNodeBase" );
wxCHECK_MSG( node->m_list == this, NULL,
"detaching node which is not from this list" );
// update the list
nodetype **prevNext = node->GetPrevious() ? &node->GetPrevious()->m_next
: &m_nodeFirst;
nodetype **nextPrev = node->GetNext() ? &node->GetNext()->m_previous
: &m_nodeLast;
*prevNext = node->GetNext();
*nextPrev = node->GetPrevious();
m_count--;
// mark the node as not belonging to this list any more
node->m_list = NULL;
return node;
}
void Erase( nodetype *node )
{
DeleteNode(node);
}
bool DeleteNode( nodetype *node )
{
if ( !DetachNode(node) )
return false;
DoDeleteNode(node);
return true;
}
bool DeleteObject( T *object )
{
for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
{
if ( current->GetData() == object )
{
DeleteNode(current);
return true;
}
}
// not found
return false;
}
nodetype *Find(const T *object) const
{
for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
{
if ( current->GetData() == object )
return current;
}
// not found
return NULL;
}
int IndexOf(const T *object) const
{
int n = 0;
for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
{
if ( current->GetData() == object )
return n;
n++;
}
return wxNOT_FOUND;
}
void Clear()
{
nodetype *current = m_nodeFirst;
while ( current )
{
nodetype *next = current->GetNext();
DoDeleteNode(current);
current = next;
}
m_nodeFirst =
m_nodeLast = NULL;
m_count = 0;
}
void Reverse()
{
nodetype * node = m_nodeFirst;
nodetype* tmp;
while (node)
{
// swap prev and next pointers
tmp = node->m_next;
node->m_next = node->m_previous;
node->m_previous = tmp;
// this is the node that was next before swapping
node = tmp;
}
// swap first and last node
tmp = m_nodeFirst; m_nodeFirst = m_nodeLast; m_nodeLast = tmp;
}
void DeleteNodes(nodetype* first, nodetype* last)
{
nodetype * node = first;
while (node != last)
{
nodetype* next = node->GetNext();
DeleteNode(node);
node = next;
}
}
void ForEach(wxListIterateFunction F)
{
for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
(*F)(current->GetData());
}
T *FirstThat(wxListIterateFunction F)
{
for ( nodetype *current = GetFirst(); current; current = current->GetNext() )
{
if ( (*F)(current->GetData()) )
return current->GetData();
}
return NULL;
}
T *LastThat(wxListIterateFunction F)
{
for ( nodetype *current = GetLast(); current; current = current->GetPrevious() )
{
if ( (*F)(current->GetData()) )
return current->GetData();
}
return NULL;
}
/* STL interface */
public:
typedef size_t size_type;
typedef int difference_type;
typedef T* value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
class iterator
{
public:
typedef nodetype Node;
typedef iterator itor;
typedef T* value_type;
typedef value_type* ptr_type;
typedef value_type& reference;
Node* m_node;
Node* m_init;
public:
typedef reference reference_type;
typedef ptr_type pointer_type;
iterator(Node* node, Node* init) : m_node(node), m_init(init) {}
iterator() : m_node(NULL), m_init(NULL) { }
reference_type operator*() const
{ return *m_node->GetDataPtr(); }
// ptrop
itor& operator++() { m_node = m_node->GetNext(); return *this; }
const itor operator++(int)
{ itor tmp = *this; m_node = m_node->GetNext(); return tmp; }
itor& operator--()
{
m_node = m_node ? m_node->GetPrevious() : m_init;
return *this;
}
const itor operator--(int)
{
itor tmp = *this;
m_node = m_node ? m_node->GetPrevious() : m_init;
return tmp;
}
bool operator!=(const itor& it) const
{ return it.m_node != m_node; }
bool operator==(const itor& it) const
{ return it.m_node == m_node; }
};
class const_iterator
{
public:
typedef nodetype Node;
typedef T* value_type;
typedef const value_type& const_reference;
typedef const_iterator itor;
typedef value_type* ptr_type;
Node* m_node;
Node* m_init;
public:
typedef const_reference reference_type;
typedef const ptr_type pointer_type;
const_iterator(Node* node, Node* init)
: m_node(node), m_init(init) { }
const_iterator() : m_node(NULL), m_init(NULL) { }
const_iterator(const iterator& it)
: m_node(it.m_node), m_init(it.m_init) { }
reference_type operator*() const
{ return *m_node->GetDataPtr(); }
// ptrop
itor& operator++() { m_node = m_node->GetNext(); return *this; }
const itor operator++(int)
{ itor tmp = *this; m_node = m_node->GetNext(); return tmp; }
itor& operator--()
{
m_node = m_node ? m_node->GetPrevious() : m_init;
return *this;
}
const itor operator--(int)
{
itor tmp = *this;
m_node = m_node ? m_node->GetPrevious() : m_init;
return tmp;
}
bool operator!=(const itor& it) const
{ return it.m_node != m_node; }
bool operator==(const itor& it) const
{ return it.m_node == m_node; }
};
class reverse_iterator
{
public:
typedef nodetype Node;
typedef T* value_type;
typedef reverse_iterator itor;
typedef value_type* ptr_type;
typedef value_type& reference;
Node* m_node;
Node* m_init;
public:
typedef reference reference_type;
typedef ptr_type pointer_type;
reverse_iterator(Node* node, Node* init)
: m_node(node), m_init(init) { }
reverse_iterator() : m_node(NULL), m_init(NULL) { }
reference_type operator*() const
{ return *m_node->GetDataPtr(); }
// ptrop
itor& operator++()
{ m_node = m_node->GetPrevious(); return *this; }
const itor operator++(int)
{ itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }
itor& operator--()
{ m_node = m_node ? m_node->GetNext() : m_init; return *this; }
const itor operator--(int)
{
itor tmp = *this;
m_node = m_node ? m_node->GetNext() : m_init;
return tmp;
}
bool operator!=(const itor& it) const
{ return it.m_node != m_node; }
bool operator==(const itor& it) const
{ return it.m_node == m_node; }
};
class const_reverse_iterator
{
public:
typedef nodetype Node;
typedef T* value_type;
typedef const_reverse_iterator itor;
typedef value_type* ptr_type;
typedef const value_type& const_reference;
Node* m_node;
Node* m_init;
public:
typedef const_reference reference_type;
typedef const ptr_type pointer_type;
const_reverse_iterator(Node* node, Node* init)
: m_node(node), m_init(init) { }
const_reverse_iterator() : m_node(NULL), m_init(NULL) { }
const_reverse_iterator(const reverse_iterator& it)
: m_node(it.m_node), m_init(it.m_init) { }
reference_type operator*() const
{ return *m_node->GetDataPtr(); }
// ptrop
itor& operator++()
{ m_node = m_node->GetPrevious(); return *this; }
const itor operator++(int)
{ itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }
itor& operator--()
{ m_node = m_node ? m_node->GetNext() : m_init; return *this;}
const itor operator--(int)
{
itor tmp = *this;
m_node = m_node ? m_node->GetNext() : m_init;
return tmp;
}
bool operator!=(const itor& it) const
{ return it.m_node != m_node; }
bool operator==(const itor& it) const
{ return it.m_node == m_node; }
};
explicit wxDList(size_type n, const_reference v = value_type())
{ assign(n, v); }
wxDList(const const_iterator& first, const const_iterator& last)
{ assign(first, last); }
iterator begin() { return iterator(GetFirst(), GetLast()); }
const_iterator begin() const
{ return const_iterator(GetFirst(), GetLast()); }
iterator end() { return iterator(NULL, GetLast()); }
const_iterator end() const { return const_iterator(NULL, GetLast()); }
reverse_iterator rbegin()
{ return reverse_iterator(GetLast(), GetFirst()); }
const_reverse_iterator rbegin() const
{ return const_reverse_iterator(GetLast(), GetFirst()); }
reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); }
const_reverse_iterator rend() const
{ return const_reverse_iterator(NULL, GetFirst()); }
void resize(size_type n, value_type v = value_type())
{
while (n < size())
pop_back();
while (n > size())
push_back(v);
}
size_type size() const { return GetCount(); }
size_type max_size() const { return INT_MAX; }
bool empty() const { return IsEmpty(); }
reference front() { return *begin(); }
const_reference front() const { return *begin(); }
reference back() { iterator tmp = end(); return *--tmp; }
const_reference back() const { const_iterator tmp = end(); return *--tmp; }
void push_front(const_reference v = value_type())
{ Insert(GetFirst(), v); }
void pop_front() { DeleteNode(GetFirst()); }
void push_back(const_reference v = value_type())
{ Append( v ); }
void pop_back() { DeleteNode(GetLast()); }
void assign(const_iterator first, const const_iterator& last)
{
clear();
for(; first != last; ++first)
Append(*first);
}
void assign(size_type n, const_reference v = value_type())
{
clear();
for(size_type i = 0; i < n; ++i)
Append(v);
}
iterator insert(const iterator& it, const_reference v)
{
if (it == end())
Append( v );
else
Insert(it.m_node,v);
iterator itprev(it);
return itprev--;
}
void insert(const iterator& it, size_type n, const_reference v)
{
for(size_type i = 0; i < n; ++i)
Insert(it.m_node, v);
}
void insert(const iterator& it, const_iterator first, const const_iterator& last)
{
for(; first != last; ++first)
Insert(it.m_node, *first);
}
iterator erase(const iterator& it)
{
iterator next = iterator(it.m_node->GetNext(), GetLast());
DeleteNode(it.m_node); return next;
}
iterator erase(const iterator& first, const iterator& last)
{
iterator next = last; ++next;
DeleteNodes(first.m_node, last.m_node);
return next;
}
void clear() { Clear(); }
void splice(const iterator& it, wxDList<T>& l, const iterator& first, const iterator& last)
{ insert(it, first, last); l.erase(first, last); }
void splice(const iterator& it, wxDList<T>& l)
{ splice(it, l, l.begin(), l.end() ); }
void splice(const iterator& it, wxDList<T>& l, const iterator& first)
{
iterator tmp = first; ++tmp;
if(it == first || it == tmp) return;
insert(it, *first);
l.erase(first);
}
void remove(const_reference v)
{ DeleteObject(v); }
void reverse()
{ Reverse(); }
/* void swap(list<T>& l)
{
{ size_t t = m_count; m_count = l.m_count; l.m_count = t; }
{ bool t = m_destroy; m_destroy = l.m_destroy; l.m_destroy = t; }
{ wxNodeBase* t = m_nodeFirst; m_nodeFirst = l.m_nodeFirst; l.m_nodeFirst = t; }
{ wxNodeBase* t = m_nodeLast; m_nodeLast = l.m_nodeLast; l.m_nodeLast = t; }
{ wxKeyType t = m_keyType; m_keyType = l.m_keyType; l.m_keyType = t; }
} */
};
#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS
#endif // _WX_DLIST_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/numdlg.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/numdlg.h
// Purpose: wxNumberEntryDialog class
// Author: John Labenski
// Modified by:
// Created: 07.02.04 (extracted from wx/textdlg.h)
// Copyright: (c) John Labenski
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_NUMDLGDLG_H_BASE_
#define _WX_NUMDLGDLG_H_BASE_
#include "wx/defs.h"
#if wxUSE_NUMBERDLG
#include "wx/generic/numdlgg.h"
#endif // wxUSE_NUMBERDLG
#endif // _WX_NUMDLGDLG_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/language.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/language.h
// Purpose: wxLanguage enum
// Author: Vadim Zeitlin
// Created: 2010-04-23
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// WARNING: Parts of this file are generated. See misc/languages/README for
// details.
#ifndef _WX_LANGUAGE_H_
#define _WX_LANGUAGE_H_
#include "wx/defs.h"
#if wxUSE_INTL
// ----------------------------------------------------------------------------
// wxLanguage: defines all supported languages
// ----------------------------------------------------------------------------
// --- --- --- generated code begins here --- --- ---
/**
The languages supported by wxLocale.
This enum is generated by misc/languages/genlang.py
When making changes, please put them into misc/languages/langtabl.txt
*/
enum wxLanguage
{
/// User's default/preferred language as got from OS.
wxLANGUAGE_DEFAULT,
/// Unknown language, returned if wxLocale::GetSystemLanguage fails.
wxLANGUAGE_UNKNOWN,
wxLANGUAGE_ABKHAZIAN,
wxLANGUAGE_AFAR,
wxLANGUAGE_AFRIKAANS,
wxLANGUAGE_ALBANIAN,
wxLANGUAGE_AMHARIC,
wxLANGUAGE_ARABIC,
wxLANGUAGE_ARABIC_ALGERIA,
wxLANGUAGE_ARABIC_BAHRAIN,
wxLANGUAGE_ARABIC_EGYPT,
wxLANGUAGE_ARABIC_IRAQ,
wxLANGUAGE_ARABIC_JORDAN,
wxLANGUAGE_ARABIC_KUWAIT,
wxLANGUAGE_ARABIC_LEBANON,
wxLANGUAGE_ARABIC_LIBYA,
wxLANGUAGE_ARABIC_MOROCCO,
wxLANGUAGE_ARABIC_OMAN,
wxLANGUAGE_ARABIC_QATAR,
wxLANGUAGE_ARABIC_SAUDI_ARABIA,
wxLANGUAGE_ARABIC_SUDAN,
wxLANGUAGE_ARABIC_SYRIA,
wxLANGUAGE_ARABIC_TUNISIA,
wxLANGUAGE_ARABIC_UAE,
wxLANGUAGE_ARABIC_YEMEN,
wxLANGUAGE_ARMENIAN,
wxLANGUAGE_ASSAMESE,
wxLANGUAGE_ASTURIAN,
wxLANGUAGE_AYMARA,
wxLANGUAGE_AZERI,
wxLANGUAGE_AZERI_CYRILLIC,
wxLANGUAGE_AZERI_LATIN,
wxLANGUAGE_BASHKIR,
wxLANGUAGE_BASQUE,
wxLANGUAGE_BELARUSIAN,
wxLANGUAGE_BENGALI,
wxLANGUAGE_BHUTANI,
wxLANGUAGE_BIHARI,
wxLANGUAGE_BISLAMA,
wxLANGUAGE_BOSNIAN,
wxLANGUAGE_BRETON,
wxLANGUAGE_BULGARIAN,
wxLANGUAGE_BURMESE,
wxLANGUAGE_CATALAN,
wxLANGUAGE_CHINESE,
wxLANGUAGE_CHINESE_SIMPLIFIED,
wxLANGUAGE_CHINESE_TRADITIONAL,
wxLANGUAGE_CHINESE_HONGKONG,
wxLANGUAGE_CHINESE_MACAU,
wxLANGUAGE_CHINESE_SINGAPORE,
wxLANGUAGE_CHINESE_TAIWAN,
wxLANGUAGE_CORSICAN,
wxLANGUAGE_CROATIAN,
wxLANGUAGE_CZECH,
wxLANGUAGE_DANISH,
wxLANGUAGE_DUTCH,
wxLANGUAGE_DUTCH_BELGIAN,
wxLANGUAGE_ENGLISH,
wxLANGUAGE_ENGLISH_UK,
wxLANGUAGE_ENGLISH_US,
wxLANGUAGE_ENGLISH_AUSTRALIA,
wxLANGUAGE_ENGLISH_BELIZE,
wxLANGUAGE_ENGLISH_BOTSWANA,
wxLANGUAGE_ENGLISH_CANADA,
wxLANGUAGE_ENGLISH_CARIBBEAN,
wxLANGUAGE_ENGLISH_DENMARK,
wxLANGUAGE_ENGLISH_EIRE,
wxLANGUAGE_ENGLISH_JAMAICA,
wxLANGUAGE_ENGLISH_NEW_ZEALAND,
wxLANGUAGE_ENGLISH_PHILIPPINES,
wxLANGUAGE_ENGLISH_SOUTH_AFRICA,
wxLANGUAGE_ENGLISH_TRINIDAD,
wxLANGUAGE_ENGLISH_ZIMBABWE,
wxLANGUAGE_ESPERANTO,
wxLANGUAGE_ESTONIAN,
wxLANGUAGE_FAEROESE,
wxLANGUAGE_FARSI,
wxLANGUAGE_FIJI,
wxLANGUAGE_FINNISH,
wxLANGUAGE_FRENCH,
wxLANGUAGE_FRENCH_BELGIAN,
wxLANGUAGE_FRENCH_CANADIAN,
wxLANGUAGE_FRENCH_LUXEMBOURG,
wxLANGUAGE_FRENCH_MONACO,
wxLANGUAGE_FRENCH_SWISS,
wxLANGUAGE_FRISIAN,
wxLANGUAGE_GALICIAN,
wxLANGUAGE_GEORGIAN,
wxLANGUAGE_GERMAN,
wxLANGUAGE_GERMAN_AUSTRIAN,
wxLANGUAGE_GERMAN_BELGIUM,
wxLANGUAGE_GERMAN_LIECHTENSTEIN,
wxLANGUAGE_GERMAN_LUXEMBOURG,
wxLANGUAGE_GERMAN_SWISS,
wxLANGUAGE_GREEK,
wxLANGUAGE_GREENLANDIC,
wxLANGUAGE_GUARANI,
wxLANGUAGE_GUJARATI,
wxLANGUAGE_HAUSA,
wxLANGUAGE_HEBREW,
wxLANGUAGE_HINDI,
wxLANGUAGE_HUNGARIAN,
wxLANGUAGE_ICELANDIC,
wxLANGUAGE_INDONESIAN,
wxLANGUAGE_INTERLINGUA,
wxLANGUAGE_INTERLINGUE,
wxLANGUAGE_INUKTITUT,
wxLANGUAGE_INUPIAK,
wxLANGUAGE_IRISH,
wxLANGUAGE_ITALIAN,
wxLANGUAGE_ITALIAN_SWISS,
wxLANGUAGE_JAPANESE,
wxLANGUAGE_JAVANESE,
wxLANGUAGE_KABYLE,
wxLANGUAGE_KANNADA,
wxLANGUAGE_KASHMIRI,
wxLANGUAGE_KASHMIRI_INDIA,
wxLANGUAGE_KAZAKH,
wxLANGUAGE_KERNEWEK,
wxLANGUAGE_KHMER,
wxLANGUAGE_KINYARWANDA,
wxLANGUAGE_KIRGHIZ,
wxLANGUAGE_KIRUNDI,
wxLANGUAGE_KONKANI,
wxLANGUAGE_KOREAN,
wxLANGUAGE_KURDISH,
wxLANGUAGE_LAOTHIAN,
wxLANGUAGE_LATIN,
wxLANGUAGE_LATVIAN,
wxLANGUAGE_LINGALA,
wxLANGUAGE_LITHUANIAN,
wxLANGUAGE_MACEDONIAN,
wxLANGUAGE_MALAGASY,
wxLANGUAGE_MALAY,
wxLANGUAGE_MALAYALAM,
wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
wxLANGUAGE_MALAY_MALAYSIA,
wxLANGUAGE_MALTESE,
wxLANGUAGE_MANIPURI,
wxLANGUAGE_MAORI,
wxLANGUAGE_MARATHI,
wxLANGUAGE_MOLDAVIAN,
wxLANGUAGE_MONGOLIAN,
wxLANGUAGE_NAURU,
wxLANGUAGE_NEPALI,
wxLANGUAGE_NEPALI_INDIA,
wxLANGUAGE_NORWEGIAN_BOKMAL,
wxLANGUAGE_NORWEGIAN_NYNORSK,
wxLANGUAGE_OCCITAN,
wxLANGUAGE_ORIYA,
wxLANGUAGE_OROMO,
wxLANGUAGE_PASHTO,
wxLANGUAGE_POLISH,
wxLANGUAGE_PORTUGUESE,
wxLANGUAGE_PORTUGUESE_BRAZILIAN,
wxLANGUAGE_PUNJABI,
wxLANGUAGE_QUECHUA,
wxLANGUAGE_RHAETO_ROMANCE,
wxLANGUAGE_ROMANIAN,
wxLANGUAGE_RUSSIAN,
wxLANGUAGE_RUSSIAN_UKRAINE,
wxLANGUAGE_SAMI,
wxLANGUAGE_SAMOAN,
wxLANGUAGE_SANGHO,
wxLANGUAGE_SANSKRIT,
wxLANGUAGE_SCOTS_GAELIC,
wxLANGUAGE_SERBIAN,
wxLANGUAGE_SERBIAN_CYRILLIC,
wxLANGUAGE_SERBIAN_LATIN,
wxLANGUAGE_SERBO_CROATIAN,
wxLANGUAGE_SESOTHO,
wxLANGUAGE_SETSWANA,
wxLANGUAGE_SHONA,
wxLANGUAGE_SINDHI,
wxLANGUAGE_SINHALESE,
wxLANGUAGE_SISWATI,
wxLANGUAGE_SLOVAK,
wxLANGUAGE_SLOVENIAN,
wxLANGUAGE_SOMALI,
wxLANGUAGE_SPANISH,
wxLANGUAGE_SPANISH_ARGENTINA,
wxLANGUAGE_SPANISH_BOLIVIA,
wxLANGUAGE_SPANISH_CHILE,
wxLANGUAGE_SPANISH_COLOMBIA,
wxLANGUAGE_SPANISH_COSTA_RICA,
wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC,
wxLANGUAGE_SPANISH_ECUADOR,
wxLANGUAGE_SPANISH_EL_SALVADOR,
wxLANGUAGE_SPANISH_GUATEMALA,
wxLANGUAGE_SPANISH_HONDURAS,
wxLANGUAGE_SPANISH_MEXICAN,
wxLANGUAGE_SPANISH_MODERN,
wxLANGUAGE_SPANISH_NICARAGUA,
wxLANGUAGE_SPANISH_PANAMA,
wxLANGUAGE_SPANISH_PARAGUAY,
wxLANGUAGE_SPANISH_PERU,
wxLANGUAGE_SPANISH_PUERTO_RICO,
wxLANGUAGE_SPANISH_URUGUAY,
wxLANGUAGE_SPANISH_US,
wxLANGUAGE_SPANISH_VENEZUELA,
wxLANGUAGE_SUNDANESE,
wxLANGUAGE_SWAHILI,
wxLANGUAGE_SWEDISH,
wxLANGUAGE_SWEDISH_FINLAND,
wxLANGUAGE_TAGALOG,
wxLANGUAGE_TAJIK,
wxLANGUAGE_TAMIL,
wxLANGUAGE_TATAR,
wxLANGUAGE_TELUGU,
wxLANGUAGE_THAI,
wxLANGUAGE_TIBETAN,
wxLANGUAGE_TIGRINYA,
wxLANGUAGE_TONGA,
wxLANGUAGE_TSONGA,
wxLANGUAGE_TURKISH,
wxLANGUAGE_TURKMEN,
wxLANGUAGE_TWI,
wxLANGUAGE_UIGHUR,
wxLANGUAGE_UKRAINIAN,
wxLANGUAGE_URDU,
wxLANGUAGE_URDU_INDIA,
wxLANGUAGE_URDU_PAKISTAN,
wxLANGUAGE_UZBEK,
wxLANGUAGE_UZBEK_CYRILLIC,
wxLANGUAGE_UZBEK_LATIN,
wxLANGUAGE_VALENCIAN,
wxLANGUAGE_VIETNAMESE,
wxLANGUAGE_VOLAPUK,
wxLANGUAGE_WELSH,
wxLANGUAGE_WOLOF,
wxLANGUAGE_XHOSA,
wxLANGUAGE_YIDDISH,
wxLANGUAGE_YORUBA,
wxLANGUAGE_ZHUANG,
wxLANGUAGE_ZULU,
/// For custom, user-defined languages.
wxLANGUAGE_USER_DEFINED,
/// Obsolete synonym.
wxLANGUAGE_CAMBODIAN = wxLANGUAGE_KHMER
};
// --- --- --- generated code ends here --- --- ---
#endif // wxUSE_INTL
#endif // _WX_LANGUAGE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/renderer.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/renderer.h
// Purpose: wxRendererNative class declaration
// Author: Vadim Zeitlin
// Modified by:
// Created: 20.07.2003
// Copyright: (c) 2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/*
Renderers are used in wxWidgets for two similar but different things:
(a) wxUniversal uses them to draw everything, i.e. all the control
(b) all the native ports use them to draw generic controls only
wxUniversal needs more functionality than what is included in the base class
as it needs to draw stuff like scrollbars which are never going to be
generic. So we put the bare minimum needed by the native ports here and the
full wxRenderer class is declared in wx/univ/renderer.h and is only used by
wxUniveral (although note that native ports can load wxRenderer objects from
theme DLLs and use them as wxRendererNative ones, of course).
*/
#ifndef _WX_RENDERER_H_
#define _WX_RENDERER_H_
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxWindow;
#include "wx/gdicmn.h" // for wxPoint, wxSize
#include "wx/colour.h"
#include "wx/font.h"
#include "wx/bitmap.h"
#include "wx/string.h"
// some platforms have their own renderers, others use the generic one
#if defined(__WXMSW__) || ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) || defined(__WXGTK__)
#define wxHAS_NATIVE_RENDERER
#else
#undef wxHAS_NATIVE_RENDERER
#endif
// only MSW and OS X currently provides DrawTitleBarBitmap() method
#if defined(__WXMSW__) || (defined(__WXMAC__) && wxUSE_LIBPNG && wxUSE_IMAGE)
#define wxHAS_DRAW_TITLE_BAR_BITMAP
#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// control state flags used in wxRenderer and wxColourScheme
enum
{
wxCONTROL_NONE = 0x00000000, // absence of any other flags
wxCONTROL_DISABLED = 0x00000001, // control is disabled
wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus
wxCONTROL_PRESSED = 0x00000004, // (button) is pressed
wxCONTROL_SPECIAL = 0x00000008, // control-specific bit:
wxCONTROL_ISDEFAULT = wxCONTROL_SPECIAL, // only for the buttons
wxCONTROL_ISSUBMENU = wxCONTROL_SPECIAL, // only for the menu items
wxCONTROL_EXPANDED = wxCONTROL_SPECIAL, // only for the tree items
wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL, // only for the status bar panes
wxCONTROL_FLAT = wxCONTROL_SPECIAL, // checkboxes only: flat border
wxCONTROL_CELL = wxCONTROL_SPECIAL, // only for item selection rect
wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control
wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox
wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE, // (check) undetermined state
wxCONTROL_FLAGS_MASK = 0x000000ff,
// this is a pseudo flag not used directly by wxRenderer but rather by some
// controls internally
wxCONTROL_DIRTY = 0x80000000
};
// title bar buttons supported by DrawTitleBarBitmap()
//
// NB: they have the same values as wxTOPLEVEL_BUTTON_XXX constants in
// wx/univ/toplevel.h as they really represent the same things
enum wxTitleBarButton
{
wxTITLEBAR_BUTTON_CLOSE = 0x01000000,
wxTITLEBAR_BUTTON_MAXIMIZE = 0x02000000,
wxTITLEBAR_BUTTON_ICONIZE = 0x04000000,
wxTITLEBAR_BUTTON_RESTORE = 0x08000000,
wxTITLEBAR_BUTTON_HELP = 0x10000000
};
// ----------------------------------------------------------------------------
// helper structs
// ----------------------------------------------------------------------------
// wxSplitterWindow parameters
struct WXDLLIMPEXP_CORE wxSplitterRenderParams
{
// the only way to initialize this struct is by using this ctor
wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_)
: widthSash(widthSash_), border(border_), isHotSensitive(isSens_)
{
}
// the width of the splitter sash
const wxCoord widthSash;
// the width of the border of the splitter window
const wxCoord border;
// true if the splitter changes its appearance when the mouse is over it
const bool isHotSensitive;
};
// extra optional parameters for DrawHeaderButton
struct WXDLLIMPEXP_CORE wxHeaderButtonParams
{
wxHeaderButtonParams()
: m_labelAlignment(wxALIGN_LEFT)
{ }
wxColour m_arrowColour;
wxColour m_selectionColour;
wxString m_labelText;
wxFont m_labelFont;
wxColour m_labelColour;
wxBitmap m_labelBitmap;
int m_labelAlignment;
};
enum wxHeaderSortIconType
{
wxHDR_SORT_ICON_NONE, // Header button has no sort arrow
wxHDR_SORT_ICON_UP, // Header button an up sort arrow icon
wxHDR_SORT_ICON_DOWN // Header button a down sort arrow icon
};
// wxRendererNative interface version
struct WXDLLIMPEXP_CORE wxRendererVersion
{
wxRendererVersion(int version_, int age_) : version(version_), age(age_) { }
// default copy ctor, assignment operator and dtor are ok
// the current version and age of wxRendererNative interface: different
// versions are incompatible (in both ways) while the ages inside the same
// version are upwards compatible, i.e. the version of the renderer must
// match the version of the main program exactly while the age may be
// highergreater or equal to it
//
// NB: don't forget to increment age after adding any new virtual function!
enum
{
Current_Version = 1,
Current_Age = 5
};
// check if the given version is compatible with the current one
static bool IsCompatible(const wxRendererVersion& ver)
{
return ver.version == Current_Version && ver.age >= Current_Age;
}
const int version;
const int age;
};
// ----------------------------------------------------------------------------
// wxRendererNative: abstracts drawing methods needed by the native controls
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRendererNative
{
public:
// drawing functions
// -----------------
// draw the header control button (used by wxListCtrl) Returns optimal
// width for the label contents.
virtual int DrawHeaderButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0,
wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params=NULL) = 0;
// Draw the contents of a header control button (label, sort arrows, etc.)
// Normally only called by DrawHeaderButton.
virtual int DrawHeaderButtonContents(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0,
wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params=NULL) = 0;
// Returns the default height of a header button, either a fixed platform
// height if available, or a generic height based on the window's font.
virtual int GetHeaderButtonHeight(wxWindow *win) = 0;
// Returns the margin on left and right sides of header button's label
virtual int GetHeaderButtonMargin(wxWindow *win) = 0;
// draw the expanded/collapsed icon for a tree control item
virtual void DrawTreeItemButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// draw the border for sash window: this border must be such that the sash
// drawn by DrawSash() blends into it well
virtual void DrawSplitterBorder(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// draw a (vertical) sash
virtual void DrawSplitterSash(wxWindow *win,
wxDC& dc,
const wxSize& size,
wxCoord position,
wxOrientation orient,
int flags = 0) = 0;
// draw a combobox dropdown button
//
// flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT
virtual void DrawComboBoxDropButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// draw a dropdown arrow
//
// flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT
virtual void DrawDropArrow(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// draw check button
//
// flags may use wxCONTROL_CHECKED, wxCONTROL_UNDETERMINED and wxCONTROL_CURRENT
virtual void DrawCheckBox(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// Returns the default size of a check box.
virtual wxSize GetCheckBoxSize(wxWindow *win) = 0;
// draw blank button
//
// flags may use wxCONTROL_PRESSED, wxCONTROL_CURRENT and wxCONTROL_ISDEFAULT
virtual void DrawPushButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// draw collapse button
//
// flags may use wxCONTROL_CHECKED, wxCONTROL_UNDETERMINED and wxCONTROL_CURRENT
virtual void DrawCollapseButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// Returns the default size of a collapse button
virtual wxSize GetCollapseButtonSize(wxWindow *win, wxDC& dc) = 0;
// draw rectangle indicating that an item in e.g. a list control
// has been selected or focused
//
// flags may use
// wxCONTROL_SELECTED (item is selected, e.g. draw background)
// wxCONTROL_CURRENT (item is the current item, e.g. dotted border)
// wxCONTROL_FOCUSED (the whole control has focus, e.g. blue background vs. grey otherwise)
virtual void DrawItemSelectionRect(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// draw the focus rectangle around the label contained in the given rect
//
// only wxCONTROL_SELECTED makes sense in flags here
virtual void DrawFocusRect(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// Draw a native wxChoice
virtual void DrawChoice(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// Draw a native wxComboBox
virtual void DrawComboBox(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// Draw a native wxTextCtrl frame
virtual void DrawTextCtrl(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// Draw a native wxRadioButton bitmap
virtual void DrawRadioBitmap(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
// Draw one of the standard title bar buttons
//
// This is currently implemented only for MSW and OS X (for the close
// button only) because there is no way to render standard title bar
// buttons under the other platforms, the best can be done is to use normal
// (only) images which wxArtProvider provides for wxART_HELP and
// wxART_CLOSE (but not any other title bar buttons)
//
// NB: make sure PNG handler is enabled if using this function under OS X
virtual void DrawTitleBarBitmap(wxWindow *win,
wxDC& dc,
const wxRect& rect,
wxTitleBarButton button,
int flags = 0) = 0;
#endif // wxHAS_DRAW_TITLE_BAR_BITMAP
// Draw a gauge with native style like a wxGauge would display.
//
// wxCONTROL_SPECIAL flag must be used for drawing vertical gauges.
virtual void DrawGauge(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int value,
int max,
int flags = 0) = 0;
// Draw text using the appropriate color for normal and selected states.
virtual void DrawItemText(wxWindow* win,
wxDC& dc,
const wxString& text,
const wxRect& rect,
int align = wxALIGN_LEFT | wxALIGN_TOP,
int flags = 0,
wxEllipsizeMode ellipsizeMode = wxELLIPSIZE_END) = 0;
// geometry functions
// ------------------
// get the splitter parameters: the x field of the returned point is the
// sash width and the y field is the border width
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) = 0;
// pseudo constructors
// -------------------
// return the currently used renderer
static wxRendererNative& Get();
// return the generic implementation of the renderer
static wxRendererNative& GetGeneric();
// return the default (native) implementation for this platform
static wxRendererNative& GetDefault();
// changing the global renderer
// ----------------------------
#if wxUSE_DYNLIB_CLASS
// load the renderer from the specified DLL, the returned pointer must be
// deleted by caller if not NULL when it is not used any more
static wxRendererNative *Load(const wxString& name);
#endif // wxUSE_DYNLIB_CLASS
// set the renderer to use, passing NULL reverts to using the default
// renderer
//
// return the previous renderer used with Set() or NULL if none
static wxRendererNative *Set(wxRendererNative *renderer);
// miscellaneous stuff
// -------------------
// this function is used for version checking: Load() refuses to load any
// DLLs implementing an older or incompatible version; it should be
// implemented simply by returning wxRendererVersion::Current_XXX values
virtual wxRendererVersion GetVersion() const = 0;
// virtual dtor for any base class
virtual ~wxRendererNative();
};
// ----------------------------------------------------------------------------
// wxDelegateRendererNative: allows reuse of renderers code
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDelegateRendererNative : public wxRendererNative
{
public:
wxDelegateRendererNative()
: m_rendererNative(GetGeneric()) { }
wxDelegateRendererNative(wxRendererNative& rendererNative)
: m_rendererNative(rendererNative) { }
virtual int DrawHeaderButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0,
wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL) wxOVERRIDE
{ return m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params); }
virtual int DrawHeaderButtonContents(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0,
wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL) wxOVERRIDE
{ return m_rendererNative.DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); }
virtual int GetHeaderButtonHeight(wxWindow *win) wxOVERRIDE
{ return m_rendererNative.GetHeaderButtonHeight(win); }
virtual int GetHeaderButtonMargin(wxWindow *win) wxOVERRIDE
{ return m_rendererNative.GetHeaderButtonMargin(win); }
virtual void DrawTreeItemButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawTreeItemButton(win, dc, rect, flags); }
virtual void DrawSplitterBorder(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawSplitterBorder(win, dc, rect, flags); }
virtual void DrawSplitterSash(wxWindow *win,
wxDC& dc,
const wxSize& size,
wxCoord position,
wxOrientation orient,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawSplitterSash(win, dc, size,
position, orient, flags); }
virtual void DrawComboBoxDropButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawComboBoxDropButton(win, dc, rect, flags); }
virtual void DrawDropArrow(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawDropArrow(win, dc, rect, flags); }
virtual void DrawCheckBox(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawCheckBox( win, dc, rect, flags ); }
virtual wxSize GetCheckBoxSize(wxWindow *win) wxOVERRIDE
{ return m_rendererNative.GetCheckBoxSize(win); }
virtual void DrawPushButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawPushButton( win, dc, rect, flags ); }
virtual void DrawCollapseButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawCollapseButton(win, dc, rect, flags); }
virtual wxSize GetCollapseButtonSize(wxWindow *win, wxDC& dc) wxOVERRIDE
{ return m_rendererNative.GetCollapseButtonSize(win, dc); }
virtual void DrawItemSelectionRect(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawItemSelectionRect( win, dc, rect, flags ); }
virtual void DrawFocusRect(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawFocusRect( win, dc, rect, flags ); }
virtual void DrawChoice(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawChoice( win, dc, rect, flags); }
virtual void DrawComboBox(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawComboBox( win, dc, rect, flags); }
virtual void DrawTextCtrl(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawTextCtrl( win, dc, rect, flags); }
virtual void DrawRadioBitmap(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawRadioBitmap(win, dc, rect, flags); }
#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
virtual void DrawTitleBarBitmap(wxWindow *win,
wxDC& dc,
const wxRect& rect,
wxTitleBarButton button,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawTitleBarBitmap(win, dc, rect, button, flags); }
#endif // wxHAS_DRAW_TITLE_BAR_BITMAP
virtual void DrawGauge(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int value,
int max,
int flags = 0) wxOVERRIDE
{ m_rendererNative.DrawGauge(win, dc, rect, value, max, flags); }
virtual void DrawItemText(wxWindow* win,
wxDC& dc,
const wxString& text,
const wxRect& rect,
int align = wxALIGN_LEFT | wxALIGN_TOP,
int flags = 0,
wxEllipsizeMode ellipsizeMode = wxELLIPSIZE_END) wxOVERRIDE
{ m_rendererNative.DrawItemText(win, dc, text, rect, align, flags, ellipsizeMode); }
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) wxOVERRIDE
{ return m_rendererNative.GetSplitterParams(win); }
virtual wxRendererVersion GetVersion() const wxOVERRIDE
{ return m_rendererNative.GetVersion(); }
protected:
wxRendererNative& m_rendererNative;
wxDECLARE_NO_COPY_CLASS(wxDelegateRendererNative);
};
// ----------------------------------------------------------------------------
// inline functions implementation
// ----------------------------------------------------------------------------
#ifndef wxHAS_NATIVE_RENDERER
// default native renderer is the generic one then
/* static */ inline
wxRendererNative& wxRendererNative::GetDefault()
{
return GetGeneric();
}
#endif // !wxHAS_NATIVE_RENDERER
#endif // _WX_RENDERER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/statbmp.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/statbmp.h
// Purpose: wxStaticBitmap class interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 25.08.00
// Copyright: (c) 2000 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATBMP_H_BASE_
#define _WX_STATBMP_H_BASE_
#include "wx/defs.h"
#if wxUSE_STATBMP
#include "wx/control.h"
#include "wx/bitmap.h"
#include "wx/icon.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBitmapNameStr[];
// a control showing an icon or a bitmap
class WXDLLIMPEXP_CORE wxStaticBitmapBase : public wxControl
{
public:
enum ScaleMode
{
Scale_None,
Scale_Fill,
Scale_AspectFit,
Scale_AspectFill
};
wxStaticBitmapBase() { }
virtual ~wxStaticBitmapBase();
// our interface
virtual void SetIcon(const wxIcon& icon) = 0;
virtual void SetBitmap(const wxBitmap& bitmap) = 0;
virtual wxBitmap GetBitmap() const = 0;
virtual wxIcon GetIcon() const /* = 0 -- should be pure virtual */
{
// stub it out here for now as not all ports implement it (but they
// should)
return wxIcon();
}
virtual void SetScaleMode(ScaleMode WXUNUSED(scaleMode)) { }
virtual ScaleMode GetScaleMode() const { return Scale_None; }
// overridden base class virtuals
virtual bool AcceptsFocus() const wxOVERRIDE { return false; }
virtual bool HasTransparentBackground() wxOVERRIDE { return true; }
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
virtual wxSize DoGetBestSize() const wxOVERRIDE;
wxDECLARE_NO_COPY_CLASS(wxStaticBitmapBase);
};
#if defined(__WXUNIVERSAL__)
#include "wx/univ/statbmp.h"
#elif defined(__WXMSW__)
#include "wx/msw/statbmp.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/statbmp.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/statbmp.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/statbmp.h"
#elif defined(__WXMAC__)
#include "wx/osx/statbmp.h"
#elif defined(__WXQT__)
#include "wx/qt/statbmp.h"
#endif
#endif // wxUSE_STATBMP
#endif
// _WX_STATBMP_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/slider.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/slider.h
// Purpose: wxSlider interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 09.02.01
// Copyright: (c) 1996-2001 Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SLIDER_H_BASE_
#define _WX_SLIDER_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_SLIDER
#include "wx/control.h"
// ----------------------------------------------------------------------------
// wxSlider flags
// ----------------------------------------------------------------------------
#define wxSL_HORIZONTAL wxHORIZONTAL /* 0x0004 */
#define wxSL_VERTICAL wxVERTICAL /* 0x0008 */
#define wxSL_TICKS 0x0010
#define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks
#define wxSL_LEFT 0x0040
#define wxSL_TOP 0x0080
#define wxSL_RIGHT 0x0100
#define wxSL_BOTTOM 0x0200
#define wxSL_BOTH 0x0400
#define wxSL_SELRANGE 0x0800
#define wxSL_INVERSE 0x1000
#define wxSL_MIN_MAX_LABELS 0x2000
#define wxSL_VALUE_LABEL 0x4000
#define wxSL_LABELS (wxSL_MIN_MAX_LABELS|wxSL_VALUE_LABEL)
extern WXDLLIMPEXP_DATA_CORE(const char) wxSliderNameStr[];
// ----------------------------------------------------------------------------
// wxSliderBase: define wxSlider interface
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSliderBase : public wxControl
{
public:
/* the ctor of the derived class should have the following form:
wxSlider(wxWindow *parent,
wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSliderNameStr);
*/
wxSliderBase() { }
// get/set the current slider value (should be in range)
virtual int GetValue() const = 0;
virtual void SetValue(int value) = 0;
// retrieve/change the range
virtual void SetRange(int minValue, int maxValue) = 0;
virtual int GetMin() const = 0;
virtual int GetMax() const = 0;
void SetMin( int minValue ) { SetRange( minValue , GetMax() ) ; }
void SetMax( int maxValue ) { SetRange( GetMin() , maxValue ) ; }
// the line/page size is the increment by which the slider moves when
// cursor arrow key/page up or down are pressed (clicking the mouse is like
// pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
virtual void SetLineSize(int lineSize) = 0;
virtual void SetPageSize(int pageSize) = 0;
virtual int GetLineSize() const = 0;
virtual int GetPageSize() const = 0;
// these methods get/set the length of the slider pointer in pixels
virtual void SetThumbLength(int lenPixels) = 0;
virtual int GetThumbLength() const = 0;
// warning: most of subsequent methods are currently only implemented in
// wxMSW and are silently ignored on other platforms
void SetTickFreq(int freq) { DoSetTickFreq(freq); }
virtual int GetTickFreq() const { return 0; }
virtual void ClearTicks() { }
virtual void SetTick(int WXUNUSED(tickPos)) { }
virtual void ClearSel() { }
virtual int GetSelEnd() const { return GetMin(); }
virtual int GetSelStart() const { return GetMax(); }
virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { }
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED_INLINE( void SetTickFreq(int freq, int), DoSetTickFreq(freq); )
#endif
protected:
// Platform-specific implementation of SetTickFreq
virtual void DoSetTickFreq(int WXUNUSED(freq)) { /* unsupported by default */ }
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
// adjust value according to wxSL_INVERSE style
virtual int ValueInvertOrNot(int value) const
{
if (HasFlag(wxSL_INVERSE))
return (GetMax() + GetMin()) - value;
else
return value;
}
private:
wxDECLARE_NO_COPY_CLASS(wxSliderBase);
};
// ----------------------------------------------------------------------------
// include the real class declaration
// ----------------------------------------------------------------------------
#if defined(__WXUNIVERSAL__)
#include "wx/univ/slider.h"
#elif defined(__WXMSW__)
#include "wx/msw/slider.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/slider.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/slider.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/slider.h"
#elif defined(__WXMAC__)
#include "wx/osx/slider.h"
#elif defined(__WXQT__)
#include "wx/qt/slider.h"
#endif
#endif // wxUSE_SLIDER
#endif
// _WX_SLIDER_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/menuitem.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/menuitem.h
// Purpose: wxMenuItem class
// Author: Vadim Zeitlin
// Modified by:
// Created: 25.10.99
// Copyright: (c) 1999 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MENUITEM_H_BASE_
#define _WX_MENUITEM_H_BASE_
#include "wx/defs.h"
#if wxUSE_MENUS
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/object.h" // base class
// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------
#if wxUSE_ACCEL
class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry;
#endif // wxUSE_ACCEL
class WXDLLIMPEXP_FWD_CORE wxMenuItem;
class WXDLLIMPEXP_FWD_CORE wxMenu;
// ----------------------------------------------------------------------------
// wxMenuItem is an item in the menu which may be either a normal item, a sub
// menu or a separator
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMenuItemBase : public wxObject
{
public:
// creation
static wxMenuItem *New(wxMenu *parentMenu = NULL,
int itemid = wxID_SEPARATOR,
const wxString& text = wxEmptyString,
const wxString& help = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL,
wxMenu *subMenu = NULL);
// destruction: wxMenuItem will delete its submenu
virtual ~wxMenuItemBase();
// the menu we're in
wxMenu *GetMenu() const { return m_parentMenu; }
void SetMenu(wxMenu* menu) { m_parentMenu = menu; }
// get/set id
void SetId(int itemid) { m_id = itemid; }
int GetId() const { return m_id; }
// the item's text (or name)
//
// NB: the item's label includes the accelerators and mnemonics info (if
// any), i.e. it may contain '&' or '_' or "\t..." and thus is
// different from the item's text which only contains the text shown
// in the menu. This used to be called SetText.
virtual void SetItemLabel(const wxString& str);
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
virtual wxString GetItemLabel() const { return m_text; }
// return just the text of the item label, without any mnemonics
// This used to be called GetLabel.
virtual wxString GetItemLabelText() const { return GetLabelText(m_text); }
// return just the text part of the given label (implemented in platform-specific code)
// This used to be called GetLabelFromText.
static wxString GetLabelText(const wxString& label);
// what kind of menu item we are
wxItemKind GetKind() const { return m_kind; }
void SetKind(wxItemKind kind) { m_kind = kind; }
bool IsSeparator() const { return m_kind == wxITEM_SEPARATOR; }
bool IsCheck() const { return m_kind == wxITEM_CHECK; }
bool IsRadio() const { return m_kind == wxITEM_RADIO; }
virtual void SetCheckable(bool checkable)
{ m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; }
// Notice that this doesn't quite match SetCheckable().
bool IsCheckable() const
{ return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; }
bool IsSubMenu() const { return m_subMenu != NULL; }
void SetSubMenu(wxMenu *menu) { m_subMenu = menu; }
wxMenu *GetSubMenu() const { return m_subMenu; }
// state
virtual void Enable(bool enable = true) { m_isEnabled = enable; }
virtual bool IsEnabled() const { return m_isEnabled; }
virtual void Check(bool check = true) { m_isChecked = check; }
virtual bool IsChecked() const { return m_isChecked; }
void Toggle() { Check(!m_isChecked); }
// help string (displayed in the status bar by default)
void SetHelp(const wxString& str);
const wxString& GetHelp() const { return m_help; }
#if wxUSE_ACCEL
// extract the accelerator from the given menu string, return NULL if none
// found
static wxAcceleratorEntry *GetAccelFromString(const wxString& label);
// get our accelerator or NULL (caller must delete the pointer)
virtual wxAcceleratorEntry *GetAccel() const;
// set the accel for this item - this may also be done indirectly with
// SetText()
virtual void SetAccel(wxAcceleratorEntry *accel);
#endif // wxUSE_ACCEL
#if WXWIN_COMPATIBILITY_2_8
// compatibility only, use new functions in the new code
wxDEPRECATED( void SetName(const wxString& str) );
wxDEPRECATED( wxString GetName() const );
// Now use GetItemLabelText
wxDEPRECATED( wxString GetLabel() const ) ;
// Now use GetItemLabel
wxDEPRECATED( const wxString& GetText() const );
// Now use GetLabelText to strip the accelerators
static wxDEPRECATED( wxString GetLabelFromText(const wxString& text) );
// Now use SetItemLabel
wxDEPRECATED( virtual void SetText(const wxString& str) );
#endif // WXWIN_COMPATIBILITY_2_8
static wxMenuItem *New(wxMenu *parentMenu,
int itemid,
const wxString& text,
const wxString& help,
bool isCheckable,
wxMenu *subMenu = NULL)
{
return New(parentMenu, itemid, text, help,
isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu);
}
protected:
wxWindowIDRef m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR
wxMenu *m_parentMenu, // the menu we belong to
*m_subMenu; // our sub menu or NULL
wxString m_text, // label of the item
m_help; // the help string for the item
wxItemKind m_kind; // separator/normal/check/radio item?
bool m_isChecked; // is checked?
bool m_isEnabled; // is enabled?
// this ctor is for the derived classes only, we're never created directly
wxMenuItemBase(wxMenu *parentMenu = NULL,
int itemid = wxID_SEPARATOR,
const wxString& text = wxEmptyString,
const wxString& help = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL,
wxMenu *subMenu = NULL);
private:
// and, if we have one ctor, compiler won't generate a default copy one, so
// declare them ourselves - but don't implement as they shouldn't be used
wxMenuItemBase(const wxMenuItemBase& item);
wxMenuItemBase& operator=(const wxMenuItemBase& item);
};
#if WXWIN_COMPATIBILITY_2_8
inline void wxMenuItemBase::SetName(const wxString &str)
{ SetItemLabel(str); }
inline wxString wxMenuItemBase::GetName() const
{ return GetItemLabel(); }
inline wxString wxMenuItemBase::GetLabel() const
{ return GetLabelText(m_text); }
inline const wxString& wxMenuItemBase::GetText() const { return m_text; }
inline void wxMenuItemBase::SetText(const wxString& text) { SetItemLabel(text); }
#endif // WXWIN_COMPATIBILITY_2_8
// ----------------------------------------------------------------------------
// include the real class declaration
// ----------------------------------------------------------------------------
#ifdef wxUSE_BASE_CLASSES_ONLY
#define wxMenuItem wxMenuItemBase
#else // !wxUSE_BASE_CLASSES_ONLY
#if defined(__WXUNIVERSAL__)
#include "wx/univ/menuitem.h"
#elif defined(__WXMSW__)
#include "wx/msw/menuitem.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/menuitem.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/menuitem.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/menuitem.h"
#elif defined(__WXMAC__)
#include "wx/osx/menuitem.h"
#elif defined(__WXQT__)
#include "wx/qt/menuitem.h"
#endif
#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY
#endif // wxUSE_MENUS
#endif
// _WX_MENUITEM_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/fs_filter.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/fs_filter.h
// Purpose: Filter file system handler
// Author: Mike Wetherell
// Copyright: (c) 2006 Mike Wetherell
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FS_FILTER_H_
#define _WX_FS_FILTER_H_
#include "wx/defs.h"
#if wxUSE_FILESYSTEM
#include "wx/filesys.h"
//---------------------------------------------------------------------------
// wxFilterFSHandler
//---------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxFilterFSHandler : public wxFileSystemHandler
{
public:
wxFilterFSHandler() : wxFileSystemHandler() { }
virtual ~wxFilterFSHandler() { }
virtual bool CanOpen(const wxString& location) wxOVERRIDE;
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE;
virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE;
virtual wxString FindNext() wxOVERRIDE;
private:
wxDECLARE_NO_COPY_CLASS(wxFilterFSHandler);
};
#endif // wxUSE_FILESYSTEM
#endif // _WX_FS_FILTER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/ustring.h |
// Name: wx/ustring.h
// Purpose: 32-bit string (UCS-4)
// Author: Robert Roebling
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_USTRING_H_
#define _WX_USTRING_H_
#include "wx/defs.h"
#include "wx/string.h"
#include <string>
#if SIZEOF_WCHAR_T == 2
typedef wxWCharBuffer wxU16CharBuffer;
typedef wxScopedWCharBuffer wxScopedU16CharBuffer;
#else
typedef wxCharTypeBuffer<wxChar16> wxU16CharBuffer;
typedef wxScopedCharTypeBuffer<wxChar16> wxScopedU16CharBuffer;
#endif
#if SIZEOF_WCHAR_T == 4
typedef wxWCharBuffer wxU32CharBuffer;
typedef wxScopedWCharBuffer wxScopedU32CharBuffer;
#else
typedef wxCharTypeBuffer<wxChar32> wxU32CharBuffer;
typedef wxScopedCharTypeBuffer<wxChar32> wxScopedU32CharBuffer;
#endif
#ifdef __VISUALC__
// "non dll-interface class 'std::basic_string<wxChar32>' used as base
// interface for dll-interface class 'wxString'" -- this is OK in our case
// (and warning is unavoidable anyhow)
#pragma warning(push)
#pragma warning(disable:4275)
#endif
class WXDLLIMPEXP_BASE wxUString: public std::basic_string<wxChar32>
{
public:
wxUString() { }
wxUString( const wxChar32 *str ) { assign(str); }
wxUString( const wxScopedU32CharBuffer &buf ) { assign(buf); }
wxUString( const char *str ) { assign(str); }
wxUString( const wxScopedCharBuffer &buf ) { assign(buf); }
wxUString( const char *str, const wxMBConv &conv ) { assign(str,conv); }
wxUString( const wxScopedCharBuffer &buf, const wxMBConv &conv ) { assign(buf,conv); }
wxUString( const wxChar16 *str ) { assign(str); }
wxUString( const wxScopedU16CharBuffer &buf ) { assign(buf); }
wxUString( const wxCStrData *cstr ) { assign(cstr); }
wxUString( const wxString &str ) { assign(str); }
wxUString( char ch ) { assign(ch); }
wxUString( wxChar16 ch ) { assign(ch); }
wxUString( wxChar32 ch ) { assign(ch); }
wxUString( wxUniChar ch ) { assign(ch); }
wxUString( wxUniCharRef ch ) { assign(ch); }
wxUString( size_type n, char ch ) { assign(n,ch); }
wxUString( size_type n, wxChar16 ch ) { assign(n,ch); }
wxUString( size_type n, wxChar32 ch ) { assign(n,ch); }
wxUString( size_type n, wxUniChar ch ) { assign(n,ch); }
wxUString( size_type n, wxUniCharRef ch ) { assign(n,ch); }
// static construction
static wxUString FromAscii( const char *str, size_type n )
{
wxUString ret;
ret.assignFromAscii( str, n );
return ret;
}
static wxUString FromAscii( const char *str )
{
wxUString ret;
ret.assignFromAscii( str );
return ret;
}
static wxUString FromUTF8( const char *str, size_type n )
{
wxUString ret;
ret.assignFromUTF8( str, n );
return ret;
}
static wxUString FromUTF8( const char *str )
{
wxUString ret;
ret.assignFromUTF8( str );
return ret;
}
static wxUString FromUTF16( const wxChar16 *str, size_type n )
{
wxUString ret;
ret.assignFromUTF16( str, n );
return ret;
}
static wxUString FromUTF16( const wxChar16 *str )
{
wxUString ret;
ret.assignFromUTF16( str );
return ret;
}
// assign from encoding
wxUString &assignFromAscii( const char *str );
wxUString &assignFromAscii( const char *str, size_type n );
wxUString &assignFromUTF8( const char *str );
wxUString &assignFromUTF8( const char *str, size_type n );
wxUString &assignFromUTF16( const wxChar16* str );
wxUString &assignFromUTF16( const wxChar16* str, size_type n );
wxUString &assignFromCString( const char* str );
wxUString &assignFromCString( const char* str, const wxMBConv &conv );
// conversions
wxScopedCharBuffer utf8_str() const;
wxScopedU16CharBuffer utf16_str() const;
#if SIZEOF_WCHAR_T == 2
wxScopedWCharBuffer wc_str() const
{
return utf16_str();
}
#else
const wchar_t *wc_str() const
{
return c_str();
}
#endif
operator wxString() const
{
#if wxUSE_UNICODE_UTF8
return wxString::FromUTF8( utf8_str() );
#else
#if SIZEOF_WCHAR_T == 2
return wxString( utf16_str() );
#else
return wxString( c_str() );
#endif
#endif
}
#if wxUSE_UNICODE_UTF8
wxScopedCharBuffer wx_str() const
{
return utf8_str();
}
#else
#if SIZEOF_WCHAR_T == 2
wxScopedWCharBuffer wx_str() const
{
return utf16_str();
}
#else
const wchar_t* wx_str() const
{
return c_str();
}
#endif
#endif
// assign
wxUString &assign( const wxChar32* str )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->assign( str );
}
wxUString &assign( const wxChar32* str, size_type n )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->assign( str, n );
}
wxUString &assign( const wxUString &str )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->assign( str );
}
wxUString &assign( const wxUString &str, size_type pos, size_type n )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->assign( str, pos, n );
}
wxUString &assign( wxChar32 ch )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->assign( (size_type) 1, ch );
}
wxUString &assign( size_type n, wxChar32 ch )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->assign( n, ch );
}
wxUString &assign( const wxScopedU32CharBuffer &buf )
{
return assign( buf.data() );
}
wxUString &assign( const char *str )
{
return assignFromCString( str );
}
wxUString &assign( const wxScopedCharBuffer &buf )
{
return assignFromCString( buf.data() );
}
wxUString &assign( const char *str, const wxMBConv &conv )
{
return assignFromCString( str, conv );
}
wxUString &assign( const wxScopedCharBuffer &buf, const wxMBConv &conv )
{
return assignFromCString( buf.data(), conv );
}
wxUString &assign( const wxChar16 *str )
{
return assignFromUTF16( str );
}
wxUString &assign( const wxScopedU16CharBuffer &buf )
{
return assignFromUTF16( buf.data() );
}
wxUString &assign( const wxCStrData *cstr )
{
#if SIZEOF_WCHAR_T == 2
return assignFromUTF16( cstr->AsWChar() );
#else
return assign( cstr->AsWChar() );
#endif
}
wxUString &assign( const wxString &str )
{
#if wxUSE_UNICODE_UTF8
return assignFromUTF8( str.wx_str() );
#else
#if SIZEOF_WCHAR_T == 2
return assignFromUTF16( str.wc_str() );
#else
return assign( str.wc_str() );
#endif
#endif
}
wxUString &assign( char ch )
{
char buf[2];
buf[0] = ch;
buf[1] = 0;
return assignFromCString( buf );
}
wxUString &assign( size_type n, char ch )
{
wxCharBuffer buffer(n);
char *p = buffer.data();
size_type i;
for (i = 0; i < n; i++)
{
*p = ch;
p++;
}
return assignFromCString( buffer.data() );
}
wxUString &assign( wxChar16 ch )
{
wxChar16 buf[2];
buf[0] = ch;
buf[1] = 0;
return assignFromUTF16( buf );
}
wxUString &assign( size_type n, wxChar16 ch )
{
wxU16CharBuffer buffer(n);
wxChar16 *p = buffer.data();
size_type i;
for (i = 0; i < n; i++)
{
*p = ch;
p++;
}
return assignFromUTF16( buffer.data() );
}
wxUString &assign( wxUniChar ch )
{
return assign( (wxChar32) ch.GetValue() );
}
wxUString &assign( size_type n, wxUniChar ch )
{
return assign( n, (wxChar32) ch.GetValue() );
}
wxUString &assign( wxUniCharRef ch )
{
return assign( (wxChar32) ch.GetValue() );
}
wxUString &assign( size_type n, wxUniCharRef ch )
{
return assign( n, (wxChar32) ch.GetValue() );
}
// append [STL overload]
wxUString &append( const wxUString &s )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->append( s );
}
wxUString &append( const wxUString &s, size_type pos, size_type n )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->append( s, pos, n );
}
wxUString &append( const wxChar32* s )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->append( s );
}
wxUString &append( const wxChar32* s, size_type n )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->append( s, n );
}
wxUString &append( size_type n, wxChar32 c )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->append( n, c );
}
wxUString &append( wxChar32 c )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->append( 1, c );
}
// append [wx overload]
wxUString &append( const wxScopedU16CharBuffer &buf )
{
return append( buf.data() );
}
wxUString &append( const wxScopedU32CharBuffer &buf )
{
return append( buf.data() );
}
wxUString &append( const char *str )
{
return append( wxUString( str ) );
}
wxUString &append( const wxScopedCharBuffer &buf )
{
return append( wxUString( buf ) );
}
wxUString &append( const wxChar16 *str )
{
return append( wxUString( str ) );
}
wxUString &append( const wxString &str )
{
return append( wxUString( str ) );
}
wxUString &append( const wxCStrData *cstr )
{
return append( wxUString( cstr ) );
}
wxUString &append( char ch )
{
char buf[2];
buf[0] = ch;
buf[1] = 0;
return append( buf );
}
wxUString &append( wxChar16 ch )
{
wxChar16 buf[2];
buf[0] = ch;
buf[1] = 0;
return append( buf );
}
wxUString &append( wxUniChar ch )
{
return append( (size_type) 1, (wxChar32) ch.GetValue() );
}
wxUString &append( wxUniCharRef ch )
{
return append( (size_type) 1, (wxChar32) ch.GetValue() );
}
// insert [STL overloads]
wxUString &insert( size_type pos, const wxUString &s )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->insert( pos, s );
}
wxUString &insert( size_type pos, const wxUString &s, size_type pos1, size_type n )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->insert( pos, s, pos1, n );
}
wxUString &insert( size_type pos, const wxChar32 *s )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->insert( pos, s );
}
wxUString &insert( size_type pos, const wxChar32 *s, size_type n )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->insert( pos, s, n );
}
wxUString &insert( size_type pos, size_type n, wxChar32 c )
{
std::basic_string<wxChar32> *base = this;
return (wxUString &) base->insert( pos, n, c );
}
// insert [STL overloads]
wxUString &insert( size_type n, const char *s )
{
return insert( n, wxUString( s ) );
}
wxUString &insert( size_type n, const wxChar16 *s )
{
return insert( n, wxUString( s ) );
}
wxUString &insert( size_type n, const wxScopedCharBuffer &buf )
{
return insert( n, wxUString( buf ) );
}
wxUString &insert( size_type n, const wxScopedU16CharBuffer &buf )
{
return insert( n, wxUString( buf ) );
}
wxUString &insert( size_type n, const wxScopedU32CharBuffer &buf )
{
return insert( n, buf.data() );
}
wxUString &insert( size_type n, const wxString &s )
{
return insert( n, wxUString( s ) );
}
wxUString &insert( size_type n, const wxCStrData *cstr )
{
return insert( n, wxUString( cstr ) );
}
wxUString &insert( size_type n, char ch )
{
char buf[2];
buf[0] = ch;
buf[1] = 0;
return insert( n, buf );
}
wxUString &insert( size_type n, wchar_t ch )
{
wchar_t buf[2];
buf[0] = ch;
buf[1] = 0;
return insert( n, buf );
}
// insert iterator
iterator insert( iterator it, wxChar32 ch )
{
std::basic_string<wxChar32> *base = this;
return base->insert( it, ch );
}
void insert(iterator it, const_iterator first, const_iterator last)
{
std::basic_string<wxChar32> *base = this;
base->insert( it, first, last );
}
// operator =
wxUString& operator=(const wxString& s)
{ return assign( s ); }
wxUString& operator=(const wxCStrData* s)
{ return assign( s ); }
wxUString& operator=(const char *s)
{ return assign( s ); }
wxUString& operator=(const wxChar16 *s)
{ return assign( s ); }
wxUString& operator=(const wxChar32 *s)
{ return assign( s ); }
wxUString& operator=(const wxScopedCharBuffer &s)
{ return assign( s ); }
wxUString& operator=(const wxScopedU16CharBuffer &s)
{ return assign( s ); }
wxUString& operator=(const wxScopedU32CharBuffer &s)
{ return assign( s ); }
wxUString& operator=(char ch)
{ return assign( ch ); }
wxUString& operator=(wxChar16 ch)
{ return assign( ch ); }
wxUString& operator=(wxChar32 ch)
{ return assign( ch ); }
wxUString& operator=(wxUniChar ch)
{ return assign( ch ); }
wxUString& operator=(const wxUniCharRef ch)
{ return assign( ch ); }
// operator +=
wxUString& operator+=(const wxUString& s)
{ return append( s ); }
wxUString& operator+=(const wxString& s)
{ return append( s ); }
wxUString& operator+=(const wxCStrData* s)
{ return append( s ); }
wxUString& operator+=(const char *s)
{ return append( s ); }
wxUString& operator+=(const wxChar16 *s)
{ return append( s ); }
wxUString& operator+=(const wxChar32 *s)
{ return append( s ); }
wxUString& operator+=(const wxScopedCharBuffer &s)
{ return append( s ); }
wxUString& operator+=(const wxScopedU16CharBuffer &s)
{ return append( s ); }
wxUString& operator+=(const wxScopedU32CharBuffer &s)
{ return append( s ); }
wxUString& operator+=(char ch)
{ return append( ch ); }
wxUString& operator+=(wxChar16 ch)
{ return append( ch ); }
wxUString& operator+=(wxChar32 ch)
{ return append( ch ); }
wxUString& operator+=(wxUniChar ch)
{ return append( ch ); }
wxUString& operator+=(const wxUniCharRef ch)
{ return append( ch ); }
};
#ifdef __VISUALC__
#pragma warning(pop)
#endif
inline wxUString operator+(const wxUString &s1, const wxUString &s2)
{ wxUString ret( s1 ); ret.append( s2 ); return ret; }
inline wxUString operator+(const wxUString &s1, const char *s2)
{ return s1 + wxUString(s2); }
inline wxUString operator+(const wxUString &s1, const wxString &s2)
{ return s1 + wxUString(s2); }
inline wxUString operator+(const wxUString &s1, const wxCStrData *s2)
{ return s1 + wxUString(s2); }
inline wxUString operator+(const wxUString &s1, const wxChar16* s2)
{ return s1 + wxUString(s2); }
inline wxUString operator+(const wxUString &s1, const wxChar32 *s2)
{ return s1 + wxUString(s2); }
inline wxUString operator+(const wxUString &s1, const wxScopedCharBuffer &s2)
{ return s1 + wxUString(s2); }
inline wxUString operator+(const wxUString &s1, const wxScopedU16CharBuffer &s2)
{ return s1 + wxUString(s2); }
inline wxUString operator+(const wxUString &s1, const wxScopedU32CharBuffer &s2)
{ return s1 + wxUString(s2); }
inline wxUString operator+(const wxUString &s1, char s2)
{ return s1 + wxUString(s2); }
inline wxUString operator+(const wxUString &s1, wxChar32 s2)
{ wxUString ret( s1 ); ret.append( s2 ); return ret; }
inline wxUString operator+(const wxUString &s1, wxChar16 s2)
{ wxUString ret( s1 ); ret.append( (wxChar32) s2 ); return ret; }
inline wxUString operator+(const wxUString &s1, wxUniChar s2)
{ wxUString ret( s1 ); ret.append( (wxChar32) s2.GetValue() ); return ret; }
inline wxUString operator+(const wxUString &s1, wxUniCharRef s2)
{ wxUString ret( s1 ); ret.append( (wxChar32) s2.GetValue() ); return ret; }
inline wxUString operator+(const char *s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(const wxString &s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(const wxCStrData *s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(const wxChar16* s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(const wxChar32 *s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(const wxScopedCharBuffer &s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(const wxScopedU16CharBuffer &s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(const wxScopedU32CharBuffer &s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(char s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(wxChar32 s1, const wxUString &s2 )
{ return wxUString(s1) + s2; }
inline wxUString operator+(wxChar16 s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(wxUniChar s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline wxUString operator+(wxUniCharRef s1, const wxUString &s2)
{ return wxUString(s1) + s2; }
inline bool operator==(const wxUString& s1, const wxUString& s2)
{ return s1.compare( s2 ) == 0; }
inline bool operator!=(const wxUString& s1, const wxUString& s2)
{ return s1.compare( s2 ) != 0; }
inline bool operator< (const wxUString& s1, const wxUString& s2)
{ return s1.compare( s2 ) < 0; }
inline bool operator> (const wxUString& s1, const wxUString& s2)
{ return s1.compare( s2 ) > 0; }
inline bool operator<=(const wxUString& s1, const wxUString& s2)
{ return s1.compare( s2 ) <= 0; }
inline bool operator>=(const wxUString& s1, const wxUString& s2)
{ return s1.compare( s2 ) >= 0; }
#define wxUSTRING_COMP_OPERATORS( T ) \
inline bool operator==(const wxUString& s1, T s2) \
{ return s1.compare( wxUString(s2) ) == 0; } \
inline bool operator!=(const wxUString& s1, T s2) \
{ return s1.compare( wxUString(s2) ) != 0; } \
inline bool operator< (const wxUString& s1, T s2) \
{ return s1.compare( wxUString(s2) ) < 0; } \
inline bool operator> (const wxUString& s1, T s2) \
{ return s1.compare( wxUString(s2) ) > 0; } \
inline bool operator<=(const wxUString& s1, T s2) \
{ return s1.compare( wxUString(s2) ) <= 0; } \
inline bool operator>=(const wxUString& s1, T s2) \
{ return s1.compare( wxUString(s2) ) >= 0; } \
\
inline bool operator==(T s2, const wxUString& s1) \
{ return s1.compare( wxUString(s2) ) == 0; } \
inline bool operator!=(T s2, const wxUString& s1) \
{ return s1.compare( wxUString(s2) ) != 0; } \
inline bool operator< (T s2, const wxUString& s1) \
{ return s1.compare( wxUString(s2) ) > 0; } \
inline bool operator> (T s2, const wxUString& s1) \
{ return s1.compare( wxUString(s2) ) < 0; } \
inline bool operator<=(T s2, const wxUString& s1) \
{ return s1.compare( wxUString(s2) ) >= 0; } \
inline bool operator>=(T s2, const wxUString& s1) \
{ return s1.compare( wxUString(s2) ) <= 0; }
wxUSTRING_COMP_OPERATORS( const wxString & )
wxUSTRING_COMP_OPERATORS( const char * )
wxUSTRING_COMP_OPERATORS( const wxChar16 * )
wxUSTRING_COMP_OPERATORS( const wxChar32 * )
wxUSTRING_COMP_OPERATORS( const wxScopedCharBuffer & )
wxUSTRING_COMP_OPERATORS( const wxScopedU16CharBuffer & )
wxUSTRING_COMP_OPERATORS( const wxScopedU32CharBuffer & )
wxUSTRING_COMP_OPERATORS( const wxCStrData * )
#endif // _WX_USTRING_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/helphtml.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/helphtml.h
// Purpose: Includes wx/html/helpctrl.h, for wxHtmlHelpController.
// Author: Julian Smart
// Modified by:
// Created: 2003-05-24
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __WX_HELPHTML_H_
#define __WX_HELPHTML_H_
#if wxUSE_WXHTML_HELP
#include "wx/html/helpctrl.h"
#endif
#endif // __WX_HELPHTML_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/event.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/event.h
// Purpose: Event classes
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_EVENT_H_
#define _WX_EVENT_H_
#include "wx/defs.h"
#include "wx/cpp.h"
#include "wx/object.h"
#include "wx/clntdata.h"
#include "wx/math.h"
#if wxUSE_GUI
#include "wx/gdicmn.h"
#include "wx/cursor.h"
#include "wx/mousestate.h"
#endif
#include "wx/dynarray.h"
#include "wx/thread.h"
#include "wx/tracker.h"
#include "wx/typeinfo.h"
#include "wx/any.h"
#include "wx/vector.h"
#include "wx/meta/convertible.h"
// Currently VC7 is known to not be able to compile CallAfter() code, so
// disable it for it (FIXME-VC7).
#if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(8)
#include "wx/meta/removeref.h"
#define wxHAS_CALL_AFTER
#endif
// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_BASE wxList;
class WXDLLIMPEXP_FWD_BASE wxEvent;
class WXDLLIMPEXP_FWD_BASE wxEventFilter;
#if wxUSE_GUI
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxMenu;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxWindowBase;
#endif // wxUSE_GUI
// We operate with pointer to members of wxEvtHandler (such functions are used
// as event handlers in the event tables or as arguments to Connect()) but by
// default MSVC uses a restricted (but more efficient) representation of
// pointers to members which can't deal with multiple base classes. To avoid
// mysterious (as the compiler is not good enough to detect this and give a
// sensible error message) errors in the user code as soon as it defines
// classes inheriting from both wxEvtHandler (possibly indirectly, e.g. via
// wxWindow) and something else (including our own wxTrackable but not limited
// to it), we use the special MSVC keyword telling the compiler to use a more
// general pointer to member representation for the classes inheriting from
// wxEvtHandler.
#ifdef __VISUALC__
#define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
#else
#define wxMSVC_FWD_MULTIPLE_BASES
#endif
class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler;
class wxEventConnectionRef;
// ----------------------------------------------------------------------------
// Event types
// ----------------------------------------------------------------------------
typedef int wxEventType;
#define wxEVT_ANY ((wxEventType)-1)
// This macro exists for compatibility only (even though it was never public,
// it still appears in some code using wxWidgets), see public
// wxEVENT_HANDLER_CAST instead.
#define wxStaticCastEvent(type, val) static_cast<type>(val)
#define wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
wxEventTableEntry(type, winid, idLast, wxNewEventTableFunctor(type, fn), obj)
#define wxDECLARE_EVENT_TABLE_TERMINATOR() \
wxEventTableEntry(wxEVT_NULL, 0, 0, 0, 0)
// generate a new unique event type
extern WXDLLIMPEXP_BASE wxEventType wxNewEventType();
// events are represented by an instance of wxEventTypeTag and the
// corresponding type must be specified for type-safety checks
// define a new custom event type, can be used alone or after event
// declaration in the header using one of the macros below
#define wxDEFINE_EVENT( name, type ) \
const wxEventTypeTag< type > name( wxNewEventType() )
// the general version allowing exporting the event type from DLL, used by
// wxWidgets itself
#define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
extern const expdecl wxEventTypeTag< type > name
// this is the version which will normally be used in the user code
#define wxDECLARE_EVENT( name, type ) \
wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
// these macros are only used internally for backwards compatibility and
// allow to define an alias for an existing event type (this is used by
// wxEVT_SPIN_XXX)
#define wxDEFINE_EVENT_ALIAS( name, type, value ) \
const wxEventTypeTag< type > name( value )
#define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
extern const expdecl wxEventTypeTag< type > name
// The type-erased method signature used for event handling.
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
template <typename T>
inline wxEventFunction wxEventFunctionCast(void (wxEvtHandler::*func)(T&))
{
// There is no going around the cast here: we do rely calling the event
// handler method, which takes a reference to an object of a class derived
// from wxEvent, as if it took wxEvent itself. On all platforms supported
// by wxWidgets, this cast is harmless, but it's not a valid cast in C++
// and gcc 8 started giving warnings about this (with -Wextra), so suppress
// them locally to avoid generating hundreds of them when compiling any
// code using event table macros.
wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE()
return reinterpret_cast<wxEventFunction>(func);
wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE()
}
// Try to cast the given event handler to the correct handler type:
#define wxEVENT_HANDLER_CAST( functype, func ) \
wxEventFunctionCast(static_cast<functype>(&func))
// The tag is a type associated to the event type (which is an integer itself,
// in spite of its name) value. It exists in order to be used as a template
// parameter and provide a mapping between the event type values and their
// corresponding wxEvent-derived classes.
template <typename T>
class wxEventTypeTag
{
public:
// The class of wxEvent-derived class carried by the events of this type.
typedef T EventClass;
wxEventTypeTag(wxEventType type) { m_type = type; }
// Return a wxEventType reference for the initialization of the static
// event tables. See wxEventTableEntry::m_eventType for a more thorough
// explanation.
operator const wxEventType&() const { return m_type; }
private:
wxEventType m_type;
};
// We had some trouble with using wxEventFunction
// in the past so we had introduced wxObjectEventFunction which
// used to be a typedef for a member of wxObject and not wxEvtHandler to work
// around this but as eVC is not really supported any longer we now only keep
// this for backwards compatibility and, despite its name, this is a typedef
// for wxEvtHandler member now -- but if we have the same problem with another
// compiler we can restore its old definition for it.
typedef wxEventFunction wxObjectEventFunction;
// The event functor which is stored in the static and dynamic event tables:
class WXDLLIMPEXP_BASE wxEventFunctor
{
public:
virtual ~wxEventFunctor();
// Invoke the actual event handler:
virtual void operator()(wxEvtHandler *, wxEvent&) = 0;
// this function tests whether this functor is matched, for the purpose of
// finding it in an event table in Unbind(), by the given functor:
virtual bool IsMatching(const wxEventFunctor& functor) const = 0;
// If the functor holds an wxEvtHandler, then get access to it and track
// its lifetime with wxEventConnectionRef:
virtual wxEvtHandler *GetEvtHandler() const
{ return NULL; }
// This is only used to maintain backward compatibility in
// wxAppConsoleBase::CallEventHandler and ensures that an overwritten
// wxAppConsoleBase::HandleEvent is still called for functors which hold an
// wxEventFunction:
virtual wxEventFunction GetEvtMethod() const
{ return NULL; }
private:
WX_DECLARE_ABSTRACT_TYPEINFO(wxEventFunctor)
};
// A plain method functor for the untyped legacy event types:
class WXDLLIMPEXP_BASE wxObjectEventFunctor : public wxEventFunctor
{
public:
wxObjectEventFunctor(wxObjectEventFunction method, wxEvtHandler *handler)
: m_handler( handler ), m_method( method )
{ }
virtual void operator()(wxEvtHandler *handler, wxEvent& event) wxOVERRIDE;
virtual bool IsMatching(const wxEventFunctor& functor) const wxOVERRIDE
{
if ( wxTypeId(functor) == wxTypeId(*this) )
{
const wxObjectEventFunctor &other =
static_cast< const wxObjectEventFunctor & >( functor );
return ( m_method == other.m_method || !other.m_method ) &&
( m_handler == other.m_handler || !other.m_handler );
}
else
return false;
}
virtual wxEvtHandler *GetEvtHandler() const wxOVERRIDE
{ return m_handler; }
virtual wxEventFunction GetEvtMethod() const wxOVERRIDE
{ return m_method; }
private:
wxEvtHandler *m_handler;
wxEventFunction m_method;
// Provide a dummy default ctor for type info purposes
wxObjectEventFunctor() { }
WX_DECLARE_TYPEINFO_INLINE(wxObjectEventFunctor)
};
// Create a functor for the legacy events: used by Connect()
inline wxObjectEventFunctor *
wxNewEventFunctor(const wxEventType& WXUNUSED(evtType),
wxObjectEventFunction method,
wxEvtHandler *handler)
{
return new wxObjectEventFunctor(method, handler);
}
// This version is used by wxDECLARE_EVENT_TABLE_ENTRY()
inline wxObjectEventFunctor *
wxNewEventTableFunctor(const wxEventType& WXUNUSED(evtType),
wxObjectEventFunction method)
{
return new wxObjectEventFunctor(method, NULL);
}
inline wxObjectEventFunctor
wxMakeEventFunctor(const wxEventType& WXUNUSED(evtType),
wxObjectEventFunction method,
wxEvtHandler *handler)
{
return wxObjectEventFunctor(method, handler);
}
namespace wxPrivate
{
// helper template defining nested "type" typedef as the event class
// corresponding to the given event type
template <typename T> struct EventClassOf;
// the typed events provide the information about the class of the events they
// carry themselves:
template <typename T>
struct EventClassOf< wxEventTypeTag<T> >
{
typedef typename wxEventTypeTag<T>::EventClass type;
};
// for the old untyped events we don't have information about the exact event
// class carried by them
template <>
struct EventClassOf<wxEventType>
{
typedef wxEvent type;
};
// helper class defining operations different for method functors using an
// object of wxEvtHandler-derived class as handler and the others
template <typename T, typename A, bool> struct HandlerImpl;
// specialization for handlers deriving from wxEvtHandler
template <typename T, typename A>
struct HandlerImpl<T, A, true>
{
static bool IsEvtHandler()
{ return true; }
static T *ConvertFromEvtHandler(wxEvtHandler *p)
{ return static_cast<T *>(p); }
static wxEvtHandler *ConvertToEvtHandler(T *p)
{ return p; }
static wxEventFunction ConvertToEvtMethod(void (T::*f)(A&))
{ return wxEventFunctionCast(
static_cast<void (wxEvtHandler::*)(A&)>(f)); }
};
// specialization for handlers not deriving from wxEvtHandler
template <typename T, typename A>
struct HandlerImpl<T, A, false>
{
static bool IsEvtHandler()
{ return false; }
static T *ConvertFromEvtHandler(wxEvtHandler *)
{ return NULL; }
static wxEvtHandler *ConvertToEvtHandler(T *)
{ return NULL; }
static wxEventFunction ConvertToEvtMethod(void (T::*)(A&))
{ return NULL; }
};
} // namespace wxPrivate
// functor forwarding the event to a method of the given object
//
// notice that the object class may be different from the class in which the
// method is defined but it must be convertible to this class
//
// also, the type of the handler parameter doesn't need to be exactly the same
// as EventTag::EventClass but it must be its base class -- this is explicitly
// allowed to handle different events in the same handler taking wxEvent&, for
// example
template
<typename EventTag, typename Class, typename EventArg, typename EventHandler>
class wxEventFunctorMethod
: public wxEventFunctor,
private wxPrivate::HandlerImpl
<
Class,
EventArg,
wxIsPubliclyDerived<Class, wxEvtHandler>::value != 0
>
{
private:
static void CheckHandlerArgument(EventArg *) { }
public:
// the event class associated with the given event tag
typedef typename wxPrivate::EventClassOf<EventTag>::type EventClass;
wxEventFunctorMethod(void (Class::*method)(EventArg&), EventHandler *handler)
: m_handler( handler ), m_method( method )
{
wxASSERT_MSG( handler || this->IsEvtHandler(),
"handlers defined in non-wxEvtHandler-derived classes "
"must be connected with a valid sink object" );
// if you get an error here it means that the signature of the handler
// you're trying to use is not compatible with (i.e. is not the same as
// or a base class of) the real event class used for this event type
CheckHandlerArgument(static_cast<EventClass *>(NULL));
}
virtual void operator()(wxEvtHandler *handler, wxEvent& event) wxOVERRIDE
{
Class * realHandler = m_handler;
if ( !realHandler )
{
realHandler = this->ConvertFromEvtHandler(handler);
// this is not supposed to happen but check for it nevertheless
wxCHECK_RET( realHandler, "invalid event handler" );
}
// the real (run-time) type of event is EventClass and we checked in
// the ctor that EventClass can be converted to EventArg, so this cast
// is always valid
(realHandler->*m_method)(static_cast<EventArg&>(event));
}
virtual bool IsMatching(const wxEventFunctor& functor) const wxOVERRIDE
{
if ( wxTypeId(functor) != wxTypeId(*this) )
return false;
typedef wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>
ThisFunctor;
// the cast is valid because wxTypeId()s matched above
const ThisFunctor& other = static_cast<const ThisFunctor &>(functor);
return (m_method == other.m_method || other.m_method == NULL) &&
(m_handler == other.m_handler || other.m_handler == NULL);
}
virtual wxEvtHandler *GetEvtHandler() const wxOVERRIDE
{ return this->ConvertToEvtHandler(m_handler); }
virtual wxEventFunction GetEvtMethod() const wxOVERRIDE
{ return this->ConvertToEvtMethod(m_method); }
private:
EventHandler *m_handler;
void (Class::*m_method)(EventArg&);
// Provide a dummy default ctor for type info purposes
wxEventFunctorMethod() { }
typedef wxEventFunctorMethod<EventTag, Class,
EventArg, EventHandler> thisClass;
WX_DECLARE_TYPEINFO_INLINE(thisClass)
};
// functor forwarding the event to function (function, static method)
template <typename EventTag, typename EventArg>
class wxEventFunctorFunction : public wxEventFunctor
{
private:
static void CheckHandlerArgument(EventArg *) { }
public:
// the event class associated with the given event tag
typedef typename wxPrivate::EventClassOf<EventTag>::type EventClass;
wxEventFunctorFunction( void ( *handler )( EventArg & ))
: m_handler( handler )
{
// if you get an error here it means that the signature of the handler
// you're trying to use is not compatible with (i.e. is not the same as
// or a base class of) the real event class used for this event type
CheckHandlerArgument(static_cast<EventClass *>(NULL));
}
virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) wxOVERRIDE
{
// If you get an error here like "must use .* or ->* to call
// pointer-to-member function" then you probably tried to call
// Bind/Unbind with a method pointer but without a handler pointer or
// NULL as a handler e.g.:
// Unbind( wxEVT_XXX, &EventHandler::method );
// or
// Unbind( wxEVT_XXX, &EventHandler::method, NULL )
m_handler(static_cast<EventArg&>(event));
}
virtual bool IsMatching(const wxEventFunctor &functor) const wxOVERRIDE
{
if ( wxTypeId(functor) != wxTypeId(*this) )
return false;
typedef wxEventFunctorFunction<EventTag, EventArg> ThisFunctor;
const ThisFunctor& other = static_cast<const ThisFunctor&>( functor );
return m_handler == other.m_handler;
}
private:
void (*m_handler)(EventArg&);
// Provide a dummy default ctor for type info purposes
wxEventFunctorFunction() { }
typedef wxEventFunctorFunction<EventTag, EventArg> thisClass;
WX_DECLARE_TYPEINFO_INLINE(thisClass)
};
template <typename EventTag, typename Functor>
class wxEventFunctorFunctor : public wxEventFunctor
{
public:
typedef typename EventTag::EventClass EventArg;
wxEventFunctorFunctor(const Functor& handler)
: m_handler(handler), m_handlerAddr(&handler)
{ }
virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) wxOVERRIDE
{
// If you get an error here like "must use '.*' or '->*' to call
// pointer-to-member function" then you probably tried to call
// Bind/Unbind with a method pointer but without a handler pointer or
// NULL as a handler e.g.:
// Unbind( wxEVT_XXX, &EventHandler::method );
// or
// Unbind( wxEVT_XXX, &EventHandler::method, NULL )
m_handler(static_cast<EventArg&>(event));
}
virtual bool IsMatching(const wxEventFunctor &functor) const wxOVERRIDE
{
if ( wxTypeId(functor) != wxTypeId(*this) )
return false;
typedef wxEventFunctorFunctor<EventTag, Functor> FunctorThis;
const FunctorThis& other = static_cast<const FunctorThis&>(functor);
// The only reliable/portable way to compare two functors is by
// identity:
return m_handlerAddr == other.m_handlerAddr;
}
private:
// Store a copy of the functor to prevent using/calling an already
// destroyed instance:
Functor m_handler;
// Use the address of the original functor for comparison in IsMatching:
const void *m_handlerAddr;
// Provide a dummy default ctor for type info purposes
wxEventFunctorFunctor() { }
typedef wxEventFunctorFunctor<EventTag, Functor> thisClass;
WX_DECLARE_TYPEINFO_INLINE(thisClass)
};
// Create functors for the templatized events, either allocated on the heap for
// wxNewXXX() variants (this is needed in wxEvtHandler::Bind<>() to store them
// in dynamic event table) or just by returning them as temporary objects (this
// is enough for Unbind<>() and we avoid unnecessary heap allocation like this).
// Create functors wrapping functions:
template <typename EventTag, typename EventArg>
inline wxEventFunctorFunction<EventTag, EventArg> *
wxNewEventFunctor(const EventTag&, void (*func)(EventArg &))
{
return new wxEventFunctorFunction<EventTag, EventArg>(func);
}
template <typename EventTag, typename EventArg>
inline wxEventFunctorFunction<EventTag, EventArg>
wxMakeEventFunctor(const EventTag&, void (*func)(EventArg &))
{
return wxEventFunctorFunction<EventTag, EventArg>(func);
}
// Create functors wrapping other functors:
template <typename EventTag, typename Functor>
inline wxEventFunctorFunctor<EventTag, Functor> *
wxNewEventFunctor(const EventTag&, const Functor &func)
{
return new wxEventFunctorFunctor<EventTag, Functor>(func);
}
template <typename EventTag, typename Functor>
inline wxEventFunctorFunctor<EventTag, Functor>
wxMakeEventFunctor(const EventTag&, const Functor &func)
{
return wxEventFunctorFunctor<EventTag, Functor>(func);
}
// Create functors wrapping methods:
template
<typename EventTag, typename Class, typename EventArg, typename EventHandler>
inline wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler> *
wxNewEventFunctor(const EventTag&,
void (Class::*method)(EventArg&),
EventHandler *handler)
{
return new wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>(
method, handler);
}
template
<typename EventTag, typename Class, typename EventArg, typename EventHandler>
inline wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>
wxMakeEventFunctor(const EventTag&,
void (Class::*method)(EventArg&),
EventHandler *handler)
{
return wxEventFunctorMethod<EventTag, Class, EventArg, EventHandler>(
method, handler);
}
// Create an event functor for the event table via wxDECLARE_EVENT_TABLE_ENTRY:
// in this case we don't have the handler (as it's always the same as the
// object which generated the event) so we must use Class as its type
template <typename EventTag, typename Class, typename EventArg>
inline wxEventFunctorMethod<EventTag, Class, EventArg, Class> *
wxNewEventTableFunctor(const EventTag&, void (Class::*method)(EventArg&))
{
return new wxEventFunctorMethod<EventTag, Class, EventArg, Class>(
method, NULL);
}
// many, but not all, standard event types
// some generic events
extern WXDLLIMPEXP_BASE const wxEventType wxEVT_NULL;
extern WXDLLIMPEXP_BASE const wxEventType wxEVT_FIRST;
extern WXDLLIMPEXP_BASE const wxEventType wxEVT_USER_FIRST;
// Need events declared to do this
class WXDLLIMPEXP_FWD_BASE wxIdleEvent;
class WXDLLIMPEXP_FWD_BASE wxThreadEvent;
class WXDLLIMPEXP_FWD_BASE wxAsyncMethodCallEvent;
class WXDLLIMPEXP_FWD_CORE wxCommandEvent;
class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
class WXDLLIMPEXP_FWD_CORE wxFocusEvent;
class WXDLLIMPEXP_FWD_CORE wxChildFocusEvent;
class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent;
class WXDLLIMPEXP_FWD_CORE wxSetCursorEvent;
class WXDLLIMPEXP_FWD_CORE wxScrollEvent;
class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
class WXDLLIMPEXP_FWD_CORE wxScrollWinEvent;
class WXDLLIMPEXP_FWD_CORE wxSizeEvent;
class WXDLLIMPEXP_FWD_CORE wxMoveEvent;
class WXDLLIMPEXP_FWD_CORE wxCloseEvent;
class WXDLLIMPEXP_FWD_CORE wxActivateEvent;
class WXDLLIMPEXP_FWD_CORE wxWindowCreateEvent;
class WXDLLIMPEXP_FWD_CORE wxWindowDestroyEvent;
class WXDLLIMPEXP_FWD_CORE wxShowEvent;
class WXDLLIMPEXP_FWD_CORE wxIconizeEvent;
class WXDLLIMPEXP_FWD_CORE wxMaximizeEvent;
class WXDLLIMPEXP_FWD_CORE wxMouseCaptureChangedEvent;
class WXDLLIMPEXP_FWD_CORE wxMouseCaptureLostEvent;
class WXDLLIMPEXP_FWD_CORE wxPaintEvent;
class WXDLLIMPEXP_FWD_CORE wxEraseEvent;
class WXDLLIMPEXP_FWD_CORE wxNcPaintEvent;
class WXDLLIMPEXP_FWD_CORE wxMenuEvent;
class WXDLLIMPEXP_FWD_CORE wxContextMenuEvent;
class WXDLLIMPEXP_FWD_CORE wxSysColourChangedEvent;
class WXDLLIMPEXP_FWD_CORE wxDisplayChangedEvent;
class WXDLLIMPEXP_FWD_CORE wxQueryNewPaletteEvent;
class WXDLLIMPEXP_FWD_CORE wxPaletteChangedEvent;
class WXDLLIMPEXP_FWD_CORE wxJoystickEvent;
class WXDLLIMPEXP_FWD_CORE wxDropFilesEvent;
class WXDLLIMPEXP_FWD_CORE wxInitDialogEvent;
class WXDLLIMPEXP_FWD_CORE wxUpdateUIEvent;
class WXDLLIMPEXP_FWD_CORE wxClipboardTextEvent;
class WXDLLIMPEXP_FWD_CORE wxHelpEvent;
class WXDLLIMPEXP_FWD_CORE wxGestureEvent;
class WXDLLIMPEXP_FWD_CORE wxPanGestureEvent;
class WXDLLIMPEXP_FWD_CORE wxZoomGestureEvent;
class WXDLLIMPEXP_FWD_CORE wxRotateGestureEvent;
class WXDLLIMPEXP_FWD_CORE wxTwoFingerTapEvent;
class WXDLLIMPEXP_FWD_CORE wxLongPressEvent;
class WXDLLIMPEXP_FWD_CORE wxPressAndTapEvent;
// Command events
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_BUTTON, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHECKBOX, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHOICE, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LISTBOX, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LISTBOX_DCLICK, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHECKLISTBOX, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SLIDER, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RADIOBOX, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RADIOBUTTON, wxCommandEvent);
// wxEVT_SCROLLBAR is deprecated, use wxEVT_SCROLL... events
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLBAR, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_VLBOX, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_RCLICKED, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_DROPDOWN, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_ENTER, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX_DROPDOWN, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX_CLOSEUP, wxCommandEvent);
// Thread and asynchronous method call events
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_THREAD, wxThreadEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_ASYNC_METHOD_CALL, wxAsyncMethodCallEvent);
// Mouse event types
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DOWN, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_UP, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DOWN, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_UP, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DOWN, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_UP, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOTION, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ENTER_WINDOW, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEAVE_WINDOW, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DCLICK, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DCLICK, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DCLICK, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_FOCUS, wxFocusEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KILL_FOCUS, wxFocusEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHILD_FOCUS, wxChildFocusEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSEWHEEL, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DOWN, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_UP, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DCLICK, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAGNIFY, wxMouseEvent);
// Character input event type
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR_HOOK, wxKeyEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NAVIGATION_KEY, wxNavigationKeyEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_DOWN, wxKeyEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_UP, wxKeyEvent);
#if wxUSE_HOTKEY
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HOTKEY, wxKeyEvent);
#endif
// This is a private event used by wxMSW code only and subject to change or
// disappear in the future. Don't use.
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AFTER_CHAR, wxKeyEvent);
// Set cursor event
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_CURSOR, wxSetCursorEvent);
// wxScrollBar and wxSlider event identifiers
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_TOP, wxScrollEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_BOTTOM, wxScrollEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEUP, wxScrollEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEDOWN, wxScrollEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEUP, wxScrollEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEDOWN, wxScrollEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBTRACK, wxScrollEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBRELEASE, wxScrollEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_CHANGED, wxScrollEvent);
// Due to a bug in older wx versions, wxSpinEvents were being sent with type of
// wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN and wxEVT_SCROLL_THUMBTRACK. But
// with the type-safe events in place, these event types are associated with
// wxScrollEvent. To allow handling of spin events, new event types have been
// defined in spinbutt.h/spinnbuttcmn.cpp. To maintain backward compatibility
// the spin event types are being initialized with the scroll event types.
#if wxUSE_SPINBTN
wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_UP, wxSpinEvent );
wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_DOWN, wxSpinEvent );
wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN, wxSpinEvent );
#endif
// Scroll events from wxWindow
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_TOP, wxScrollWinEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEUP, wxScrollWinEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEvent);
// Gesture events
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_GESTURE_PAN, wxPanGestureEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_GESTURE_ZOOM, wxZoomGestureEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_GESTURE_ROTATE, wxRotateGestureEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TWO_FINGER_TAP, wxTwoFingerTapEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LONG_PRESS, wxLongPressEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PRESS_AND_TAP, wxPressAndTapEvent);
// System events
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZE, wxSizeEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE, wxMoveEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CLOSE_WINDOW, wxCloseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_END_SESSION, wxCloseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_END_SESSION, wxCloseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE_APP, wxActivateEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE, wxActivateEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CREATE, wxWindowCreateEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DESTROY, wxWindowDestroyEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SHOW, wxShowEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ICONIZE, wxIconizeEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAXIMIZE, wxMaximizeEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PAINT, wxPaintEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ERASE_BACKGROUND, wxEraseEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NC_PAINT, wxNcPaintEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_OPEN, wxMenuEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_CLOSE, wxMenuEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_HIGHLIGHT, wxMenuEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CONTEXT_MENU, wxContextMenuEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DISPLAY_CHANGED, wxDisplayChangedEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PALETTE_CHANGED, wxPaletteChangedEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_DOWN, wxJoystickEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_UP, wxJoystickEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_MOVE, wxJoystickEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_ZMOVE, wxJoystickEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DROP_FILES, wxDropFilesEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_INIT_DIALOG, wxInitDialogEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_IDLE, wxIdleEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_UPDATE_UI, wxUpdateUIEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZING, wxSizeEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVING, wxMoveEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_START, wxMoveEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_END, wxMoveEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HIBERNATE, wxActivateEvent);
// Clipboard events
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_COPY, wxClipboardTextEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_CUT, wxClipboardTextEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_PASTE, wxClipboardTextEvent);
// Generic command events
// Note: a click is a higher-level event than button down/up
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_CLICK, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_DCLICK, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_DCLICK, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SET_FOCUS, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_KILL_FOCUS, wxCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_ENTER, wxCommandEvent);
// Help events
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HELP, wxHelpEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DETAILED_HELP, wxHelpEvent);
// these 2 events are the same
#define wxEVT_TOOL wxEVT_MENU
// ----------------------------------------------------------------------------
// Compatibility
// ----------------------------------------------------------------------------
// this event is also used by wxComboBox and wxSpinCtrl which don't include
// wx/textctrl.h in all ports [yet], so declare it here as well
//
// still, any new code using it should include wx/textctrl.h explicitly
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT, wxCommandEvent);
// ----------------------------------------------------------------------------
// wxEvent(-derived) classes
// ----------------------------------------------------------------------------
// the predefined constants for the number of times we propagate event
// upwards window child-parent chain
enum wxEventPropagation
{
// don't propagate it at all
wxEVENT_PROPAGATE_NONE = 0,
// propagate it until it is processed
wxEVENT_PROPAGATE_MAX = INT_MAX
};
// The different categories for a wxEvent; see wxEvent::GetEventCategory.
// NOTE: they are used as OR-combinable flags by wxEventLoopBase::YieldFor
enum wxEventCategory
{
// this is the category for those events which are generated to update
// the appearance of the GUI but which (usually) do not comport data
// processing, i.e. which do not provide input or output data
// (e.g. size events, scroll events, etc).
// They are events NOT directly generated by the user's input devices.
wxEVT_CATEGORY_UI = 1,
// this category groups those events which are generated directly from the
// user through input devices like mouse and keyboard and usually result in
// data to be processed from the application.
// (e.g. mouse clicks, key presses, etc)
wxEVT_CATEGORY_USER_INPUT = 2,
// this category is for wxSocketEvent
wxEVT_CATEGORY_SOCKET = 4,
// this category is for wxTimerEvent
wxEVT_CATEGORY_TIMER = 8,
// this category is for any event used to send notifications from the
// secondary threads to the main one or in general for notifications among
// different threads (which may or may not be user-generated)
wxEVT_CATEGORY_THREAD = 16,
// implementation only
// used in the implementations of wxEventLoopBase::YieldFor
wxEVT_CATEGORY_UNKNOWN = 32,
// a special category used as an argument to wxEventLoopBase::YieldFor to indicate that
// Yield() should leave all wxEvents on the queue while emptying the native event queue
// (native events will be processed but the wxEvents they generate will be queued)
wxEVT_CATEGORY_CLIPBOARD = 64,
// shortcut masks
// this category groups those events which are emitted in response to
// events of the native toolkit and which typically are not-"delayable".
wxEVT_CATEGORY_NATIVE_EVENTS = wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT,
// used in wxEventLoopBase::YieldFor to specify all event categories should be processed:
wxEVT_CATEGORY_ALL =
wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_SOCKET| \
wxEVT_CATEGORY_TIMER|wxEVT_CATEGORY_THREAD|wxEVT_CATEGORY_UNKNOWN| \
wxEVT_CATEGORY_CLIPBOARD
};
/*
* wxWidgets events, covering all interesting things that might happen
* (button clicking, resizing, setting text in widgets, etc.).
*
* For each completely new event type, derive a new event class.
* An event CLASS represents a C++ class defining a range of similar event TYPES;
* examples are canvas events, panel item command events.
* An event TYPE is a unique identifier for a particular system event,
* such as a button press or a listbox deselection.
*
*/
class WXDLLIMPEXP_BASE wxEvent : public wxObject
{
public:
wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL );
void SetEventType(wxEventType typ) { m_eventType = typ; }
wxEventType GetEventType() const { return m_eventType; }
wxObject *GetEventObject() const { return m_eventObject; }
void SetEventObject(wxObject *obj) { m_eventObject = obj; }
long GetTimestamp() const { return m_timeStamp; }
void SetTimestamp(long ts = 0) { m_timeStamp = ts; }
int GetId() const { return m_id; }
void SetId(int Id) { m_id = Id; }
// Returns the user data optionally associated with the event handler when
// using Connect() or Bind().
wxObject *GetEventUserData() const { return m_callbackUserData; }
// Can instruct event processor that we wish to ignore this event
// (treat as if the event table entry had not been found): this must be done
// to allow the event processing by the base classes (calling event.Skip()
// is the analog of calling the base class version of a virtual function)
void Skip(bool skip = true) { m_skipped = skip; }
bool GetSkipped() const { return m_skipped; }
// This function is used to create a copy of the event polymorphically and
// all derived classes must implement it because otherwise wxPostEvent()
// for them wouldn't work (it needs to do a copy of the event)
virtual wxEvent *Clone() const = 0;
// this function is used to selectively process events in wxEventLoopBase::YieldFor
// NOTE: by default it returns wxEVT_CATEGORY_UI just because the major
// part of wxWidgets events belong to that category.
virtual wxEventCategory GetEventCategory() const
{ return wxEVT_CATEGORY_UI; }
// Implementation only: this test is explicitly anti OO and this function
// exists only for optimization purposes.
bool IsCommandEvent() const { return m_isCommandEvent; }
// Determine if this event should be propagating to the parent window.
bool ShouldPropagate() const
{ return m_propagationLevel != wxEVENT_PROPAGATE_NONE; }
// Stop an event from propagating to its parent window, returns the old
// propagation level value
int StopPropagation()
{
const int propagationLevel = m_propagationLevel;
m_propagationLevel = wxEVENT_PROPAGATE_NONE;
return propagationLevel;
}
// Resume the event propagation by restoring the propagation level
// (returned by StopPropagation())
void ResumePropagation(int propagationLevel)
{
m_propagationLevel = propagationLevel;
}
// This method is for internal use only and allows to get the object that
// is propagating this event upwards the window hierarchy, if any.
wxEvtHandler* GetPropagatedFrom() const { return m_propagatedFrom; }
// This is for internal use only and is only called by
// wxEvtHandler::ProcessEvent() to check whether it's the first time this
// event is being processed
bool WasProcessed()
{
if ( m_wasProcessed )
return true;
m_wasProcessed = true;
return false;
}
// This is for internal use only and is used for setting, testing and
// resetting of m_willBeProcessedAgain flag.
void SetWillBeProcessedAgain()
{
m_willBeProcessedAgain = true;
}
bool WillBeProcessedAgain()
{
if ( m_willBeProcessedAgain )
{
m_willBeProcessedAgain = false;
return true;
}
return false;
}
// This is also used only internally by ProcessEvent() to check if it
// should process the event normally or only restrict the search for the
// event handler to this object itself.
bool ShouldProcessOnlyIn(wxEvtHandler *h) const
{
return h == m_handlerToProcessOnlyIn;
}
// Called to indicate that the result of ShouldProcessOnlyIn() wasn't taken
// into account. The existence of this function may seem counterintuitive
// but unfortunately it's needed by wxScrollHelperEvtHandler, see comments
// there. Don't even think of using this in your own code, this is a gross
// hack and is only needed because of wx complicated history and should
// never be used anywhere else.
void DidntHonourProcessOnlyIn()
{
m_handlerToProcessOnlyIn = NULL;
}
protected:
wxObject* m_eventObject;
wxEventType m_eventType;
long m_timeStamp;
int m_id;
public:
// m_callbackUserData is for internal usage only
wxObject* m_callbackUserData;
private:
// If this handler
wxEvtHandler *m_handlerToProcessOnlyIn;
protected:
// the propagation level: while it is positive, we propagate the event to
// the parent window (if any)
int m_propagationLevel;
// The object that the event is being propagated from, initially NULL and
// only set by wxPropagateOnce.
wxEvtHandler* m_propagatedFrom;
bool m_skipped;
bool m_isCommandEvent;
// initially false but becomes true as soon as WasProcessed() is called for
// the first time, as this is done only by ProcessEvent() it explains the
// variable name: it becomes true after ProcessEvent() was called at least
// once for this event
bool m_wasProcessed;
// This one is initially false too, but can be set to true to indicate that
// the event will be passed to another handler if it's not processed in
// this one.
bool m_willBeProcessedAgain;
protected:
wxEvent(const wxEvent&); // for implementing Clone()
wxEvent& operator=(const wxEvent&); // for derived classes operator=()
private:
// It needs to access our m_propagationLevel and m_propagatedFrom fields.
friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce;
// and this one needs to access our m_handlerToProcessOnlyIn
friend class WXDLLIMPEXP_FWD_BASE wxEventProcessInHandlerOnly;
wxDECLARE_ABSTRACT_CLASS(wxEvent);
};
/*
* Helper class to temporarily change an event not to propagate.
*/
class WXDLLIMPEXP_BASE wxPropagationDisabler
{
public:
wxPropagationDisabler(wxEvent& event) : m_event(event)
{
m_propagationLevelOld = m_event.StopPropagation();
}
~wxPropagationDisabler()
{
m_event.ResumePropagation(m_propagationLevelOld);
}
private:
wxEvent& m_event;
int m_propagationLevelOld;
wxDECLARE_NO_COPY_CLASS(wxPropagationDisabler);
};
/*
* Helper used to indicate that an event is propagated upwards the window
* hierarchy by the given window.
*/
class WXDLLIMPEXP_BASE wxPropagateOnce
{
public:
// The handler argument should normally be non-NULL to allow the parent
// event handler to know that it's being used to process an event coming
// from the child, it's only NULL by default for backwards compatibility.
wxPropagateOnce(wxEvent& event, wxEvtHandler* handler = NULL)
: m_event(event),
m_propagatedFromOld(event.m_propagatedFrom)
{
wxASSERT_MSG( m_event.m_propagationLevel > 0,
wxT("shouldn't be used unless ShouldPropagate()!") );
m_event.m_propagationLevel--;
m_event.m_propagatedFrom = handler;
}
~wxPropagateOnce()
{
m_event.m_propagatedFrom = m_propagatedFromOld;
m_event.m_propagationLevel++;
}
private:
wxEvent& m_event;
wxEvtHandler* const m_propagatedFromOld;
wxDECLARE_NO_COPY_CLASS(wxPropagateOnce);
};
// A helper object used to temporarily make wxEvent::ShouldProcessOnlyIn()
// return true for the handler passed to its ctor.
class wxEventProcessInHandlerOnly
{
public:
wxEventProcessInHandlerOnly(wxEvent& event, wxEvtHandler *handler)
: m_event(event),
m_handlerToProcessOnlyInOld(event.m_handlerToProcessOnlyIn)
{
m_event.m_handlerToProcessOnlyIn = handler;
}
~wxEventProcessInHandlerOnly()
{
m_event.m_handlerToProcessOnlyIn = m_handlerToProcessOnlyInOld;
}
private:
wxEvent& m_event;
wxEvtHandler * const m_handlerToProcessOnlyInOld;
wxDECLARE_NO_COPY_CLASS(wxEventProcessInHandlerOnly);
};
class WXDLLIMPEXP_BASE wxEventBasicPayloadMixin
{
public:
wxEventBasicPayloadMixin()
: m_commandInt(0),
m_extraLong(0)
{
}
void SetString(const wxString& s) { m_cmdString = s; }
const wxString& GetString() const { return m_cmdString; }
void SetInt(int i) { m_commandInt = i; }
int GetInt() const { return m_commandInt; }
void SetExtraLong(long extraLong) { m_extraLong = extraLong; }
long GetExtraLong() const { return m_extraLong; }
protected:
// Note: these variables have "cmd" or "command" in their name for backward compatibility:
// they used to be part of wxCommandEvent, not this mixin.
wxString m_cmdString; // String event argument
int m_commandInt;
long m_extraLong; // Additional information (e.g. select/deselect)
wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin);
};
class WXDLLIMPEXP_BASE wxEventAnyPayloadMixin : public wxEventBasicPayloadMixin
{
public:
wxEventAnyPayloadMixin() : wxEventBasicPayloadMixin() {}
#if wxUSE_ANY
template<typename T>
void SetPayload(const T& payload)
{
m_payload = payload;
}
template<typename T>
T GetPayload() const
{
return m_payload.As<T>();
}
protected:
wxAny m_payload;
#endif // wxUSE_ANY
wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin);
};
// Idle event
/*
wxEVT_IDLE
*/
// Whether to always send idle events to windows, or
// to only send update events to those with the
// wxWS_EX_PROCESS_IDLE style.
enum wxIdleMode
{
// Send idle events to all windows
wxIDLE_PROCESS_ALL,
// Send idle events to windows that have
// the wxWS_EX_PROCESS_IDLE flag specified
wxIDLE_PROCESS_SPECIFIED
};
class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent
{
public:
wxIdleEvent()
: wxEvent(0, wxEVT_IDLE),
m_requestMore(false)
{ }
wxIdleEvent(const wxIdleEvent& event)
: wxEvent(event),
m_requestMore(event.m_requestMore)
{ }
void RequestMore(bool needMore = true) { m_requestMore = needMore; }
bool MoreRequested() const { return m_requestMore; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxIdleEvent(*this); }
// Specify how wxWidgets will send idle events: to
// all windows, or only to those which specify that they
// will process the events.
static void SetMode(wxIdleMode mode) { sm_idleMode = mode; }
// Returns the idle event mode
static wxIdleMode GetMode() { return sm_idleMode; }
protected:
bool m_requestMore;
static wxIdleMode sm_idleMode;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent);
};
// Thread event
class WXDLLIMPEXP_BASE wxThreadEvent : public wxEvent,
public wxEventAnyPayloadMixin
{
public:
wxThreadEvent(wxEventType eventType = wxEVT_THREAD, int id = wxID_ANY)
: wxEvent(id, eventType)
{ }
wxThreadEvent(const wxThreadEvent& event)
: wxEvent(event),
wxEventAnyPayloadMixin(event)
{
// make sure our string member (which uses COW, aka refcounting) is not
// shared by other wxString instances:
SetString(GetString().Clone());
}
virtual wxEvent *Clone() const wxOVERRIDE
{
return new wxThreadEvent(*this);
}
// this is important to avoid that calling wxEventLoopBase::YieldFor thread events
// gets processed when this is unwanted:
virtual wxEventCategory GetEventCategory() const wxOVERRIDE
{ return wxEVT_CATEGORY_THREAD; }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent);
};
// Asynchronous method call events: these event are processed by wxEvtHandler
// itself and result in a call to its Execute() method which simply calls the
// specified method. The difference with a simple method call is that this is
// done asynchronously, i.e. at some later time, instead of immediately when
// the event object is constructed.
#ifdef wxHAS_CALL_AFTER
// This is a base class used to process all method calls.
class wxAsyncMethodCallEvent : public wxEvent
{
public:
wxAsyncMethodCallEvent(wxObject* object)
: wxEvent(wxID_ANY, wxEVT_ASYNC_METHOD_CALL)
{
SetEventObject(object);
}
wxAsyncMethodCallEvent(const wxAsyncMethodCallEvent& other)
: wxEvent(other)
{
}
virtual void Execute() = 0;
};
// This is a version for calling methods without parameters.
template <typename T>
class wxAsyncMethodCallEvent0 : public wxAsyncMethodCallEvent
{
public:
typedef T ObjectType;
typedef void (ObjectType::*MethodType)();
wxAsyncMethodCallEvent0(ObjectType* object,
MethodType method)
: wxAsyncMethodCallEvent(object),
m_object(object),
m_method(method)
{
}
wxAsyncMethodCallEvent0(const wxAsyncMethodCallEvent0& other)
: wxAsyncMethodCallEvent(other),
m_object(other.m_object),
m_method(other.m_method)
{
}
virtual wxEvent *Clone() const wxOVERRIDE
{
return new wxAsyncMethodCallEvent0(*this);
}
virtual void Execute() wxOVERRIDE
{
(m_object->*m_method)();
}
private:
ObjectType* const m_object;
const MethodType m_method;
};
// This is a version for calling methods with a single parameter.
template <typename T, typename T1>
class wxAsyncMethodCallEvent1 : public wxAsyncMethodCallEvent
{
public:
typedef T ObjectType;
typedef void (ObjectType::*MethodType)(T1 x1);
typedef typename wxRemoveRef<T1>::type ParamType1;
wxAsyncMethodCallEvent1(ObjectType* object,
MethodType method,
const ParamType1& x1)
: wxAsyncMethodCallEvent(object),
m_object(object),
m_method(method),
m_param1(x1)
{
}
wxAsyncMethodCallEvent1(const wxAsyncMethodCallEvent1& other)
: wxAsyncMethodCallEvent(other),
m_object(other.m_object),
m_method(other.m_method),
m_param1(other.m_param1)
{
}
virtual wxEvent *Clone() const wxOVERRIDE
{
return new wxAsyncMethodCallEvent1(*this);
}
virtual void Execute() wxOVERRIDE
{
(m_object->*m_method)(m_param1);
}
private:
ObjectType* const m_object;
const MethodType m_method;
const ParamType1 m_param1;
};
// This is a version for calling methods with two parameters.
template <typename T, typename T1, typename T2>
class wxAsyncMethodCallEvent2 : public wxAsyncMethodCallEvent
{
public:
typedef T ObjectType;
typedef void (ObjectType::*MethodType)(T1 x1, T2 x2);
typedef typename wxRemoveRef<T1>::type ParamType1;
typedef typename wxRemoveRef<T2>::type ParamType2;
wxAsyncMethodCallEvent2(ObjectType* object,
MethodType method,
const ParamType1& x1,
const ParamType2& x2)
: wxAsyncMethodCallEvent(object),
m_object(object),
m_method(method),
m_param1(x1),
m_param2(x2)
{
}
wxAsyncMethodCallEvent2(const wxAsyncMethodCallEvent2& other)
: wxAsyncMethodCallEvent(other),
m_object(other.m_object),
m_method(other.m_method),
m_param1(other.m_param1),
m_param2(other.m_param2)
{
}
virtual wxEvent *Clone() const wxOVERRIDE
{
return new wxAsyncMethodCallEvent2(*this);
}
virtual void Execute() wxOVERRIDE
{
(m_object->*m_method)(m_param1, m_param2);
}
private:
ObjectType* const m_object;
const MethodType m_method;
const ParamType1 m_param1;
const ParamType2 m_param2;
};
// This is a version for calling any functors
template <typename T>
class wxAsyncMethodCallEventFunctor : public wxAsyncMethodCallEvent
{
public:
typedef T FunctorType;
wxAsyncMethodCallEventFunctor(wxObject *object, const FunctorType& fn)
: wxAsyncMethodCallEvent(object),
m_fn(fn)
{
}
wxAsyncMethodCallEventFunctor(const wxAsyncMethodCallEventFunctor& other)
: wxAsyncMethodCallEvent(other),
m_fn(other.m_fn)
{
}
virtual wxEvent *Clone() const wxOVERRIDE
{
return new wxAsyncMethodCallEventFunctor(*this);
}
virtual void Execute() wxOVERRIDE
{
m_fn();
}
private:
FunctorType m_fn;
};
#endif // wxHAS_CALL_AFTER
#if wxUSE_GUI
// Item or menu event class
/*
wxEVT_BUTTON
wxEVT_CHECKBOX
wxEVT_CHOICE
wxEVT_LISTBOX
wxEVT_LISTBOX_DCLICK
wxEVT_TEXT
wxEVT_TEXT_ENTER
wxEVT_MENU
wxEVT_SLIDER
wxEVT_RADIOBOX
wxEVT_RADIOBUTTON
wxEVT_SCROLLBAR
wxEVT_VLBOX
wxEVT_COMBOBOX
wxEVT_TOGGLEBUTTON
*/
class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent,
public wxEventBasicPayloadMixin
{
public:
wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
: wxEvent(winid, commandType)
{
m_clientData = NULL;
m_clientObject = NULL;
m_isCommandEvent = true;
// the command events are propagated upwards by default
m_propagationLevel = wxEVENT_PROPAGATE_MAX;
}
wxCommandEvent(const wxCommandEvent& event)
: wxEvent(event),
wxEventBasicPayloadMixin(event),
m_clientData(event.m_clientData),
m_clientObject(event.m_clientObject)
{
// Because GetString() can retrieve the string text only on demand, we
// need to copy it explicitly.
if ( m_cmdString.empty() )
m_cmdString = event.GetString();
}
// Set/Get client data from controls
void SetClientData(void* clientData) { m_clientData = clientData; }
void *GetClientData() const { return m_clientData; }
// Set/Get client object from controls
void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
wxClientData *GetClientObject() const { return m_clientObject; }
// Note: this shadows wxEventBasicPayloadMixin::GetString(), because it does some
// GUI-specific hacks
wxString GetString() const;
// Get listbox selection if single-choice
int GetSelection() const { return m_commandInt; }
// Get checkbox value
bool IsChecked() const { return m_commandInt != 0; }
// true if the listbox event was a selection.
bool IsSelection() const { return (m_extraLong != 0); }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxCommandEvent(*this); }
virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; }
protected:
void* m_clientData; // Arbitrary client data
wxClientData* m_clientObject; // Arbitrary client object
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent);
};
// this class adds a possibility to react (from the user) code to a control
// notification: allow or veto the operation being reported.
class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent
{
public:
wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
: wxCommandEvent(commandType, winid)
{ m_bAllow = true; }
wxNotifyEvent(const wxNotifyEvent& event)
: wxCommandEvent(event)
{ m_bAllow = event.m_bAllow; }
// veto the operation (usually it's allowed by default)
void Veto() { m_bAllow = false; }
// allow the operation if it was disabled by default
void Allow() { m_bAllow = true; }
// for implementation code only: is the operation allowed?
bool IsAllowed() const { return m_bAllow; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxNotifyEvent(*this); }
private:
bool m_bAllow;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent);
};
// Scroll event class, derived form wxCommandEvent. wxScrollEvents are
// sent by wxSlider and wxScrollBar.
/*
wxEVT_SCROLL_TOP
wxEVT_SCROLL_BOTTOM
wxEVT_SCROLL_LINEUP
wxEVT_SCROLL_LINEDOWN
wxEVT_SCROLL_PAGEUP
wxEVT_SCROLL_PAGEDOWN
wxEVT_SCROLL_THUMBTRACK
wxEVT_SCROLL_THUMBRELEASE
wxEVT_SCROLL_CHANGED
*/
class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent
{
public:
wxScrollEvent(wxEventType commandType = wxEVT_NULL,
int winid = 0, int pos = 0, int orient = 0);
int GetOrientation() const { return (int) m_extraLong; }
int GetPosition() const { return m_commandInt; }
void SetOrientation(int orient) { m_extraLong = (long) orient; }
void SetPosition(int pos) { m_commandInt = pos; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxScrollEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent);
};
// ScrollWin event class, derived fom wxEvent. wxScrollWinEvents
// are sent by wxWindow.
/*
wxEVT_SCROLLWIN_TOP
wxEVT_SCROLLWIN_BOTTOM
wxEVT_SCROLLWIN_LINEUP
wxEVT_SCROLLWIN_LINEDOWN
wxEVT_SCROLLWIN_PAGEUP
wxEVT_SCROLLWIN_PAGEDOWN
wxEVT_SCROLLWIN_THUMBTRACK
wxEVT_SCROLLWIN_THUMBRELEASE
*/
class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent
{
public:
wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
int pos = 0, int orient = 0);
wxScrollWinEvent(const wxScrollWinEvent& event) : wxEvent(event)
{ m_commandInt = event.m_commandInt;
m_extraLong = event.m_extraLong; }
int GetOrientation() const { return (int) m_extraLong; }
int GetPosition() const { return m_commandInt; }
void SetOrientation(int orient) { m_extraLong = (long) orient; }
void SetPosition(int pos) { m_commandInt = pos; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxScrollWinEvent(*this); }
protected:
int m_commandInt;
long m_extraLong;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent);
};
// Mouse event class
/*
wxEVT_LEFT_DOWN
wxEVT_LEFT_UP
wxEVT_MIDDLE_DOWN
wxEVT_MIDDLE_UP
wxEVT_RIGHT_DOWN
wxEVT_RIGHT_UP
wxEVT_MOTION
wxEVT_ENTER_WINDOW
wxEVT_LEAVE_WINDOW
wxEVT_LEFT_DCLICK
wxEVT_MIDDLE_DCLICK
wxEVT_RIGHT_DCLICK
*/
enum wxMouseWheelAxis
{
wxMOUSE_WHEEL_VERTICAL,
wxMOUSE_WHEEL_HORIZONTAL
};
class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent,
public wxMouseState
{
public:
wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
wxMouseEvent(const wxMouseEvent& event)
: wxEvent(event),
wxMouseState(event)
{
Assign(event);
}
// Was it a button event? (*doesn't* mean: is any button *down*?)
bool IsButton() const { return Button(wxMOUSE_BTN_ANY); }
// Was it a down event from this (or any) button?
bool ButtonDown(int but = wxMOUSE_BTN_ANY) const;
// Was it a dclick event from this (or any) button?
bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const;
// Was it a up event from this (or any) button?
bool ButtonUp(int but = wxMOUSE_BTN_ANY) const;
// Was this event generated by the given button?
bool Button(int but) const;
// Get the button which is changing state (wxMOUSE_BTN_NONE if none)
int GetButton() const;
// Find which event was just generated
bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); }
bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); }
bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); }
bool Aux1Down() const { return (m_eventType == wxEVT_AUX1_DOWN); }
bool Aux2Down() const { return (m_eventType == wxEVT_AUX2_DOWN); }
bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); }
bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); }
bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); }
bool Aux1Up() const { return (m_eventType == wxEVT_AUX1_UP); }
bool Aux2Up() const { return (m_eventType == wxEVT_AUX2_UP); }
bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); }
bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); }
bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); }
bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_DCLICK); }
bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_DCLICK); }
bool Magnify() const { return (m_eventType == wxEVT_MAGNIFY); }
// True if a button is down and the mouse is moving
bool Dragging() const
{
return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY);
}
// True if the mouse is moving, and no button is down
bool Moving() const
{
return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY);
}
// True if the mouse is just entering the window
bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); }
// True if the mouse is just leaving the window
bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); }
// Returns the number of mouse clicks associated with this event.
int GetClickCount() const { return m_clickCount; }
// Find the logical position of the event given the DC
wxPoint GetLogicalPosition(const wxDC& dc) const;
// Get wheel rotation, positive or negative indicates direction of
// rotation. Current devices all send an event when rotation is equal to
// +/-WheelDelta, but this allows for finer resolution devices to be
// created in the future. Because of this you shouldn't assume that one
// event is equal to 1 line or whatever, but you should be able to either
// do partial line scrolling or wait until +/-WheelDelta rotation values
// have been accumulated before scrolling.
int GetWheelRotation() const { return m_wheelRotation; }
// Get wheel delta, normally 120. This is the threshold for action to be
// taken, and one such action (for example, scrolling one increment)
// should occur for each delta.
int GetWheelDelta() const { return m_wheelDelta; }
// Gets the axis the wheel operation concerns; wxMOUSE_WHEEL_VERTICAL
// (most common case) or wxMOUSE_WHEEL_HORIZONTAL (for horizontal scrolling
// using e.g. a trackpad).
wxMouseWheelAxis GetWheelAxis() const { return m_wheelAxis; }
// Returns the configured number of lines (or whatever) to be scrolled per
// wheel action. Defaults to three.
int GetLinesPerAction() const { return m_linesPerAction; }
// Returns the configured number of columns (or whatever) to be scrolled per
// wheel action. Defaults to three.
int GetColumnsPerAction() const { return m_columnsPerAction; }
// Is the system set to do page scrolling?
bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); }
float GetMagnification() const { return m_magnification; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxMouseEvent(*this); }
virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; }
wxMouseEvent& operator=(const wxMouseEvent& event)
{
if (&event != this)
Assign(event);
return *this;
}
public:
int m_clickCount;
wxMouseWheelAxis m_wheelAxis;
int m_wheelRotation;
int m_wheelDelta;
int m_linesPerAction;
int m_columnsPerAction;
float m_magnification;
protected:
void Assign(const wxMouseEvent& evt);
private:
wxDECLARE_DYNAMIC_CLASS(wxMouseEvent);
};
// Cursor set event
/*
wxEVT_SET_CURSOR
*/
class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent
{
public:
wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0)
: wxEvent(0, wxEVT_SET_CURSOR),
m_x(x), m_y(y), m_cursor()
{ }
wxSetCursorEvent(const wxSetCursorEvent& event)
: wxEvent(event),
m_x(event.m_x),
m_y(event.m_y),
m_cursor(event.m_cursor)
{ }
wxCoord GetX() const { return m_x; }
wxCoord GetY() const { return m_y; }
void SetCursor(const wxCursor& cursor) { m_cursor = cursor; }
const wxCursor& GetCursor() const { return m_cursor; }
bool HasCursor() const { return m_cursor.IsOk(); }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxSetCursorEvent(*this); }
private:
wxCoord m_x, m_y;
wxCursor m_cursor;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent);
};
// Gesture Event
const unsigned int wxTwoFingerTimeInterval = 200;
class WXDLLIMPEXP_CORE wxGestureEvent : public wxEvent
{
public:
wxGestureEvent(wxWindowID winid = 0, wxEventType type = wxEVT_NULL)
: wxEvent(winid, type)
{
m_isStart = false;
m_isEnd = false;
}
wxGestureEvent(const wxGestureEvent& event) : wxEvent(event)
{
m_pos = event.m_pos;
m_isStart = event.m_isStart;
m_isEnd = event.m_isEnd;
}
const wxPoint& GetPosition() const { return m_pos; }
void SetPosition(const wxPoint& pos) { m_pos = pos; }
bool IsGestureStart() const { return m_isStart; }
void SetGestureStart(bool isStart = true) { m_isStart = isStart; }
bool IsGestureEnd() const { return m_isEnd; }
void SetGestureEnd(bool isEnd = true) { m_isEnd = isEnd; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxGestureEvent(*this); }
protected:
wxPoint m_pos;
bool m_isStart, m_isEnd;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGestureEvent);
};
// Pan Gesture Event
/*
wxEVT_GESTURE_PAN
*/
class WXDLLIMPEXP_CORE wxPanGestureEvent : public wxGestureEvent
{
public:
wxPanGestureEvent(wxWindowID winid = 0)
: wxGestureEvent(winid, wxEVT_GESTURE_PAN)
{
}
wxPanGestureEvent(const wxPanGestureEvent& event)
: wxGestureEvent(event),
m_delta(event.m_delta)
{
}
wxPoint GetDelta() const { return m_delta; }
void SetDelta(const wxPoint& delta) { m_delta = delta; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxPanGestureEvent(*this); }
private:
wxPoint m_delta;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPanGestureEvent);
};
// Zoom Gesture Event
/*
wxEVT_GESTURE_ZOOM
*/
class WXDLLIMPEXP_CORE wxZoomGestureEvent : public wxGestureEvent
{
public:
wxZoomGestureEvent(wxWindowID winid = 0)
: wxGestureEvent(winid, wxEVT_GESTURE_ZOOM)
{ m_zoomFactor = 1.0; }
wxZoomGestureEvent(const wxZoomGestureEvent& event) : wxGestureEvent(event)
{
m_zoomFactor = event.m_zoomFactor;
}
double GetZoomFactor() const { return m_zoomFactor; }
void SetZoomFactor(double zoomFactor) { m_zoomFactor = zoomFactor; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxZoomGestureEvent(*this); }
private:
double m_zoomFactor;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxZoomGestureEvent);
};
// Rotate Gesture Event
/*
wxEVT_GESTURE_ROTATE
*/
class WXDLLIMPEXP_CORE wxRotateGestureEvent : public wxGestureEvent
{
public:
wxRotateGestureEvent(wxWindowID winid = 0)
: wxGestureEvent(winid, wxEVT_GESTURE_ROTATE)
{ m_rotationAngle = 0.0; }
wxRotateGestureEvent(const wxRotateGestureEvent& event) : wxGestureEvent(event)
{
m_rotationAngle = event.m_rotationAngle;
}
double GetRotationAngle() const { return m_rotationAngle; }
void SetRotationAngle(double rotationAngle) { m_rotationAngle = rotationAngle; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxRotateGestureEvent(*this); }
private:
double m_rotationAngle;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRotateGestureEvent);
};
// Two Finger Tap Gesture Event
/*
wxEVT_TWO_FINGER_TAP
*/
class WXDLLIMPEXP_CORE wxTwoFingerTapEvent : public wxGestureEvent
{
public:
wxTwoFingerTapEvent(wxWindowID winid = 0)
: wxGestureEvent(winid, wxEVT_TWO_FINGER_TAP)
{ }
wxTwoFingerTapEvent(const wxTwoFingerTapEvent& event) : wxGestureEvent(event)
{ }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxTwoFingerTapEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTwoFingerTapEvent);
};
// Long Press Gesture Event
/*
wxEVT_LONG_PRESS
*/
class WXDLLIMPEXP_CORE wxLongPressEvent : public wxGestureEvent
{
public:
wxLongPressEvent(wxWindowID winid = 0)
: wxGestureEvent(winid, wxEVT_LONG_PRESS)
{ }
wxLongPressEvent(const wxLongPressEvent& event) : wxGestureEvent(event)
{ }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxLongPressEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxLongPressEvent);
};
// Press And Tap Gesture Event
/*
wxEVT_PRESS_AND_TAP
*/
class WXDLLIMPEXP_CORE wxPressAndTapEvent : public wxGestureEvent
{
public:
wxPressAndTapEvent(wxWindowID winid = 0)
: wxGestureEvent(winid, wxEVT_PRESS_AND_TAP)
{ }
wxPressAndTapEvent(const wxPressAndTapEvent& event) : wxGestureEvent(event)
{ }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxPressAndTapEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPressAndTapEvent);
};
// Keyboard input event class
/*
wxEVT_CHAR
wxEVT_CHAR_HOOK
wxEVT_KEY_DOWN
wxEVT_KEY_UP
wxEVT_HOTKEY
*/
// key categories: the bit flags for IsKeyInCategory() function
//
// the enum values used may change in future version of wx
// use the named constants only, or bitwise combinations thereof
enum wxKeyCategoryFlags
{
// arrow keys, on and off numeric keypads
WXK_CATEGORY_ARROW = 1,
// page up and page down keys, on and off numeric keypads
WXK_CATEGORY_PAGING = 2,
// home and end keys, on and off numeric keypads
WXK_CATEGORY_JUMP = 4,
// tab key, on and off numeric keypads
WXK_CATEGORY_TAB = 8,
// backspace and delete keys, on and off numeric keypads
WXK_CATEGORY_CUT = 16,
// all keys usually used for navigation
WXK_CATEGORY_NAVIGATION = WXK_CATEGORY_ARROW |
WXK_CATEGORY_PAGING |
WXK_CATEGORY_JUMP
};
class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent,
public wxKeyboardState
{
public:
wxKeyEvent(wxEventType keyType = wxEVT_NULL);
// Normal copy ctor and a ctor creating a new event for the same key as the
// given one but a different event type (this is used in implementation
// code only, do not use outside of the library).
wxKeyEvent(const wxKeyEvent& evt);
wxKeyEvent(wxEventType eventType, const wxKeyEvent& evt);
// get the key code: an ASCII7 char or an element of wxKeyCode enum
int GetKeyCode() const { return (int)m_keyCode; }
// returns true iff this event's key code is of a certain type
bool IsKeyInCategory(int category) const;
#if wxUSE_UNICODE
// get the Unicode character corresponding to this key
wxChar GetUnicodeKey() const { return m_uniChar; }
#endif // wxUSE_UNICODE
// get the raw key code (platform-dependent)
wxUint32 GetRawKeyCode() const { return m_rawCode; }
// get the raw key flags (platform-dependent)
wxUint32 GetRawKeyFlags() const { return m_rawFlags; }
// Find the position of the event
void GetPosition(wxCoord *xpos, wxCoord *ypos) const
{
if (xpos)
*xpos = GetX();
if (ypos)
*ypos = GetY();
}
// This version if provided only for backwards compatiblity, don't use.
void GetPosition(long *xpos, long *ypos) const
{
if (xpos)
*xpos = GetX();
if (ypos)
*ypos = GetY();
}
wxPoint GetPosition() const
{ return wxPoint(GetX(), GetY()); }
// Get X position
wxCoord GetX() const;
// Get Y position
wxCoord GetY() const;
// Can be called from wxEVT_CHAR_HOOK handler to allow generation of normal
// key events even though the event had been handled (by default they would
// not be generated in this case).
void DoAllowNextEvent() { m_allowNext = true; }
// Return the value of the "allow next" flag, for internal use only.
bool IsNextEventAllowed() const { return m_allowNext; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxKeyEvent(*this); }
virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; }
// we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for
// example)
wxKeyEvent& operator=(const wxKeyEvent& evt)
{
if ( &evt != this )
{
wxEvent::operator=(evt);
// Borland C++ 5.82 doesn't compile an explicit call to an
// implicitly defined operator=() so need to do it this way:
*static_cast<wxKeyboardState *>(this) = evt;
DoAssignMembers(evt);
}
return *this;
}
public:
// Do not use these fields directly, they are initialized on demand, so
// call GetX() and GetY() or GetPosition() instead.
wxCoord m_x, m_y;
long m_keyCode;
#if wxUSE_UNICODE
// This contains the full Unicode character
// in a character events in Unicode mode
wxChar m_uniChar;
#endif
// these fields contain the platform-specific information about
// key that was pressed
wxUint32 m_rawCode;
wxUint32 m_rawFlags;
private:
// Set the event to propagate if necessary, i.e. if it's of wxEVT_CHAR_HOOK
// type. This is used by all ctors.
void InitPropagation()
{
if ( m_eventType == wxEVT_CHAR_HOOK )
m_propagationLevel = wxEVENT_PROPAGATE_MAX;
m_allowNext = false;
}
// Copy only the event data present in this class, this is used by
// AssignKeyData() and copy ctor.
void DoAssignMembers(const wxKeyEvent& evt)
{
m_x = evt.m_x;
m_y = evt.m_y;
m_hasPosition = evt.m_hasPosition;
m_keyCode = evt.m_keyCode;
m_rawCode = evt.m_rawCode;
m_rawFlags = evt.m_rawFlags;
#if wxUSE_UNICODE
m_uniChar = evt.m_uniChar;
#endif
}
// Initialize m_x and m_y using the current mouse cursor position if
// necessary.
void InitPositionIfNecessary() const;
// If this flag is true, the normal key events should still be generated
// even if wxEVT_CHAR_HOOK had been handled. By default it is false as
// handling wxEVT_CHAR_HOOK suppresses all the subsequent events.
bool m_allowNext;
// If true, m_x and m_y were already initialized. If false, try to get them
// when they're requested.
bool m_hasPosition;
wxDECLARE_DYNAMIC_CLASS(wxKeyEvent);
};
// Size event class
/*
wxEVT_SIZE
*/
class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent
{
public:
wxSizeEvent() : wxEvent(0, wxEVT_SIZE)
{ }
wxSizeEvent(const wxSize& sz, int winid = 0)
: wxEvent(winid, wxEVT_SIZE),
m_size(sz)
{ }
wxSizeEvent(const wxSizeEvent& event)
: wxEvent(event),
m_size(event.m_size), m_rect(event.m_rect)
{ }
wxSizeEvent(const wxRect& rect, int id = 0)
: m_size(rect.GetSize()), m_rect(rect)
{ m_eventType = wxEVT_SIZING; m_id = id; }
wxSize GetSize() const { return m_size; }
void SetSize(wxSize size) { m_size = size; }
wxRect GetRect() const { return m_rect; }
void SetRect(const wxRect& rect) { m_rect = rect; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxSizeEvent(*this); }
public:
// For internal usage only. Will be converted to protected members.
wxSize m_size;
wxRect m_rect; // Used for wxEVT_SIZING
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent);
};
// Move event class
/*
wxEVT_MOVE
*/
class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent
{
public:
wxMoveEvent()
: wxEvent(0, wxEVT_MOVE)
{ }
wxMoveEvent(const wxPoint& pos, int winid = 0)
: wxEvent(winid, wxEVT_MOVE),
m_pos(pos)
{ }
wxMoveEvent(const wxMoveEvent& event)
: wxEvent(event),
m_pos(event.m_pos)
{ }
wxMoveEvent(const wxRect& rect, int id = 0)
: m_pos(rect.GetPosition()), m_rect(rect)
{ m_eventType = wxEVT_MOVING; m_id = id; }
wxPoint GetPosition() const { return m_pos; }
void SetPosition(const wxPoint& pos) { m_pos = pos; }
wxRect GetRect() const { return m_rect; }
void SetRect(const wxRect& rect) { m_rect = rect; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxMoveEvent(*this); }
protected:
wxPoint m_pos;
wxRect m_rect;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent);
};
// Paint event class
/*
wxEVT_PAINT
wxEVT_NC_PAINT
*/
#if wxDEBUG_LEVEL && defined(__WXMSW__)
#define wxHAS_PAINT_DEBUG
// see comments in src/msw/dcclient.cpp where g_isPainting is defined
extern WXDLLIMPEXP_CORE int g_isPainting;
#endif // debug
class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent
{
public:
wxPaintEvent(int Id = 0)
: wxEvent(Id, wxEVT_PAINT)
{
#ifdef wxHAS_PAINT_DEBUG
// set the internal flag for the duration of redrawing
g_isPainting++;
#endif // debug
}
// default copy ctor and dtor are normally fine, we only need them to keep
// g_isPainting updated in debug build
#ifdef wxHAS_PAINT_DEBUG
wxPaintEvent(const wxPaintEvent& event)
: wxEvent(event)
{
g_isPainting++;
}
virtual ~wxPaintEvent()
{
g_isPainting--;
}
#endif // debug
virtual wxEvent *Clone() const wxOVERRIDE { return new wxPaintEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent);
};
class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent
{
public:
wxNcPaintEvent(int winid = 0)
: wxEvent(winid, wxEVT_NC_PAINT)
{ }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxNcPaintEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent);
};
// Erase background event class
/*
wxEVT_ERASE_BACKGROUND
*/
class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent
{
public:
wxEraseEvent(int Id = 0, wxDC *dc = NULL)
: wxEvent(Id, wxEVT_ERASE_BACKGROUND),
m_dc(dc)
{ }
wxEraseEvent(const wxEraseEvent& event)
: wxEvent(event),
m_dc(event.m_dc)
{ }
wxDC *GetDC() const { return m_dc; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxEraseEvent(*this); }
protected:
wxDC *m_dc;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent);
};
// Focus event class
/*
wxEVT_SET_FOCUS
wxEVT_KILL_FOCUS
*/
class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent
{
public:
wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0)
: wxEvent(winid, type)
{ m_win = NULL; }
wxFocusEvent(const wxFocusEvent& event)
: wxEvent(event)
{ m_win = event.m_win; }
// The window associated with this event is the window which had focus
// before for SET event and the window which will have focus for the KILL
// one. NB: it may be NULL in both cases!
wxWindow *GetWindow() const { return m_win; }
void SetWindow(wxWindow *win) { m_win = win; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxFocusEvent(*this); }
private:
wxWindow *m_win;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent);
};
// wxChildFocusEvent notifies the parent that a child has got the focus: unlike
// wxFocusEvent it is propagated upwards the window chain
class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent
{
public:
wxChildFocusEvent(wxWindow *win = NULL);
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxChildFocusEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent);
};
// Activate event class
/*
wxEVT_ACTIVATE
wxEVT_ACTIVATE_APP
wxEVT_HIBERNATE
*/
class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
{
public:
// Type of activation. For now we can only detect if it was by mouse or by
// some other method and even this is only available under wxMSW.
enum Reason
{
Reason_Mouse,
Reason_Unknown
};
wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true,
int Id = 0, Reason activationReason = Reason_Unknown)
: wxEvent(Id, type),
m_activationReason(activationReason)
{
m_active = active;
}
wxActivateEvent(const wxActivateEvent& event)
: wxEvent(event)
{
m_active = event.m_active;
m_activationReason = event.m_activationReason;
}
bool GetActive() const { return m_active; }
Reason GetActivationReason() const { return m_activationReason;}
virtual wxEvent *Clone() const wxOVERRIDE { return new wxActivateEvent(*this); }
private:
bool m_active;
Reason m_activationReason;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent);
};
// InitDialog event class
/*
wxEVT_INIT_DIALOG
*/
class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent
{
public:
wxInitDialogEvent(int Id = 0)
: wxEvent(Id, wxEVT_INIT_DIALOG)
{ }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxInitDialogEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent);
};
// Miscellaneous menu event class
/*
wxEVT_MENU_OPEN,
wxEVT_MENU_CLOSE,
wxEVT_MENU_HIGHLIGHT,
*/
class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent
{
public:
wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL)
: wxEvent(winid, type)
{ m_menuId = winid; m_menu = menu; }
wxMenuEvent(const wxMenuEvent& event)
: wxEvent(event)
{ m_menuId = event.m_menuId; m_menu = event.m_menu; }
// only for wxEVT_MENU_HIGHLIGHT
int GetMenuId() const { return m_menuId; }
// only for wxEVT_MENU_OPEN/CLOSE
bool IsPopup() const { return m_menuId == wxID_ANY; }
// only for wxEVT_MENU_OPEN/CLOSE
wxMenu* GetMenu() const { return m_menu; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxMenuEvent(*this); }
private:
int m_menuId;
wxMenu* m_menu;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent);
};
// Window close or session close event class
/*
wxEVT_CLOSE_WINDOW,
wxEVT_END_SESSION,
wxEVT_QUERY_END_SESSION
*/
class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent
{
public:
wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0)
: wxEvent(winid, type),
m_loggingOff(true),
m_veto(false), // should be false by default
m_canVeto(true) {}
wxCloseEvent(const wxCloseEvent& event)
: wxEvent(event),
m_loggingOff(event.m_loggingOff),
m_veto(event.m_veto),
m_canVeto(event.m_canVeto) {}
void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
bool GetLoggingOff() const
{
// m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it
// doesn't make sense for wxEVT_CLOSE_WINDOW
wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW,
wxT("this flag is for end session events only") );
return m_loggingOff;
}
void Veto(bool veto = true)
{
// GetVeto() will return false anyhow...
wxCHECK_RET( m_canVeto,
wxT("call to Veto() ignored (can't veto this event)") );
m_veto = veto;
}
void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
bool CanVeto() const { return m_canVeto; }
bool GetVeto() const { return m_canVeto && m_veto; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxCloseEvent(*this); }
protected:
bool m_loggingOff,
m_veto,
m_canVeto;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent);
};
/*
wxEVT_SHOW
*/
class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent
{
public:
wxShowEvent(int winid = 0, bool show = false)
: wxEvent(winid, wxEVT_SHOW)
{ m_show = show; }
wxShowEvent(const wxShowEvent& event)
: wxEvent(event)
{ m_show = event.m_show; }
void SetShow(bool show) { m_show = show; }
// return true if the window was shown, false if hidden
bool IsShown() const { return m_show; }
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( bool GetShow() const { return IsShown(); } )
#endif
virtual wxEvent *Clone() const wxOVERRIDE { return new wxShowEvent(*this); }
protected:
bool m_show;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent);
};
/*
wxEVT_ICONIZE
*/
class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent
{
public:
wxIconizeEvent(int winid = 0, bool iconized = true)
: wxEvent(winid, wxEVT_ICONIZE)
{ m_iconized = iconized; }
wxIconizeEvent(const wxIconizeEvent& event)
: wxEvent(event)
{ m_iconized = event.m_iconized; }
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( bool Iconized() const { return IsIconized(); } )
#endif
// return true if the frame was iconized, false if restored
bool IsIconized() const { return m_iconized; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxIconizeEvent(*this); }
protected:
bool m_iconized;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent);
};
/*
wxEVT_MAXIMIZE
*/
class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent
{
public:
wxMaximizeEvent(int winid = 0)
: wxEvent(winid, wxEVT_MAXIMIZE)
{ }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxMaximizeEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent);
};
// Joystick event class
/*
wxEVT_JOY_BUTTON_DOWN,
wxEVT_JOY_BUTTON_UP,
wxEVT_JOY_MOVE,
wxEVT_JOY_ZMOVE
*/
// Which joystick? Same as Windows ids so no conversion necessary.
enum
{
wxJOYSTICK1,
wxJOYSTICK2
};
// Which button is down?
enum
{
wxJOY_BUTTON_ANY = -1,
wxJOY_BUTTON1 = 1,
wxJOY_BUTTON2 = 2,
wxJOY_BUTTON3 = 4,
wxJOY_BUTTON4 = 8
};
class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent
{
protected:
wxPoint m_pos;
int m_zPosition;
int m_buttonChange; // Which button changed?
int m_buttonState; // Which buttons are down?
int m_joyStick; // Which joystick?
public:
wxJoystickEvent(wxEventType type = wxEVT_NULL,
int state = 0,
int joystick = wxJOYSTICK1,
int change = 0)
: wxEvent(0, type),
m_pos(),
m_zPosition(0),
m_buttonChange(change),
m_buttonState(state),
m_joyStick(joystick)
{
}
wxJoystickEvent(const wxJoystickEvent& event)
: wxEvent(event),
m_pos(event.m_pos),
m_zPosition(event.m_zPosition),
m_buttonChange(event.m_buttonChange),
m_buttonState(event.m_buttonState),
m_joyStick(event.m_joyStick)
{ }
wxPoint GetPosition() const { return m_pos; }
int GetZPosition() const { return m_zPosition; }
int GetButtonState() const { return m_buttonState; }
int GetButtonChange() const { return m_buttonChange; }
int GetButtonOrdinal() const { return wxCTZ(m_buttonChange); }
int GetJoystick() const { return m_joyStick; }
void SetJoystick(int stick) { m_joyStick = stick; }
void SetButtonState(int state) { m_buttonState = state; }
void SetButtonChange(int change) { m_buttonChange = change; }
void SetPosition(const wxPoint& pos) { m_pos = pos; }
void SetZPosition(int zPos) { m_zPosition = zPos; }
// Was it a button event? (*doesn't* mean: is any button *down*?)
bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) ||
(GetEventType() == wxEVT_JOY_BUTTON_UP)); }
// Was it a move event?
bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); }
// Was it a zmove event?
bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); }
// Was it a down event from button 1, 2, 3, 4 or any?
bool ButtonDown(int but = wxJOY_BUTTON_ANY) const
{ return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) &&
((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
// Was it a up event from button 1, 2, 3 or any?
bool ButtonUp(int but = wxJOY_BUTTON_ANY) const
{ return ((GetEventType() == wxEVT_JOY_BUTTON_UP) &&
((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
// Was the given button 1,2,3,4 or any in Down state?
bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const
{ return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) ||
((m_buttonState & but) == but)); }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxJoystickEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent);
};
// Drop files event class
/*
wxEVT_DROP_FILES
*/
class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent
{
public:
int m_noFiles;
wxPoint m_pos;
wxString* m_files;
wxDropFilesEvent(wxEventType type = wxEVT_NULL,
int noFiles = 0,
wxString *files = NULL)
: wxEvent(0, type),
m_noFiles(noFiles),
m_pos(),
m_files(files)
{ }
// we need a copy ctor to avoid deleting m_files pointer twice
wxDropFilesEvent(const wxDropFilesEvent& other)
: wxEvent(other),
m_noFiles(other.m_noFiles),
m_pos(other.m_pos),
m_files(NULL)
{
m_files = new wxString[m_noFiles];
for ( int n = 0; n < m_noFiles; n++ )
{
m_files[n] = other.m_files[n];
}
}
virtual ~wxDropFilesEvent()
{
delete [] m_files;
}
wxPoint GetPosition() const { return m_pos; }
int GetNumberOfFiles() const { return m_noFiles; }
wxString *GetFiles() const { return m_files; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxDropFilesEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent);
};
// Update UI event
/*
wxEVT_UPDATE_UI
*/
// Whether to always send update events to windows, or
// to only send update events to those with the
// wxWS_EX_PROCESS_UI_UPDATES style.
enum wxUpdateUIMode
{
// Send UI update events to all windows
wxUPDATE_UI_PROCESS_ALL,
// Send UI update events to windows that have
// the wxWS_EX_PROCESS_UI_UPDATES flag specified
wxUPDATE_UI_PROCESS_SPECIFIED
};
class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent
{
public:
wxUpdateUIEvent(wxWindowID commandId = 0)
: wxCommandEvent(wxEVT_UPDATE_UI, commandId)
{
m_checked =
m_enabled =
m_shown =
m_setEnabled =
m_setShown =
m_setText =
m_setChecked = false;
}
wxUpdateUIEvent(const wxUpdateUIEvent& event)
: wxCommandEvent(event),
m_checked(event.m_checked),
m_enabled(event.m_enabled),
m_shown(event.m_shown),
m_setEnabled(event.m_setEnabled),
m_setShown(event.m_setShown),
m_setText(event.m_setText),
m_setChecked(event.m_setChecked),
m_text(event.m_text)
{ }
bool GetChecked() const { return m_checked; }
bool GetEnabled() const { return m_enabled; }
bool GetShown() const { return m_shown; }
wxString GetText() const { return m_text; }
bool GetSetText() const { return m_setText; }
bool GetSetChecked() const { return m_setChecked; }
bool GetSetEnabled() const { return m_setEnabled; }
bool GetSetShown() const { return m_setShown; }
void Check(bool check) { m_checked = check; m_setChecked = true; }
void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; }
void Show(bool show) { m_shown = show; m_setShown = true; }
void SetText(const wxString& text) { m_text = text; m_setText = true; }
// Sets the interval between updates in milliseconds.
// Set to -1 to disable updates, or to 0 to update as frequently as possible.
static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; }
// Returns the current interval between updates in milliseconds
static long GetUpdateInterval() { return sm_updateInterval; }
// Can we update this window?
static bool CanUpdate(wxWindowBase *win);
// Reset the update time to provide a delay until the next
// time we should update
static void ResetUpdateTime();
// Specify how wxWidgets will send update events: to
// all windows, or only to those which specify that they
// will process the events.
static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; }
// Returns the UI update mode
static wxUpdateUIMode GetMode() { return sm_updateMode; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxUpdateUIEvent(*this); }
protected:
bool m_checked;
bool m_enabled;
bool m_shown;
bool m_setEnabled;
bool m_setShown;
bool m_setText;
bool m_setChecked;
wxString m_text;
#if wxUSE_LONGLONG
static wxLongLong sm_lastUpdate;
#endif
static long sm_updateInterval;
static wxUpdateUIMode sm_updateMode;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent);
};
/*
wxEVT_SYS_COLOUR_CHANGED
*/
// TODO: shouldn't all events record the window ID?
class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent
{
public:
wxSysColourChangedEvent()
: wxEvent(0, wxEVT_SYS_COLOUR_CHANGED)
{ }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxSysColourChangedEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent);
};
/*
wxEVT_MOUSE_CAPTURE_CHANGED
The window losing the capture receives this message
(even if it released the capture itself).
*/
class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent
{
public:
wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL)
: wxEvent(winid, wxEVT_MOUSE_CAPTURE_CHANGED),
m_gainedCapture(gainedCapture)
{ }
wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent& event)
: wxEvent(event),
m_gainedCapture(event.m_gainedCapture)
{ }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxMouseCaptureChangedEvent(*this); }
wxWindow* GetCapturedWindow() const { return m_gainedCapture; }
private:
wxWindow* m_gainedCapture;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent);
};
/*
wxEVT_MOUSE_CAPTURE_LOST
The window losing the capture receives this message, unless it released it
it itself or unless wxWindow::CaptureMouse was called on another window
(and so capture will be restored when the new capturer releases it).
*/
class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent : public wxEvent
{
public:
wxMouseCaptureLostEvent(wxWindowID winid = 0)
: wxEvent(winid, wxEVT_MOUSE_CAPTURE_LOST)
{}
wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent& event)
: wxEvent(event)
{}
virtual wxEvent *Clone() const wxOVERRIDE { return new wxMouseCaptureLostEvent(*this); }
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent);
};
/*
wxEVT_DISPLAY_CHANGED
*/
class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent
{
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent);
public:
wxDisplayChangedEvent()
: wxEvent(0, wxEVT_DISPLAY_CHANGED)
{ }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxDisplayChangedEvent(*this); }
};
/*
wxEVT_PALETTE_CHANGED
*/
class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent
{
public:
wxPaletteChangedEvent(wxWindowID winid = 0)
: wxEvent(winid, wxEVT_PALETTE_CHANGED),
m_changedWindow(NULL)
{ }
wxPaletteChangedEvent(const wxPaletteChangedEvent& event)
: wxEvent(event),
m_changedWindow(event.m_changedWindow)
{ }
void SetChangedWindow(wxWindow* win) { m_changedWindow = win; }
wxWindow* GetChangedWindow() const { return m_changedWindow; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxPaletteChangedEvent(*this); }
protected:
wxWindow* m_changedWindow;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent);
};
/*
wxEVT_QUERY_NEW_PALETTE
Indicates the window is getting keyboard focus and should re-do its palette.
*/
class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent : public wxEvent
{
public:
wxQueryNewPaletteEvent(wxWindowID winid = 0)
: wxEvent(winid, wxEVT_QUERY_NEW_PALETTE),
m_paletteRealized(false)
{ }
wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent& event)
: wxEvent(event),
m_paletteRealized(event.m_paletteRealized)
{ }
// App sets this if it changes the palette.
void SetPaletteRealized(bool realized) { m_paletteRealized = realized; }
bool GetPaletteRealized() const { return m_paletteRealized; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxQueryNewPaletteEvent(*this); }
protected:
bool m_paletteRealized;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent);
};
/*
Event generated by dialog navigation keys
wxEVT_NAVIGATION_KEY
*/
// NB: don't derive from command event to avoid being propagated to the parent
class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent
{
public:
wxNavigationKeyEvent()
: wxEvent(0, wxEVT_NAVIGATION_KEY),
m_flags(IsForward | FromTab), // defaults are for TAB
m_focus(NULL)
{
m_propagationLevel = wxEVENT_PROPAGATE_NONE;
}
wxNavigationKeyEvent(const wxNavigationKeyEvent& event)
: wxEvent(event),
m_flags(event.m_flags),
m_focus(event.m_focus)
{ }
// direction: forward (true) or backward (false)
bool GetDirection() const
{ return (m_flags & IsForward) != 0; }
void SetDirection(bool bForward)
{ if ( bForward ) m_flags |= IsForward; else m_flags &= ~IsForward; }
// it may be a window change event (MDI, notebook pages...) or a control
// change event
bool IsWindowChange() const
{ return (m_flags & WinChange) != 0; }
void SetWindowChange(bool bIs)
{ if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; }
// Set to true under MSW if the event was generated using the tab key.
// This is required for proper navogation over radio buttons
bool IsFromTab() const
{ return (m_flags & FromTab) != 0; }
void SetFromTab(bool bIs)
{ if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; }
// the child which has the focus currently (may be NULL - use
// wxWindow::FindFocus then)
wxWindow* GetCurrentFocus() const { return m_focus; }
void SetCurrentFocus(wxWindow *win) { m_focus = win; }
// Set flags
void SetFlags(long flags) { m_flags = flags; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxNavigationKeyEvent(*this); }
enum wxNavigationKeyEventFlags
{
IsBackward = 0x0000,
IsForward = 0x0001,
WinChange = 0x0002,
FromTab = 0x0004
};
long m_flags;
wxWindow *m_focus;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent);
};
// Window creation/destruction events: the first is sent as soon as window is
// created (i.e. the underlying GUI object exists), but when the C++ object is
// fully initialized (so virtual functions may be called). The second,
// wxEVT_DESTROY, is sent right before the window is destroyed - again, it's
// still safe to call virtual functions at this moment
/*
wxEVT_CREATE
wxEVT_DESTROY
*/
class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent
{
public:
wxWindowCreateEvent(wxWindow *win = NULL);
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxWindowCreateEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent);
};
class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent
{
public:
wxWindowDestroyEvent(wxWindow *win = NULL);
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxWindowDestroyEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent);
};
// A help event is sent when the user clicks on a window in context-help mode.
/*
wxEVT_HELP
wxEVT_DETAILED_HELP
*/
class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent
{
public:
// how was this help event generated?
enum Origin
{
Origin_Unknown, // unrecognized event source
Origin_Keyboard, // event generated from F1 key press
Origin_HelpButton // event from [?] button on the title bar (Windows)
};
wxHelpEvent(wxEventType type = wxEVT_NULL,
wxWindowID winid = 0,
const wxPoint& pt = wxDefaultPosition,
Origin origin = Origin_Unknown)
: wxCommandEvent(type, winid),
m_pos(pt),
m_origin(GuessOrigin(origin))
{ }
wxHelpEvent(const wxHelpEvent& event)
: wxCommandEvent(event),
m_pos(event.m_pos),
m_target(event.m_target),
m_link(event.m_link),
m_origin(event.m_origin)
{ }
// Position of event (in screen coordinates)
const wxPoint& GetPosition() const { return m_pos; }
void SetPosition(const wxPoint& pos) { m_pos = pos; }
// Optional link to further help
const wxString& GetLink() const { return m_link; }
void SetLink(const wxString& link) { m_link = link; }
// Optional target to display help in. E.g. a window specification
const wxString& GetTarget() const { return m_target; }
void SetTarget(const wxString& target) { m_target = target; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxHelpEvent(*this); }
// optional indication of the event source
Origin GetOrigin() const { return m_origin; }
void SetOrigin(Origin origin) { m_origin = origin; }
protected:
wxPoint m_pos;
wxString m_target;
wxString m_link;
Origin m_origin;
// we can try to guess the event origin ourselves, even if none is
// specified in the ctor
static Origin GuessOrigin(Origin origin);
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent);
};
// A Clipboard Text event is sent when a window intercepts text copy/cut/paste
// message, i.e. the user has cut/copied/pasted data from/into a text control
// via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc.
// NOTE : under windows these events are *NOT* generated automatically
// for a Rich Edit text control.
/*
wxEVT_TEXT_COPY
wxEVT_TEXT_CUT
wxEVT_TEXT_PASTE
*/
class WXDLLIMPEXP_CORE wxClipboardTextEvent : public wxCommandEvent
{
public:
wxClipboardTextEvent(wxEventType type = wxEVT_NULL,
wxWindowID winid = 0)
: wxCommandEvent(type, winid)
{ }
wxClipboardTextEvent(const wxClipboardTextEvent& event)
: wxCommandEvent(event)
{ }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxClipboardTextEvent(*this); }
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent);
};
// A Context event is sent when the user right clicks on a window or
// presses Shift-F10
// NOTE : Under windows this is a repackaged WM_CONTETXMENU message
// Under other systems it may have to be generated from a right click event
/*
wxEVT_CONTEXT_MENU
*/
class WXDLLIMPEXP_CORE wxContextMenuEvent : public wxCommandEvent
{
public:
wxContextMenuEvent(wxEventType type = wxEVT_NULL,
wxWindowID winid = 0,
const wxPoint& pt = wxDefaultPosition)
: wxCommandEvent(type, winid),
m_pos(pt)
{ }
wxContextMenuEvent(const wxContextMenuEvent& event)
: wxCommandEvent(event),
m_pos(event.m_pos)
{ }
// Position of event (in screen coordinates)
const wxPoint& GetPosition() const { return m_pos; }
void SetPosition(const wxPoint& pos) { m_pos = pos; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxContextMenuEvent(*this); }
protected:
wxPoint m_pos;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent);
};
/* TODO
wxEVT_SETTING_CHANGED, // WM_WININICHANGE
// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate
// wxEVT_FONT_CHANGED to all other windows (maybe).
wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific.
wxEVT_MEASURE_ITEM,
wxEVT_COMPARE_ITEM
*/
#endif // wxUSE_GUI
// ============================================================================
// event handler and related classes
// ============================================================================
// struct containing the members common to static and dynamic event tables
// entries
struct WXDLLIMPEXP_BASE wxEventTableEntryBase
{
wxEventTableEntryBase(int winid, int idLast,
wxEventFunctor* fn, wxObject *data)
: m_id(winid),
m_lastId(idLast),
m_fn(fn),
m_callbackUserData(data)
{
wxASSERT_MSG( idLast == wxID_ANY || winid <= idLast,
"invalid IDs range: lower bound > upper bound" );
}
wxEventTableEntryBase( const wxEventTableEntryBase &entry )
: m_id( entry.m_id ),
m_lastId( entry.m_lastId ),
m_fn( entry.m_fn ),
m_callbackUserData( entry.m_callbackUserData )
{
// This is a 'hack' to ensure that only one instance tries to delete
// the functor pointer. It is safe as long as the only place where the
// copy constructor is being called is when the static event tables are
// being initialized (a temporary instance is created and then this
// constructor is called).
const_cast<wxEventTableEntryBase&>( entry ).m_fn = NULL;
}
~wxEventTableEntryBase()
{
delete m_fn;
}
// the range of ids for this entry: if m_lastId == wxID_ANY, the range
// consists only of m_id, otherwise it is m_id..m_lastId inclusive
int m_id,
m_lastId;
// function/method/functor to call
wxEventFunctor* m_fn;
// arbitrary user data associated with the callback
wxObject* m_callbackUserData;
private:
wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntryBase);
};
// an entry from a static event table
struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase
{
wxEventTableEntry(const int& evType, int winid, int idLast,
wxEventFunctor* fn, wxObject *data)
: wxEventTableEntryBase(winid, idLast, fn, data),
m_eventType(evType)
{ }
// the reference to event type: this allows us to not care about the
// (undefined) order in which the event table entries and the event types
// are initialized: initially the value of this reference might be
// invalid, but by the time it is used for the first time, all global
// objects will have been initialized (including the event type constants)
// and so it will have the correct value when it is needed
const int& m_eventType;
private:
wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntry);
};
// an entry used in dynamic event table managed by wxEvtHandler::Connect()
struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase
{
wxDynamicEventTableEntry(int evType, int winid, int idLast,
wxEventFunctor* fn, wxObject *data)
: wxEventTableEntryBase(winid, idLast, fn, data),
m_eventType(evType)
{ }
// not a reference here as we can't keep a reference to a temporary int
// created to wrap the constant value typically passed to Connect() - nor
// do we need it
int m_eventType;
private:
wxDECLARE_NO_ASSIGN_CLASS(wxDynamicEventTableEntry);
};
// ----------------------------------------------------------------------------
// wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0}
// ----------------------------------------------------------------------------
struct WXDLLIMPEXP_BASE wxEventTable
{
const wxEventTable *baseTable; // base event table (next in chain)
const wxEventTableEntry *entries; // bottom of entry array
};
// ----------------------------------------------------------------------------
// wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups.
// ----------------------------------------------------------------------------
WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray);
class WXDLLIMPEXP_BASE wxEventHashTable
{
private:
// Internal data structs
struct EventTypeTable
{
wxEventType eventType;
wxEventTableEntryPointerArray eventEntryTable;
};
typedef EventTypeTable* EventTypeTablePointer;
public:
// Constructor, needs the event table it needs to hash later on.
// Note: hashing of the event table is not done in the constructor as it
// can be that the event table is not yet full initialize, the hash
// will gets initialized when handling the first event look-up request.
wxEventHashTable(const wxEventTable &table);
// Destructor.
~wxEventHashTable();
// Handle the given event, in other words search the event table hash
// and call self->ProcessEvent() if a match was found.
bool HandleEvent(wxEvent& event, wxEvtHandler *self);
// Clear table
void Clear();
#if wxUSE_MEMORY_TRACING
// Clear all tables: only used to work around problems in memory tracing
// code
static void ClearAll();
#endif // wxUSE_MEMORY_TRACING
protected:
// Init the hash table with the entries of the static event table.
void InitHashTable();
// Helper function of InitHashTable() to insert 1 entry into the hash table.
void AddEntry(const wxEventTableEntry &entry);
// Allocate and init with null pointers the base hash table.
void AllocEventTypeTable(size_t size);
// Grow the hash table in size and transfer all items currently
// in the table to the correct location in the new table.
void GrowEventTypeTable();
protected:
const wxEventTable &m_table;
bool m_rebuildHash;
size_t m_size;
EventTypeTablePointer *m_eventTypeTable;
static wxEventHashTable* sm_first;
wxEventHashTable* m_previous;
wxEventHashTable* m_next;
wxDECLARE_NO_COPY_CLASS(wxEventHashTable);
};
// ----------------------------------------------------------------------------
// wxEvtHandler: the base class for all objects handling wxWidgets events
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject
, public wxTrackable
{
public:
wxEvtHandler();
virtual ~wxEvtHandler();
// Event handler chain
// -------------------
wxEvtHandler *GetNextHandler() const { return m_nextHandler; }
wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; }
virtual void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; }
virtual void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; }
void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; }
bool GetEvtHandlerEnabled() const { return m_enabled; }
void Unlink();
bool IsUnlinked() const;
// Global event filters
// --------------------
// Add an event filter whose FilterEvent() method will be called for each
// and every event processed by wxWidgets. The filters are called in LIFO
// order and wxApp is registered as an event filter by default. The pointer
// must remain valid until it's removed with RemoveFilter() and is not
// deleted by wxEvtHandler.
static void AddFilter(wxEventFilter* filter);
// Remove a filter previously installed with AddFilter().
static void RemoveFilter(wxEventFilter* filter);
// Event queuing and processing
// ----------------------------
// Process an event right now: this can only be called from the main
// thread, use QueueEvent() for scheduling the events for
// processing from other threads.
virtual bool ProcessEvent(wxEvent& event);
// Process an event by calling ProcessEvent and handling any exceptions
// thrown by event handlers. It's mostly useful when processing wx events
// when called from C code (e.g. in GTK+ callback) when the exception
// wouldn't correctly propagate to wxEventLoop.
bool SafelyProcessEvent(wxEvent& event);
// NOTE: uses ProcessEvent()
// This method tries to process the event in this event handler, including
// any preprocessing done by TryBefore() and all the handlers chained to
// it, but excluding the post-processing done in TryAfter().
//
// It is meant to be called from ProcessEvent() only and is not virtual,
// additional event handlers can be hooked into the normal event processing
// logic using TryBefore() and TryAfter() hooks.
//
// You can also call it yourself to forward an event to another handler but
// without propagating it upwards if it's unhandled (this is usually
// unwanted when forwarding as the original handler would already do it if
// needed normally).
bool ProcessEventLocally(wxEvent& event);
// Schedule the given event to be processed later. It takes ownership of
// the event pointer, i.e. it will be deleted later. This is safe to call
// from multiple threads although you still need to ensure that wxString
// fields of the event object are deep copies and not use the same string
// buffer as other wxString objects in this thread.
virtual void QueueEvent(wxEvent *event);
// Add an event to be processed later: notice that this function is not
// safe to call from threads other than main, use QueueEvent()
virtual void AddPendingEvent(const wxEvent& event)
{
// notice that the thread-safety problem comes from the fact that
// Clone() doesn't make deep copies of wxString fields of wxEvent
// object and so the same wxString could be used from both threads when
// the event object is destroyed in this one -- QueueEvent() avoids
// this problem as the event pointer is not used any more in this
// thread at all after it is called.
QueueEvent(event.Clone());
}
void ProcessPendingEvents();
// NOTE: uses ProcessEvent()
void DeletePendingEvents();
#if wxUSE_THREADS
bool ProcessThreadEvent(const wxEvent& event);
// NOTE: uses AddPendingEvent(); call only from secondary threads
#endif
#if wxUSE_EXCEPTIONS
// This is a private function which handles any exceptions arising during
// the execution of user-defined code called in the event loop context by
// forwarding them to wxApp::OnExceptionInMainLoop() and, if it rethrows,
// to wxApp::OnUnhandledException(). In any case this function ensures that
// no exceptions ever escape from it and so is useful to call at module
// boundary.
//
// It must be only called when handling an active exception.
static void WXConsumeException();
#endif // wxUSE_EXCEPTIONS
#ifdef wxHAS_CALL_AFTER
// Asynchronous method calls: these methods schedule the given method
// pointer for a later call (during the next idle event loop iteration).
//
// Notice that the method is called on this object itself, so the object
// CallAfter() is called on must have the correct dynamic type.
//
// These method can be used from another thread.
template <typename T>
void CallAfter(void (T::*method)())
{
QueueEvent(
new wxAsyncMethodCallEvent0<T>(static_cast<T*>(this), method)
);
}
// Notice that we use P1 and not T1 for the parameter to allow passing
// parameters that are convertible to the type taken by the method
// instead of being exactly the same, to be closer to the usual method call
// semantics.
template <typename T, typename T1, typename P1>
void CallAfter(void (T::*method)(T1 x1), P1 x1)
{
QueueEvent(
new wxAsyncMethodCallEvent1<T, T1>(
static_cast<T*>(this), method, x1)
);
}
template <typename T, typename T1, typename T2, typename P1, typename P2>
void CallAfter(void (T::*method)(T1 x1, T2 x2), P1 x1, P2 x2)
{
QueueEvent(
new wxAsyncMethodCallEvent2<T, T1, T2>(
static_cast<T*>(this), method, x1, x2)
);
}
template <typename T>
void CallAfter(const T& fn)
{
QueueEvent(new wxAsyncMethodCallEventFunctor<T>(this, fn));
}
#endif // wxHAS_CALL_AFTER
// Connecting and disconnecting
// ----------------------------
// These functions are used for old, untyped, event handlers and don't
// check that the type of the function passed to them actually matches the
// type of the event. They also only allow connecting events to methods of
// wxEvtHandler-derived classes.
//
// The template Connect() methods below are safer and allow connecting
// events to arbitrary functions or functors -- but require compiler
// support for templates.
// Dynamic association of a member function handler with the event handler,
// winid and event type
void Connect(int winid,
int lastId,
wxEventType eventType,
wxObjectEventFunction func,
wxObject *userData = NULL,
wxEvtHandler *eventSink = NULL)
{
DoBind(winid, lastId, eventType,
wxNewEventFunctor(eventType, func, eventSink),
userData);
}
// Convenience function: take just one id
void Connect(int winid,
wxEventType eventType,
wxObjectEventFunction func,
wxObject *userData = NULL,
wxEvtHandler *eventSink = NULL)
{ Connect(winid, wxID_ANY, eventType, func, userData, eventSink); }
// Even more convenient: without id (same as using id of wxID_ANY)
void Connect(wxEventType eventType,
wxObjectEventFunction func,
wxObject *userData = NULL,
wxEvtHandler *eventSink = NULL)
{ Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); }
bool Disconnect(int winid,
int lastId,
wxEventType eventType,
wxObjectEventFunction func = NULL,
wxObject *userData = NULL,
wxEvtHandler *eventSink = NULL)
{
return DoUnbind(winid, lastId, eventType,
wxMakeEventFunctor(eventType, func, eventSink),
userData );
}
bool Disconnect(int winid = wxID_ANY,
wxEventType eventType = wxEVT_NULL,
wxObjectEventFunction func = NULL,
wxObject *userData = NULL,
wxEvtHandler *eventSink = NULL)
{ return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); }
bool Disconnect(wxEventType eventType,
wxObjectEventFunction func,
wxObject *userData = NULL,
wxEvtHandler *eventSink = NULL)
{ return Disconnect(wxID_ANY, eventType, func, userData, eventSink); }
// Bind functions to an event:
template <typename EventTag, typename EventArg>
void Bind(const EventTag& eventType,
void (*function)(EventArg &),
int winid = wxID_ANY,
int lastId = wxID_ANY,
wxObject *userData = NULL)
{
DoBind(winid, lastId, eventType,
wxNewEventFunctor(eventType, function),
userData);
}
template <typename EventTag, typename EventArg>
bool Unbind(const EventTag& eventType,
void (*function)(EventArg &),
int winid = wxID_ANY,
int lastId = wxID_ANY,
wxObject *userData = NULL)
{
return DoUnbind(winid, lastId, eventType,
wxMakeEventFunctor(eventType, function),
userData);
}
// Bind functors to an event:
template <typename EventTag, typename Functor>
void Bind(const EventTag& eventType,
const Functor &functor,
int winid = wxID_ANY,
int lastId = wxID_ANY,
wxObject *userData = NULL)
{
DoBind(winid, lastId, eventType,
wxNewEventFunctor(eventType, functor),
userData);
}
template <typename EventTag, typename Functor>
bool Unbind(const EventTag& eventType,
const Functor &functor,
int winid = wxID_ANY,
int lastId = wxID_ANY,
wxObject *userData = NULL)
{
return DoUnbind(winid, lastId, eventType,
wxMakeEventFunctor(eventType, functor),
userData);
}
// Bind a method of a class (called on the specified handler which must
// be convertible to this class) object to an event:
template <typename EventTag, typename Class, typename EventArg, typename EventHandler>
void Bind(const EventTag &eventType,
void (Class::*method)(EventArg &),
EventHandler *handler,
int winid = wxID_ANY,
int lastId = wxID_ANY,
wxObject *userData = NULL)
{
DoBind(winid, lastId, eventType,
wxNewEventFunctor(eventType, method, handler),
userData);
}
template <typename EventTag, typename Class, typename EventArg, typename EventHandler>
bool Unbind(const EventTag &eventType,
void (Class::*method)(EventArg&),
EventHandler *handler,
int winid = wxID_ANY,
int lastId = wxID_ANY,
wxObject *userData = NULL )
{
return DoUnbind(winid, lastId, eventType,
wxMakeEventFunctor(eventType, method, handler),
userData);
}
// User data can be associated with each wxEvtHandler
void SetClientObject( wxClientData *data ) { DoSetClientObject(data); }
wxClientData *GetClientObject() const { return DoGetClientObject(); }
void SetClientData( void *data ) { DoSetClientData(data); }
void *GetClientData() const { return DoGetClientData(); }
// implementation from now on
// --------------------------
// check if the given event table entry matches this event by id (the check
// for the event type should be done by caller) and call the handler if it
// does
//
// return true if the event was processed, false otherwise (no match or the
// handler decided to skip the event)
static bool ProcessEventIfMatchesId(const wxEventTableEntryBase& tableEntry,
wxEvtHandler *handler,
wxEvent& event);
// Allow iterating over all connected dynamic event handlers: you must pass
// the same "cookie" to GetFirst() and GetNext() and call them until null
// is returned.
//
// These functions are for internal use only.
wxDynamicEventTableEntry* GetFirstDynamicEntry(size_t& cookie) const;
wxDynamicEventTableEntry* GetNextDynamicEntry(size_t& cookie) const;
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
bool SearchDynamicEventTable( wxEvent& event );
// Avoid problems at exit by cleaning up static hash table gracefully
void ClearEventHashTable() { GetEventHashTable().Clear(); }
void OnSinkDestroyed( wxEvtHandler *sink );
private:
void DoBind(int winid,
int lastId,
wxEventType eventType,
wxEventFunctor *func,
wxObject* userData = NULL);
bool DoUnbind(int winid,
int lastId,
wxEventType eventType,
const wxEventFunctor& func,
wxObject *userData = NULL);
static const wxEventTableEntry sm_eventTableEntries[];
protected:
// hooks for wxWindow used by ProcessEvent()
// -----------------------------------------
// this one is called before trying our own event table to allow plugging
// in the event handlers overriding the default logic, this is used by e.g.
// validators.
virtual bool TryBefore(wxEvent& event);
// This one is not a hook but just a helper which looks up the handler in
// this object itself.
//
// It is called from ProcessEventLocally() and normally shouldn't be called
// directly as doing it would ignore any chained event handlers
bool TryHereOnly(wxEvent& event);
// Another helper which simply calls pre-processing hook and then tries to
// handle the event at this handler level.
bool TryBeforeAndHere(wxEvent& event)
{
return TryBefore(event) || TryHereOnly(event);
}
// this one is called after failing to find the event handle in our own
// table to give a chance to the other windows to process it
//
// base class implementation passes the event to wxTheApp
virtual bool TryAfter(wxEvent& event);
#if WXWIN_COMPATIBILITY_2_8
// deprecated method: override TryBefore() instead of this one
wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
virtual bool TryValidator(wxEvent& WXUNUSED(event)), return false; )
wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(
virtual bool TryParent(wxEvent& event), return DoTryApp(event); )
#endif // WXWIN_COMPATIBILITY_2_8
// Overriding this method allows filtering the event handlers dynamically
// connected to this object. If this method returns false, the handler is
// not connected at all. If it returns true, it is connected using the
// possibly modified fields of the given entry.
virtual bool OnDynamicBind(wxDynamicEventTableEntry& WXUNUSED(entry))
{
return true;
}
static const wxEventTable sm_eventTable;
virtual const wxEventTable *GetEventTable() const;
static wxEventHashTable sm_eventHashTable;
virtual wxEventHashTable& GetEventHashTable() const;
wxEvtHandler* m_nextHandler;
wxEvtHandler* m_previousHandler;
typedef wxVector<wxDynamicEventTableEntry*> DynamicEvents;
DynamicEvents* m_dynamicEvents;
wxList* m_pendingEvents;
#if wxUSE_THREADS
// critical section protecting m_pendingEvents
wxCriticalSection m_pendingEventsLock;
#endif // wxUSE_THREADS
// Is event handler enabled?
bool m_enabled;
// The user data: either an object which will be deleted by the container
// when it's deleted or some raw pointer which we do nothing with - only
// one type of data can be used with the given window (i.e. you cannot set
// the void data and then associate the container with wxClientData or vice
// versa)
union
{
wxClientData *m_clientObject;
void *m_clientData;
};
// what kind of data do we have?
wxClientDataType m_clientDataType;
// client data accessors
virtual void DoSetClientObject( wxClientData *data );
virtual wxClientData *DoGetClientObject() const;
virtual void DoSetClientData( void *data );
virtual void *DoGetClientData() const;
// Search tracker objects for event connection with this sink
wxEventConnectionRef *FindRefInTrackerList(wxEvtHandler *handler);
private:
// pass the event to wxTheApp instance, called from TryAfter()
bool DoTryApp(wxEvent& event);
// try to process events in all handlers chained to this one
bool DoTryChain(wxEvent& event);
// Head of the event filter linked list.
static wxEventFilter* ms_filterList;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler);
};
WX_DEFINE_ARRAY_WITH_DECL_PTR(wxEvtHandler *, wxEvtHandlerArray, class WXDLLIMPEXP_BASE);
// Define an inline method of wxObjectEventFunctor which couldn't be defined
// before wxEvtHandler declaration: at least Sun CC refuses to compile function
// calls through pointer to member for forward-declared classes (see #12452).
inline void wxObjectEventFunctor::operator()(wxEvtHandler *handler, wxEvent& event)
{
wxEvtHandler * const realHandler = m_handler ? m_handler : handler;
(realHandler->*m_method)(event);
}
// ----------------------------------------------------------------------------
// wxEventConnectionRef represents all connections between two event handlers
// and enables automatic disconnect when an event handler sink goes out of
// scope. Each connection/disconnect increases/decreases ref count, and
// when it reaches zero the node goes out of scope.
// ----------------------------------------------------------------------------
class wxEventConnectionRef : public wxTrackerNode
{
public:
wxEventConnectionRef() : m_src(NULL), m_sink(NULL), m_refCount(0) { }
wxEventConnectionRef(wxEvtHandler *src, wxEvtHandler *sink)
: m_src(src), m_sink(sink), m_refCount(1)
{
m_sink->AddNode(this);
}
// The sink is being destroyed
virtual void OnObjectDestroy( ) wxOVERRIDE
{
if ( m_src )
m_src->OnSinkDestroyed( m_sink );
delete this;
}
virtual wxEventConnectionRef *ToEventConnection() wxOVERRIDE { return this; }
void IncRef() { m_refCount++; }
void DecRef()
{
if ( !--m_refCount )
{
// The sink holds the only external pointer to this object
if ( m_sink )
m_sink->RemoveNode(this);
delete this;
}
}
private:
wxEvtHandler *m_src,
*m_sink;
int m_refCount;
friend class wxEvtHandler;
wxDECLARE_NO_ASSIGN_CLASS(wxEventConnectionRef);
};
// Post a message to the given event handler which will be processed during the
// next event loop iteration.
//
// Notice that this one is not thread-safe, use wxQueueEvent()
inline void wxPostEvent(wxEvtHandler *dest, const wxEvent& event)
{
wxCHECK_RET( dest, "need an object to post event to" );
dest->AddPendingEvent(event);
}
// Wrapper around wxEvtHandler::QueueEvent(): adds an event for later
// processing, unlike wxPostEvent it is safe to use from different thread even
// for events with wxString members
inline void wxQueueEvent(wxEvtHandler *dest, wxEvent *event)
{
wxCHECK_RET( dest, "need an object to queue event for" );
dest->QueueEvent(event);
}
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&);
typedef void (wxEvtHandler::*wxThreadEventFunction)(wxThreadEvent&);
#define wxEventHandler(func) \
wxEVENT_HANDLER_CAST(wxEventFunction, func)
#define wxIdleEventHandler(func) \
wxEVENT_HANDLER_CAST(wxIdleEventFunction, func)
#define wxThreadEventHandler(func) \
wxEVENT_HANDLER_CAST(wxThreadEventFunction, func)
#if wxUSE_GUI
// ----------------------------------------------------------------------------
// wxEventBlocker: helper class to temporarily disable event handling for a window
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxEventBlocker : public wxEvtHandler
{
public:
wxEventBlocker(wxWindow *win, wxEventType type = wxEVT_ANY);
virtual ~wxEventBlocker();
void Block(wxEventType type)
{
m_eventsToBlock.push_back(type);
}
virtual bool ProcessEvent(wxEvent& event) wxOVERRIDE;
protected:
wxArrayInt m_eventsToBlock;
wxWindow *m_window;
wxDECLARE_NO_COPY_CLASS(wxEventBlocker);
};
typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&);
typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&);
typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&);
typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&);
typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&);
typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&);
typedef void (wxEvtHandler::*wxNcPaintEventFunction)(wxNcPaintEvent&);
typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&);
typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&);
typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&);
typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&);
typedef void (wxEvtHandler::*wxChildFocusEventFunction)(wxChildFocusEvent&);
typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&);
typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&);
typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&);
typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&);
typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&);
typedef void (wxEvtHandler::*wxSysColourChangedEventFunction)(wxSysColourChangedEvent&);
typedef void (wxEvtHandler::*wxDisplayChangedEventFunction)(wxDisplayChangedEvent&);
typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&);
typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&);
typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&);
typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxMaximizeEvent&);
typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&);
typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&);
typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&);
typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&);
typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&);
typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&);
typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&);
typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&);
typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&);
typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&);
typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&);
typedef void (wxEvtHandler::*wxPanGestureEventFunction)(wxPanGestureEvent&);
typedef void (wxEvtHandler::*wxZoomGestureEventFunction)(wxZoomGestureEvent&);
typedef void (wxEvtHandler::*wxRotateGestureEventFunction)(wxRotateGestureEvent&);
typedef void (wxEvtHandler::*wxTwoFingerTapEventFunction)(wxTwoFingerTapEvent&);
typedef void (wxEvtHandler::*wxLongPressEventFunction)(wxLongPressEvent&);
typedef void (wxEvtHandler::*wxPressAndTapEventFunction)(wxPressAndTapEvent&);
#define wxCommandEventHandler(func) \
wxEVENT_HANDLER_CAST(wxCommandEventFunction, func)
#define wxScrollEventHandler(func) \
wxEVENT_HANDLER_CAST(wxScrollEventFunction, func)
#define wxScrollWinEventHandler(func) \
wxEVENT_HANDLER_CAST(wxScrollWinEventFunction, func)
#define wxSizeEventHandler(func) \
wxEVENT_HANDLER_CAST(wxSizeEventFunction, func)
#define wxMoveEventHandler(func) \
wxEVENT_HANDLER_CAST(wxMoveEventFunction, func)
#define wxPaintEventHandler(func) \
wxEVENT_HANDLER_CAST(wxPaintEventFunction, func)
#define wxNcPaintEventHandler(func) \
wxEVENT_HANDLER_CAST(wxNcPaintEventFunction, func)
#define wxEraseEventHandler(func) \
wxEVENT_HANDLER_CAST(wxEraseEventFunction, func)
#define wxMouseEventHandler(func) \
wxEVENT_HANDLER_CAST(wxMouseEventFunction, func)
#define wxCharEventHandler(func) \
wxEVENT_HANDLER_CAST(wxCharEventFunction, func)
#define wxKeyEventHandler(func) wxCharEventHandler(func)
#define wxFocusEventHandler(func) \
wxEVENT_HANDLER_CAST(wxFocusEventFunction, func)
#define wxChildFocusEventHandler(func) \
wxEVENT_HANDLER_CAST(wxChildFocusEventFunction, func)
#define wxActivateEventHandler(func) \
wxEVENT_HANDLER_CAST(wxActivateEventFunction, func)
#define wxMenuEventHandler(func) \
wxEVENT_HANDLER_CAST(wxMenuEventFunction, func)
#define wxJoystickEventHandler(func) \
wxEVENT_HANDLER_CAST(wxJoystickEventFunction, func)
#define wxDropFilesEventHandler(func) \
wxEVENT_HANDLER_CAST(wxDropFilesEventFunction, func)
#define wxInitDialogEventHandler(func) \
wxEVENT_HANDLER_CAST(wxInitDialogEventFunction, func)
#define wxSysColourChangedEventHandler(func) \
wxEVENT_HANDLER_CAST(wxSysColourChangedEventFunction, func)
#define wxDisplayChangedEventHandler(func) \
wxEVENT_HANDLER_CAST(wxDisplayChangedEventFunction, func)
#define wxUpdateUIEventHandler(func) \
wxEVENT_HANDLER_CAST(wxUpdateUIEventFunction, func)
#define wxCloseEventHandler(func) \
wxEVENT_HANDLER_CAST(wxCloseEventFunction, func)
#define wxShowEventHandler(func) \
wxEVENT_HANDLER_CAST(wxShowEventFunction, func)
#define wxIconizeEventHandler(func) \
wxEVENT_HANDLER_CAST(wxIconizeEventFunction, func)
#define wxMaximizeEventHandler(func) \
wxEVENT_HANDLER_CAST(wxMaximizeEventFunction, func)
#define wxNavigationKeyEventHandler(func) \
wxEVENT_HANDLER_CAST(wxNavigationKeyEventFunction, func)
#define wxPaletteChangedEventHandler(func) \
wxEVENT_HANDLER_CAST(wxPaletteChangedEventFunction, func)
#define wxQueryNewPaletteEventHandler(func) \
wxEVENT_HANDLER_CAST(wxQueryNewPaletteEventFunction, func)
#define wxWindowCreateEventHandler(func) \
wxEVENT_HANDLER_CAST(wxWindowCreateEventFunction, func)
#define wxWindowDestroyEventHandler(func) \
wxEVENT_HANDLER_CAST(wxWindowDestroyEventFunction, func)
#define wxSetCursorEventHandler(func) \
wxEVENT_HANDLER_CAST(wxSetCursorEventFunction, func)
#define wxNotifyEventHandler(func) \
wxEVENT_HANDLER_CAST(wxNotifyEventFunction, func)
#define wxHelpEventHandler(func) \
wxEVENT_HANDLER_CAST(wxHelpEventFunction, func)
#define wxContextMenuEventHandler(func) \
wxEVENT_HANDLER_CAST(wxContextMenuEventFunction, func)
#define wxMouseCaptureChangedEventHandler(func) \
wxEVENT_HANDLER_CAST(wxMouseCaptureChangedEventFunction, func)
#define wxMouseCaptureLostEventHandler(func) \
wxEVENT_HANDLER_CAST(wxMouseCaptureLostEventFunction, func)
#define wxClipboardTextEventHandler(func) \
wxEVENT_HANDLER_CAST(wxClipboardTextEventFunction, func)
#define wxPanGestureEventHandler(func) \
wxEVENT_HANDLER_CAST(wxPanGestureEventFunction, func)
#define wxZoomGestureEventHandler(func) \
wxEVENT_HANDLER_CAST(wxZoomGestureEventFunction, func)
#define wxRotateGestureEventHandler(func) \
wxEVENT_HANDLER_CAST(wxRotateGestureEventFunction, func)
#define wxTwoFingerTapEventHandler(func) \
wxEVENT_HANDLER_CAST(wxTwoFingerTapEventFunction, func)
#define wxLongPressEventHandler(func) \
wxEVENT_HANDLER_CAST(wxLongPressEventFunction, func)
#define wxPressAndTapEventHandler(func) \
wxEVENT_HANDLER_CAST(wxPressAndTapEventFunction, func)
#endif // wxUSE_GUI
// N.B. In GNU-WIN32, you *have* to take the address of a member function
// (use &) or the compiler crashes...
#define wxDECLARE_EVENT_TABLE() \
private: \
static const wxEventTableEntry sm_eventTableEntries[]; \
protected: \
wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) \
const wxEventTable* GetEventTable() const; \
wxEventHashTable& GetEventHashTable() const; \
wxCLANG_WARNING_RESTORE(inconsistent-missing-override) \
static const wxEventTable sm_eventTable; \
static wxEventHashTable sm_eventHashTable
// N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize
// sm_eventTable before using it in GetEventTable() or the compiler gives
// E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews)
#define wxBEGIN_EVENT_TABLE(theClass, baseClass) \
const wxEventTable theClass::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \
const wxEventTable *theClass::GetEventTable() const \
{ return &theClass::sm_eventTable; } \
wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \
wxEventHashTable &theClass::GetEventHashTable() const \
{ return theClass::sm_eventHashTable; } \
const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
#define wxBEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \
template<typename T1> \
const wxEventTable theClass<T1>::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass<T1>::sm_eventTableEntries[0] }; \
template<typename T1> \
const wxEventTable *theClass<T1>::GetEventTable() const \
{ return &theClass<T1>::sm_eventTable; } \
template<typename T1> \
wxEventHashTable theClass<T1>::sm_eventHashTable(theClass<T1>::sm_eventTable); \
template<typename T1> \
wxEventHashTable &theClass<T1>::GetEventHashTable() const \
{ return theClass<T1>::sm_eventHashTable; } \
template<typename T1> \
const wxEventTableEntry theClass<T1>::sm_eventTableEntries[] = { \
#define wxBEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \
template<typename T1, typename T2> \
const wxEventTable theClass<T1, T2>::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass<T1, T2>::sm_eventTableEntries[0] }; \
template<typename T1, typename T2> \
const wxEventTable *theClass<T1, T2>::GetEventTable() const \
{ return &theClass<T1, T2>::sm_eventTable; } \
template<typename T1, typename T2> \
wxEventHashTable theClass<T1, T2>::sm_eventHashTable(theClass<T1, T2>::sm_eventTable); \
template<typename T1, typename T2> \
wxEventHashTable &theClass<T1, T2>::GetEventHashTable() const \
{ return theClass<T1, T2>::sm_eventHashTable; } \
template<typename T1, typename T2> \
const wxEventTableEntry theClass<T1, T2>::sm_eventTableEntries[] = { \
#define wxBEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \
template<typename T1, typename T2, typename T3> \
const wxEventTable theClass<T1, T2, T3>::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass<T1, T2, T3>::sm_eventTableEntries[0] }; \
template<typename T1, typename T2, typename T3> \
const wxEventTable *theClass<T1, T2, T3>::GetEventTable() const \
{ return &theClass<T1, T2, T3>::sm_eventTable; } \
template<typename T1, typename T2, typename T3> \
wxEventHashTable theClass<T1, T2, T3>::sm_eventHashTable(theClass<T1, T2, T3>::sm_eventTable); \
template<typename T1, typename T2, typename T3> \
wxEventHashTable &theClass<T1, T2, T3>::GetEventHashTable() const \
{ return theClass<T1, T2, T3>::sm_eventHashTable; } \
template<typename T1, typename T2, typename T3> \
const wxEventTableEntry theClass<T1, T2, T3>::sm_eventTableEntries[] = { \
#define wxBEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \
template<typename T1, typename T2, typename T3, typename T4> \
const wxEventTable theClass<T1, T2, T3, T4>::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4>::sm_eventTableEntries[0] }; \
template<typename T1, typename T2, typename T3, typename T4> \
const wxEventTable *theClass<T1, T2, T3, T4>::GetEventTable() const \
{ return &theClass<T1, T2, T3, T4>::sm_eventTable; } \
template<typename T1, typename T2, typename T3, typename T4> \
wxEventHashTable theClass<T1, T2, T3, T4>::sm_eventHashTable(theClass<T1, T2, T3, T4>::sm_eventTable); \
template<typename T1, typename T2, typename T3, typename T4> \
wxEventHashTable &theClass<T1, T2, T3, T4>::GetEventHashTable() const \
{ return theClass<T1, T2, T3, T4>::sm_eventHashTable; } \
template<typename T1, typename T2, typename T3, typename T4> \
const wxEventTableEntry theClass<T1, T2, T3, T4>::sm_eventTableEntries[] = { \
#define wxBEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \
template<typename T1, typename T2, typename T3, typename T4, typename T5> \
const wxEventTable theClass<T1, T2, T3, T4, T5>::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[0] }; \
template<typename T1, typename T2, typename T3, typename T4, typename T5> \
const wxEventTable *theClass<T1, T2, T3, T4, T5>::GetEventTable() const \
{ return &theClass<T1, T2, T3, T4, T5>::sm_eventTable; } \
template<typename T1, typename T2, typename T3, typename T4, typename T5> \
wxEventHashTable theClass<T1, T2, T3, T4, T5>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5>::sm_eventTable); \
template<typename T1, typename T2, typename T3, typename T4, typename T5> \
wxEventHashTable &theClass<T1, T2, T3, T4, T5>::GetEventHashTable() const \
{ return theClass<T1, T2, T3, T4, T5>::sm_eventHashTable; } \
template<typename T1, typename T2, typename T3, typename T4, typename T5> \
const wxEventTableEntry theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[] = { \
#define wxBEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[0] }; \
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventTable() const \
{ return &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable; } \
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable); \
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventHashTable() const \
{ return theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable; } \
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[] = { \
#define wxBEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[0] }; \
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventTable() const \
{ return &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable; } \
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable); \
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventHashTable() const \
{ return theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable; } \
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[] = { \
#define wxEND_EVENT_TABLE() \
wxDECLARE_EVENT_TABLE_TERMINATOR() };
/*
* Event table macros
*/
// helpers for writing shorter code below: declare an event macro taking 2, 1
// or none ids (the missing ids default to wxID_ANY)
//
// macro arguments:
// - evt one of wxEVT_XXX constants
// - id1, id2 ids of the first/last id
// - fn the function (should be cast to the right type)
#define wx__DECLARE_EVT2(evt, id1, id2, fn) \
wxDECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL),
#define wx__DECLARE_EVT1(evt, id, fn) \
wx__DECLARE_EVT2(evt, id, wxID_ANY, fn)
#define wx__DECLARE_EVT0(evt, fn) \
wx__DECLARE_EVT1(evt, wxID_ANY, fn)
// Generic events
#define EVT_CUSTOM(event, winid, func) \
wx__DECLARE_EVT1(event, winid, wxEventHandler(func))
#define EVT_CUSTOM_RANGE(event, id1, id2, func) \
wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func))
// EVT_COMMAND
#define EVT_COMMAND(winid, event, func) \
wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func))
#define EVT_COMMAND_RANGE(id1, id2, event, func) \
wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func))
#define EVT_NOTIFY(event, winid, func) \
wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func))
#define EVT_NOTIFY_RANGE(event, id1, id2, func) \
wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func))
// Miscellaneous
#define EVT_SIZE(func) wx__DECLARE_EVT0(wxEVT_SIZE, wxSizeEventHandler(func))
#define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func))
#define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func))
#define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func))
#define EVT_MOVE_START(func) wx__DECLARE_EVT0(wxEVT_MOVE_START, wxMoveEventHandler(func))
#define EVT_MOVE_END(func) wx__DECLARE_EVT0(wxEVT_MOVE_END, wxMoveEventHandler(func))
#define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func))
#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
#define EVT_PAINT(func) wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func))
#define EVT_NC_PAINT(func) wx__DECLARE_EVT0(wxEVT_NC_PAINT, wxNcPaintEventHandler(func))
#define EVT_ERASE_BACKGROUND(func) wx__DECLARE_EVT0(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(func))
#define EVT_CHAR(func) wx__DECLARE_EVT0(wxEVT_CHAR, wxCharEventHandler(func))
#define EVT_KEY_DOWN(func) wx__DECLARE_EVT0(wxEVT_KEY_DOWN, wxKeyEventHandler(func))
#define EVT_KEY_UP(func) wx__DECLARE_EVT0(wxEVT_KEY_UP, wxKeyEventHandler(func))
#if wxUSE_HOTKEY
#define EVT_HOTKEY(winid, func) wx__DECLARE_EVT1(wxEVT_HOTKEY, winid, wxCharEventHandler(func))
#endif
#define EVT_CHAR_HOOK(func) wx__DECLARE_EVT0(wxEVT_CHAR_HOOK, wxCharEventHandler(func))
#define EVT_MENU_OPEN(func) wx__DECLARE_EVT0(wxEVT_MENU_OPEN, wxMenuEventHandler(func))
#define EVT_MENU_CLOSE(func) wx__DECLARE_EVT0(wxEVT_MENU_CLOSE, wxMenuEventHandler(func))
#define EVT_MENU_HIGHLIGHT(winid, func) wx__DECLARE_EVT1(wxEVT_MENU_HIGHLIGHT, winid, wxMenuEventHandler(func))
#define EVT_MENU_HIGHLIGHT_ALL(func) wx__DECLARE_EVT0(wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler(func))
#define EVT_SET_FOCUS(func) wx__DECLARE_EVT0(wxEVT_SET_FOCUS, wxFocusEventHandler(func))
#define EVT_KILL_FOCUS(func) wx__DECLARE_EVT0(wxEVT_KILL_FOCUS, wxFocusEventHandler(func))
#define EVT_CHILD_FOCUS(func) wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func))
#define EVT_ACTIVATE(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func))
#define EVT_ACTIVATE_APP(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func))
#define EVT_HIBERNATE(func) wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func))
#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
#define EVT_DROP_FILES(func) wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func))
#define EVT_INIT_DIALOG(func) wx__DECLARE_EVT0(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(func))
#define EVT_SYS_COLOUR_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(func))
#define EVT_DISPLAY_CHANGED(func) wx__DECLARE_EVT0(wxEVT_DISPLAY_CHANGED, wxDisplayChangedEventHandler(func))
#define EVT_SHOW(func) wx__DECLARE_EVT0(wxEVT_SHOW, wxShowEventHandler(func))
#define EVT_MAXIMIZE(func) wx__DECLARE_EVT0(wxEVT_MAXIMIZE, wxMaximizeEventHandler(func))
#define EVT_ICONIZE(func) wx__DECLARE_EVT0(wxEVT_ICONIZE, wxIconizeEventHandler(func))
#define EVT_NAVIGATION_KEY(func) wx__DECLARE_EVT0(wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(func))
#define EVT_PALETTE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_PALETTE_CHANGED, wxPaletteChangedEventHandler(func))
#define EVT_QUERY_NEW_PALETTE(func) wx__DECLARE_EVT0(wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEventHandler(func))
#define EVT_WINDOW_CREATE(func) wx__DECLARE_EVT0(wxEVT_CREATE, wxWindowCreateEventHandler(func))
#define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func))
#define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func))
#define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func))
#define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func))
// Mouse events
#define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func))
#define EVT_LEFT_UP(func) wx__DECLARE_EVT0(wxEVT_LEFT_UP, wxMouseEventHandler(func))
#define EVT_MIDDLE_DOWN(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(func))
#define EVT_MIDDLE_UP(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_UP, wxMouseEventHandler(func))
#define EVT_RIGHT_DOWN(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DOWN, wxMouseEventHandler(func))
#define EVT_RIGHT_UP(func) wx__DECLARE_EVT0(wxEVT_RIGHT_UP, wxMouseEventHandler(func))
#define EVT_MOTION(func) wx__DECLARE_EVT0(wxEVT_MOTION, wxMouseEventHandler(func))
#define EVT_LEFT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_LEFT_DCLICK, wxMouseEventHandler(func))
#define EVT_MIDDLE_DCLICK(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler(func))
#define EVT_RIGHT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(func))
#define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func))
#define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func))
#define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func))
#define EVT_MOUSE_AUX1_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX1_DOWN, wxMouseEventHandler(func))
#define EVT_MOUSE_AUX1_UP(func) wx__DECLARE_EVT0(wxEVT_AUX1_UP, wxMouseEventHandler(func))
#define EVT_MOUSE_AUX1_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX1_DCLICK, wxMouseEventHandler(func))
#define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func))
#define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func))
#define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func))
#define EVT_MAGNIFY(func) wx__DECLARE_EVT0(wxEVT_MAGNIFY, wxMouseEventHandler(func))
// All mouse events
#define EVT_MOUSE_EVENTS(func) \
EVT_LEFT_DOWN(func) \
EVT_LEFT_UP(func) \
EVT_LEFT_DCLICK(func) \
EVT_MIDDLE_DOWN(func) \
EVT_MIDDLE_UP(func) \
EVT_MIDDLE_DCLICK(func) \
EVT_RIGHT_DOWN(func) \
EVT_RIGHT_UP(func) \
EVT_RIGHT_DCLICK(func) \
EVT_MOUSE_AUX1_DOWN(func) \
EVT_MOUSE_AUX1_UP(func) \
EVT_MOUSE_AUX1_DCLICK(func) \
EVT_MOUSE_AUX2_DOWN(func) \
EVT_MOUSE_AUX2_UP(func) \
EVT_MOUSE_AUX2_DCLICK(func) \
EVT_MOTION(func) \
EVT_LEAVE_WINDOW(func) \
EVT_ENTER_WINDOW(func) \
EVT_MOUSEWHEEL(func) \
EVT_MAGNIFY(func)
// Scrolling from wxWindow (sent to wxScrolledWindow)
#define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func))
#define EVT_SCROLLWIN_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(func))
#define EVT_SCROLLWIN_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(func))
#define EVT_SCROLLWIN_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(func))
#define EVT_SCROLLWIN_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(func))
#define EVT_SCROLLWIN_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(func))
#define EVT_SCROLLWIN_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(func))
#define EVT_SCROLLWIN_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(func))
#define EVT_SCROLLWIN(func) \
EVT_SCROLLWIN_TOP(func) \
EVT_SCROLLWIN_BOTTOM(func) \
EVT_SCROLLWIN_LINEUP(func) \
EVT_SCROLLWIN_LINEDOWN(func) \
EVT_SCROLLWIN_PAGEUP(func) \
EVT_SCROLLWIN_PAGEDOWN(func) \
EVT_SCROLLWIN_THUMBTRACK(func) \
EVT_SCROLLWIN_THUMBRELEASE(func)
// Scrolling from wxSlider and wxScrollBar
#define EVT_SCROLL_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_TOP, wxScrollEventHandler(func))
#define EVT_SCROLL_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(func))
#define EVT_SCROLL_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(func))
#define EVT_SCROLL_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(func))
#define EVT_SCROLL_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(func))
#define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func))
#define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func))
#define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func))
#define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func))
#define EVT_SCROLL(func) \
EVT_SCROLL_TOP(func) \
EVT_SCROLL_BOTTOM(func) \
EVT_SCROLL_LINEUP(func) \
EVT_SCROLL_LINEDOWN(func) \
EVT_SCROLL_PAGEUP(func) \
EVT_SCROLL_PAGEDOWN(func) \
EVT_SCROLL_THUMBTRACK(func) \
EVT_SCROLL_THUMBRELEASE(func) \
EVT_SCROLL_CHANGED(func)
// Scrolling from wxSlider and wxScrollBar, with an id
#define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func))
#define EVT_COMMAND_SCROLL_BOTTOM(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_BOTTOM, winid, wxScrollEventHandler(func))
#define EVT_COMMAND_SCROLL_LINEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxScrollEventHandler(func))
#define EVT_COMMAND_SCROLL_LINEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxScrollEventHandler(func))
#define EVT_COMMAND_SCROLL_PAGEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEUP, winid, wxScrollEventHandler(func))
#define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func))
#define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func))
#define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func))
#define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func))
#define EVT_COMMAND_SCROLL(winid, func) \
EVT_COMMAND_SCROLL_TOP(winid, func) \
EVT_COMMAND_SCROLL_BOTTOM(winid, func) \
EVT_COMMAND_SCROLL_LINEUP(winid, func) \
EVT_COMMAND_SCROLL_LINEDOWN(winid, func) \
EVT_COMMAND_SCROLL_PAGEUP(winid, func) \
EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \
EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \
EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \
EVT_COMMAND_SCROLL_CHANGED(winid, func)
// Gesture events
#define EVT_GESTURE_PAN(winid, func) wx__DECLARE_EVT1(wxEVT_GESTURE_PAN, winid, wxPanGestureEventHandler(func))
#define EVT_GESTURE_ZOOM(winid, func) wx__DECLARE_EVT1(wxEVT_GESTURE_ZOOM, winid, wxZoomGestureEventHandler(func))
#define EVT_GESTURE_ROTATE(winid, func) wx__DECLARE_EVT1(wxEVT_GESTURE_ROTATE, winid, wxRotateGestureEventHandler(func))
#define EVT_TWO_FINGER_TAP(winid, func) wx__DECLARE_EVT1(wxEVT_TWO_FINGER_TAP, winid, wxTwoFingerTapEventHandler(func))
#define EVT_LONG_PRESS(winid, func) wx__DECLARE_EVT1(wxEVT_LONG_PRESS, winid, wxLongPressEventHandler(func))
#define EVT_PRESS_AND_TAP(winid, func) wx__DECLARE_EVT1(wxEVT_PRESS_AND_TAP, winid, wxPressAndTapEvent(func))
// Convenience macros for commonly-used commands
#define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_CHECKBOX, winid, wxCommandEventHandler(func))
#define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_CHOICE, winid, wxCommandEventHandler(func))
#define EVT_LISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_LISTBOX, winid, wxCommandEventHandler(func))
#define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_LISTBOX_DCLICK, winid, wxCommandEventHandler(func))
#define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_MENU, winid, wxCommandEventHandler(func))
#define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_MENU, id1, id2, wxCommandEventHandler(func))
#define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_BUTTON, winid, wxCommandEventHandler(func))
#define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_SLIDER, winid, wxCommandEventHandler(func))
#define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_RADIOBOX, winid, wxCommandEventHandler(func))
#define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_RADIOBUTTON, winid, wxCommandEventHandler(func))
// EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events
#define EVT_SCROLLBAR(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLLBAR, winid, wxCommandEventHandler(func))
#define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_VLBOX, winid, wxCommandEventHandler(func))
#define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX, winid, wxCommandEventHandler(func))
#define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL, winid, wxCommandEventHandler(func))
#define EVT_TOOL_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_DROPDOWN, winid, wxCommandEventHandler(func))
#define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_TOOL, id1, id2, wxCommandEventHandler(func))
#define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_RCLICKED, winid, wxCommandEventHandler(func))
#define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func))
#define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_ENTER, winid, wxCommandEventHandler(func))
#define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_CHECKLISTBOX, winid, wxCommandEventHandler(func))
#define EVT_COMBOBOX_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX_DROPDOWN, winid, wxCommandEventHandler(func))
#define EVT_COMBOBOX_CLOSEUP(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX_CLOSEUP, winid, wxCommandEventHandler(func))
// Generic command events
#define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func))
#define EVT_COMMAND_LEFT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_DCLICK, winid, wxCommandEventHandler(func))
#define EVT_COMMAND_RIGHT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_CLICK, winid, wxCommandEventHandler(func))
#define EVT_COMMAND_RIGHT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_DCLICK, winid, wxCommandEventHandler(func))
#define EVT_COMMAND_SET_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SET_FOCUS, winid, wxCommandEventHandler(func))
#define EVT_COMMAND_KILL_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_KILL_FOCUS, winid, wxCommandEventHandler(func))
#define EVT_COMMAND_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_ENTER, winid, wxCommandEventHandler(func))
// Joystick events
#define EVT_JOY_BUTTON_DOWN(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_DOWN, wxJoystickEventHandler(func))
#define EVT_JOY_BUTTON_UP(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_UP, wxJoystickEventHandler(func))
#define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func))
#define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func))
// All joystick events
#define EVT_JOYSTICK_EVENTS(func) \
EVT_JOY_BUTTON_DOWN(func) \
EVT_JOY_BUTTON_UP(func) \
EVT_JOY_MOVE(func) \
EVT_JOY_ZMOVE(func)
// Idle event
#define EVT_IDLE(func) wx__DECLARE_EVT0(wxEVT_IDLE, wxIdleEventHandler(func))
// Update UI event
#define EVT_UPDATE_UI(winid, func) wx__DECLARE_EVT1(wxEVT_UPDATE_UI, winid, wxUpdateUIEventHandler(func))
#define EVT_UPDATE_UI_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_UPDATE_UI, id1, id2, wxUpdateUIEventHandler(func))
// Help events
#define EVT_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_HELP, winid, wxHelpEventHandler(func))
#define EVT_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_HELP, id1, id2, wxHelpEventHandler(func))
#define EVT_DETAILED_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_DETAILED_HELP, winid, wxHelpEventHandler(func))
#define EVT_DETAILED_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_DETAILED_HELP, id1, id2, wxHelpEventHandler(func))
// Context Menu Events
#define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func))
#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func))
// Clipboard text Events
#define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_CUT, winid, wxClipboardTextEventHandler(func))
#define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_COPY, winid, wxClipboardTextEventHandler(func))
#define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_PASTE, winid, wxClipboardTextEventHandler(func))
// Thread events
#define EVT_THREAD(id, func) wx__DECLARE_EVT1(wxEVT_THREAD, id, wxThreadEventHandler(func))
// ----------------------------------------------------------------------------
// Helper functions
// ----------------------------------------------------------------------------
#if wxUSE_GUI
// Find a window with the focus, that is also a descendant of the given window.
// This is used to determine the window to initially send commands to.
WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor);
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// Compatibility macro aliases
// ----------------------------------------------------------------------------
// deprecated variants _not_ requiring a semicolon after them and without wx prefix
// (note that also some wx-prefixed macro do _not_ require a semicolon because
// it's not always possible to force the compiler to require it)
#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj)
#define DECLARE_EVENT_TABLE_TERMINATOR() wxDECLARE_EVENT_TABLE_TERMINATOR()
#define DECLARE_EVENT_TABLE() wxDECLARE_EVENT_TABLE();
#define BEGIN_EVENT_TABLE(a,b) wxBEGIN_EVENT_TABLE(a,b)
#define BEGIN_EVENT_TABLE_TEMPLATE1(a,b,c) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c)
#define BEGIN_EVENT_TABLE_TEMPLATE2(a,b,c,d) wxBEGIN_EVENT_TABLE_TEMPLATE2(a,b,c,d)
#define BEGIN_EVENT_TABLE_TEMPLATE3(a,b,c,d,e) wxBEGIN_EVENT_TABLE_TEMPLATE3(a,b,c,d,e)
#define BEGIN_EVENT_TABLE_TEMPLATE4(a,b,c,d,e,f) wxBEGIN_EVENT_TABLE_TEMPLATE4(a,b,c,d,e,f)
#define BEGIN_EVENT_TABLE_TEMPLATE5(a,b,c,d,e,f,g) wxBEGIN_EVENT_TABLE_TEMPLATE5(a,b,c,d,e,f,g)
#define BEGIN_EVENT_TABLE_TEMPLATE6(a,b,c,d,e,f,g,h) wxBEGIN_EVENT_TABLE_TEMPLATE6(a,b,c,d,e,f,g,h)
#define END_EVENT_TABLE() wxEND_EVENT_TABLE()
// other obsolete event declaration/definition macros; we don't need them any longer
// but we keep them for compatibility as it doesn't cost us anything anyhow
#define BEGIN_DECLARE_EVENT_TYPES()
#define END_DECLARE_EVENT_TYPES()
#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \
extern expdecl const wxEventType name;
#define DECLARE_EVENT_TYPE(name, value) \
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value)
#define DECLARE_LOCAL_EVENT_TYPE(name, value) \
DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value)
#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name)
// alias for backward compatibility with 2.9.0:
#define wxEVT_COMMAND_THREAD wxEVT_THREAD
// other old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_BUTTON_CLICKED wxEVT_BUTTON
#define wxEVT_COMMAND_CHECKBOX_CLICKED wxEVT_CHECKBOX
#define wxEVT_COMMAND_CHOICE_SELECTED wxEVT_CHOICE
#define wxEVT_COMMAND_LISTBOX_SELECTED wxEVT_LISTBOX
#define wxEVT_COMMAND_LISTBOX_DOUBLECLICKED wxEVT_LISTBOX_DCLICK
#define wxEVT_COMMAND_CHECKLISTBOX_TOGGLED wxEVT_CHECKLISTBOX
#define wxEVT_COMMAND_MENU_SELECTED wxEVT_MENU
#define wxEVT_COMMAND_TOOL_CLICKED wxEVT_TOOL
#define wxEVT_COMMAND_SLIDER_UPDATED wxEVT_SLIDER
#define wxEVT_COMMAND_RADIOBOX_SELECTED wxEVT_RADIOBOX
#define wxEVT_COMMAND_RADIOBUTTON_SELECTED wxEVT_RADIOBUTTON
#define wxEVT_COMMAND_SCROLLBAR_UPDATED wxEVT_SCROLLBAR
#define wxEVT_COMMAND_VLBOX_SELECTED wxEVT_VLBOX
#define wxEVT_COMMAND_COMBOBOX_SELECTED wxEVT_COMBOBOX
#define wxEVT_COMMAND_TOOL_RCLICKED wxEVT_TOOL_RCLICKED
#define wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED wxEVT_TOOL_DROPDOWN
#define wxEVT_COMMAND_TOOL_ENTER wxEVT_TOOL_ENTER
#define wxEVT_COMMAND_COMBOBOX_DROPDOWN wxEVT_COMBOBOX_DROPDOWN
#define wxEVT_COMMAND_COMBOBOX_CLOSEUP wxEVT_COMBOBOX_CLOSEUP
#define wxEVT_COMMAND_TEXT_COPY wxEVT_TEXT_COPY
#define wxEVT_COMMAND_TEXT_CUT wxEVT_TEXT_CUT
#define wxEVT_COMMAND_TEXT_PASTE wxEVT_TEXT_PASTE
#define wxEVT_COMMAND_TEXT_UPDATED wxEVT_TEXT
#endif // _WX_EVENT_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/catch_cppunit.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/catch_cppunit.h
// Purpose: Reimplementation of CppUnit macros in terms of CATCH
// Author: Vadim Zeitlin
// Created: 2017-10-30
// Copyright: (c) 2017 Vadim Zeitlin <[email protected]>
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CATCH_CPPUNIT_H_
#define _WX_CATCH_CPPUNIT_H_
#include "catch.hpp"
// CppUnit-compatible macros.
// CPPUNIT_ASSERTs are mapped to REQUIRE(), not CHECK(), as this is how CppUnit
// works but in many cases they really should be CHECK()s instead, i.e. the
// test should continue to run even if one assert failed. Unfortunately there
// is no automatic way to know it, so the existing code will need to be
// reviewed and CHECK() used explicitly where appropriate.
//
// Also notice that we don't use parentheses around x and y macro arguments in
// the macro expansion, as usual. This is because these parentheses would then
// appear in CATCH error messages if the assertion fails, making them much less
// readable and omitting should be fine here, exceptionally, as the arguments
// of these macros are usually just simple expressions.
#define CPPUNIT_ASSERT(cond) REQUIRE(cond)
#define CPPUNIT_ASSERT_EQUAL(x, y) REQUIRE(x == y)
// Using INFO() disallows putting more than one of these macros on the same
// line but this can happen if they're used inside another macro, so wrap it
// inside a scope.
#define CPPUNIT_ASSERT_MESSAGE(msg, cond) \
do { INFO(msg); REQUIRE(cond); } while (Catch::alwaysFalse())
#define CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, x, y) \
do { INFO(msg); REQUIRE(x == y); } while (Catch::alwaysFalse())
// CATCH Approx class uses the upper bound of "epsilon*(scale + max(|x|, |y|))"
// for |x - y| which is not really compatible with our fixed delta, so we can't
// use it here.
#define CPPUNIT_ASSERT_DOUBLES_EQUAL(x, y, delta) \
REQUIRE(std::abs(x - y) < delta)
#define CPPUNIT_FAIL(msg) FAIL(msg)
#define CPPUNIT_ASSERT_THROW(expr, exception) \
try \
{ \
expr; \
FAIL("Expected exception of type " #exception \
" not thrown by " #expr); \
} \
catch ( exception& ) {}
// Define conversions to strings for some common wxWidgets types.
namespace Catch
{
template <>
struct StringMaker<wxUniChar>
{
static std::string convert(wxUniChar uc)
{
return wxString(uc).ToStdString(wxConvUTF8);
}
};
template <>
struct StringMaker<wxUniCharRef>
{
static std::string convert(wxUniCharRef ucr)
{
return wxString(ucr).ToStdString(wxConvUTF8);
}
};
// While this conversion already works due to the existence of the stream
// insertion operator for wxString, define a custom one making it more
// obvious when strings containing non-printable characters differ.
template <>
struct StringMaker<wxString>
{
static std::string convert(const wxString& wxs)
{
std::string s;
s.reserve(wxs.length());
for ( wxString::const_iterator i = wxs.begin();
i != wxs.end();
++i )
{
#if wxUSE_UNICODE
if ( !iswprint(*i) )
s += wxString::Format("\\u%04X", *i).ToStdString();
else
#endif // wxUSE_UNICODE
s += *i;
}
return s;
}
};
}
// Use a different namespace for our mock ups of the real declarations in
// CppUnit namespace to avoid clashes if we end up being linked with the real
// CppUnit library, but bring it into scope with a using directive below to
// make it possible to compile the original code using CppUnit unmodified.
namespace CatchCppUnit
{
namespace CppUnit
{
// These classes don't really correspond to the real CppUnit ones, but contain
// just the minimum we need to make CPPUNIT_TEST() macro and our mock up of
// TestSuite class work.
class Test
{
public:
// Name argument exists only for compatibility with the real CppUnit but is
// not used here.
explicit Test(const std::string& name = std::string()) : m_name(name) { }
virtual ~Test() { }
virtual void runTest() = 0;
const std::string& getName() const { return m_name; }
private:
std::string m_name;
};
class TestCase : public Test
{
public:
explicit TestCase(const std::string& name = std::string()) : Test(name) { }
virtual void setUp() {}
virtual void tearDown() {}
};
class TestSuite : public Test
{
public:
explicit TestSuite(const std::string& name = std::string()) : Test(name) { }
~TestSuite()
{
for ( size_t n = 0; n < m_tests.size(); ++n )
{
delete m_tests[n];
}
}
void addTest(Test* test) { m_tests.push_back(test); }
size_t getChildTestCount() const { return m_tests.size(); }
void runTest() wxOVERRIDE
{
for ( size_t n = 0; n < m_tests.size(); ++n )
{
m_tests[n]->runTest();
}
}
private:
std::vector<Test*> m_tests;
wxDECLARE_NO_COPY_CLASS(TestSuite);
};
} // namespace CppUnit
} // namespace CatchCppUnit
using namespace CatchCppUnit;
// Helpers used in the implementation of the macros below.
namespace wxPrivate
{
// An object which resets a string to its old value when going out of scope.
class TempStringAssign
{
public:
explicit TempStringAssign(std::string& str, const char* value)
: m_str(str),
m_orig(str)
{
str = value;
}
~TempStringAssign()
{
m_str = m_orig;
}
private:
std::string& m_str;
const std::string m_orig;
wxDECLARE_NO_COPY_CLASS(TempStringAssign);
};
// These two strings are used to implement wxGetCurrentTestName() and must be
// defined in the test driver.
extern std::string wxTheCurrentTestClass, wxTheCurrentTestMethod;
} // namespace wxPrivate
inline std::string wxGetCurrentTestName()
{
std::string s = wxPrivate::wxTheCurrentTestClass;
if ( !s.empty() && !wxPrivate::wxTheCurrentTestMethod.empty() )
s += "::";
s += wxPrivate::wxTheCurrentTestMethod;
return s;
}
// Notice that the use of this macro unconditionally changes the protection for
// everything that follows it to "public". This is necessary to allow taking
// the address of the runTest() method in CPPUNIT_TEST_SUITE_REGISTRATION()
// below and there just doesn't seem to be any way around it.
#define CPPUNIT_TEST_SUITE(testclass) \
public: \
void runTest() wxOVERRIDE \
{ \
using namespace wxPrivate; \
TempStringAssign setClass(wxTheCurrentTestClass, #testclass)
#define CPPUNIT_TEST(testname) \
SECTION(#testname) \
{ \
TempStringAssign setMethod(wxTheCurrentTestMethod, #testname); \
setUp(); \
try \
{ \
testname(); \
} \
catch ( ... ) \
{ \
tearDown(); \
throw; \
} \
tearDown(); \
}
#define CPPUNIT_TEST_SUITE_END() \
} \
struct EatNextSemicolon
#define wxREGISTER_UNIT_TEST_WITH_TAGS(testclass, tags) \
METHOD_AS_TEST_CASE(testclass::runTest, #testclass, tags) \
struct EatNextSemicolon
#define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(testclass, suitename) \
wxREGISTER_UNIT_TEST_WITH_TAGS(testclass, "[" suitename "]")
// Existings tests always use both this macro and the named registration one
// above, but we can't register the same test case twice with CATCH, so simply
// ignore this one.
#define CPPUNIT_TEST_SUITE_REGISTRATION(testclass) \
struct EatNextSemicolon
// ----------------------------------------------------------------------------
// wxWidgets-specific macros
// ----------------------------------------------------------------------------
// Convenient variant of INFO() which uses wxString::Format() internally.
#define wxINFO_FMT_HELPER(fmt, ...) \
wxString::Format(fmt, __VA_ARGS__).ToStdString(wxConvUTF8)
#define wxINFO_FMT(...) INFO(wxINFO_FMT_HELPER(__VA_ARGS__))
// Use this macro to assert with the given formatted message (it should contain
// the format string and arguments in a separate pair of parentheses)
#define WX_ASSERT_MESSAGE(msg, cond) \
CPPUNIT_ASSERT_MESSAGE(std::string(wxString::Format msg .mb_str()), (cond))
#define WX_ASSERT_EQUAL_MESSAGE(msg, expected, actual) \
CPPUNIT_ASSERT_EQUAL_MESSAGE(std::string(wxString::Format msg .mb_str()), \
(expected), (actual))
#endif // _WX_CATCH_CPPUNIT_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/panel.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/panel.h
// Purpose: Base header for wxPanel
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// (c) 2011 Vadim Zeitlin <[email protected]>
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PANEL_H_BASE_
#define _WX_PANEL_H_BASE_
// ----------------------------------------------------------------------------
// headers and forward declarations
// ----------------------------------------------------------------------------
#include "wx/window.h"
#include "wx/containr.h"
class WXDLLIMPEXP_FWD_CORE wxControlContainer;
extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[];
// ----------------------------------------------------------------------------
// wxPanel contains other controls and implements TAB traversal between them
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPanelBase : public wxNavigationEnabled<wxWindow>
{
public:
wxPanelBase() { }
// Derived classes should also provide this constructor:
/*
wxPanelBase(wxWindow *parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
const wxString& name = wxPanelNameStr);
*/
// Pseudo ctor
bool Create(wxWindow *parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
const wxString& name = wxPanelNameStr);
// implementation from now on
// --------------------------
virtual void InitDialog() wxOVERRIDE;
private:
wxDECLARE_NO_COPY_CLASS(wxPanelBase);
};
#if defined(__WXUNIVERSAL__)
#include "wx/univ/panel.h"
#elif defined(__WXMSW__)
#include "wx/msw/panel.h"
#else
#define wxHAS_GENERIC_PANEL
#include "wx/generic/panelg.h"
#endif
#endif // _WX_PANELH_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/object.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/object.h
// Purpose: wxObject class, plus run-time type information macros
// Author: Julian Smart
// Modified by: Ron Lee
// Created: 01/02/97
// Copyright: (c) 1997 Julian Smart
// (c) 2001 Ron Lee <[email protected]>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_OBJECTH__
#define _WX_OBJECTH__
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/memory.h"
#define wxDECLARE_CLASS_INFO_ITERATORS() \
class WXDLLIMPEXP_BASE const_iterator \
{ \
typedef wxHashTable_Node Node; \
public: \
typedef const wxClassInfo* value_type; \
typedef const value_type& const_reference; \
typedef const_iterator itor; \
typedef value_type* ptr_type; \
\
Node* m_node; \
wxHashTable* m_table; \
public: \
typedef const_reference reference_type; \
typedef ptr_type pointer_type; \
\
const_iterator(Node* node, wxHashTable* table) \
: m_node(node), m_table(table) { } \
const_iterator() : m_node(NULL), m_table(NULL) { } \
value_type operator*() const; \
itor& operator++(); \
const itor operator++(int); \
bool operator!=(const itor& it) const \
{ return it.m_node != m_node; } \
bool operator==(const itor& it) const \
{ return it.m_node == m_node; } \
}; \
\
static const_iterator begin_classinfo(); \
static const_iterator end_classinfo()
// based on the value of wxUSE_EXTENDED_RTTI symbol,
// only one of the RTTI system will be compiled:
// - the "old" one (defined by rtti.h) or
// - the "new" one (defined by xti.h)
#include "wx/xti.h"
#include "wx/rtti.h"
#define wxIMPLEMENT_CLASS(name, basename) \
wxIMPLEMENT_ABSTRACT_CLASS(name, basename)
#define wxIMPLEMENT_CLASS2(name, basename1, basename2) \
wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2)
// -----------------------------------
// for pluggable classes
// -----------------------------------
// NOTE: this should probably be the very first statement
// in the class declaration so wxPluginSentinel is
// the first member initialised and the last destroyed.
// _DECLARE_DL_SENTINEL(name) wxPluginSentinel m_pluginsentinel;
#if wxUSE_NESTED_CLASSES
#define _DECLARE_DL_SENTINEL(name, exportdecl) \
class exportdecl name##PluginSentinel { \
private: \
static const wxString sm_className; \
public: \
name##PluginSentinel(); \
~name##PluginSentinel(); \
}; \
name##PluginSentinel m_pluginsentinel
#define _IMPLEMENT_DL_SENTINEL(name) \
const wxString name::name##PluginSentinel::sm_className(#name); \
name::name##PluginSentinel::name##PluginSentinel() { \
wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \
if( e != 0 ) { e->RefObj(); } \
} \
name::name##PluginSentinel::~name##PluginSentinel() { \
wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \
if( e != 0 ) { e->UnrefObj(); } \
}
#else
#define _DECLARE_DL_SENTINEL(name)
#define _IMPLEMENT_DL_SENTINEL(name)
#endif // wxUSE_NESTED_CLASSES
#define wxDECLARE_PLUGGABLE_CLASS(name) \
wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE)
#define wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \
wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE)
#define wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \
wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo)
#define wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \
wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo)
#define wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) \
wxIMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name)
#define wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \
wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name)
#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \
wxIMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name)
#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \
wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name)
#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \
wxIMPLEMENT_PLUGGABLE_CLASS(name, basename)
#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \
wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2)
#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \
wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename)
#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \
wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2)
#define wxCLASSINFO(name) (&name::ms_classInfo)
#define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo)
// Just seems a bit nicer-looking (pretend it's not a macro)
#define wxIsKindOf(obj, className) obj->IsKindOf(&className::ms_classInfo)
// this cast does some more checks at compile time as it uses static_cast
// internally
//
// note that it still has different semantics from dynamic_cast<> and so can't
// be replaced by it as long as there are any compilers not supporting it
#define wxDynamicCast(obj, className) \
((className *) wxCheckDynamicCast( \
const_cast<wxObject *>(static_cast<const wxObject *>(\
const_cast<className *>(static_cast<const className *>(obj)))), \
&className::ms_classInfo))
// The 'this' pointer is always true, so use this version
// to cast the this pointer and avoid compiler warnings.
#define wxDynamicCastThis(className) \
(IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0)
template <class T>
inline T *wxCheckCast(const void *ptr)
{
wxASSERT_MSG( wxDynamicCast(ptr, T), "wxStaticCast() used incorrectly" );
return const_cast<T *>(static_cast<const T *>(ptr));
}
#define wxStaticCast(obj, className) wxCheckCast<className>(obj)
// ----------------------------------------------------------------------------
// set up memory debugging macros
// ----------------------------------------------------------------------------
/*
Which new/delete operator variants do we want?
_WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0)
_WX_WANT_DELETE_VOID = void operator delete (void * buf)
_WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int)
_WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0)
_WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf)
_WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int )
*/
#if wxUSE_MEMORY_TRACING
// All compilers get these ones
#define _WX_WANT_NEW_SIZET_WXCHAR_INT
#define _WX_WANT_DELETE_VOID
#if defined(__VISUALC__)
#define _WX_WANT_DELETE_VOID_WXCHAR_INT
#endif
// Now see who (if anyone) gets the array memory operators
#if wxUSE_ARRAY_MEMORY_OPERATORS
// Everyone except Visual C++ (cause problems for VC++ - crashes)
#if !defined(__VISUALC__)
#define _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT
#endif
// Everyone except Visual C++ (cause problems for VC++ - crashes)
#if !defined(__VISUALC__)
#define _WX_WANT_ARRAY_DELETE_VOID
#endif
#endif // wxUSE_ARRAY_MEMORY_OPERATORS
#endif // wxUSE_MEMORY_TRACING
// ----------------------------------------------------------------------------
// Compatibility macro aliases DECLARE group
// ----------------------------------------------------------------------------
// deprecated variants _not_ requiring a semicolon after them and without wx prefix.
// (note that also some wx-prefixed macro do _not_ require a semicolon because
// it's not always possible to force the compiler to require it)
#define DECLARE_CLASS_INFO_ITERATORS() wxDECLARE_CLASS_INFO_ITERATORS();
#define DECLARE_ABSTRACT_CLASS(n) wxDECLARE_ABSTRACT_CLASS(n);
#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(n) wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(n);
#define DECLARE_DYNAMIC_CLASS_NO_COPY(n) wxDECLARE_DYNAMIC_CLASS_NO_COPY(n);
#define DECLARE_DYNAMIC_CLASS(n) wxDECLARE_DYNAMIC_CLASS(n);
#define DECLARE_CLASS(n) wxDECLARE_CLASS(n);
#define DECLARE_PLUGGABLE_CLASS(n) wxDECLARE_PLUGGABLE_CLASS(n);
#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(n) wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(n);
#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u);
#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u);
// ----------------------------------------------------------------------------
// wxRefCounter: ref counted data "manager"
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxRefCounter
{
public:
wxRefCounter() { m_count = 1; }
int GetRefCount() const { return m_count; }
void IncRef() { m_count++; }
void DecRef();
protected:
// this object should never be destroyed directly but only as a
// result of a DecRef() call:
virtual ~wxRefCounter() { }
private:
// our refcount:
int m_count;
// It doesn't make sense to copy the reference counted objects, a new ref
// counter should be created for a new object instead and compilation
// errors in the code using wxRefCounter due to the lack of copy ctor often
// indicate a problem, e.g. a forgotten copy ctor implementation somewhere.
wxDECLARE_NO_COPY_CLASS(wxRefCounter);
};
// ----------------------------------------------------------------------------
// wxObjectRefData: ref counted data meant to be stored in wxObject
// ----------------------------------------------------------------------------
typedef wxRefCounter wxObjectRefData;
// ----------------------------------------------------------------------------
// wxObjectDataPtr: helper class to avoid memleaks because of missing calls
// to wxObjectRefData::DecRef
// ----------------------------------------------------------------------------
template <class T>
class wxObjectDataPtr
{
public:
typedef T element_type;
explicit wxObjectDataPtr(T *ptr = NULL) : m_ptr(ptr) {}
// copy ctor
wxObjectDataPtr(const wxObjectDataPtr<T> &tocopy)
: m_ptr(tocopy.m_ptr)
{
if (m_ptr)
m_ptr->IncRef();
}
~wxObjectDataPtr()
{
if (m_ptr)
m_ptr->DecRef();
}
T *get() const { return m_ptr; }
// test for pointer validity: defining conversion to unspecified_bool_type
// and not more obvious bool to avoid implicit conversions to integer types
typedef T *(wxObjectDataPtr<T>::*unspecified_bool_type)() const;
operator unspecified_bool_type() const
{
return m_ptr ? &wxObjectDataPtr<T>::get : NULL;
}
T& operator*() const
{
wxASSERT(m_ptr != NULL);
return *(m_ptr);
}
T *operator->() const
{
wxASSERT(m_ptr != NULL);
return get();
}
void reset(T *ptr)
{
if (m_ptr)
m_ptr->DecRef();
m_ptr = ptr;
}
wxObjectDataPtr& operator=(const wxObjectDataPtr &tocopy)
{
if (m_ptr)
m_ptr->DecRef();
m_ptr = tocopy.m_ptr;
if (m_ptr)
m_ptr->IncRef();
return *this;
}
wxObjectDataPtr& operator=(T *ptr)
{
if (m_ptr)
m_ptr->DecRef();
m_ptr = ptr;
return *this;
}
private:
T *m_ptr;
};
// ----------------------------------------------------------------------------
// wxObject: the root class of wxWidgets object hierarchy
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxObject
{
wxDECLARE_ABSTRACT_CLASS(wxObject);
public:
wxObject() { m_refData = NULL; }
virtual ~wxObject() { UnRef(); }
wxObject(const wxObject& other)
{
m_refData = other.m_refData;
if (m_refData)
m_refData->IncRef();
}
wxObject& operator=(const wxObject& other)
{
if ( this != &other )
{
Ref(other);
}
return *this;
}
bool IsKindOf(const wxClassInfo *info) const;
// Turn on the correct set of new and delete operators
#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT
void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 );
#endif
#ifdef _WX_WANT_DELETE_VOID
void operator delete ( void * buf );
#endif
#ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT
void operator delete ( void *buf, const wxChar*, int );
#endif
#ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT
void *operator new[] ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 );
#endif
#ifdef _WX_WANT_ARRAY_DELETE_VOID
void operator delete[] ( void *buf );
#endif
#ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT
void operator delete[] (void* buf, const wxChar*, int );
#endif
// ref counted data handling methods
// get/set
wxObjectRefData *GetRefData() const { return m_refData; }
void SetRefData(wxObjectRefData *data) { m_refData = data; }
// make a 'clone' of the object
void Ref(const wxObject& clone);
// destroy a reference
void UnRef();
// Make sure this object has only one reference
void UnShare() { AllocExclusive(); }
// check if this object references the same data as the other one
bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; }
protected:
// ensure that our data is not shared with anybody else: if we have no
// data, it is created using CreateRefData() below, if we have shared data
// it is copied using CloneRefData(), otherwise nothing is done
void AllocExclusive();
// both methods must be implemented if AllocExclusive() is used, not pure
// virtual only because of the backwards compatibility reasons
// create a new m_refData
virtual wxObjectRefData *CreateRefData() const;
// create a new m_refData initialized with the given one
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
wxObjectRefData *m_refData;
};
inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo)
{
return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL;
}
#include "wx/xti2.h"
// ----------------------------------------------------------------------------
// more debugging macros
// ----------------------------------------------------------------------------
#if wxUSE_DEBUG_NEW_ALWAYS
#define WXDEBUG_NEW new(__TFILE__,__LINE__)
#if wxUSE_GLOBAL_MEMORY_OPERATORS
#define new WXDEBUG_NEW
#elif defined(__VISUALC__)
// Including this file redefines new and allows leak reports to
// contain line numbers
#include "wx/msw/msvcrt.h"
#endif
#endif // wxUSE_DEBUG_NEW_ALWAYS
// ----------------------------------------------------------------------------
// Compatibility macro aliases IMPLEMENT group
// ----------------------------------------------------------------------------
// deprecated variants _not_ requiring a semicolon after them and without wx prefix.
// (note that also some wx-prefixed macro do _not_ require a semicolon because
// it's not always possible to force the compiler to require it)
#define IMPLEMENT_DYNAMIC_CLASS(n,b) wxIMPLEMENT_DYNAMIC_CLASS(n,b)
#define IMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) wxIMPLEMENT_DYNAMIC_CLASS2(n,b1,b2)
#define IMPLEMENT_ABSTRACT_CLASS(n,b) wxIMPLEMENT_ABSTRACT_CLASS(n,b)
#define IMPLEMENT_ABSTRACT_CLASS2(n,b1,b2) wxIMPLEMENT_ABSTRACT_CLASS2(n,b1,b2)
#define IMPLEMENT_CLASS(n,b) wxIMPLEMENT_CLASS(n,b)
#define IMPLEMENT_CLASS2(n,b1,b2) wxIMPLEMENT_CLASS2(n,b1,b2)
#define IMPLEMENT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_PLUGGABLE_CLASS(n,b)
#define IMPLEMENT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_PLUGGABLE_CLASS2(n,b,b2)
#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b)
#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2)
#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b)
#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2)
#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b)
#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2)
#define CLASSINFO(n) wxCLASSINFO(n)
#endif // _WX_OBJECTH__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/longlong.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/longlong.h
// Purpose: declaration of wxLongLong class - best implementation of a 64
// bit integer for the current platform.
// Author: Jeffrey C. Ollie <[email protected]>, Vadim Zeitlin
// Modified by:
// Created: 10.02.99
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LONGLONG_H
#define _WX_LONGLONG_H
#include "wx/defs.h"
#if wxUSE_LONGLONG
#include "wx/string.h"
#include <limits.h> // for LONG_MAX
// define this to compile wxLongLongWx in "test" mode: the results of all
// calculations will be compared with the real results taken from
// wxLongLongNative -- this is extremely useful to find the bugs in
// wxLongLongWx class!
// #define wxLONGLONG_TEST_MODE
#ifdef wxLONGLONG_TEST_MODE
#define wxUSE_LONGLONG_WX 1
#define wxUSE_LONGLONG_NATIVE 1
#endif // wxLONGLONG_TEST_MODE
// ----------------------------------------------------------------------------
// decide upon which class we will use
// ----------------------------------------------------------------------------
#ifndef wxLongLong_t
// both warning and pragma warning are not portable, but at least an
// unknown pragma should never be an error -- except that, actually, some
// broken compilers don't like it, so we have to disable it in this case
// <sigh>
#ifdef __GNUC__
#warning "Your compiler does not appear to support 64 bit "\
"integers, using emulation class instead.\n" \
"Please report your compiler version to " \
"[email protected]!"
#else
#pragma warning "Your compiler does not appear to support 64 bit "\
"integers, using emulation class instead.\n" \
"Please report your compiler version to " \
"[email protected]!"
#endif
#define wxUSE_LONGLONG_WX 1
#endif // compiler
// the user may predefine wxUSE_LONGLONG_NATIVE and/or wxUSE_LONGLONG_NATIVE
// to disable automatic testing (useful for the test program which defines
// both classes) but by default we only use one class
#if (defined(wxUSE_LONGLONG_WX) && wxUSE_LONGLONG_WX) || !defined(wxLongLong_t)
// don't use both classes unless wxUSE_LONGLONG_NATIVE was explicitly set:
// this is useful in test programs and only there
#ifndef wxUSE_LONGLONG_NATIVE
#define wxUSE_LONGLONG_NATIVE 0
#endif
class WXDLLIMPEXP_FWD_BASE wxLongLongWx;
class WXDLLIMPEXP_FWD_BASE wxULongLongWx;
#if defined(__VISUALC__) && !defined(__WIN32__)
#define wxLongLong wxLongLongWx
#define wxULongLong wxULongLongWx
#else
typedef wxLongLongWx wxLongLong;
typedef wxULongLongWx wxULongLong;
#endif
#else
// if nothing is defined, use native implementation by default, of course
#ifndef wxUSE_LONGLONG_NATIVE
#define wxUSE_LONGLONG_NATIVE 1
#endif
#endif
#ifndef wxUSE_LONGLONG_WX
#define wxUSE_LONGLONG_WX 0
class WXDLLIMPEXP_FWD_BASE wxLongLongNative;
class WXDLLIMPEXP_FWD_BASE wxULongLongNative;
typedef wxLongLongNative wxLongLong;
typedef wxULongLongNative wxULongLong;
#endif
// NB: if both wxUSE_LONGLONG_WX and NATIVE are defined, the user code should
// typedef wxLongLong as it wants, we don't do it
// ----------------------------------------------------------------------------
// choose the appropriate class
// ----------------------------------------------------------------------------
// we use iostream for wxLongLong output
#include "wx/iosfwrap.h"
#if wxUSE_LONGLONG_NATIVE
class WXDLLIMPEXP_BASE wxLongLongNative
{
public:
// ctors
// default ctor initializes to 0
wxLongLongNative() : m_ll(0) { }
// from long long
wxLongLongNative(wxLongLong_t ll) : m_ll(ll) { }
// from 2 longs
wxLongLongNative(wxInt32 hi, wxUint32 lo)
{
// cast to wxLongLong_t first to avoid precision loss!
m_ll = ((wxLongLong_t) hi) << 32;
m_ll |= (wxLongLong_t) lo;
}
#if wxUSE_LONGLONG_WX
wxLongLongNative(wxLongLongWx ll);
#endif
// default copy ctor is ok
// no dtor
// assignment operators
// from native 64 bit integer
#ifndef wxLongLongIsLong
wxLongLongNative& operator=(wxLongLong_t ll)
{ m_ll = ll; return *this; }
wxLongLongNative& operator=(wxULongLong_t ll)
{ m_ll = ll; return *this; }
#endif // !wxLongLongNative
wxLongLongNative& operator=(const wxULongLongNative &ll);
wxLongLongNative& operator=(int l)
{ m_ll = l; return *this; }
wxLongLongNative& operator=(long l)
{ m_ll = l; return *this; }
wxLongLongNative& operator=(unsigned int l)
{ m_ll = l; return *this; }
wxLongLongNative& operator=(unsigned long l)
{ m_ll = l; return *this; }
#if wxUSE_LONGLONG_WX
wxLongLongNative& operator=(wxLongLongWx ll);
wxLongLongNative& operator=(const class wxULongLongWx &ll);
#endif
// from double: this one has an explicit name because otherwise we
// would have ambiguity with "ll = int" and also because we don't want
// to have implicit conversions between doubles and wxLongLongs
wxLongLongNative& Assign(double d)
{ m_ll = (wxLongLong_t)d; return *this; }
// assignment operators from wxLongLongNative is ok
// accessors
// get high part
wxInt32 GetHi() const
{ return wx_truncate_cast(wxInt32, m_ll >> 32); }
// get low part
wxUint32 GetLo() const
{ return wx_truncate_cast(wxUint32, m_ll); }
// get absolute value
wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); }
wxLongLongNative& Abs() { if ( m_ll < 0 ) m_ll = -m_ll; return *this; }
// convert to native long long
wxLongLong_t GetValue() const { return m_ll; }
// convert to long with range checking in debug mode (only!)
long ToLong() const
{
// This assert is useless if long long is the same as long (which is
// the case under the standard Unix LP64 model).
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX),
wxT("wxLongLong to long conversion loss of precision") );
#endif
return wx_truncate_cast(long, m_ll);
}
// convert to double
double ToDouble() const { return wx_truncate_cast(double, m_ll); }
// don't provide implicit conversion to wxLongLong_t or we will have an
// ambiguity for all arithmetic operations
//operator wxLongLong_t() const { return m_ll; }
// operations
// addition
wxLongLongNative operator+(const wxLongLongNative& ll) const
{ return wxLongLongNative(m_ll + ll.m_ll); }
wxLongLongNative& operator+=(const wxLongLongNative& ll)
{ m_ll += ll.m_ll; return *this; }
wxLongLongNative operator+(const wxLongLong_t ll) const
{ return wxLongLongNative(m_ll + ll); }
wxLongLongNative& operator+=(const wxLongLong_t ll)
{ m_ll += ll; return *this; }
// pre increment
wxLongLongNative& operator++()
{ m_ll++; return *this; }
// post increment
wxLongLongNative operator++(int)
{ wxLongLongNative value(*this); m_ll++; return value; }
// negation operator
wxLongLongNative operator-() const
{ return wxLongLongNative(-m_ll); }
wxLongLongNative& Negate() { m_ll = -m_ll; return *this; }
// subtraction
wxLongLongNative operator-(const wxLongLongNative& ll) const
{ return wxLongLongNative(m_ll - ll.m_ll); }
wxLongLongNative& operator-=(const wxLongLongNative& ll)
{ m_ll -= ll.m_ll; return *this; }
wxLongLongNative operator-(const wxLongLong_t ll) const
{ return wxLongLongNative(m_ll - ll); }
wxLongLongNative& operator-=(const wxLongLong_t ll)
{ m_ll -= ll; return *this; }
// pre decrement
wxLongLongNative& operator--()
{ m_ll--; return *this; }
// post decrement
wxLongLongNative operator--(int)
{ wxLongLongNative value(*this); m_ll--; return value; }
// shifts
// left shift
wxLongLongNative operator<<(int shift) const
{ return wxLongLongNative(m_ll << shift); }
wxLongLongNative& operator<<=(int shift)
{ m_ll <<= shift; return *this; }
// right shift
wxLongLongNative operator>>(int shift) const
{ return wxLongLongNative(m_ll >> shift); }
wxLongLongNative& operator>>=(int shift)
{ m_ll >>= shift; return *this; }
// bitwise operators
wxLongLongNative operator&(const wxLongLongNative& ll) const
{ return wxLongLongNative(m_ll & ll.m_ll); }
wxLongLongNative& operator&=(const wxLongLongNative& ll)
{ m_ll &= ll.m_ll; return *this; }
wxLongLongNative operator|(const wxLongLongNative& ll) const
{ return wxLongLongNative(m_ll | ll.m_ll); }
wxLongLongNative& operator|=(const wxLongLongNative& ll)
{ m_ll |= ll.m_ll; return *this; }
wxLongLongNative operator^(const wxLongLongNative& ll) const
{ return wxLongLongNative(m_ll ^ ll.m_ll); }
wxLongLongNative& operator^=(const wxLongLongNative& ll)
{ m_ll ^= ll.m_ll; return *this; }
// multiplication/division
wxLongLongNative operator*(const wxLongLongNative& ll) const
{ return wxLongLongNative(m_ll * ll.m_ll); }
wxLongLongNative operator*(long l) const
{ return wxLongLongNative(m_ll * l); }
wxLongLongNative& operator*=(const wxLongLongNative& ll)
{ m_ll *= ll.m_ll; return *this; }
wxLongLongNative& operator*=(long l)
{ m_ll *= l; return *this; }
wxLongLongNative operator/(const wxLongLongNative& ll) const
{ return wxLongLongNative(m_ll / ll.m_ll); }
wxLongLongNative operator/(long l) const
{ return wxLongLongNative(m_ll / l); }
wxLongLongNative& operator/=(const wxLongLongNative& ll)
{ m_ll /= ll.m_ll; return *this; }
wxLongLongNative& operator/=(long l)
{ m_ll /= l; return *this; }
wxLongLongNative operator%(const wxLongLongNative& ll) const
{ return wxLongLongNative(m_ll % ll.m_ll); }
wxLongLongNative operator%(long l) const
{ return wxLongLongNative(m_ll % l); }
// comparison
bool operator==(const wxLongLongNative& ll) const
{ return m_ll == ll.m_ll; }
bool operator==(long l) const
{ return m_ll == l; }
bool operator!=(const wxLongLongNative& ll) const
{ return m_ll != ll.m_ll; }
bool operator!=(long l) const
{ return m_ll != l; }
bool operator<(const wxLongLongNative& ll) const
{ return m_ll < ll.m_ll; }
bool operator<(long l) const
{ return m_ll < l; }
bool operator>(const wxLongLongNative& ll) const
{ return m_ll > ll.m_ll; }
bool operator>(long l) const
{ return m_ll > l; }
bool operator<=(const wxLongLongNative& ll) const
{ return m_ll <= ll.m_ll; }
bool operator<=(long l) const
{ return m_ll <= l; }
bool operator>=(const wxLongLongNative& ll) const
{ return m_ll >= ll.m_ll; }
bool operator>=(long l) const
{ return m_ll >= l; }
// miscellaneous
// return the string representation of this number
wxString ToString() const;
// conversion to byte array: returns a pointer to static buffer!
void *asArray() const;
#if wxUSE_STD_IOSTREAM
// input/output
friend WXDLLIMPEXP_BASE
wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongNative&);
#endif
friend WXDLLIMPEXP_BASE
wxString& operator<<(wxString&, const wxLongLongNative&);
#if wxUSE_STREAMS
friend WXDLLIMPEXP_BASE
class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongNative&);
friend WXDLLIMPEXP_BASE
class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongNative&);
#endif
private:
wxLongLong_t m_ll;
};
class WXDLLIMPEXP_BASE wxULongLongNative
{
public:
// ctors
// default ctor initializes to 0
wxULongLongNative() : m_ll(0) { }
// from long long
wxULongLongNative(wxULongLong_t ll) : m_ll(ll) { }
// from 2 longs
wxULongLongNative(wxUint32 hi, wxUint32 lo) : m_ll(0)
{
// cast to wxLongLong_t first to avoid precision loss!
m_ll = ((wxULongLong_t) hi) << 32;
m_ll |= (wxULongLong_t) lo;
}
#if wxUSE_LONGLONG_WX
wxULongLongNative(const class wxULongLongWx &ll);
#endif
// default copy ctor is ok
// no dtor
// assignment operators
// from native 64 bit integer
#ifndef wxLongLongIsLong
wxULongLongNative& operator=(wxULongLong_t ll)
{ m_ll = ll; return *this; }
wxULongLongNative& operator=(wxLongLong_t ll)
{ m_ll = ll; return *this; }
#endif // !wxLongLongNative
wxULongLongNative& operator=(int l)
{ m_ll = l; return *this; }
wxULongLongNative& operator=(long l)
{ m_ll = l; return *this; }
wxULongLongNative& operator=(unsigned int l)
{ m_ll = l; return *this; }
wxULongLongNative& operator=(unsigned long l)
{ m_ll = l; return *this; }
wxULongLongNative& operator=(const wxLongLongNative &ll)
{ m_ll = ll.GetValue(); return *this; }
#if wxUSE_LONGLONG_WX
wxULongLongNative& operator=(wxLongLongWx ll);
wxULongLongNative& operator=(const class wxULongLongWx &ll);
#endif
// assignment operators from wxULongLongNative is ok
// accessors
// get high part
wxUint32 GetHi() const
{ return wx_truncate_cast(wxUint32, m_ll >> 32); }
// get low part
wxUint32 GetLo() const
{ return wx_truncate_cast(wxUint32, m_ll); }
// convert to native ulong long
wxULongLong_t GetValue() const { return m_ll; }
// convert to ulong with range checking in debug mode (only!)
unsigned long ToULong() const
{
wxASSERT_MSG( m_ll <= ULONG_MAX,
wxT("wxULongLong to long conversion loss of precision") );
return wx_truncate_cast(unsigned long, m_ll);
}
// convert to double
double ToDouble() const { return wx_truncate_cast(double, m_ll); }
// operations
// addition
wxULongLongNative operator+(const wxULongLongNative& ll) const
{ return wxULongLongNative(m_ll + ll.m_ll); }
wxULongLongNative& operator+=(const wxULongLongNative& ll)
{ m_ll += ll.m_ll; return *this; }
wxULongLongNative operator+(const wxULongLong_t ll) const
{ return wxULongLongNative(m_ll + ll); }
wxULongLongNative& operator+=(const wxULongLong_t ll)
{ m_ll += ll; return *this; }
// pre increment
wxULongLongNative& operator++()
{ m_ll++; return *this; }
// post increment
wxULongLongNative operator++(int)
{ wxULongLongNative value(*this); m_ll++; return value; }
// subtraction
wxULongLongNative operator-(const wxULongLongNative& ll) const
{ return wxULongLongNative(m_ll - ll.m_ll); }
wxULongLongNative& operator-=(const wxULongLongNative& ll)
{ m_ll -= ll.m_ll; return *this; }
wxULongLongNative operator-(const wxULongLong_t ll) const
{ return wxULongLongNative(m_ll - ll); }
wxULongLongNative& operator-=(const wxULongLong_t ll)
{ m_ll -= ll; return *this; }
// pre decrement
wxULongLongNative& operator--()
{ m_ll--; return *this; }
// post decrement
wxULongLongNative operator--(int)
{ wxULongLongNative value(*this); m_ll--; return value; }
// shifts
// left shift
wxULongLongNative operator<<(int shift) const
{ return wxULongLongNative(m_ll << shift); }
wxULongLongNative& operator<<=(int shift)
{ m_ll <<= shift; return *this; }
// right shift
wxULongLongNative operator>>(int shift) const
{ return wxULongLongNative(m_ll >> shift); }
wxULongLongNative& operator>>=(int shift)
{ m_ll >>= shift; return *this; }
// bitwise operators
wxULongLongNative operator&(const wxULongLongNative& ll) const
{ return wxULongLongNative(m_ll & ll.m_ll); }
wxULongLongNative& operator&=(const wxULongLongNative& ll)
{ m_ll &= ll.m_ll; return *this; }
wxULongLongNative operator|(const wxULongLongNative& ll) const
{ return wxULongLongNative(m_ll | ll.m_ll); }
wxULongLongNative& operator|=(const wxULongLongNative& ll)
{ m_ll |= ll.m_ll; return *this; }
wxULongLongNative operator^(const wxULongLongNative& ll) const
{ return wxULongLongNative(m_ll ^ ll.m_ll); }
wxULongLongNative& operator^=(const wxULongLongNative& ll)
{ m_ll ^= ll.m_ll; return *this; }
// multiplication/division
wxULongLongNative operator*(const wxULongLongNative& ll) const
{ return wxULongLongNative(m_ll * ll.m_ll); }
wxULongLongNative operator*(unsigned long l) const
{ return wxULongLongNative(m_ll * l); }
wxULongLongNative& operator*=(const wxULongLongNative& ll)
{ m_ll *= ll.m_ll; return *this; }
wxULongLongNative& operator*=(unsigned long l)
{ m_ll *= l; return *this; }
wxULongLongNative operator/(const wxULongLongNative& ll) const
{ return wxULongLongNative(m_ll / ll.m_ll); }
wxULongLongNative operator/(unsigned long l) const
{ return wxULongLongNative(m_ll / l); }
wxULongLongNative& operator/=(const wxULongLongNative& ll)
{ m_ll /= ll.m_ll; return *this; }
wxULongLongNative& operator/=(unsigned long l)
{ m_ll /= l; return *this; }
wxULongLongNative operator%(const wxULongLongNative& ll) const
{ return wxULongLongNative(m_ll % ll.m_ll); }
wxULongLongNative operator%(unsigned long l) const
{ return wxULongLongNative(m_ll % l); }
// comparison
bool operator==(const wxULongLongNative& ll) const
{ return m_ll == ll.m_ll; }
bool operator==(unsigned long l) const
{ return m_ll == l; }
bool operator!=(const wxULongLongNative& ll) const
{ return m_ll != ll.m_ll; }
bool operator!=(unsigned long l) const
{ return m_ll != l; }
bool operator<(const wxULongLongNative& ll) const
{ return m_ll < ll.m_ll; }
bool operator<(unsigned long l) const
{ return m_ll < l; }
bool operator>(const wxULongLongNative& ll) const
{ return m_ll > ll.m_ll; }
bool operator>(unsigned long l) const
{ return m_ll > l; }
bool operator<=(const wxULongLongNative& ll) const
{ return m_ll <= ll.m_ll; }
bool operator<=(unsigned long l) const
{ return m_ll <= l; }
bool operator>=(const wxULongLongNative& ll) const
{ return m_ll >= ll.m_ll; }
bool operator>=(unsigned long l) const
{ return m_ll >= l; }
// miscellaneous
// return the string representation of this number
wxString ToString() const;
// conversion to byte array: returns a pointer to static buffer!
void *asArray() const;
#if wxUSE_STD_IOSTREAM
// input/output
friend WXDLLIMPEXP_BASE
wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongNative&);
#endif
friend WXDLLIMPEXP_BASE
wxString& operator<<(wxString&, const wxULongLongNative&);
#if wxUSE_STREAMS
friend WXDLLIMPEXP_BASE
class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongNative&);
friend WXDLLIMPEXP_BASE
class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongNative&);
#endif
private:
wxULongLong_t m_ll;
};
inline
wxLongLongNative& wxLongLongNative::operator=(const wxULongLongNative &ll)
{
m_ll = ll.GetValue();
return *this;
}
#endif // wxUSE_LONGLONG_NATIVE
#if wxUSE_LONGLONG_WX
class WXDLLIMPEXP_BASE wxLongLongWx
{
public:
// ctors
// default ctor initializes to 0
wxLongLongWx()
{
m_lo = m_hi = 0;
#ifdef wxLONGLONG_TEST_MODE
m_ll = 0;
Check();
#endif // wxLONGLONG_TEST_MODE
}
// from long
wxLongLongWx(long l) { *this = l; }
// from 2 longs
wxLongLongWx(long hi, unsigned long lo)
{
m_hi = hi;
m_lo = lo;
#ifdef wxLONGLONG_TEST_MODE
m_ll = hi;
m_ll <<= 32;
m_ll |= lo;
Check();
#endif // wxLONGLONG_TEST_MODE
}
// default copy ctor is ok in both cases
// no dtor
// assignment operators
// from long
wxLongLongWx& operator=(long l)
{
m_lo = l;
m_hi = (l < 0 ? -1l : 0l);
#ifdef wxLONGLONG_TEST_MODE
m_ll = l;
Check();
#endif // wxLONGLONG_TEST_MODE
return *this;
}
// from int
wxLongLongWx& operator=(int l)
{
return operator=((long)l);
}
wxLongLongWx& operator=(unsigned long l)
{
m_lo = l;
m_hi = 0;
#ifdef wxLONGLONG_TEST_MODE
m_ll = l;
Check();
#endif // wxLONGLONG_TEST_MODE
return *this;
}
wxLongLongWx& operator=(unsigned int l)
{
return operator=((unsigned long)l);
}
wxLongLongWx& operator=(const class wxULongLongWx &ll);
// from double
wxLongLongWx& Assign(double d);
// can't have assignment operator from 2 longs
// accessors
// get high part
long GetHi() const { return m_hi; }
// get low part
unsigned long GetLo() const { return m_lo; }
// get absolute value
wxLongLongWx Abs() const { return wxLongLongWx(*this).Abs(); }
wxLongLongWx& Abs()
{
if ( m_hi < 0 )
m_hi = -m_hi;
#ifdef wxLONGLONG_TEST_MODE
if ( m_ll < 0 )
m_ll = -m_ll;
Check();
#endif // wxLONGLONG_TEST_MODE
return *this;
}
// convert to long with range checking in debug mode (only!)
long ToLong() const
{
wxASSERT_MSG( (m_hi == 0l) || (m_hi == -1l),
wxT("wxLongLong to long conversion loss of precision") );
return (long)m_lo;
}
// convert to double
double ToDouble() const;
// operations
// addition
wxLongLongWx operator+(const wxLongLongWx& ll) const;
wxLongLongWx& operator+=(const wxLongLongWx& ll);
wxLongLongWx operator+(long l) const;
wxLongLongWx& operator+=(long l);
// pre increment operator
wxLongLongWx& operator++();
// post increment operator
wxLongLongWx& operator++(int) { return ++(*this); }
// negation operator
wxLongLongWx operator-() const;
wxLongLongWx& Negate();
// subraction
wxLongLongWx operator-(const wxLongLongWx& ll) const;
wxLongLongWx& operator-=(const wxLongLongWx& ll);
// pre decrement operator
wxLongLongWx& operator--();
// post decrement operator
wxLongLongWx& operator--(int) { return --(*this); }
// shifts
// left shift
wxLongLongWx operator<<(int shift) const;
wxLongLongWx& operator<<=(int shift);
// right shift
wxLongLongWx operator>>(int shift) const;
wxLongLongWx& operator>>=(int shift);
// bitwise operators
wxLongLongWx operator&(const wxLongLongWx& ll) const;
wxLongLongWx& operator&=(const wxLongLongWx& ll);
wxLongLongWx operator|(const wxLongLongWx& ll) const;
wxLongLongWx& operator|=(const wxLongLongWx& ll);
wxLongLongWx operator^(const wxLongLongWx& ll) const;
wxLongLongWx& operator^=(const wxLongLongWx& ll);
wxLongLongWx operator~() const;
// comparison
bool operator==(const wxLongLongWx& ll) const
{ return m_lo == ll.m_lo && m_hi == ll.m_hi; }
#if wxUSE_LONGLONG_NATIVE
bool operator==(const wxLongLongNative& ll) const
{ return m_lo == ll.GetLo() && m_hi == ll.GetHi(); }
#endif
bool operator!=(const wxLongLongWx& ll) const
{ return !(*this == ll); }
bool operator<(const wxLongLongWx& ll) const;
bool operator>(const wxLongLongWx& ll) const;
bool operator<=(const wxLongLongWx& ll) const
{ return *this < ll || *this == ll; }
bool operator>=(const wxLongLongWx& ll) const
{ return *this > ll || *this == ll; }
bool operator<(long l) const { return *this < wxLongLongWx(l); }
bool operator>(long l) const { return *this > wxLongLongWx(l); }
bool operator==(long l) const
{
return l >= 0 ? (m_hi == 0 && m_lo == (unsigned long)l)
: (m_hi == -1 && m_lo == (unsigned long)l);
}
bool operator<=(long l) const { return *this < l || *this == l; }
bool operator>=(long l) const { return *this > l || *this == l; }
// multiplication
wxLongLongWx operator*(const wxLongLongWx& ll) const;
wxLongLongWx& operator*=(const wxLongLongWx& ll);
// division
wxLongLongWx operator/(const wxLongLongWx& ll) const;
wxLongLongWx& operator/=(const wxLongLongWx& ll);
wxLongLongWx operator%(const wxLongLongWx& ll) const;
void Divide(const wxLongLongWx& divisor,
wxLongLongWx& quotient,
wxLongLongWx& remainder) const;
// input/output
// return the string representation of this number
wxString ToString() const;
void *asArray() const;
#if wxUSE_STD_IOSTREAM
friend WXDLLIMPEXP_BASE
wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongWx&);
#endif // wxUSE_STD_IOSTREAM
friend WXDLLIMPEXP_BASE
wxString& operator<<(wxString&, const wxLongLongWx&);
#if wxUSE_STREAMS
friend WXDLLIMPEXP_BASE
class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongWx&);
friend WXDLLIMPEXP_BASE
class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongWx&);
#endif
private:
// long is at least 32 bits, so represent our 64bit number as 2 longs
long m_hi; // signed bit is in the high part
unsigned long m_lo;
#ifdef wxLONGLONG_TEST_MODE
void Check()
{
wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo );
}
wxLongLong_t m_ll;
#endif // wxLONGLONG_TEST_MODE
};
class WXDLLIMPEXP_BASE wxULongLongWx
{
public:
// ctors
// default ctor initializes to 0
wxULongLongWx()
{
m_lo = m_hi = 0;
#ifdef wxLONGLONG_TEST_MODE
m_ll = 0;
Check();
#endif // wxLONGLONG_TEST_MODE
}
// from ulong
wxULongLongWx(unsigned long l) { *this = l; }
// from 2 ulongs
wxULongLongWx(unsigned long hi, unsigned long lo)
{
m_hi = hi;
m_lo = lo;
#ifdef wxLONGLONG_TEST_MODE
m_ll = hi;
m_ll <<= 32;
m_ll |= lo;
Check();
#endif // wxLONGLONG_TEST_MODE
}
// from signed to unsigned
wxULongLongWx(wxLongLongWx ll)
{
wxASSERT(ll.GetHi() >= 0);
m_hi = (unsigned long)ll.GetHi();
m_lo = ll.GetLo();
}
// default copy ctor is ok in both cases
// no dtor
// assignment operators
// from long
wxULongLongWx& operator=(unsigned long l)
{
m_lo = l;
m_hi = 0;
#ifdef wxLONGLONG_TEST_MODE
m_ll = l;
Check();
#endif // wxLONGLONG_TEST_MODE
return *this;
}
wxULongLongWx& operator=(long l)
{
m_lo = l;
m_hi = (unsigned long) ((l<0) ? -1l : 0);
#ifdef wxLONGLONG_TEST_MODE
m_ll = (wxULongLong_t) (wxLongLong_t) l;
Check();
#endif // wxLONGLONG_TEST_MODE
return *this;
}
wxULongLongWx& operator=(const class wxLongLongWx &ll) {
// Should we use an assert like it was before in the constructor?
// wxASSERT(ll.GetHi() >= 0);
m_hi = (unsigned long)ll.GetHi();
m_lo = ll.GetLo();
return *this;
}
// can't have assignment operator from 2 longs
// accessors
// get high part
unsigned long GetHi() const { return m_hi; }
// get low part
unsigned long GetLo() const { return m_lo; }
// convert to long with range checking in debug mode (only!)
unsigned long ToULong() const
{
wxASSERT_MSG( m_hi == 0ul,
wxT("wxULongLong to long conversion loss of precision") );
return (unsigned long)m_lo;
}
// convert to double
double ToDouble() const;
// operations
// addition
wxULongLongWx operator+(const wxULongLongWx& ll) const;
wxULongLongWx& operator+=(const wxULongLongWx& ll);
wxULongLongWx operator+(unsigned long l) const;
wxULongLongWx& operator+=(unsigned long l);
// pre increment operator
wxULongLongWx& operator++();
// post increment operator
wxULongLongWx& operator++(int) { return ++(*this); }
// subtraction
wxLongLongWx operator-(const wxULongLongWx& ll) const;
wxULongLongWx& operator-=(const wxULongLongWx& ll);
// pre decrement operator
wxULongLongWx& operator--();
// post decrement operator
wxULongLongWx& operator--(int) { return --(*this); }
// shifts
// left shift
wxULongLongWx operator<<(int shift) const;
wxULongLongWx& operator<<=(int shift);
// right shift
wxULongLongWx operator>>(int shift) const;
wxULongLongWx& operator>>=(int shift);
// bitwise operators
wxULongLongWx operator&(const wxULongLongWx& ll) const;
wxULongLongWx& operator&=(const wxULongLongWx& ll);
wxULongLongWx operator|(const wxULongLongWx& ll) const;
wxULongLongWx& operator|=(const wxULongLongWx& ll);
wxULongLongWx operator^(const wxULongLongWx& ll) const;
wxULongLongWx& operator^=(const wxULongLongWx& ll);
wxULongLongWx operator~() const;
// comparison
bool operator==(const wxULongLongWx& ll) const
{ return m_lo == ll.m_lo && m_hi == ll.m_hi; }
bool operator!=(const wxULongLongWx& ll) const
{ return !(*this == ll); }
bool operator<(const wxULongLongWx& ll) const;
bool operator>(const wxULongLongWx& ll) const;
bool operator<=(const wxULongLongWx& ll) const
{ return *this < ll || *this == ll; }
bool operator>=(const wxULongLongWx& ll) const
{ return *this > ll || *this == ll; }
bool operator<(unsigned long l) const { return *this < wxULongLongWx(l); }
bool operator>(unsigned long l) const { return *this > wxULongLongWx(l); }
bool operator==(unsigned long l) const
{
return (m_hi == 0 && m_lo == (unsigned long)l);
}
bool operator<=(unsigned long l) const { return *this < l || *this == l; }
bool operator>=(unsigned long l) const { return *this > l || *this == l; }
// multiplication
wxULongLongWx operator*(const wxULongLongWx& ll) const;
wxULongLongWx& operator*=(const wxULongLongWx& ll);
// division
wxULongLongWx operator/(const wxULongLongWx& ll) const;
wxULongLongWx& operator/=(const wxULongLongWx& ll);
wxULongLongWx operator%(const wxULongLongWx& ll) const;
void Divide(const wxULongLongWx& divisor,
wxULongLongWx& quotient,
wxULongLongWx& remainder) const;
// input/output
// return the string representation of this number
wxString ToString() const;
void *asArray() const;
#if wxUSE_STD_IOSTREAM
friend WXDLLIMPEXP_BASE
wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongWx&);
#endif // wxUSE_STD_IOSTREAM
friend WXDLLIMPEXP_BASE
wxString& operator<<(wxString&, const wxULongLongWx&);
#if wxUSE_STREAMS
friend WXDLLIMPEXP_BASE
class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongWx&);
friend WXDLLIMPEXP_BASE
class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongWx&);
#endif
private:
// long is at least 32 bits, so represent our 64bit number as 2 longs
unsigned long m_hi;
unsigned long m_lo;
#ifdef wxLONGLONG_TEST_MODE
void Check()
{
wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo );
}
wxULongLong_t m_ll;
#endif // wxLONGLONG_TEST_MODE
};
#endif // wxUSE_LONGLONG_WX
// ----------------------------------------------------------------------------
// binary operators
// ----------------------------------------------------------------------------
inline bool operator<(long l, const wxLongLong& ll) { return ll > l; }
inline bool operator>(long l, const wxLongLong& ll) { return ll < l; }
inline bool operator<=(long l, const wxLongLong& ll) { return ll >= l; }
inline bool operator>=(long l, const wxLongLong& ll) { return ll <= l; }
inline bool operator==(long l, const wxLongLong& ll) { return ll == l; }
inline bool operator!=(long l, const wxLongLong& ll) { return ll != l; }
inline wxLongLong operator+(long l, const wxLongLong& ll) { return ll + l; }
inline wxLongLong operator-(long l, const wxLongLong& ll)
{
return wxLongLong(l) - ll;
}
inline bool operator<(unsigned long l, const wxULongLong& ull) { return ull > l; }
inline bool operator>(unsigned long l, const wxULongLong& ull) { return ull < l; }
inline bool operator<=(unsigned long l, const wxULongLong& ull) { return ull >= l; }
inline bool operator>=(unsigned long l, const wxULongLong& ull) { return ull <= l; }
inline bool operator==(unsigned long l, const wxULongLong& ull) { return ull == l; }
inline bool operator!=(unsigned long l, const wxULongLong& ull) { return ull != l; }
inline wxULongLong operator+(unsigned long l, const wxULongLong& ull) { return ull + l; }
inline wxLongLong operator-(unsigned long l, const wxULongLong& ull)
{
const wxULongLong ret = wxULongLong(l) - ull;
return wxLongLong((wxInt32)ret.GetHi(),ret.GetLo());
}
#if wxUSE_LONGLONG_NATIVE && wxUSE_STREAMS
WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxULongLong_t value);
WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxLongLong_t value);
WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxULongLong_t &value);
WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxLongLong_t &value);
#endif
// ----------------------------------------------------------------------------
// Specialize numeric_limits<> for our long long wrapper classes.
// ----------------------------------------------------------------------------
#if wxUSE_LONGLONG_NATIVE
#include <limits>
namespace std
{
#ifdef __clang__
// libstdc++ (used by Clang) uses struct for numeric_limits; unlike gcc, clang
// warns about this
template<> struct numeric_limits<wxLongLong> : public numeric_limits<wxLongLong_t> {};
template<> struct numeric_limits<wxULongLong> : public numeric_limits<wxULongLong_t> {};
#else
template<> class numeric_limits<wxLongLong> : public numeric_limits<wxLongLong_t> {};
template<> class numeric_limits<wxULongLong> : public numeric_limits<wxULongLong_t> {};
#endif
} // namespace std
#endif // wxUSE_LONGLONG_NATIVE
// ----------------------------------------------------------------------------
// Specialize wxArgNormalizer to allow using wxLongLong directly with wx pseudo
// vararg functions.
// ----------------------------------------------------------------------------
// Notice that this must be done here and not in wx/strvararg.h itself because
// we can't include wx/longlong.h from there as this header itself includes
// wx/string.h which includes wx/strvararg.h too, so to avoid the circular
// dependencies we can only do it here (or add another header just for this but
// it doesn't seem necessary).
#include "wx/strvararg.h"
template<>
struct WXDLLIMPEXP_BASE wxArgNormalizer<wxLongLong>
{
wxArgNormalizer(wxLongLong value,
const wxFormatString *fmt, unsigned index)
: m_value(value)
{
wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_LongLongInt );
}
wxLongLong_t get() const { return m_value.GetValue(); }
wxLongLong m_value;
};
#endif // wxUSE_LONGLONG
#endif // _WX_LONGLONG_H
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/calctrl.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/calctrl.h
// Purpose: date-picker control
// Author: Vadim Zeitlin
// Modified by:
// Created: 29.12.99
// Copyright: (c) 1999 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CALCTRL_H_
#define _WX_CALCTRL_H_
#include "wx/defs.h"
#if wxUSE_CALENDARCTRL
#include "wx/dateevt.h"
#include "wx/colour.h"
#include "wx/font.h"
#include "wx/control.h"
// ----------------------------------------------------------------------------
// wxCalendarCtrl flags
// ----------------------------------------------------------------------------
enum
{
// show Sunday as the first day of the week (default)
wxCAL_SUNDAY_FIRST = 0x0080,
// show Monday as the first day of the week
wxCAL_MONDAY_FIRST = 0x0001,
// highlight holidays
wxCAL_SHOW_HOLIDAYS = 0x0002,
// disable the year change control, show only the month change one
// deprecated
wxCAL_NO_YEAR_CHANGE = 0x0004,
// don't allow changing neither month nor year (implies
// wxCAL_NO_YEAR_CHANGE)
wxCAL_NO_MONTH_CHANGE = 0x000c,
// use MS-style month-selection instead of combo-spin combination
wxCAL_SEQUENTIAL_MONTH_SELECTION = 0x0010,
// show the neighbouring weeks in the previous and next month
wxCAL_SHOW_SURROUNDING_WEEKS = 0x0020,
// show week numbers on the left side of the calendar.
wxCAL_SHOW_WEEK_NUMBERS = 0x0040
};
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// return values for the HitTest() method
enum wxCalendarHitTestResult
{
wxCAL_HITTEST_NOWHERE, // outside of anything
wxCAL_HITTEST_HEADER, // on the header (weekdays)
wxCAL_HITTEST_DAY, // on a day in the calendar
wxCAL_HITTEST_INCMONTH,
wxCAL_HITTEST_DECMONTH,
wxCAL_HITTEST_SURROUNDING_WEEK,
wxCAL_HITTEST_WEEK
};
// border types for a date
enum wxCalendarDateBorder
{
wxCAL_BORDER_NONE, // no border (default)
wxCAL_BORDER_SQUARE, // a rectangular border
wxCAL_BORDER_ROUND // a round border
};
// ----------------------------------------------------------------------------
// wxCalendarDateAttr: custom attributes for a calendar date
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCalendarDateAttr
{
public:
// ctors
wxCalendarDateAttr(const wxColour& colText = wxNullColour,
const wxColour& colBack = wxNullColour,
const wxColour& colBorder = wxNullColour,
const wxFont& font = wxNullFont,
wxCalendarDateBorder border = wxCAL_BORDER_NONE)
: m_colText(colText), m_colBack(colBack),
m_colBorder(colBorder), m_font(font)
{
Init(border);
}
wxCalendarDateAttr(wxCalendarDateBorder border,
const wxColour& colBorder = wxNullColour)
: m_colBorder(colBorder)
{
Init(border);
}
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; }
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
void SetBorderColour(const wxColour& col) { m_colBorder = col; }
void SetFont(const wxFont& font) { m_font = font; }
void SetBorder(wxCalendarDateBorder border) { m_border = border; }
void SetHoliday(bool holiday) { m_holiday = holiday; }
// accessors
bool HasTextColour() const { return m_colText.IsOk(); }
bool HasBackgroundColour() const { return m_colBack.IsOk(); }
bool HasBorderColour() const { return m_colBorder.IsOk(); }
bool HasFont() const { return m_font.IsOk(); }
bool HasBorder() const { return m_border != wxCAL_BORDER_NONE; }
bool IsHoliday() const { return m_holiday; }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
const wxColour& GetBorderColour() const { return m_colBorder; }
const wxFont& GetFont() const { return m_font; }
wxCalendarDateBorder GetBorder() const { return m_border; }
// get or change the "mark" attribute, i.e. the one used for the items
// marked with wxCalendarCtrl::Mark()
static const wxCalendarDateAttr& GetMark() { return m_mark; }
static void SetMark(wxCalendarDateAttr const& m) { m_mark = m; }
protected:
void Init(wxCalendarDateBorder border = wxCAL_BORDER_NONE)
{
m_border = border;
m_holiday = false;
}
private:
static wxCalendarDateAttr m_mark;
wxColour m_colText,
m_colBack,
m_colBorder;
wxFont m_font;
wxCalendarDateBorder m_border;
bool m_holiday;
};
// ----------------------------------------------------------------------------
// wxCalendarCtrl events
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxCalendarCtrl;
class WXDLLIMPEXP_CORE wxCalendarEvent : public wxDateEvent
{
public:
wxCalendarEvent() : m_wday(wxDateTime::Inv_WeekDay) { }
wxCalendarEvent(wxWindow *win, const wxDateTime& dt, wxEventType type)
: wxDateEvent(win, dt, type),
m_wday(wxDateTime::Inv_WeekDay) { }
wxCalendarEvent(const wxCalendarEvent& event)
: wxDateEvent(event), m_wday(event.m_wday) { }
void SetWeekDay(wxDateTime::WeekDay wd) { m_wday = wd; }
wxDateTime::WeekDay GetWeekDay() const { return m_wday; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxCalendarEvent(*this); }
private:
wxDateTime::WeekDay m_wday;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalendarEvent);
};
// ----------------------------------------------------------------------------
// wxCalendarCtrlBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCalendarCtrlBase : public wxControl
{
public:
// do we allow changing the month/year?
bool AllowMonthChange() const { return !HasFlag(wxCAL_NO_MONTH_CHANGE); }
// get/set the current date
virtual wxDateTime GetDate() const = 0;
virtual bool SetDate(const wxDateTime& date) = 0;
// restricting the dates shown by the control to the specified range: only
// implemented in the generic and MSW versions for now
// if either date is set, the corresponding limit will be enforced and true
// returned; if none are set, the existing restrictions are removed and
// false is returned
virtual bool
SetDateRange(const wxDateTime& WXUNUSED(lowerdate) = wxDefaultDateTime,
const wxDateTime& WXUNUSED(upperdate) = wxDefaultDateTime)
{
return false;
}
// retrieves the limits currently in use (wxDefaultDateTime if none) in the
// provided pointers (which may be NULL) and returns true if there are any
// limits or false if none
virtual bool
GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const
{
if ( lowerdate )
*lowerdate = wxDefaultDateTime;
if ( upperdate )
*upperdate = wxDefaultDateTime;
return false;
}
// returns one of wxCAL_HITTEST_XXX constants and fills either date or wd
// with the corresponding value (none for NOWHERE, the date for DAY and wd
// for HEADER)
//
// notice that this is not implemented in all versions
virtual wxCalendarHitTestResult
HitTest(const wxPoint& WXUNUSED(pos),
wxDateTime* WXUNUSED(date) = NULL,
wxDateTime::WeekDay* WXUNUSED(wd) = NULL)
{
return wxCAL_HITTEST_NOWHERE;
}
// allow or disable changing the current month (and year), return true if
// the value of this option really changed or false if it was already set
// to the required value
//
// NB: we provide implementation for this pure virtual function, derived
// classes should call it
virtual bool EnableMonthChange(bool enable = true) = 0;
// an item without custom attributes is drawn with the default colours and
// font and without border, setting custom attributes allows to modify this
//
// the day parameter should be in 1..31 range, for days 29, 30, 31 the
// corresponding attribute is just unused if there is no such day in the
// current month
//
// notice that currently arbitrary attributes are supported only in the
// generic version, the native controls only support Mark() which assigns
// some special appearance (which can be customized using SetMark() for the
// generic version) to the given day
virtual void Mark(size_t day, bool mark) = 0;
virtual wxCalendarDateAttr *GetAttr(size_t WXUNUSED(day)) const
{ return NULL; }
virtual void SetAttr(size_t WXUNUSED(day), wxCalendarDateAttr *attr)
{ delete attr; }
virtual void ResetAttr(size_t WXUNUSED(day)) { }
// holidays support
//
// currently only the generic version implements all functions in this
// section; wxMSW implements simple support for holidays (they can be
// just enabled or disabled) and wxGTK doesn't support them at all
// equivalent to changing wxCAL_SHOW_HOLIDAYS flag but should be called
// instead of just changing it
virtual void EnableHolidayDisplay(bool display = true);
// set/get the colours to use for holidays (if they're enabled)
virtual void SetHolidayColours(const wxColour& WXUNUSED(colFg),
const wxColour& WXUNUSED(colBg)) { }
virtual const wxColour& GetHolidayColourFg() const { return wxNullColour; }
virtual const wxColour& GetHolidayColourBg() const { return wxNullColour; }
// mark the given day of the current month as being a holiday
virtual void SetHoliday(size_t WXUNUSED(day)) { }
// customizing the colours of the controls
//
// most of the methods in this section are only implemented by the native
// version of the control and do nothing in the native ones
// set/get the colours to use for the display of the week day names at the
// top of the controls
virtual void SetHeaderColours(const wxColour& WXUNUSED(colFg),
const wxColour& WXUNUSED(colBg)) { }
virtual const wxColour& GetHeaderColourFg() const { return wxNullColour; }
virtual const wxColour& GetHeaderColourBg() const { return wxNullColour; }
// set/get the colours used for the currently selected date
virtual void SetHighlightColours(const wxColour& WXUNUSED(colFg),
const wxColour& WXUNUSED(colBg)) { }
virtual const wxColour& GetHighlightColourFg() const { return wxNullColour; }
virtual const wxColour& GetHighlightColourBg() const { return wxNullColour; }
// implementation only from now on
// generate the given calendar event, return true if it was processed
//
// NB: this is public because it's used from GTK+ callbacks
bool GenerateEvent(wxEventType type)
{
wxCalendarEvent event(this, GetDate(), type);
return HandleWindowEvent(event);
}
protected:
// generate all the events for the selection change from dateOld to current
// date: SEL_CHANGED, PAGE_CHANGED if necessary and also one of (deprecated)
// YEAR/MONTH/DAY_CHANGED ones
//
// returns true if page changed event was generated, false if the new date
// is still in the same month as before
bool GenerateAllChangeEvents(const wxDateTime& dateOld);
// call SetHoliday() for all holidays in the current month
//
// should be called on month change, does nothing if wxCAL_SHOW_HOLIDAYS is
// not set and returns false in this case, true if we do show them
bool SetHolidayAttrs();
// called by SetHolidayAttrs() to forget the previously set holidays
virtual void ResetHolidayAttrs() { }
// called by EnableHolidayDisplay()
virtual void RefreshHolidays() { }
// does the week start on monday based on flags and OS settings?
bool WeekStartsOnMonday() const;
};
// ----------------------------------------------------------------------------
// wxCalendarCtrl
// ----------------------------------------------------------------------------
#define wxCalendarNameStr "CalendarCtrl"
#ifndef __WXUNIVERSAL__
#if defined(__WXGTK20__)
#define wxHAS_NATIVE_CALENDARCTRL
#include "wx/gtk/calctrl.h"
#define wxCalendarCtrl wxGtkCalendarCtrl
#elif defined(__WXMSW__)
#define wxHAS_NATIVE_CALENDARCTRL
#include "wx/msw/calctrl.h"
#elif defined(__WXQT__)
#define wxHAS_NATIVE_CALENDARCTRL
#include "wx/qt/calctrl.h"
#endif
#endif // !__WXUNIVERSAL__
#ifndef wxHAS_NATIVE_CALENDARCTRL
#include "wx/generic/calctrlg.h"
#define wxCalendarCtrl wxGenericCalendarCtrl
#endif
// ----------------------------------------------------------------------------
// calendar event types and macros for handling them
// ----------------------------------------------------------------------------
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_PAGE_CHANGED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_DOUBLECLICKED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_WEEKDAY_CLICKED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_WEEK_CLICKED, wxCalendarEvent );
// deprecated events
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_DAY_CHANGED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_MONTH_CHANGED, wxCalendarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_YEAR_CHANGED, wxCalendarEvent );
typedef void (wxEvtHandler::*wxCalendarEventFunction)(wxCalendarEvent&);
#define wxCalendarEventHandler(func) \
wxEVENT_HANDLER_CAST(wxCalendarEventFunction, func)
#define wx__DECLARE_CALEVT(evt, id, fn) \
wx__DECLARE_EVT1(wxEVT_CALENDAR_ ## evt, id, wxCalendarEventHandler(fn))
#define EVT_CALENDAR(id, fn) wx__DECLARE_CALEVT(DOUBLECLICKED, id, fn)
#define EVT_CALENDAR_SEL_CHANGED(id, fn) wx__DECLARE_CALEVT(SEL_CHANGED, id, fn)
#define EVT_CALENDAR_PAGE_CHANGED(id, fn) wx__DECLARE_CALEVT(PAGE_CHANGED, id, fn)
#define EVT_CALENDAR_WEEKDAY_CLICKED(id, fn) wx__DECLARE_CALEVT(WEEKDAY_CLICKED, id, fn)
#define EVT_CALENDAR_WEEK_CLICKED(id, fn) wx__DECLARE_CALEVT(WEEK_CLICKED, id, fn)
// deprecated events
#define EVT_CALENDAR_DAY(id, fn) wx__DECLARE_CALEVT(DAY_CHANGED, id, fn)
#define EVT_CALENDAR_MONTH(id, fn) wx__DECLARE_CALEVT(MONTH_CHANGED, id, fn)
#define EVT_CALENDAR_YEAR(id, fn) wx__DECLARE_CALEVT(YEAR_CHANGED, id, fn)
#endif // wxUSE_CALENDARCTRL
#endif // _WX_CALCTRL_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/webviewfshandler.h | /////////////////////////////////////////////////////////////////////////////
// Name: webviewfshandler.h
// Purpose: Custom webview handler for virtual file system
// Author: Nick Matthews
// Copyright: (c) 2012 Steven Lamerton
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Based on webviewarchivehandler.h file by Steven Lamerton
#ifndef _WX_WEBVIEW_FS_HANDLER_H_
#define _WX_WEBVIEW_FS_HANDLER_H_
#include "wx/setup.h"
#if wxUSE_WEBVIEW
class wxFSFile;
class wxFileSystem;
#include "wx/webview.h"
//Loads from uris such as scheme:example.html
class WXDLLIMPEXP_WEBVIEW wxWebViewFSHandler : public wxWebViewHandler
{
public:
wxWebViewFSHandler(const wxString& scheme);
virtual ~wxWebViewFSHandler();
virtual wxFSFile* GetFile(const wxString &uri) wxOVERRIDE;
private:
wxFileSystem* m_fileSystem;
};
#endif // wxUSE_WEBVIEW
#endif // _WX_WEBVIEW_FS_HANDLER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/wizard.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/wizard.h
// Purpose: wxWizard class: a GUI control presenting the user with a
// sequence of dialogs which allows to simply perform some task
// Author: Vadim Zeitlin (partly based on work by Ron Kuris and Kevin B.
// Smith)
// Modified by: Robert Cavanaugh
// Added capability to use .WXR resource files in Wizard pages
// Added wxWIZARD_HELP event
// Robert Vazan (sizers)
// Created: 15.08.99
// Copyright: (c) 1999 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WIZARD_H_
#define _WX_WIZARD_H_
#include "wx/defs.h"
#if wxUSE_WIZARDDLG
// ----------------------------------------------------------------------------
// headers and other simple declarations
// ----------------------------------------------------------------------------
#include "wx/dialog.h" // the base class
#include "wx/panel.h" // ditto
#include "wx/event.h" // wxEVT_XXX constants
#include "wx/bitmap.h"
// Extended style to specify a help button
#define wxWIZARD_EX_HELPBUTTON 0x00000010
// Placement flags
#define wxWIZARD_VALIGN_TOP 0x01
#define wxWIZARD_VALIGN_CENTRE 0x02
#define wxWIZARD_VALIGN_BOTTOM 0x04
#define wxWIZARD_HALIGN_LEFT 0x08
#define wxWIZARD_HALIGN_CENTRE 0x10
#define wxWIZARD_HALIGN_RIGHT 0x20
#define wxWIZARD_TILE 0x40
// forward declarations
class WXDLLIMPEXP_FWD_CORE wxWizard;
// ----------------------------------------------------------------------------
// wxWizardPage is one of the wizards screen: it must know what are the
// following and preceding pages (which may be NULL for the first/last page).
//
// Other than GetNext/Prev() functions, wxWizardPage is just a panel and may be
// used as such (i.e. controls may be placed directly on it &c).
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWizardPage : public wxPanel
{
public:
wxWizardPage() { Init(); }
// ctor accepts an optional bitmap which will be used for this page instead
// of the default one for this wizard (should be of the same size). Notice
// that no other parameters are needed because the wizard will resize and
// reposition the page anyhow
wxWizardPage(wxWizard *parent,
const wxBitmap& bitmap = wxNullBitmap);
bool Create(wxWizard *parent,
const wxBitmap& bitmap = wxNullBitmap);
// these functions are used by the wizard to show another page when the
// user chooses "Back" or "Next" button
virtual wxWizardPage *GetPrev() const = 0;
virtual wxWizardPage *GetNext() const = 0;
// default GetBitmap() will just return m_bitmap which is ok in 99% of
// cases - override this method if you want to create the bitmap to be used
// dynamically or to do something even more fancy. It's ok to return
// wxNullBitmap from here - the default one will be used then.
virtual wxBitmap GetBitmap() const { return m_bitmap; }
#if wxUSE_VALIDATORS
// Override the base functions to allow a validator to be assigned to this page.
virtual bool TransferDataToWindow() wxOVERRIDE
{
return GetValidator() ? GetValidator()->TransferToWindow()
: wxPanel::TransferDataToWindow();
}
virtual bool TransferDataFromWindow() wxOVERRIDE
{
return GetValidator() ? GetValidator()->TransferFromWindow()
: wxPanel::TransferDataFromWindow();
}
virtual bool Validate() wxOVERRIDE
{
return GetValidator() ? GetValidator()->Validate(this)
: wxPanel::Validate();
}
#endif // wxUSE_VALIDATORS
protected:
// common part of ctors:
void Init();
wxBitmap m_bitmap;
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPage);
};
// ----------------------------------------------------------------------------
// wxWizardPageSimple just returns the pointers given to the ctor and is useful
// to create a simple wizard where the order of pages never changes.
//
// OTOH, it is also possible to dynamically decide which page to return (i.e.
// depending on the user's choices) as the wizard sample shows - in order to do
// this, you must derive from wxWizardPage directly.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWizardPageSimple : public wxWizardPage
{
public:
wxWizardPageSimple() { Init(); }
// ctor takes the previous and next pages
wxWizardPageSimple(wxWizard *parent,
wxWizardPage *prev = NULL,
wxWizardPage *next = NULL,
const wxBitmap& bitmap = wxNullBitmap)
{
Create(parent, prev, next, bitmap);
}
bool Create(wxWizard *parent = NULL, // let it be default ctor too
wxWizardPage *prev = NULL,
wxWizardPage *next = NULL,
const wxBitmap& bitmap = wxNullBitmap)
{
m_prev = prev;
m_next = next;
return wxWizardPage::Create(parent, bitmap);
}
// the pointers may be also set later - but before starting the wizard
void SetPrev(wxWizardPage *prev) { m_prev = prev; }
void SetNext(wxWizardPage *next) { m_next = next; }
// Convenience functions to make the pages follow each other without having
// to call their SetPrev() or SetNext() explicitly.
wxWizardPageSimple& Chain(wxWizardPageSimple* next)
{
SetNext(next);
next->SetPrev(this);
return *next;
}
static void Chain(wxWizardPageSimple *first, wxWizardPageSimple *second)
{
wxCHECK_RET( first && second,
wxT("NULL passed to wxWizardPageSimple::Chain") );
first->SetNext(second);
second->SetPrev(first);
}
// base class pure virtuals
virtual wxWizardPage *GetPrev() const wxOVERRIDE;
virtual wxWizardPage *GetNext() const wxOVERRIDE;
private:
// common part of ctors:
void Init()
{
m_prev = m_next = NULL;
}
// pointers are private, the derived classes shouldn't mess with them -
// just derive from wxWizardPage directly to implement different behaviour
wxWizardPage *m_prev,
*m_next;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPageSimple);
};
// ----------------------------------------------------------------------------
// wxWizard
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWizardBase : public wxDialog
{
public:
/*
The derived class (i.e. the real wxWizard) has a ctor and Create()
function taking the following arguments:
wxWizard(wxWindow *parent,
int id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxBitmap& bitmap = wxNullBitmap,
const wxPoint& pos = wxDefaultPosition,
long style = wxDEFAULT_DIALOG_STYLE);
*/
wxWizardBase() { }
// executes the wizard starting from the given page, returns true if it was
// successfully finished, false if user cancelled it
virtual bool RunWizard(wxWizardPage *firstPage) = 0;
// get the current page (NULL if RunWizard() isn't running)
virtual wxWizardPage *GetCurrentPage() const = 0;
// set the min size which should be available for the pages: a
// wizard will take into account the size of the bitmap (if any)
// itself and will never be less than some predefined fixed size
virtual void SetPageSize(const wxSize& size) = 0;
// get the size available for the page
virtual wxSize GetPageSize() const = 0;
// set the best size for the wizard, i.e. make it big enough to contain all
// of the pages starting from the given one
//
// this function may be called several times and possible with different
// pages in which case it will only increase the page size if needed (this
// may be useful if not all pages are accessible from the first one by
// default)
virtual void FitToPage(const wxWizardPage *firstPage) = 0;
// Adding pages to page area sizer enlarges wizard
virtual wxSizer *GetPageAreaSizer() const = 0;
// Set border around page area. Default is 0 if you add at least one
// page to GetPageAreaSizer and 5 if you don't.
virtual void SetBorder(int border) = 0;
// the methods below may be overridden by the derived classes to provide
// custom logic for determining the pages order
virtual bool HasNextPage(wxWizardPage *page)
{ return page->GetNext() != NULL; }
virtual bool HasPrevPage(wxWizardPage *page)
{ return page->GetPrev() != NULL; }
/// Override these functions to stop InitDialog from calling TransferDataToWindow
/// for _all_ pages when the wizard starts. Instead 'ShowPage' will call
/// TransferDataToWindow for the first page only.
bool TransferDataToWindow() wxOVERRIDE { return true; }
bool TransferDataFromWindow() wxOVERRIDE { return true; }
bool Validate() wxOVERRIDE { return true; }
private:
wxDECLARE_NO_COPY_CLASS(wxWizardBase);
};
// include the real class declaration
#include "wx/generic/wizard.h"
// ----------------------------------------------------------------------------
// wxWizardEvent class represents an event generated by the wizard: this event
// is first sent to the page itself and, if not processed there, goes up the
// window hierarchy as usual
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWizardEvent : public wxNotifyEvent
{
public:
wxWizardEvent(wxEventType type = wxEVT_NULL,
int id = wxID_ANY,
bool direction = true,
wxWizardPage* page = NULL);
// for EVT_WIZARD_PAGE_CHANGING, return true if we're going forward or
// false otherwise and for EVT_WIZARD_PAGE_CHANGED return true if we came
// from the previous page and false if we returned from the next one
// (this function doesn't make sense for CANCEL events)
bool GetDirection() const { return m_direction; }
wxWizardPage* GetPage() const { return m_page; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxWizardEvent(*this); }
private:
bool m_direction;
wxWizardPage* m_page;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWizardEvent);
};
// ----------------------------------------------------------------------------
// macros for handling wxWizardEvents
// ----------------------------------------------------------------------------
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_PAGE_CHANGED, wxWizardEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_PAGE_CHANGING, wxWizardEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_CANCEL, wxWizardEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_HELP, wxWizardEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_FINISHED, wxWizardEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_PAGE_SHOWN, wxWizardEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_BEFORE_PAGE_CHANGED, wxWizardEvent );
typedef void (wxEvtHandler::*wxWizardEventFunction)(wxWizardEvent&);
#define wxWizardEventHandler(func) \
wxEVENT_HANDLER_CAST(wxWizardEventFunction, func)
#define wx__DECLARE_WIZARDEVT(evt, id, fn) \
wx__DECLARE_EVT1(wxEVT_WIZARD_ ## evt, id, wxWizardEventHandler(fn))
// notifies that the page has just been changed (can't be vetoed)
#define EVT_WIZARD_PAGE_CHANGED(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGED, id, fn)
// the user pressed "<Back" or "Next>" button and the page is going to be
// changed - unless the event handler vetoes the event
#define EVT_WIZARD_PAGE_CHANGING(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGING, id, fn)
// Called before GetNext/GetPrev is called, so that the handler can change state that will be
// used when GetNext/GetPrev is called. PAGE_CHANGING is called too late to influence GetNext/GetPrev.
#define EVT_WIZARD_BEFORE_PAGE_CHANGED(id, fn) wx__DECLARE_WIZARDEVT(BEFORE_PAGE_CHANGED, id, fn)
// the user pressed "Cancel" button and the wizard is going to be dismissed -
// unless the event handler vetoes the event
#define EVT_WIZARD_CANCEL(id, fn) wx__DECLARE_WIZARDEVT(CANCEL, id, fn)
// the user pressed "Finish" button and the wizard is going to be dismissed -
#define EVT_WIZARD_FINISHED(id, fn) wx__DECLARE_WIZARDEVT(FINISHED, id, fn)
// the user pressed "Help" button
#define EVT_WIZARD_HELP(id, fn) wx__DECLARE_WIZARDEVT(HELP, id, fn)
// the page was just shown and laid out
#define EVT_WIZARD_PAGE_SHOWN(id, fn) wx__DECLARE_WIZARDEVT(PAGE_SHOWN, id, fn)
#endif // wxUSE_WIZARDDLG
#endif // _WX_WIZARD_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/variantbase.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/variantbase.h
// Purpose: wxVariantBase class, a minimal version of wxVariant used by XTI
// Author: Julian Smart
// Modified by: Francesco Montorsi
// Created: 10/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_VARIANTBASE_H_
#define _WX_VARIANTBASE_H_
#include "wx/defs.h"
#if wxUSE_VARIANT
#include "wx/string.h"
#include "wx/arrstr.h"
#include "wx/cpp.h"
#include <typeinfo>
#if wxUSE_DATETIME
#include "wx/datetime.h"
#endif // wxUSE_DATETIME
#include "wx/iosfwrap.h"
class wxTypeInfo;
class wxObject;
class wxClassInfo;
/*
* wxVariantData stores the actual data in a wxVariant object,
* to allow it to store any type of data.
* Derive from this to provide custom data handling.
*
* NB: To prevent addition of extra vtbl pointer to wxVariantData,
* we don't multiple-inherit from wxObjectRefData. Instead,
* we simply replicate the wxObject ref-counting scheme.
*
* NB: When you construct a wxVariantData, it will have refcount
* of one. Refcount will not be further increased when
* it is passed to wxVariant. This simulates old common
* scenario where wxVariant took ownership of wxVariantData
* passed to it.
* If you create wxVariantData for other reasons than passing
* it to wxVariant, technically you are not required to call
* DecRef() before deleting it.
*
* TODO: in order to replace wxPropertyValue, we would need
* to consider adding constructors that take pointers to C++ variables,
* or removing that functionality from the wxProperty library.
* Essentially wxPropertyValue takes on some of the wxValidator functionality
* by storing pointers and not just actual values, allowing update of C++ data
* to be handled automatically. Perhaps there's another way of doing this without
* overloading wxVariant with unnecessary functionality.
*/
class WXDLLIMPEXP_BASE wxVariantData
{
friend class wxVariantBase;
public:
wxVariantData()
: m_count(1)
{ }
#if wxUSE_STD_IOSTREAM
virtual bool Write(wxSTD ostream& WXUNUSED(str)) const { return false; }
virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; }
#endif
virtual bool Write(wxString& WXUNUSED(str)) const { return false; }
virtual bool Read(wxString& WXUNUSED(str)) { return false; }
// Override these to provide common functionality
virtual bool Eq(wxVariantData& data) const = 0;
// What type is it? Return a string name.
virtual wxString GetType() const = 0;
// returns the type info of the content
virtual const wxTypeInfo* GetTypeInfo() const = 0;
// If it based on wxObject return the ClassInfo.
virtual wxClassInfo* GetValueClassInfo() { return NULL; }
int GetRefCount() const
{ return m_count; }
void IncRef()
{ m_count++; }
void DecRef()
{
if ( --m_count == 0 )
delete this;
}
protected:
// Protected dtor should make some incompatible code
// break more louder. That is, they should do data->DecRef()
// instead of delete data.
virtual ~wxVariantData() {}
private:
int m_count;
};
template<typename T> class wxVariantDataT : public wxVariantData
{
public:
wxVariantDataT(const T& d) : m_data(d) {}
virtual ~wxVariantDataT() {}
// get a ref to the stored data
T & Get() { return m_data; }
// get a const ref to the stored data
const T & Get() const { return m_data; }
// set the data
void Set(const T& d) { m_data = d; }
// Override these to provide common functionality
virtual bool Eq(wxVariantData& WXUNUSED(data)) const
{ return false; /* FIXME!! */ }
// What type is it? Return a string name.
virtual wxString GetType() const
{ return GetTypeInfo()->GetTypeName(); }
// return a heap allocated duplicate
//virtual wxVariantData* Clone() const { return new wxVariantDataT<T>( Get() ); }
// returns the type info of the contentc
virtual const wxTypeInfo* GetTypeInfo() const { return wxGetTypeInfo( (T*) NULL ); }
private:
T m_data;
};
/*
* wxVariantBase can store any kind of data, but has some basic types
* built in.
*/
class WXDLLIMPEXP_BASE wxVariantBase
{
public:
wxVariantBase();
wxVariantBase(const wxVariantBase& variant);
wxVariantBase(wxVariantData* data, const wxString& name = wxEmptyString);
template<typename T>
wxVariantBase(const T& data, const wxString& name = wxEmptyString) :
m_data(new wxVariantDataT<T>(data)), m_name(name) {}
virtual ~wxVariantBase();
// generic assignment
void operator= (const wxVariantBase& variant);
// Assignment using data, e.g.
// myVariant = new wxStringVariantData("hello");
void operator= (wxVariantData* variantData);
bool operator== (const wxVariantBase& variant) const;
bool operator!= (const wxVariantBase& variant) const;
// Sets/gets name
inline void SetName(const wxString& name) { m_name = name; }
inline const wxString& GetName() const { return m_name; }
// Tests whether there is data
bool IsNull() const;
// FIXME: used by wxVariantBase code but is nice wording...
bool IsEmpty() const { return IsNull(); }
// For compatibility with wxWidgets <= 2.6, this doesn't increase
// reference count.
wxVariantData* GetData() const { return m_data; }
void SetData(wxVariantData* data) ;
// make a 'clone' of the object
void Ref(const wxVariantBase& clone);
// destroy a reference
void UnRef();
// Make NULL (i.e. delete the data)
void MakeNull();
// write contents to a string (e.g. for debugging)
wxString MakeString() const;
// Delete data and name
void Clear();
// Returns a string representing the type of the variant,
// e.g. "string", "bool", "stringlist", "list", "double", "long"
wxString GetType() const;
bool IsType(const wxString& type) const;
bool IsValueKindOf(const wxClassInfo* type) const;
// FIXME wxXTI methods:
// get the typeinfo of the stored object
const wxTypeInfo* GetTypeInfo() const
{
if (!m_data)
return NULL;
return m_data->GetTypeInfo();
}
// get a ref to the stored data
template<typename T> T& Get()
{
wxVariantDataT<T> *dataptr =
wx_dynamic_cast(wxVariantDataT<T>*, m_data);
wxASSERT_MSG( dataptr,
wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) );
return dataptr->Get();
}
// get a const ref to the stored data
template<typename T> const T& Get() const
{
const wxVariantDataT<T> *dataptr =
wx_dynamic_cast(const wxVariantDataT<T>*, m_data);
wxASSERT_MSG( dataptr,
wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) );
return dataptr->Get();
}
template<typename T> bool HasData() const
{
const wxVariantDataT<T> *dataptr =
wx_dynamic_cast(const wxVariantDataT<T>*, m_data);
return dataptr != NULL;
}
// returns this value as string
wxString GetAsString() const;
// gets the stored data casted to a wxObject*,
// returning NULL if cast is not possible
wxObject* GetAsObject();
protected:
wxVariantData* m_data;
wxString m_name;
};
#include "wx/dynarray.h"
WX_DECLARE_OBJARRAY_WITH_DECL(wxVariantBase, wxVariantBaseArray, class WXDLLIMPEXP_BASE);
// templated streaming, every type must have their specialization for these methods
template<typename T>
void wxStringReadValue( const wxString &s, T &data );
template<typename T>
void wxStringWriteValue( wxString &s, const T &data);
template<typename T>
void wxToStringConverter( const wxVariantBase &v, wxString &s ) \
{ wxStringWriteValue( s, v.Get<T>() ); }
template<typename T>
void wxFromStringConverter( const wxString &s, wxVariantBase &v ) \
{ T d; wxStringReadValue( s, d ); v = wxVariantBase(d); }
#endif // wxUSE_VARIANT
#endif // _WX_VARIANTBASE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/tracker.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/tracker.h
// Purpose: Support class for object lifetime tracking (wxWeakRef<T>)
// Author: Arne Steinarson
// Created: 28 Dec 07
// Copyright: (c) 2007 Arne Steinarson
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TRACKER_H_
#define _WX_TRACKER_H_
#include "wx/defs.h"
class wxEventConnectionRef;
// This class represents an object tracker and is stored in a linked list
// in the tracked object. It is only used in one of its derived forms.
class WXDLLIMPEXP_BASE wxTrackerNode
{
public:
wxTrackerNode() : m_nxt(NULL) { }
virtual ~wxTrackerNode() { }
virtual void OnObjectDestroy() = 0;
virtual wxEventConnectionRef *ToEventConnection() { return NULL; }
private:
wxTrackerNode *m_nxt;
friend class wxTrackable; // For list access
friend class wxEvtHandler; // For list access
};
// Add-on base class for a trackable object.
class WXDLLIMPEXP_BASE wxTrackable
{
public:
void AddNode(wxTrackerNode *prn)
{
prn->m_nxt = m_first;
m_first = prn;
}
void RemoveNode(wxTrackerNode *prn)
{
for ( wxTrackerNode **pprn = &m_first; *pprn; pprn = &(*pprn)->m_nxt )
{
if ( *pprn == prn )
{
*pprn = prn->m_nxt;
return;
}
}
wxFAIL_MSG( "removing invalid tracker node" );
}
wxTrackerNode *GetFirst() const { return m_first; }
protected:
// this class is only supposed to be used as a base class but never be
// created nor destroyed directly so all ctors and dtor are protected
wxTrackable() : m_first(NULL) { }
// copy ctor and assignment operator intentionally do not copy m_first: the
// objects which track the original trackable shouldn't track the new copy
wxTrackable(const wxTrackable& WXUNUSED(other)) : m_first(NULL) { }
wxTrackable& operator=(const wxTrackable& WXUNUSED(other)) { return *this; }
// dtor is not virtual: this class is not supposed to be used
// polymorphically and adding a virtual table to it would add unwanted
// overhead
~wxTrackable()
{
// Notify all registered refs
while ( m_first )
{
wxTrackerNode * const first = m_first;
m_first = first->m_nxt;
first->OnObjectDestroy();
}
}
wxTrackerNode *m_first;
};
#endif // _WX_TRACKER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/hashset.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/hashset.h
// Purpose: wxHashSet class
// Author: Mattia Barbon
// Modified by:
// Created: 11/08/2003
// Copyright: (c) Mattia Barbon
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HASHSET_H_
#define _WX_HASHSET_H_
#include "wx/hashmap.h"
// see comment in wx/hashmap.h which also applies to different standard hash
// set classes
#if wxUSE_STD_CONTAINERS && \
(defined(HAVE_STD_UNORDERED_SET) || defined(HAVE_TR1_UNORDERED_SET))
#if defined(HAVE_STD_UNORDERED_SET)
#include <unordered_set>
#define WX_HASH_SET_BASE_TEMPLATE std::unordered_set
#elif defined(HAVE_TR1_UNORDERED_SET)
#include <tr1/unordered_set>
#define WX_HASH_SET_BASE_TEMPLATE std::tr1::unordered_set
#else
#error Update this code: unordered_set is available, but I do not know where.
#endif
#elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP)
#if defined(HAVE_EXT_HASH_MAP)
#include <ext/hash_set>
#elif defined(HAVE_HASH_MAP)
#include <hash_set>
#endif
#define WX_HASH_SET_BASE_TEMPLATE WX_HASH_MAP_NAMESPACE::hash_set
#endif // different hash_set/unordered_set possibilities
#ifdef WX_HASH_SET_BASE_TEMPLATE
// we need to define the class declared by _WX_DECLARE_HASH_SET as a class and
// not a typedef to allow forward declaring it
#define _WX_DECLARE_HASH_SET_IMPL( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP ) \
CLASSEXP CLASSNAME \
: public WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T > \
{ \
public: \
explicit CLASSNAME(size_type n = 3, \
const hasher& h = hasher(), \
const key_equal& ke = key_equal(), \
const allocator_type& a = allocator_type()) \
: WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(n, h, ke, a) \
{} \
template <class InputIterator> \
CLASSNAME(InputIterator f, InputIterator l, \
const hasher& h = hasher(), \
const key_equal& ke = key_equal(), \
const allocator_type& a = allocator_type()) \
: WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(f, l, h, ke, a)\
{} \
CLASSNAME(const WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >& s) \
: WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(s) \
{} \
}
// In some standard library implementations (in particular, the libstdc++ that
// ships with g++ 4.7), std::unordered_set inherits privately from its hasher
// and comparator template arguments for purposes of empty base optimization.
// As a result, in the declaration of a class deriving from std::unordered_set
// the names of the hasher and comparator classes are interpreted as naming
// the base class which is inaccessible.
// The workaround is to prefix the class names with 'struct'; however, don't
// do this on MSVC because it causes a warning there if the class was
// declared as a 'class' rather than a 'struct' (and MSVC's std::unordered_set
// implementation does not suffer from the access problem).
#ifdef _MSC_VER
#define WX_MAYBE_PREFIX_WITH_STRUCT(STRUCTNAME) STRUCTNAME
#else
#define WX_MAYBE_PREFIX_WITH_STRUCT(STRUCTNAME) struct STRUCTNAME
#endif
#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP ) \
_WX_DECLARE_HASH_SET_IMPL( \
KEY_T, \
WX_MAYBE_PREFIX_WITH_STRUCT(HASH_T), \
WX_MAYBE_PREFIX_WITH_STRUCT(KEY_EQ_T), \
PTROP, \
CLASSNAME, \
CLASSEXP)
#else // no appropriate STL class, use our own implementation
// this is a complex way of defining an easily inlineable identity function...
#define _WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME, CLASSEXP ) \
CLASSEXP CLASSNAME \
{ \
typedef KEY_T key_type; \
typedef const key_type const_key_type; \
typedef const_key_type& const_key_reference; \
public: \
CLASSNAME() { } \
const_key_reference operator()( const_key_reference key ) const \
{ return key; } \
\
/* 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; } \
};
#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP )\
_WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \
_WX_DECLARE_HASHTABLE( KEY_T, KEY_T, HASH_T, \
CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, PTROP, \
CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \
CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \
{ \
public: \
_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() ) {} \
\
Insert_Result insert( const key_type& key ) \
{ \
bool created; \
Node *node = GetOrCreateNode( key, created ); \
return Insert_Result( iterator( node, this ), created ); \
} \
\
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 ); \
} \
\
size_type erase( const key_type& k ) \
{ return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \
void erase( const iterator& it ) { erase( *it ); } \
void erase( const const_iterator& it ) { erase( *it ); } \
\
/* count() == 0 | 1 */ \
size_type count( const const_key_type& key ) const \
{ return GetNode( key ) ? 1 : 0; } \
}
#endif // STL/wx implementations
// these macros are to be used in the user code
#define WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \
_WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, class )
// and these do exactly the same thing but should be used inside the
// library
#define WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
_WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, DECL )
#define WX_DECLARE_EXPORTED_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \
WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, \
CLASSNAME, class WXDLLIMPEXP_CORE )
// Finally these versions allow to define hash sets of non-objects (including
// pointers, hence the confusing but wxArray-compatible name) without
// operator->() which can't be used for them. This is mostly used inside the
// library itself to avoid warnings when using such hash sets with some less
// common compilers (notably Sun CC).
#define WX_DECLARE_HASH_SET_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \
_WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, class )
#define WX_DECLARE_HASH_SET_WITH_DECL_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
_WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, DECL )
// 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_SET(type, hashset) \
{ \
type::iterator it, en; \
for( it = (hashset).begin(), en = (hashset).end(); it != en; ++it ) \
delete *it; \
(hashset).clear(); \
}
#endif // _WX_HASHSET_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/imagpcx.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/imagpcx.h
// Purpose: wxImage PCX handler
// Author: Guillermo Rodriguez Garcia <[email protected]>
// Copyright: (c) 1999 Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_IMAGPCX_H_
#define _WX_IMAGPCX_H_
#include "wx/image.h"
//-----------------------------------------------------------------------------
// wxPCXHandler
//-----------------------------------------------------------------------------
#if wxUSE_PCX
class WXDLLIMPEXP_CORE wxPCXHandler : public wxImageHandler
{
public:
inline wxPCXHandler()
{
m_name = wxT("PCX file");
m_extension = wxT("pcx");
m_type = wxBITMAP_TYPE_PCX;
m_mime = wxT("image/pcx");
}
#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
private:
wxDECLARE_DYNAMIC_CLASS(wxPCXHandler);
};
#endif // wxUSE_PCX
#endif
// _WX_IMAGPCX_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dateevt.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/dateevt.h
// Purpose: declares wxDateEvent class
// Author: Vadim Zeitlin
// Modified by:
// Created: 2005-01-10
// Copyright: (c) 2005 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DATEEVT_H_
#define _WX_DATEEVT_H_
#include "wx/event.h"
#include "wx/datetime.h"
#include "wx/window.h"
// ----------------------------------------------------------------------------
// wxDateEvent: used by wxCalendarCtrl, wxDatePickerCtrl and wxTimePickerCtrl.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDateEvent : public wxCommandEvent
{
public:
wxDateEvent() { }
wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type)
: wxCommandEvent(type, win->GetId()),
m_date(dt)
{
SetEventObject(win);
}
const wxDateTime& GetDate() const { return m_date; }
void SetDate(const wxDateTime &date) { m_date = date; }
// default copy ctor, assignment operator and dtor are ok
virtual wxEvent *Clone() const wxOVERRIDE { return new wxDateEvent(*this); }
private:
wxDateTime m_date;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent);
};
// ----------------------------------------------------------------------------
// event types and macros for handling them
// ----------------------------------------------------------------------------
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_DATE_CHANGED, wxDateEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_ADV, wxEVT_TIME_CHANGED, wxDateEvent);
typedef void (wxEvtHandler::*wxDateEventFunction)(wxDateEvent&);
#define wxDateEventHandler(func) \
wxEVENT_HANDLER_CAST(wxDateEventFunction, func)
#define EVT_DATE_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_DATE_CHANGED, id, wxDateEventHandler(fn))
#define EVT_TIME_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_TIME_CHANGED, id, wxDateEventHandler(fn))
#endif // _WX_DATEEVT_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/sstream.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/sstream.h
// Purpose: string-based streams
// Author: Vadim Zeitlin
// Modified by:
// Created: 2004-09-19
// Copyright: (c) 2004 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SSTREAM_H_
#define _WX_SSTREAM_H_
#include "wx/stream.h"
#if wxUSE_STREAMS
// ----------------------------------------------------------------------------
// wxStringInputStream is a stream reading from the given (fixed size) string
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxStringInputStream : public wxInputStream
{
public:
// ctor associates the stream with the given string which makes a copy of
// it
wxStringInputStream(const wxString& s);
virtual wxFileOffset GetLength() const wxOVERRIDE;
virtual bool IsSeekable() const wxOVERRIDE { return true; }
protected:
virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode) wxOVERRIDE;
virtual wxFileOffset OnSysTell() const wxOVERRIDE;
virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE;
private:
// the string that was passed in the ctor
wxString m_str;
// the buffer we're reading from
wxCharBuffer m_buf;
// length of the buffer we're reading from
size_t m_len;
// position in the stream in bytes, *not* in chars
size_t m_pos;
wxDECLARE_NO_COPY_CLASS(wxStringInputStream);
};
// ----------------------------------------------------------------------------
// wxStringOutputStream writes data to the given string, expanding it as needed
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxStringOutputStream : public wxOutputStream
{
public:
// The stream will write data either to the provided string or to an
// internal string which can be retrieved using GetString()
//
// Note that the conversion object should have the life time greater than
// this stream.
explicit wxStringOutputStream(wxString *pString = NULL,
wxMBConv& conv = wxConvUTF8);
// get the string containing current output
const wxString& GetString() const { return *m_str; }
virtual bool IsSeekable() const wxOVERRIDE { return true; }
protected:
virtual wxFileOffset OnSysTell() const wxOVERRIDE;
virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE;
private:
// internal string, not used if caller provided his own string
wxString m_strInternal;
// pointer given by the caller or just pointer to m_strInternal
wxString *m_str;
// position in the stream in bytes, *not* in chars
size_t m_pos;
// converter to use: notice that with the default UTF-8 one the input
// stream must contain valid UTF-8 data, use wxConvISO8859_1 to work with
// arbitrary 8 bit data
wxMBConv& m_conv;
#if wxUSE_UNICODE
// unconverted data from the last call to OnSysWrite()
wxMemoryBuffer m_unconv;
#endif // wxUSE_UNICODE
wxDECLARE_NO_COPY_CLASS(wxStringOutputStream);
};
#endif // wxUSE_STREAMS
#endif // _WX_SSTREAM_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/bookctrl.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/bookctrl.h
// Purpose: wxBookCtrlBase: common base class for wxList/Tree/Notebook
// Author: Vadim Zeitlin
// Modified by:
// Created: 19.08.03
// Copyright: (c) 2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BOOKCTRL_H_
#define _WX_BOOKCTRL_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_BOOKCTRL
#include "wx/control.h"
#include "wx/vector.h"
#include "wx/withimages.h"
class WXDLLIMPEXP_FWD_CORE wxImageList;
class WXDLLIMPEXP_FWD_CORE wxBookCtrlEvent;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// wxBookCtrl hit results
enum
{
wxBK_HITTEST_NOWHERE = 1, // not on tab
wxBK_HITTEST_ONICON = 2, // on icon
wxBK_HITTEST_ONLABEL = 4, // on label
wxBK_HITTEST_ONITEM = 16, // on tab control but not on its icon or label
wxBK_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page
};
// wxBookCtrl flags (common for wxNotebook, wxListbook, wxChoicebook, wxTreebook)
#define wxBK_DEFAULT 0x0000
#define wxBK_TOP 0x0010
#define wxBK_BOTTOM 0x0020
#define wxBK_LEFT 0x0040
#define wxBK_RIGHT 0x0080
#define wxBK_ALIGN_MASK (wxBK_TOP | wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT)
// ----------------------------------------------------------------------------
// wxBookCtrlBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBookCtrlBase : public wxControl,
public wxWithImages
{
public:
// construction
// ------------
wxBookCtrlBase()
{
Init();
}
wxBookCtrlBase(wxWindow *parent,
wxWindowID winid,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxEmptyString)
{
Init();
(void)Create(parent, winid, pos, size, style, name);
}
// quasi ctor
bool Create(wxWindow *parent,
wxWindowID winid,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxEmptyString);
// accessors
// ---------
// get number of pages in the dialog
virtual size_t GetPageCount() const { return m_pages.size(); }
// get the panel which represents the given page
virtual wxWindow *GetPage(size_t n) const { return m_pages.at(n); }
// get the current page or NULL if none
wxWindow *GetCurrentPage() const
{
const int n = GetSelection();
return n == wxNOT_FOUND ? NULL : GetPage(n);
}
// get the currently selected page or wxNOT_FOUND if none
virtual int GetSelection() const { return m_selection; }
// set/get the title of a page
virtual bool SetPageText(size_t n, const wxString& strText) = 0;
virtual wxString GetPageText(size_t n) const = 0;
// image list stuff: each page may have an image associated with it (all
// images belong to the same image list)
// ---------------------------------------------------------------------
// sets/returns item's image index in the current image list
virtual int GetPageImage(size_t n) const = 0;
virtual bool SetPageImage(size_t n, int imageId) = 0;
// geometry
// --------
// resize the notebook so that all pages will have the specified size
virtual void SetPageSize(const wxSize& size);
// return the size of the area needed to accommodate the controller
wxSize GetControllerSize() const;
// calculate the size of the control from the size of its page
//
// by default this simply returns size enough to fit both the page and the
// controller
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
// get/set size of area between book control area and page area
unsigned int GetInternalBorder() const { return m_internalBorder; }
void SetInternalBorder(unsigned int border) { m_internalBorder = border; }
// Sets/gets the margin around the controller
void SetControlMargin(int margin) { m_controlMargin = margin; }
int GetControlMargin() const { return m_controlMargin; }
// returns true if we have wxBK_TOP or wxBK_BOTTOM style
bool IsVertical() const { return HasFlag(wxBK_BOTTOM | wxBK_TOP); }
// set/get option to shrink to fit current page
void SetFitToCurrentPage(bool fit) { m_fitToCurrentPage = fit; }
bool GetFitToCurrentPage() const { return m_fitToCurrentPage; }
// returns the sizer containing the control, if any
wxSizer* GetControlSizer() const { return m_controlSizer; }
// operations
// ----------
// remove one page from the control and delete it
virtual bool DeletePage(size_t n);
// remove one page from the notebook, without deleting it
virtual bool RemovePage(size_t n)
{
DoInvalidateBestSize();
return DoRemovePage(n) != NULL;
}
// remove all pages and delete them
virtual bool DeleteAllPages()
{
m_selection = wxNOT_FOUND;
DoInvalidateBestSize();
WX_CLEAR_ARRAY(m_pages);
return true;
}
// adds a new page to the control
virtual bool AddPage(wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = NO_IMAGE)
{
DoInvalidateBestSize();
return InsertPage(GetPageCount(), page, text, bSelect, imageId);
}
// the same as AddPage(), but adds the page at the specified position
virtual bool InsertPage(size_t n,
wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = NO_IMAGE) = 0;
// set the currently selected page, return the index of the previously
// selected one (or wxNOT_FOUND on error)
//
// NB: this function will generate PAGE_CHANGING/ED events
virtual int SetSelection(size_t n) = 0;
// acts as SetSelection but does not generate events
virtual int ChangeSelection(size_t n) = 0;
// cycle thru the pages
void AdvanceSelection(bool forward = true)
{
int nPage = GetNextPage(forward);
if ( nPage != wxNOT_FOUND )
{
// cast is safe because of the check above
SetSelection((size_t)nPage);
}
}
// return the index of the given page or wxNOT_FOUND
int FindPage(const wxWindow* page) const;
// hit test: returns which page is hit and, optionally, where (icon, label)
virtual int HitTest(const wxPoint& WXUNUSED(pt),
long * WXUNUSED(flags) = NULL) const
{
return wxNOT_FOUND;
}
// we do have multiple pages
virtual bool HasMultiplePages() const wxOVERRIDE { return true; }
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; }
protected:
// flags for DoSetSelection()
enum
{
SetSelection_SendEvent = 1
};
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
// After the insertion of the page in the method InsertPage, calling this
// method sets the selection to the given page or the first one if there is
// still no selection. The "selection changed" event is sent only if
// bSelect is true, so when it is false, no event is sent even if the
// selection changed from wxNOT_FOUND to 0 when inserting the first page.
//
// Returns true if the selection was set to the specified page (explicitly
// because of bSelect == true or implicitly because it's the first page) or
// false otherwise.
bool DoSetSelectionAfterInsertion(size_t n, bool bSelect);
// Update the selection after removing the page at the given index,
// typically called from the derived class overridden DoRemovePage().
void DoSetSelectionAfterRemoval(size_t n);
// set the selection to the given page, sending the events (which can
// possibly prevent the page change from taking place) if SendEvent flag is
// included
virtual int DoSetSelection(size_t nPage, int flags = 0);
// if the derived class uses DoSetSelection() for implementing
// [Set|Change]Selection, it must override UpdateSelectedPage(),
// CreatePageChangingEvent() and MakeChangedEvent(), but as it might not
// use it, these functions are not pure virtual
// called to notify the control about a new current page
virtual void UpdateSelectedPage(size_t WXUNUSED(newsel))
{ wxFAIL_MSG(wxT("Override this function!")); }
// create a new "page changing" event
virtual wxBookCtrlEvent* CreatePageChangingEvent() const
{ wxFAIL_MSG(wxT("Override this function!")); return NULL; }
// modify the event created by CreatePageChangingEvent() to "page changed"
// event, usually by just calling SetEventType() on it
virtual void MakeChangedEvent(wxBookCtrlEvent& WXUNUSED(event))
{ wxFAIL_MSG(wxT("Override this function!")); }
// The derived class also may override the following method, also called
// from DoSetSelection(), to show/hide pages differently.
virtual void DoShowPage(wxWindow* page, bool show) { page->Show(show); }
// Should we accept NULL page pointers in Add/InsertPage()?
//
// Default is no but derived classes may override it if they can treat NULL
// pages in some sensible way (e.g. wxTreebook overrides this to allow
// having nodes without any associated page)
virtual bool AllowNullPage() const { return false; }
// For classes that allow null pages, we also need a way to find the
// closest non-NULL page corresponding to the given index, e.g. the first
// leaf item in wxTreebook tree and this method must be overridden to
// return it if AllowNullPage() is overridden. Note that it can still
// return null if there are no valid pages after this one.
virtual wxWindow *TryGetNonNullPage(size_t page) { return m_pages[page]; }
// Remove the page and return a pointer to it.
//
// It also needs to update the current selection if necessary, i.e. if the
// page being removed comes before the selected one and the helper method
// DoSetSelectionAfterRemoval() can be used for this.
virtual wxWindow *DoRemovePage(size_t page) = 0;
// our best size is the size which fits all our pages
virtual wxSize DoGetBestSize() const wxOVERRIDE;
// helper: get the next page wrapping if we reached the end
int GetNextPage(bool forward) const;
// Lay out controls
virtual void DoSize();
// It is better to make this control transparent so that by default the controls on
// its pages are on the same colour background as the rest of the window. If the user
// prefers a coloured background they can set the background colour on the page panel
virtual bool HasTransparentBackground() wxOVERRIDE { return true; }
// This method also invalidates the size of the controller and should be
// called instead of just InvalidateBestSize() whenever pages are added or
// removed as this also affects the controller
void DoInvalidateBestSize();
#if wxUSE_HELP
// Show the help for the corresponding page
void OnHelp(wxHelpEvent& event);
#endif // wxUSE_HELP
// the array of all pages of this control
wxVector<wxWindow*> m_pages;
// get the page area
virtual wxRect GetPageRect() const;
// event handlers
void OnSize(wxSizeEvent& event);
// controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook)
wxControl *m_bookctrl;
// Whether to shrink to fit current page
bool m_fitToCurrentPage;
// the sizer containing the choice control
wxSizer *m_controlSizer;
// the margin around the choice control
int m_controlMargin;
// The currently selected page (in range 0..m_pages.size()-1 inclusive) or
// wxNOT_FOUND if none (this can normally only be the case for an empty
// control without any pages).
int m_selection;
private:
// common part of all ctors
void Init();
// internal border
unsigned int m_internalBorder;
wxDECLARE_ABSTRACT_CLASS(wxBookCtrlBase);
wxDECLARE_NO_COPY_CLASS(wxBookCtrlBase);
wxDECLARE_EVENT_TABLE();
};
// ----------------------------------------------------------------------------
// wxBookCtrlEvent: page changing events generated by book classes
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBookCtrlEvent : public wxNotifyEvent
{
public:
wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
: wxNotifyEvent(commandType, winid)
{
m_nSel = nSel;
m_nOldSel = nOldSel;
}
wxBookCtrlEvent(const wxBookCtrlEvent& event)
: wxNotifyEvent(event)
{
m_nSel = event.m_nSel;
m_nOldSel = event.m_nOldSel;
}
virtual wxEvent *Clone() const wxOVERRIDE { return new wxBookCtrlEvent(*this); }
// accessors
// the currently selected page (wxNOT_FOUND if none)
int GetSelection() const { return m_nSel; }
void SetSelection(int nSel) { m_nSel = nSel; }
// the page that was selected before the change (wxNOT_FOUND if none)
int GetOldSelection() const { return m_nOldSel; }
void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; }
private:
int m_nSel, // currently selected page
m_nOldSel; // previously selected page
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxBookCtrlEvent);
};
typedef void (wxEvtHandler::*wxBookCtrlEventFunction)(wxBookCtrlEvent&);
#define wxBookCtrlEventHandler(func) \
wxEVENT_HANDLER_CAST(wxBookCtrlEventFunction, func)
// obsolete name, defined for compatibility only
#define wxBookCtrlBaseEvent wxBookCtrlEvent
// make a default book control for given platform
#if wxUSE_NOTEBOOK
// dedicated to majority of desktops
#include "wx/notebook.h"
#define wxBookCtrl wxNotebook
#define wxEVT_BOOKCTRL_PAGE_CHANGED wxEVT_NOTEBOOK_PAGE_CHANGED
#define wxEVT_BOOKCTRL_PAGE_CHANGING wxEVT_NOTEBOOK_PAGE_CHANGING
#define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn)
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn)
#else
// dedicated to Smartphones
#include "wx/choicebk.h"
#define wxBookCtrl wxChoicebook
#define wxEVT_BOOKCTRL_PAGE_CHANGED wxEVT_CHOICEBOOK_PAGE_CHANGED
#define wxEVT_BOOKCTRL_PAGE_CHANGING wxEVT_CHOICEBOOK_PAGE_CHANGING
#define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn)
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn)
#endif
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_BOOKCTRL_PAGE_CHANGED
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_BOOKCTRL_PAGE_CHANGING
#endif // wxUSE_BOOKCTRL
#endif // _WX_BOOKCTRL_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/toolbar.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/toolbar.h
// Purpose: wxToolBar interface declaration
// Author: Vadim Zeitlin
// Modified by:
// Created: 20.11.99
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TOOLBAR_H_BASE_
#define _WX_TOOLBAR_H_BASE_
#include "wx/defs.h"
// ----------------------------------------------------------------------------
// wxToolBar style flags
// ----------------------------------------------------------------------------
enum
{
// lay out the toolbar horizontally
wxTB_HORIZONTAL = wxHORIZONTAL, // == 0x0004
wxTB_TOP = wxTB_HORIZONTAL,
// lay out the toolbar vertically
wxTB_VERTICAL = wxVERTICAL, // == 0x0008
wxTB_LEFT = wxTB_VERTICAL,
// "flat" buttons (Win32/GTK only)
wxTB_FLAT = 0x0020,
// dockable toolbar (GTK only)
wxTB_DOCKABLE = 0x0040,
// don't show the icons (they're shown by default)
wxTB_NOICONS = 0x0080,
// show the text (not shown by default)
wxTB_TEXT = 0x0100,
// don't show the divider between toolbar and the window (Win32 only)
wxTB_NODIVIDER = 0x0200,
// no automatic alignment (Win32 only, useless)
wxTB_NOALIGN = 0x0400,
// show the text and the icons alongside, not vertically stacked (Win32/GTK)
wxTB_HORZ_LAYOUT = 0x0800,
wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT,
// don't show the toolbar short help tooltips
wxTB_NO_TOOLTIPS = 0x1000,
// lay out toolbar at the bottom of the window
wxTB_BOTTOM = 0x2000,
// lay out toolbar at the right edge of the window
wxTB_RIGHT = 0x4000,
wxTB_DEFAULT_STYLE = wxTB_HORIZONTAL
};
#if wxUSE_TOOLBAR
#include "wx/tbarbase.h" // the base class for all toolbars
#if defined(__WXUNIVERSAL__)
#include "wx/univ/toolbar.h"
#elif defined(__WXMSW__)
#include "wx/msw/toolbar.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/toolbar.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/toolbar.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/toolbar.h"
#elif defined(__WXMAC__)
#include "wx/osx/toolbar.h"
#elif defined(__WXQT__)
#include "wx/qt/toolbar.h"
#endif
#endif // wxUSE_TOOLBAR
#endif
// _WX_TOOLBAR_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dynload.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/dynload.h
// Purpose: Dynamic loading framework
// Author: Ron Lee, David Falkinder, Vadim Zeitlin and a cast of 1000's
// (derived in part from dynlib.cpp (c) 1998 Guilhem Lavaux)
// Modified by:
// Created: 03/12/01
// Copyright: (c) 2001 Ron Lee <[email protected]>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DYNAMICLOADER_H__
#define _WX_DYNAMICLOADER_H__
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_DYNAMIC_LOADER
#include "wx/dynlib.h"
#include "wx/hashmap.h"
#include "wx/module.h"
class WXDLLIMPEXP_FWD_BASE wxPluginLibrary;
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPluginLibrary *, wxDLManifest,
class WXDLLIMPEXP_BASE);
typedef wxDLManifest wxDLImports;
// ---------------------------------------------------------------------------
// wxPluginLibrary
// ---------------------------------------------------------------------------
// NOTE: Do not attempt to use a base class pointer to this class.
// wxDL is not virtual and we deliberately hide some of it's
// methods here.
//
// Unless you know exacty why you need to, you probably shouldn't
// instantiate this class directly anyway, use wxPluginManager
// instead.
class WXDLLIMPEXP_BASE wxPluginLibrary : public wxDynamicLibrary
{
public:
static wxDLImports* ms_classes; // Static hash of all imported classes.
wxPluginLibrary( const wxString &libname, int flags = wxDL_DEFAULT );
~wxPluginLibrary();
wxPluginLibrary *RefLib();
bool UnrefLib();
// These two are called by the PluginSentinel on (PLUGGABLE) object
// creation/destruction. There is usually no reason for the user to
// call them directly. We have to separate this from the link count,
// since the two are not interchangeable.
// FIXME: for even better debugging PluginSentinel should register
// the name of the class created too, then we can state
// exactly which object was not destroyed which may be
// difficult to find otherwise. Also this code should
// probably only be active in DEBUG mode, but let's just
// get it right first.
void RefObj() { ++m_objcount; }
void UnrefObj()
{
wxASSERT_MSG( m_objcount > 0, wxT("Too many objects deleted??") );
--m_objcount;
}
// Override/hide some base class methods
bool IsLoaded() const { return m_linkcount > 0; }
void Unload() { UnrefLib(); }
private:
// These pointers may be NULL but if they are not, then m_ourLast follows
// m_ourFirst in the linked list, i.e. can be found by calling GetNext() a
// sufficient number of times.
const wxClassInfo *m_ourFirst; // first class info in this plugin
const wxClassInfo *m_ourLast; // ..and the last one
size_t m_linkcount; // Ref count of library link calls
size_t m_objcount; // ..and (pluggable) object instantiations.
wxModuleList m_wxmodules; // any wxModules that we initialised.
void UpdateClasses(); // Update ms_classes
void RestoreClasses(); // Removes this library from ms_classes
void RegisterModules(); // Init any wxModules in the lib.
void UnregisterModules(); // Cleanup any wxModules we installed.
wxDECLARE_NO_COPY_CLASS(wxPluginLibrary);
};
class WXDLLIMPEXP_BASE wxPluginManager
{
public:
// Static accessors.
static wxPluginLibrary *LoadLibrary( const wxString &libname,
int flags = wxDL_DEFAULT );
static bool UnloadLibrary(const wxString &libname);
// Instance methods.
wxPluginManager() : m_entry(NULL) {}
wxPluginManager(const wxString &libname, int flags = wxDL_DEFAULT)
{
Load(libname, flags);
}
~wxPluginManager() { if ( IsLoaded() ) Unload(); }
bool Load(const wxString &libname, int flags = wxDL_DEFAULT);
void Unload();
bool IsLoaded() const { return m_entry && m_entry->IsLoaded(); }
void *GetSymbol(const wxString &symbol, bool *success = 0)
{
return m_entry->GetSymbol( symbol, success );
}
static void CreateManifest() { ms_manifest = new wxDLManifest(wxKEY_STRING); }
static void ClearManifest() { delete ms_manifest; ms_manifest = NULL; }
private:
// return the pointer to the entry for the library with given name in
// ms_manifest or NULL if none
static wxPluginLibrary *FindByName(const wxString& name)
{
const wxDLManifest::iterator i = ms_manifest->find(name);
return i == ms_manifest->end() ? NULL : i->second;
}
static wxDLManifest* ms_manifest; // Static hash of loaded libs.
wxPluginLibrary* m_entry; // Cache our entry in the manifest.
// We could allow this class to be copied if we really
// wanted to, but not without modification.
wxDECLARE_NO_COPY_CLASS(wxPluginManager);
};
#endif // wxUSE_DYNAMIC_LOADER
#endif // _WX_DYNAMICLOADER_H__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/wxcrt.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/wxcrt.h
// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
// CRT functions
// Author: Joel Farley, Ove Kaaven
// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee, Vaclav Slavik
// Created: 1998/06/12
// Copyright: (c) 1998-2006 wxWidgets dev team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WXCRT_H_
#define _WX_WXCRT_H_
#include "wx/wxcrtbase.h"
#include "wx/string.h"
#ifndef __WX_SETUP_H__
// For non-configure builds assume vsscanf is available, if not Visual C
#if !defined (__VISUALC__)
#define HAVE_VSSCANF 1
#endif
#endif
// ============================================================================
// misc functions
// ============================================================================
/* checks whether the passed in pointer is NULL and if the string is empty */
inline bool wxIsEmpty(const char *s) { return !s || !*s; }
inline bool wxIsEmpty(const wchar_t *s) { return !s || !*s; }
inline bool wxIsEmpty(const wxScopedCharBuffer& s) { return wxIsEmpty(s.data()); }
inline bool wxIsEmpty(const wxScopedWCharBuffer& s) { return wxIsEmpty(s.data()); }
inline bool wxIsEmpty(const wxString& s) { return s.empty(); }
inline bool wxIsEmpty(const wxCStrData& s) { return s.AsString().empty(); }
/* multibyte to wide char conversion functions and macros */
/* multibyte<->widechar conversion */
WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n);
WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n);
#if wxUSE_UNICODE
#define wxMB2WX wxMB2WC
#define wxWX2MB wxWC2MB
#define wxWC2WX wxStrncpy
#define wxWX2WC wxStrncpy
#else
#define wxMB2WX wxStrncpy
#define wxWX2MB wxStrncpy
#define wxWC2WX wxWC2MB
#define wxWX2WC wxMB2WC
#endif
// RN: We could do the usual tricky compiler detection here,
// and use their variant (such as wmemchr, etc.). The problem
// is that these functions are quite rare, even though they are
// part of the current POSIX standard. In addition, most compilers
// (including even MSC) inline them just like we do right in their
// headers.
//
#include <string.h>
#if wxUSE_UNICODE
//implement our own wmem variants
inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l)
{
for(;l && *s != c;--l, ++s) {}
if(l)
return const_cast<wxChar*>(s);
return NULL;
}
inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len)
{
for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {}
if(len)
return *sz1 < *sz2 ? -1 : *sz1 > *sz2;
else
return 0;
}
inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len)
{
return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar));
}
inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len)
{
return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar));
}
inline wxChar* wxTmemset(wxChar* szOut, wxChar cIn, size_t len)
{
wxChar* szRet = szOut;
while (len--)
*szOut++ = cIn;
return szRet;
}
#endif /* wxUSE_UNICODE */
// provide trivial wrappers for char* versions for both ANSI and Unicode builds
// (notice that these intentionally return "char *" and not "void *" unlike the
// standard memxxx() for symmetry with the wide char versions):
inline char* wxTmemchr(const char* s, char c, size_t len)
{ return (char*)memchr(s, c, len); }
inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len)
{ return memcmp(sz1, sz2, len); }
inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len)
{ return (char*)memcpy(szOut, szIn, len); }
inline char* wxTmemmove(char* szOut, const char* szIn, size_t len)
{ return (char*)memmove(szOut, szIn, len); }
inline char* wxTmemset(char* szOut, char cIn, size_t len)
{ return (char*)memset(szOut, cIn, len); }
// ============================================================================
// wx wrappers for CRT functions in both char* and wchar_t* versions
// ============================================================================
// A few notes on implementation of these wrappers:
//
// We need both char* and wchar_t* versions of functions like wxStrlen() for
// compatibility with both ANSI and Unicode builds.
//
// This makes passing wxString or c_str()/mb_str()/wc_str() result to them
// ambiguous, so we need to provide overrides for that as well (in cases where
// it makes sense).
//
// We can do this without problems for some functions (wxStrlen()), but in some
// cases, we can't stay compatible with both ANSI and Unicode builds, e.g. for
// wxStrcpy(const wxString&), which can only return either char* or wchar_t*.
// In these cases, we preserve ANSI build compatibility by returning char*.
// ----------------------------------------------------------------------------
// locale functions
// ----------------------------------------------------------------------------
// NB: we can't provide const wchar_t* (= wxChar*) overload, because calling
// wxSetlocale(category, NULL) -- which is a common thing to do -- would be
// ambiguous
WXDLLIMPEXP_BASE char* wxSetlocale(int category, const char *locale);
inline char* wxSetlocale(int category, const wxScopedCharBuffer& locale)
{ return wxSetlocale(category, locale.data()); }
inline char* wxSetlocale(int category, const wxString& locale)
{ return wxSetlocale(category, locale.mb_str()); }
inline char* wxSetlocale(int category, const wxCStrData& locale)
{ return wxSetlocale(category, locale.AsCharBuf()); }
// ----------------------------------------------------------------------------
// string functions
// ----------------------------------------------------------------------------
/* safe version of strlen() (returns 0 if passed NULL pointer) */
// NB: these are defined in wxcrtbase.h, see the comment there
// inline size_t wxStrlen(const char *s) { return s ? strlen(s) : 0; }
// inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_Strlen_(s) : 0; }
inline size_t wxStrlen(const wxScopedCharBuffer& s) { return wxStrlen(s.data()); }
inline size_t wxStrlen(const wxScopedWCharBuffer& s) { return wxStrlen(s.data()); }
inline size_t wxStrlen(const wxString& s) { return s.length(); }
inline size_t wxStrlen(const wxCStrData& s) { return s.AsString().length(); }
// this is a function new in 2.9 so we don't care about backwards compatibility and
// so don't need to support wxScopedCharBuffer/wxScopedWCharBuffer overloads
#if defined(wxCRT_StrnlenA)
inline size_t wxStrnlen(const char *str, size_t maxlen) { return wxCRT_StrnlenA(str, maxlen); }
#else
inline size_t wxStrnlen(const char *str, size_t maxlen)
{
size_t n;
for ( n = 0; n < maxlen; n++ )
if ( !str[n] )
break;
return n;
}
#endif
#if defined(wxCRT_StrnlenW)
inline size_t wxStrnlen(const wchar_t *str, size_t maxlen) { return wxCRT_StrnlenW(str, maxlen); }
#else
inline size_t wxStrnlen(const wchar_t *str, size_t maxlen)
{
size_t n;
for ( n = 0; n < maxlen; n++ )
if ( !str[n] )
break;
return n;
}
#endif
// NB: these are defined in wxcrtbase.h, see the comment there
// inline char* wxStrdup(const char *s) { return wxStrdupA(s); }
// inline wchar_t* wxStrdup(const wchar_t *s) { return wxStrdupW(s); }
inline char* wxStrdup(const wxScopedCharBuffer& s) { return wxStrdup(s.data()); }
inline wchar_t* wxStrdup(const wxScopedWCharBuffer& s) { return wxStrdup(s.data()); }
inline char* wxStrdup(const wxString& s) { return wxStrdup(s.mb_str()); }
inline char* wxStrdup(const wxCStrData& s) { return wxStrdup(s.AsCharBuf()); }
inline char *wxStrcpy(char *dest, const char *src)
{ return wxCRT_StrcpyA(dest, src); }
inline wchar_t *wxStrcpy(wchar_t *dest, const wchar_t *src)
{ return wxCRT_StrcpyW(dest, src); }
inline char *wxStrcpy(char *dest, const wxString& src)
{ return wxCRT_StrcpyA(dest, src.mb_str()); }
inline char *wxStrcpy(char *dest, const wxCStrData& src)
{ return wxCRT_StrcpyA(dest, src.AsCharBuf()); }
inline char *wxStrcpy(char *dest, const wxScopedCharBuffer& src)
{ return wxCRT_StrcpyA(dest, src.data()); }
inline wchar_t *wxStrcpy(wchar_t *dest, const wxString& src)
{ return wxCRT_StrcpyW(dest, src.wc_str()); }
inline wchar_t *wxStrcpy(wchar_t *dest, const wxCStrData& src)
{ return wxCRT_StrcpyW(dest, src.AsWCharBuf()); }
inline wchar_t *wxStrcpy(wchar_t *dest, const wxScopedWCharBuffer& src)
{ return wxCRT_StrcpyW(dest, src.data()); }
inline char *wxStrcpy(char *dest, const wchar_t *src)
{ return wxCRT_StrcpyA(dest, wxConvLibc.cWC2MB(src)); }
inline wchar_t *wxStrcpy(wchar_t *dest, const char *src)
{ return wxCRT_StrcpyW(dest, wxConvLibc.cMB2WC(src)); }
inline char *wxStrncpy(char *dest, const char *src, size_t n)
{ return wxCRT_StrncpyA(dest, src, n); }
inline wchar_t *wxStrncpy(wchar_t *dest, const wchar_t *src, size_t n)
{ return wxCRT_StrncpyW(dest, src, n); }
inline char *wxStrncpy(char *dest, const wxString& src, size_t n)
{ return wxCRT_StrncpyA(dest, src.mb_str(), n); }
inline char *wxStrncpy(char *dest, const wxCStrData& src, size_t n)
{ return wxCRT_StrncpyA(dest, src.AsCharBuf(), n); }
inline char *wxStrncpy(char *dest, const wxScopedCharBuffer& src, size_t n)
{ return wxCRT_StrncpyA(dest, src.data(), n); }
inline wchar_t *wxStrncpy(wchar_t *dest, const wxString& src, size_t n)
{ return wxCRT_StrncpyW(dest, src.wc_str(), n); }
inline wchar_t *wxStrncpy(wchar_t *dest, const wxCStrData& src, size_t n)
{ return wxCRT_StrncpyW(dest, src.AsWCharBuf(), n); }
inline wchar_t *wxStrncpy(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n)
{ return wxCRT_StrncpyW(dest, src.data(), n); }
inline char *wxStrncpy(char *dest, const wchar_t *src, size_t n)
{ return wxCRT_StrncpyA(dest, wxConvLibc.cWC2MB(src), n); }
inline wchar_t *wxStrncpy(wchar_t *dest, const char *src, size_t n)
{ return wxCRT_StrncpyW(dest, wxConvLibc.cMB2WC(src), n); }
// this is a function new in 2.9 so we don't care about backwards compatibility and
// so don't need to support wchar_t/char overloads
inline size_t wxStrlcpy(char *dest, const char *src, size_t n)
{
const size_t len = wxCRT_StrlenA(src);
if ( n )
{
if ( n-- > len )
n = len;
memcpy(dest, src, n);
dest[n] = '\0';
}
return len;
}
inline size_t wxStrlcpy(wchar_t *dest, const wchar_t *src, size_t n)
{
const size_t len = wxCRT_StrlenW(src);
if ( n )
{
if ( n-- > len )
n = len;
memcpy(dest, src, n * sizeof(wchar_t));
dest[n] = L'\0';
}
return len;
}
inline char *wxStrcat(char *dest, const char *src)
{ return wxCRT_StrcatA(dest, src); }
inline wchar_t *wxStrcat(wchar_t *dest, const wchar_t *src)
{ return wxCRT_StrcatW(dest, src); }
inline char *wxStrcat(char *dest, const wxString& src)
{ return wxCRT_StrcatA(dest, src.mb_str()); }
inline char *wxStrcat(char *dest, const wxCStrData& src)
{ return wxCRT_StrcatA(dest, src.AsCharBuf()); }
inline char *wxStrcat(char *dest, const wxScopedCharBuffer& src)
{ return wxCRT_StrcatA(dest, src.data()); }
inline wchar_t *wxStrcat(wchar_t *dest, const wxString& src)
{ return wxCRT_StrcatW(dest, src.wc_str()); }
inline wchar_t *wxStrcat(wchar_t *dest, const wxCStrData& src)
{ return wxCRT_StrcatW(dest, src.AsWCharBuf()); }
inline wchar_t *wxStrcat(wchar_t *dest, const wxScopedWCharBuffer& src)
{ return wxCRT_StrcatW(dest, src.data()); }
inline char *wxStrcat(char *dest, const wchar_t *src)
{ return wxCRT_StrcatA(dest, wxConvLibc.cWC2MB(src)); }
inline wchar_t *wxStrcat(wchar_t *dest, const char *src)
{ return wxCRT_StrcatW(dest, wxConvLibc.cMB2WC(src)); }
inline char *wxStrncat(char *dest, const char *src, size_t n)
{ return wxCRT_StrncatA(dest, src, n); }
inline wchar_t *wxStrncat(wchar_t *dest, const wchar_t *src, size_t n)
{ return wxCRT_StrncatW(dest, src, n); }
inline char *wxStrncat(char *dest, const wxString& src, size_t n)
{ return wxCRT_StrncatA(dest, src.mb_str(), n); }
inline char *wxStrncat(char *dest, const wxCStrData& src, size_t n)
{ return wxCRT_StrncatA(dest, src.AsCharBuf(), n); }
inline char *wxStrncat(char *dest, const wxScopedCharBuffer& src, size_t n)
{ return wxCRT_StrncatA(dest, src.data(), n); }
inline wchar_t *wxStrncat(wchar_t *dest, const wxString& src, size_t n)
{ return wxCRT_StrncatW(dest, src.wc_str(), n); }
inline wchar_t *wxStrncat(wchar_t *dest, const wxCStrData& src, size_t n)
{ return wxCRT_StrncatW(dest, src.AsWCharBuf(), n); }
inline wchar_t *wxStrncat(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n)
{ return wxCRT_StrncatW(dest, src.data(), n); }
inline char *wxStrncat(char *dest, const wchar_t *src, size_t n)
{ return wxCRT_StrncatA(dest, wxConvLibc.cWC2MB(src), n); }
inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n)
{ return wxCRT_StrncatW(dest, wxConvLibc.cMB2WC(src), n); }
#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2)
#define WX_STR_CALL(func, a1, a2) func(a1, a2)
// This macro defines string function for all possible variants of arguments,
// except for those taking wxString or wxCStrData as second argument.
// Parameters:
// rettype - return type
// name - name of the (overloaded) function to define
// crtA - function to call for char* versions (takes two arguments)
// crtW - ditto for wchar_t* function
// forString - function to call when the *first* argument is wxString;
// the second argument can be any string type, so this is
// typically a template
#define WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \
inline rettype WX_STR_DECL(name, const char *, const char *) \
{ return WX_STR_CALL(crtA, s1, s2); } \
inline rettype WX_STR_DECL(name, const char *, const wchar_t *) \
{ return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
inline rettype WX_STR_DECL(name, const char *, const wxScopedCharBuffer&) \
{ return WX_STR_CALL(crtA, s1, s2.data()); } \
inline rettype WX_STR_DECL(name, const char *, const wxScopedWCharBuffer&) \
{ return WX_STR_CALL(forString, wxString(s1), s2.data()); } \
\
inline rettype WX_STR_DECL(name, const wchar_t *, const wchar_t *) \
{ return WX_STR_CALL(crtW, s1, s2); } \
inline rettype WX_STR_DECL(name, const wchar_t *, const char *) \
{ return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedWCharBuffer&) \
{ return WX_STR_CALL(crtW, s1, s2.data()); } \
inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedCharBuffer&) \
{ return WX_STR_CALL(forString, wxString(s1), s2.data()); } \
\
inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const char *) \
{ return WX_STR_CALL(crtA, s1.data(), s2); } \
inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wchar_t *) \
{ return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedCharBuffer&)\
{ return WX_STR_CALL(crtA, s1.data(), s2.data()); } \
inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedWCharBuffer&) \
{ return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
\
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wchar_t *) \
{ return WX_STR_CALL(crtW, s1.data(), s2); } \
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const char *) \
{ return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedWCharBuffer&) \
{ return WX_STR_CALL(crtW, s1.data(), s2.data()); } \
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedCharBuffer&) \
{ return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \
\
inline rettype WX_STR_DECL(name, const wxString&, const char*) \
{ return WX_STR_CALL(forString, s1, s2); } \
inline rettype WX_STR_DECL(name, const wxString&, const wchar_t*) \
{ return WX_STR_CALL(forString, s1, s2); } \
inline rettype WX_STR_DECL(name, const wxString&, const wxScopedCharBuffer&) \
{ return WX_STR_CALL(forString, s1, s2); } \
inline rettype WX_STR_DECL(name, const wxString&, const wxScopedWCharBuffer&) \
{ return WX_STR_CALL(forString, s1, s2); } \
inline rettype WX_STR_DECL(name, const wxString&, const wxString&) \
{ return WX_STR_CALL(forString, s1, s2); } \
inline rettype WX_STR_DECL(name, const wxString&, const wxCStrData&) \
{ return WX_STR_CALL(forString, s1, s2); } \
\
inline rettype WX_STR_DECL(name, const wxCStrData&, const char*) \
{ return WX_STR_CALL(forString, s1.AsString(), s2); } \
inline rettype WX_STR_DECL(name, const wxCStrData&, const wchar_t*) \
{ return WX_STR_CALL(forString, s1.AsString(), s2); } \
inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedCharBuffer&) \
{ return WX_STR_CALL(forString, s1.AsString(), s2); } \
inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedWCharBuffer&) \
{ return WX_STR_CALL(forString, s1.AsString(), s2); } \
inline rettype WX_STR_DECL(name, const wxCStrData&, const wxString&) \
{ return WX_STR_CALL(forString, s1.AsString(), s2); } \
inline rettype WX_STR_DECL(name, const wxCStrData&, const wxCStrData&) \
{ return WX_STR_CALL(forString, s1.AsString(), s2); }
// This defines strcmp-like function, i.e. one returning the result of
// comparison; see WX_STR_FUNC_NO_INVERT for explanation of the arguments
#define WX_STRCMP_FUNC(name, crtA, crtW, forString) \
WX_STR_FUNC_NO_INVERT(int, name, crtA, crtW, forString) \
\
inline int WX_STR_DECL(name, const char *, const wxCStrData&) \
{ return -WX_STR_CALL(forString, s2.AsString(), s1); } \
inline int WX_STR_DECL(name, const char *, const wxString&) \
{ return -WX_STR_CALL(forString, s2, s1); } \
\
inline int WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \
{ return -WX_STR_CALL(forString, s2.AsString(), s1); } \
inline int WX_STR_DECL(name, const wchar_t *, const wxString&) \
{ return -WX_STR_CALL(forString, s2, s1); } \
\
inline int WX_STR_DECL(name, const wxScopedCharBuffer&, const wxCStrData&) \
{ return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \
inline int WX_STR_DECL(name, const wxScopedCharBuffer&, const wxString&) \
{ return -WX_STR_CALL(forString, s2, s1.data()); } \
\
inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \
{ return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \
inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \
{ return -WX_STR_CALL(forString, s2, s1.data()); }
// This defines a string function that is *not* strcmp-like, i.e. doesn't
// return the result of comparison and so if the second argument is a string,
// it has to be converted to char* or wchar_t*
#define WX_STR_FUNC(rettype, name, crtA, crtW, forString) \
WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \
\
inline rettype WX_STR_DECL(name, const char *, const wxCStrData&) \
{ return WX_STR_CALL(crtA, s1, s2.AsCharBuf()); } \
inline rettype WX_STR_DECL(name, const char *, const wxString&) \
{ return WX_STR_CALL(crtA, s1, s2.mb_str()); } \
\
inline rettype WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \
{ return WX_STR_CALL(crtW, s1, s2.AsWCharBuf()); } \
inline rettype WX_STR_DECL(name, const wchar_t *, const wxString&) \
{ return WX_STR_CALL(crtW, s1, s2.wc_str()); } \
\
inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxCStrData&) \
{ return WX_STR_CALL(crtA, s1.data(), s2.AsCharBuf()); } \
inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxString&) \
{ return WX_STR_CALL(crtA, s1.data(), s2.mb_str()); } \
\
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \
{ return WX_STR_CALL(crtW, s1.data(), s2.AsWCharBuf()); } \
inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \
{ return WX_STR_CALL(crtW, s1.data(), s2.wc_str()); }
template<typename T>
inline int wxStrcmp_String(const wxString& s1, const T& s2)
{ return s1.compare(s2); }
WX_STRCMP_FUNC(wxStrcmp, wxCRT_StrcmpA, wxCRT_StrcmpW, wxStrcmp_String)
template<typename T>
inline int wxStricmp_String(const wxString& s1, const T& s2)
{ return s1.CmpNoCase(s2); }
WX_STRCMP_FUNC(wxStricmp, wxCRT_StricmpA, wxCRT_StricmpW, wxStricmp_String)
#if defined(wxCRT_StrcollA) && defined(wxCRT_StrcollW)
// GCC 3.4 and other compilers have a bug that causes it to fail compilation if
// the template's implementation uses overloaded function declared later (see
// the wxStrcoll() call in wxStrcoll_String<T>()), so we have to
// forward-declare the template and implement it below WX_STRCMP_FUNC. OTOH,
// this causes problems with GCC visibility in newer GCC versions.
#if !(wxCHECK_GCC_VERSION(3,5) && !wxCHECK_GCC_VERSION(4,7)) || defined(__clang__)
#define wxNEEDS_DECL_BEFORE_TEMPLATE
#endif
#ifdef wxNEEDS_DECL_BEFORE_TEMPLATE
template<typename T>
inline int wxStrcoll_String(const wxString& s1, const T& s2);
WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String)
#endif // wxNEEDS_DECL_BEFORE_TEMPLATE
template<typename T>
inline int wxStrcoll_String(const wxString& s1, const T& s2)
{
#if wxUSE_UNICODE
// NB: strcoll() doesn't work correctly on UTF-8 strings, so we have to use
// wc_str() even if wxUSE_UNICODE_UTF8; the (const wchar_t*) cast is
// there just as optimization to avoid going through
// wxStrcoll<wxScopedWCharBuffer>:
return wxStrcoll((const wchar_t*)s1.wc_str(), s2);
#else
return wxStrcoll((const char*)s1.mb_str(), s2);
#endif
}
#ifndef wxNEEDS_DECL_BEFORE_TEMPLATE
// this is exactly the same WX_STRCMP_FUNC line as above, insde the
// wxNEEDS_DECL_BEFORE_TEMPLATE case
WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String)
#endif
#endif // defined(wxCRT_Strcoll[AW])
template<typename T>
inline size_t wxStrspn_String(const wxString& s1, const T& s2)
{
size_t pos = s1.find_first_not_of(s2);
return pos == wxString::npos ? s1.length() : pos;
}
WX_STR_FUNC(size_t, wxStrspn, wxCRT_StrspnA, wxCRT_StrspnW, wxStrspn_String)
template<typename T>
inline size_t wxStrcspn_String(const wxString& s1, const T& s2)
{
size_t pos = s1.find_first_of(s2);
return pos == wxString::npos ? s1.length() : pos;
}
WX_STR_FUNC(size_t, wxStrcspn, wxCRT_StrcspnA, wxCRT_StrcspnW, wxStrcspn_String)
#undef WX_STR_DECL
#undef WX_STR_CALL
#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2, size_t n)
#define WX_STR_CALL(func, a1, a2) func(a1, a2, n)
template<typename T>
inline int wxStrncmp_String(const wxString& s1, const T& s2, size_t n)
{ return s1.compare(0, n, s2, 0, n); }
WX_STRCMP_FUNC(wxStrncmp, wxCRT_StrncmpA, wxCRT_StrncmpW, wxStrncmp_String)
template<typename T>
inline int wxStrnicmp_String(const wxString& s1, const T& s2, size_t n)
{ return s1.substr(0, n).CmpNoCase(wxString(s2).substr(0, n)); }
WX_STRCMP_FUNC(wxStrnicmp, wxCRT_StrnicmpA, wxCRT_StrnicmpW, wxStrnicmp_String)
#undef WX_STR_DECL
#undef WX_STR_CALL
#undef WX_STRCMP_FUNC
#undef WX_STR_FUNC
#undef WX_STR_FUNC_NO_INVERT
#if defined(wxCRT_StrxfrmA) && defined(wxCRT_StrxfrmW)
inline size_t wxStrxfrm(char *dest, const char *src, size_t n)
{ return wxCRT_StrxfrmA(dest, src, n); }
inline size_t wxStrxfrm(wchar_t *dest, const wchar_t *src, size_t n)
{ return wxCRT_StrxfrmW(dest, src, n); }
template<typename T>
inline size_t wxStrxfrm(T *dest, const wxScopedCharTypeBuffer<T>& src, size_t n)
{ return wxStrxfrm(dest, src.data(), n); }
inline size_t wxStrxfrm(char *dest, const wxString& src, size_t n)
{ return wxCRT_StrxfrmA(dest, src.mb_str(), n); }
inline size_t wxStrxfrm(wchar_t *dest, const wxString& src, size_t n)
{ return wxCRT_StrxfrmW(dest, src.wc_str(), n); }
inline size_t wxStrxfrm(char *dest, const wxCStrData& src, size_t n)
{ return wxCRT_StrxfrmA(dest, src.AsCharBuf(), n); }
inline size_t wxStrxfrm(wchar_t *dest, const wxCStrData& src, size_t n)
{ return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); }
#endif // defined(wxCRT_Strxfrm[AW])
inline char *wxStrtok(char *str, const char *delim, char **saveptr)
{ return wxCRT_StrtokA(str, delim, saveptr); }
inline wchar_t *wxStrtok(wchar_t *str, const wchar_t *delim, wchar_t **saveptr)
{ return wxCRT_StrtokW(str, delim, saveptr); }
template<typename T>
inline T *wxStrtok(T *str, const wxScopedCharTypeBuffer<T>& delim, T **saveptr)
{ return wxStrtok(str, delim.data(), saveptr); }
inline char *wxStrtok(char *str, const wxCStrData& delim, char **saveptr)
{ return wxCRT_StrtokA(str, delim.AsCharBuf(), saveptr); }
inline wchar_t *wxStrtok(wchar_t *str, const wxCStrData& delim, wchar_t **saveptr)
{ return wxCRT_StrtokW(str, delim.AsWCharBuf(), saveptr); }
inline char *wxStrtok(char *str, const wxString& delim, char **saveptr)
{ return wxCRT_StrtokA(str, delim.mb_str(), saveptr); }
inline wchar_t *wxStrtok(wchar_t *str, const wxString& delim, wchar_t **saveptr)
{ return wxCRT_StrtokW(str, delim.wc_str(), saveptr); }
inline const char *wxStrstr(const char *haystack, const char *needle)
{ return wxCRT_StrstrA(haystack, needle); }
inline const wchar_t *wxStrstr(const wchar_t *haystack, const wchar_t *needle)
{ return wxCRT_StrstrW(haystack, needle); }
inline const char *wxStrstr(const char *haystack, const wxString& needle)
{ return wxCRT_StrstrA(haystack, needle.mb_str()); }
inline const wchar_t *wxStrstr(const wchar_t *haystack, const wxString& needle)
{ return wxCRT_StrstrW(haystack, needle.wc_str()); }
// these functions return char* pointer into the non-temporary conversion buffer
// used by c_str()'s implicit conversion to char*, for ANSI build compatibility
inline const char *wxStrstr(const wxString& haystack, const wxString& needle)
{ return wxCRT_StrstrA(haystack.c_str(), needle.mb_str()); }
inline const char *wxStrstr(const wxCStrData& haystack, const wxString& needle)
{ return wxCRT_StrstrA(haystack, needle.mb_str()); }
inline const char *wxStrstr(const wxCStrData& haystack, const wxCStrData& needle)
{ return wxCRT_StrstrA(haystack, needle.AsCharBuf()); }
// if 'needle' is char/wchar_t, then the same is probably wanted as return value
inline const char *wxStrstr(const wxString& haystack, const char *needle)
{ return wxCRT_StrstrA(haystack.c_str(), needle); }
inline const char *wxStrstr(const wxCStrData& haystack, const char *needle)
{ return wxCRT_StrstrA(haystack, needle); }
inline const wchar_t *wxStrstr(const wxString& haystack, const wchar_t *needle)
{ return wxCRT_StrstrW(haystack.c_str(), needle); }
inline const wchar_t *wxStrstr(const wxCStrData& haystack, const wchar_t *needle)
{ return wxCRT_StrstrW(haystack, needle); }
inline const char *wxStrchr(const char *s, char c)
{ return wxCRT_StrchrA(s, c); }
inline const wchar_t *wxStrchr(const wchar_t *s, wchar_t c)
{ return wxCRT_StrchrW(s, c); }
inline const char *wxStrrchr(const char *s, char c)
{ return wxCRT_StrrchrA(s, c); }
inline const wchar_t *wxStrrchr(const wchar_t *s, wchar_t c)
{ return wxCRT_StrrchrW(s, c); }
inline const char *wxStrchr(const char *s, const wxUniChar& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniChar& c)
{ return wxCRT_StrchrW(s, (wchar_t)c); }
inline const char *wxStrrchr(const char *s, const wxUniChar& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniChar& c)
{ return wxCRT_StrrchrW(s, (wchar_t)c); }
inline const char *wxStrchr(const char *s, const wxUniCharRef& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniCharRef& c)
{ return wxCRT_StrchrW(s, (wchar_t)c); }
inline const char *wxStrrchr(const char *s, const wxUniCharRef& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniCharRef& c)
{ return wxCRT_StrrchrW(s, (wchar_t)c); }
template<typename T>
inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, T c)
{ return wxStrchr(s.data(), c); }
template<typename T>
inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, T c)
{ return wxStrrchr(s.data(), c); }
template<typename T>
inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniChar& c)
{ return wxStrchr(s.data(), (T)c); }
template<typename T>
inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniChar& c)
{ return wxStrrchr(s.data(), (T)c); }
template<typename T>
inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef& c)
{ return wxStrchr(s.data(), (T)c); }
template<typename T>
inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef& c)
{ return wxStrrchr(s.data(), (T)c); }
// these functions return char* pointer into the non-temporary conversion buffer
// used by c_str()'s implicit conversion to char*, for ANSI build compatibility
inline const char* wxStrchr(const wxString& s, char c)
{ return wxCRT_StrchrA((const char*)s.c_str(), c); }
inline const char* wxStrrchr(const wxString& s, char c)
{ return wxCRT_StrrchrA((const char*)s.c_str(), c); }
inline const char* wxStrchr(const wxString& s, int c)
{ return wxCRT_StrchrA((const char*)s.c_str(), c); }
inline const char* wxStrrchr(const wxString& s, int c)
{ return wxCRT_StrrchrA((const char*)s.c_str(), c); }
inline const char* wxStrchr(const wxString& s, const wxUniChar& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; }
inline const char* wxStrrchr(const wxString& s, const wxUniChar& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; }
inline const char* wxStrchr(const wxString& s, const wxUniCharRef& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; }
inline const char* wxStrrchr(const wxString& s, const wxUniCharRef& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; }
inline const wchar_t* wxStrchr(const wxString& s, wchar_t c)
{ return wxCRT_StrchrW((const wchar_t*)s.c_str(), c); }
inline const wchar_t* wxStrrchr(const wxString& s, wchar_t c)
{ return wxCRT_StrrchrW((const wchar_t*)s.c_str(), c); }
inline const char* wxStrchr(const wxCStrData& s, char c)
{ return wxCRT_StrchrA(s.AsChar(), c); }
inline const char* wxStrrchr(const wxCStrData& s, char c)
{ return wxCRT_StrrchrA(s.AsChar(), c); }
inline const char* wxStrchr(const wxCStrData& s, int c)
{ return wxCRT_StrchrA(s.AsChar(), c); }
inline const char* wxStrrchr(const wxCStrData& s, int c)
{ return wxCRT_StrrchrA(s.AsChar(), c); }
inline const char* wxStrchr(const wxCStrData& s, const wxUniChar& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
inline const char* wxStrrchr(const wxCStrData& s, const wxUniChar& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
inline const char* wxStrchr(const wxCStrData& s, const wxUniCharRef& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; }
inline const char* wxStrrchr(const wxCStrData& s, const wxUniCharRef& uc)
{ char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; }
inline const wchar_t* wxStrchr(const wxCStrData& s, wchar_t c)
{ return wxCRT_StrchrW(s.AsWChar(), c); }
inline const wchar_t* wxStrrchr(const wxCStrData& s, wchar_t c)
{ return wxCRT_StrrchrW(s.AsWChar(), c); }
inline const char *wxStrpbrk(const char *s, const char *accept)
{ return wxCRT_StrpbrkA(s, accept); }
inline const wchar_t *wxStrpbrk(const wchar_t *s, const wchar_t *accept)
{ return wxCRT_StrpbrkW(s, accept); }
inline const char *wxStrpbrk(const char *s, const wxString& accept)
{ return wxCRT_StrpbrkA(s, accept.mb_str()); }
inline const char *wxStrpbrk(const char *s, const wxCStrData& accept)
{ return wxCRT_StrpbrkA(s, accept.AsCharBuf()); }
inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxString& accept)
{ return wxCRT_StrpbrkW(s, accept.wc_str()); }
inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxCStrData& accept)
{ return wxCRT_StrpbrkW(s, accept.AsWCharBuf()); }
inline const char *wxStrpbrk(const wxString& s, const wxString& accept)
{ return wxCRT_StrpbrkA(s.c_str(), accept.mb_str()); }
inline const char *wxStrpbrk(const wxString& s, const char *accept)
{ return wxCRT_StrpbrkA(s.c_str(), accept); }
inline const wchar_t *wxStrpbrk(const wxString& s, const wchar_t *accept)
{ return wxCRT_StrpbrkW(s.wc_str(), accept); }
inline const char *wxStrpbrk(const wxString& s, const wxCStrData& accept)
{ return wxCRT_StrpbrkA(s.c_str(), accept.AsCharBuf()); }
inline const char *wxStrpbrk(const wxCStrData& s, const wxString& accept)
{ return wxCRT_StrpbrkA(s.AsChar(), accept.mb_str()); }
inline const char *wxStrpbrk(const wxCStrData& s, const char *accept)
{ return wxCRT_StrpbrkA(s.AsChar(), accept); }
inline const wchar_t *wxStrpbrk(const wxCStrData& s, const wchar_t *accept)
{ return wxCRT_StrpbrkW(s.AsWChar(), accept); }
inline const char *wxStrpbrk(const wxCStrData& s, const wxCStrData& accept)
{ return wxCRT_StrpbrkA(s.AsChar(), accept.AsCharBuf()); }
template <typename S, typename T>
inline const T *wxStrpbrk(const S& s, const wxScopedCharTypeBuffer<T>& accept)
{ return wxStrpbrk(s, accept.data()); }
/* inlined non-const versions */
template <typename T>
inline char *wxStrstr(char *haystack, T needle)
{ return const_cast<char*>(wxStrstr(const_cast<const char*>(haystack), needle)); }
template <typename T>
inline wchar_t *wxStrstr(wchar_t *haystack, T needle)
{ return const_cast<wchar_t*>(wxStrstr(const_cast<const wchar_t*>(haystack), needle)); }
template <typename T>
inline char * wxStrchr(char *s, T c)
{ return const_cast<char*>(wxStrchr(const_cast<const char*>(s), c)); }
template <typename T>
inline wchar_t * wxStrchr(wchar_t *s, T c)
{ return (wchar_t *)wxStrchr((const wchar_t *)s, c); }
template <typename T>
inline char * wxStrrchr(char *s, T c)
{ return const_cast<char*>(wxStrrchr(const_cast<const char*>(s), c)); }
template <typename T>
inline wchar_t * wxStrrchr(wchar_t *s, T c)
{ return const_cast<wchar_t*>(wxStrrchr(const_cast<const wchar_t*>(s), c)); }
template <typename T>
inline char * wxStrpbrk(char *s, T accept)
{ return const_cast<char*>(wxStrpbrk(const_cast<const char*>(s), accept)); }
template <typename T>
inline wchar_t * wxStrpbrk(wchar_t *s, T accept)
{ return const_cast<wchar_t*>(wxStrpbrk(const_cast<const wchar_t*>(s), accept)); }
// ----------------------------------------------------------------------------
// stdio.h functions
// ----------------------------------------------------------------------------
// NB: using fn_str() for mode is a hack to get the same type (char*/wchar_t*)
// as needed, the conversion itself doesn't matter, it's ASCII
inline FILE *wxFopen(const wxString& path, const wxString& mode)
{ return wxCRT_Fopen(path.fn_str(), mode.fn_str()); }
inline FILE *wxFreopen(const wxString& path, const wxString& mode, FILE *stream)
{ return wxCRT_Freopen(path.fn_str(), mode.fn_str(), stream); }
inline int wxRemove(const wxString& path)
{ return wxCRT_Remove(path.fn_str()); }
inline int wxRename(const wxString& oldpath, const wxString& newpath)
{ return wxCRT_Rename(oldpath.fn_str(), newpath.fn_str()); }
extern WXDLLIMPEXP_BASE int wxPuts(const wxString& s);
extern WXDLLIMPEXP_BASE int wxFputs(const wxString& s, FILE *stream);
extern WXDLLIMPEXP_BASE void wxPerror(const wxString& s);
extern WXDLLIMPEXP_BASE int wxFputc(const wxUniChar& c, FILE *stream);
#define wxPutc(c, stream) wxFputc(c, stream)
#define wxPutchar(c) wxFputc(c, stdout)
#define wxFputchar(c) wxPutchar(c)
// NB: We only provide ANSI version of fgets() because fgetws() interprets the
// stream according to current locale, which is rarely what is desired.
inline char *wxFgets(char *s, int size, FILE *stream)
{ return wxCRT_FgetsA(s, size, stream); }
// This version calls ANSI version and converts the string using wxConvLibc
extern WXDLLIMPEXP_BASE wchar_t *wxFgets(wchar_t *s, int size, FILE *stream);
#define wxGets(s) wxGets_is_insecure_and_dangerous_use_wxFgets_instead
// NB: We only provide ANSI versions of this for the same reasons as in the
// case of wxFgets() above
inline int wxFgetc(FILE *stream) { return wxCRT_FgetcA(stream); }
inline int wxUngetc(int c, FILE *stream) { return wxCRT_UngetcA(c, stream); }
#define wxGetc(stream) wxFgetc(stream)
#define wxGetchar() wxFgetc(stdin)
#define wxFgetchar() wxGetchar()
// ----------------------------------------------------------------------------
// stdlib.h functions
// ----------------------------------------------------------------------------
#ifdef wxCRT_AtoiW
inline int wxAtoi(const wxString& str) { return wxCRT_AtoiW(str.wc_str()); }
#else
inline int wxAtoi(const wxString& str) { return wxCRT_AtoiA(str.mb_str()); }
#endif
#ifdef wxCRT_AtolW
inline long wxAtol(const wxString& str) { return wxCRT_AtolW(str.wc_str()); }
#else
inline long wxAtol(const wxString& str) { return wxCRT_AtolA(str.mb_str()); }
#endif
#ifdef wxCRT_AtofW
inline double wxAtof(const wxString& str) { return wxCRT_AtofW(str.wc_str()); }
#else
inline double wxAtof(const wxString& str) { return wxCRT_AtofA(str.mb_str()); }
#endif
inline double wxStrtod(const char *nptr, char **endptr)
{ return wxCRT_StrtodA(nptr, endptr); }
inline double wxStrtod(const wchar_t *nptr, wchar_t **endptr)
{ return wxCRT_StrtodW(nptr, endptr); }
template<typename T>
inline double wxStrtod(const wxScopedCharTypeBuffer<T>& nptr, T **endptr)
{ return wxStrtod(nptr.data(), endptr); }
// We implement wxStrto*() like this so that the code compiles when NULL is
// passed in - - if we had just char** and wchar_t** overloads for 'endptr', it
// would be ambiguous. The solution is to use a template so that endptr can be
// any type: when NULL constant is used, the type will be int and we can handle
// that case specially. Otherwise, we infer the type that 'nptr' should be
// converted to from the type of 'endptr'. We need wxStrtoxCharType<T> template
// to make the code compile even for T=int (that's the case when it's not going
// to be ever used, but it still has to compile).
template<typename T> struct wxStrtoxCharType {};
template<> struct wxStrtoxCharType<char**>
{
typedef const char* Type;
static char** AsPointer(char **p) { return p; }
};
template<> struct wxStrtoxCharType<wchar_t**>
{
typedef const wchar_t* Type;
static wchar_t** AsPointer(wchar_t **p) { return p; }
};
template<> struct wxStrtoxCharType<int>
{
typedef const char* Type; /* this one is never used */
static char** AsPointer(int WXUNUSED_UNLESS_DEBUG(p))
{
wxASSERT_MSG( p == 0, "passing non-NULL int is invalid" );
return NULL;
}
};
template<typename T>
inline double wxStrtod(const wxString& nptr, T endptr)
{
if ( endptr == 0 )
{
// when we don't care about endptr, use the string representation that
// doesn't require any conversion (it doesn't matter for this function
// even if its UTF-8):
return wxStrtod(nptr.wx_str(), (wxStringCharType**)NULL);
}
else
{
// note that it is important to use c_str() here and not mb_str() or
// wc_str(), because we store the pointer into (possibly converted)
// buffer in endptr and so it must be valid even when wxStrtod() returns
typedef typename wxStrtoxCharType<T>::Type CharType;
return wxStrtod((CharType)nptr.c_str(),
wxStrtoxCharType<T>::AsPointer(endptr));
}
}
template<typename T>
inline double wxStrtod(const wxCStrData& nptr, T endptr)
{ return wxStrtod(nptr.AsString(), endptr); }
#define WX_STRTOX_FUNC(rettype, name, implA, implW) \
/* see wxStrtod() above for explanation of this code: */ \
inline rettype name(const char *nptr, char **endptr, int base) \
{ return implA(nptr, endptr, base); } \
inline rettype name(const wchar_t *nptr, wchar_t **endptr, int base) \
{ return implW(nptr, endptr, base); } \
template<typename T> \
inline rettype name(const wxScopedCharTypeBuffer<T>& nptr, T **endptr, int)\
{ return name(nptr.data(), endptr); } \
template<typename T> \
inline rettype name(const wxString& nptr, T endptr, int base) \
{ \
if ( endptr == 0 ) \
return name(nptr.wx_str(), (wxStringCharType**)NULL, base); \
else \
{ \
typedef typename wxStrtoxCharType<T>::Type CharType; \
return name((CharType)nptr.c_str(), \
wxStrtoxCharType<T>::AsPointer(endptr), \
base); \
} \
} \
template<typename T> \
inline rettype name(const wxCStrData& nptr, T endptr, int base) \
{ return name(nptr.AsString(), endptr, base); }
WX_STRTOX_FUNC(long, wxStrtol, wxCRT_StrtolA, wxCRT_StrtolW)
WX_STRTOX_FUNC(unsigned long, wxStrtoul, wxCRT_StrtoulA, wxCRT_StrtoulW)
#ifdef wxLongLong_t
WX_STRTOX_FUNC(wxLongLong_t, wxStrtoll, wxCRT_StrtollA, wxCRT_StrtollW)
WX_STRTOX_FUNC(wxULongLong_t, wxStrtoull, wxCRT_StrtoullA, wxCRT_StrtoullW)
#endif // wxLongLong_t
#undef WX_STRTOX_FUNC
// ios doesn't export system starting from iOS 11 anymore and usage was critical before
#if defined(__WXOSX__) && wxOSX_USE_IPHONE
#else
// mingw32 doesn't provide _tsystem() even though it provides other stdlib.h
// functions in their wide versions
#ifdef wxCRT_SystemW
inline int wxSystem(const wxString& str) { return wxCRT_SystemW(str.wc_str()); }
#else
inline int wxSystem(const wxString& str) { return wxCRT_SystemA(str.mb_str()); }
#endif
#endif
inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(name); }
inline wchar_t* wxGetenv(const wchar_t *name) { return wxCRT_GetenvW(name); }
inline char* wxGetenv(const wxString& name) { return wxCRT_GetenvA(name.mb_str()); }
inline char* wxGetenv(const wxCStrData& name) { return wxCRT_GetenvA(name.AsCharBuf()); }
inline char* wxGetenv(const wxScopedCharBuffer& name) { return wxCRT_GetenvA(name.data()); }
inline wchar_t* wxGetenv(const wxScopedWCharBuffer& name) { return wxCRT_GetenvW(name.data()); }
// ----------------------------------------------------------------------------
// time.h functions
// ----------------------------------------------------------------------------
inline size_t wxStrftime(char *s, size_t max,
const wxString& format, const struct tm *tm)
{ return wxCRT_StrftimeA(s, max, format.mb_str(), tm); }
inline size_t wxStrftime(wchar_t *s, size_t max,
const wxString& format, const struct tm *tm)
{ return wxCRT_StrftimeW(s, max, format.wc_str(), tm); }
// NB: we can't provide both char* and wchar_t* versions for obvious reasons
// and returning wxString wouldn't work either (it would be immediately
// destroyed and if assigned to char*/wchar_t*, the pointer would be
// invalid), so we only keep ASCII version, because the returned value
// is always ASCII anyway
#define wxAsctime asctime
#define wxCtime ctime
// ----------------------------------------------------------------------------
// ctype.h functions
// ----------------------------------------------------------------------------
// FIXME-UTF8: we'd be better off implementing these ourselves, as the CRT
// version is locale-dependent
// FIXME-UTF8: these don't work when EOF is passed in because of wxUniChar,
// is this OK or not?
inline bool wxIsalnum(const wxUniChar& c) { return wxCRT_IsalnumW(c) != 0; }
inline bool wxIsalpha(const wxUniChar& c) { return wxCRT_IsalphaW(c) != 0; }
inline bool wxIscntrl(const wxUniChar& c) { return wxCRT_IscntrlW(c) != 0; }
inline bool wxIsdigit(const wxUniChar& c) { return wxCRT_IsdigitW(c) != 0; }
inline bool wxIsgraph(const wxUniChar& c) { return wxCRT_IsgraphW(c) != 0; }
inline bool wxIslower(const wxUniChar& c) { return wxCRT_IslowerW(c) != 0; }
inline bool wxIsprint(const wxUniChar& c) { return wxCRT_IsprintW(c) != 0; }
inline bool wxIspunct(const wxUniChar& c) { return wxCRT_IspunctW(c) != 0; }
inline bool wxIsspace(const wxUniChar& c) { return wxCRT_IsspaceW(c) != 0; }
inline bool wxIsupper(const wxUniChar& c) { return wxCRT_IsupperW(c) != 0; }
inline bool wxIsxdigit(const wxUniChar& c) { return wxCRT_IsxdigitW(c) != 0; }
inline wxUniChar wxTolower(const wxUniChar& c) { return wxCRT_TolowerW(c); }
inline wxUniChar wxToupper(const wxUniChar& c) { return wxCRT_ToupperW(c); }
#if WXWIN_COMPATIBILITY_2_8
// we had goofed and defined wxIsctrl() instead of (correct) wxIscntrl() in the
// initial versions of this header -- now it is too late to remove it so
// although we fixed the function/macro name above, still provide the
// backwards-compatible synonym.
wxDEPRECATED( inline int wxIsctrl(const wxUniChar& c) );
inline int wxIsctrl(const wxUniChar& c) { return wxIscntrl(c); }
#endif // WXWIN_COMPATIBILITY_2_8
inline bool wxIsascii(const wxUniChar& c) { return c.IsAscii(); }
#endif /* _WX_WXCRT_H_ */
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/gauge.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/gauge.h
// Purpose: wxGauge interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 20.02.01
// Copyright: (c) 1996-2001 wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GAUGE_H_BASE_
#define _WX_GAUGE_H_BASE_
#include "wx/defs.h"
#if wxUSE_GAUGE
#include "wx/control.h"
// ----------------------------------------------------------------------------
// wxGauge style flags
// ----------------------------------------------------------------------------
#define wxGA_HORIZONTAL wxHORIZONTAL
#define wxGA_VERTICAL wxVERTICAL
// Available since Windows 7 only. With this style, the value of guage will
// reflect on the taskbar button.
#define wxGA_PROGRESS 0x0010
// Win32 only, is default (and only) on some other platforms
#define wxGA_SMOOTH 0x0020
// QT only, display current completed percentage (text default format "%p%")
#define wxGA_TEXT 0x0040
// GTK and Mac always have native implementation of the indeterminate mode
// wxMSW has native implementation only if comctl32.dll >= 6.00
#if !defined(__WXGTK20__) && !defined(__WXMAC__)
#define wxGAUGE_EMULATE_INDETERMINATE_MODE 1
#else
#define wxGAUGE_EMULATE_INDETERMINATE_MODE 0
#endif
extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[];
class WXDLLIMPEXP_FWD_CORE wxAppProgressIndicator;
// ----------------------------------------------------------------------------
// wxGauge: a progress bar
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGaugeBase : public wxControl
{
public:
wxGaugeBase() : m_rangeMax(0), m_gaugePos(0),
m_appProgressIndicator(NULL) { }
virtual ~wxGaugeBase();
bool Create(wxWindow *parent,
wxWindowID id,
int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxGaugeNameStr);
// determinate mode API
// set/get the control range
virtual void SetRange(int range);
virtual int GetRange() const;
virtual void SetValue(int pos);
virtual int GetValue() const;
// indeterminate mode API
virtual void Pulse();
// simple accessors
bool IsVertical() const { return HasFlag(wxGA_VERTICAL); }
// overridden base class virtuals
virtual bool AcceptsFocus() const wxOVERRIDE { return false; }
// Deprecated methods not doing anything since a long time.
wxDEPRECATED_MSG("Remove calls to this method, it doesn't do anything")
void SetShadowWidth(int WXUNUSED(w)) { }
wxDEPRECATED_MSG("Remove calls to this method, it always returns 0")
int GetShadowWidth() const { return 0; }
wxDEPRECATED_MSG("Remove calls to this method, it doesn't do anything")
void SetBezelFace(int WXUNUSED(w)) { }
wxDEPRECATED_MSG("Remove calls to this method, it always returns 0")
int GetBezelFace() const { return 0; }
protected:
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
// Initialize m_appProgressIndicator if necessary, i.e. if this object has
// wxGA_PROGRESS style. This method is supposed to be called from the
// derived class Create() if it doesn't call the base class Create(), which
// already does it, after initializing the window style and range.
void InitProgressIndicatorIfNeeded();
// the max position
int m_rangeMax;
// the current position
int m_gaugePos;
#if wxGAUGE_EMULATE_INDETERMINATE_MODE
int m_nDirection; // can be wxRIGHT or wxLEFT
#endif
wxAppProgressIndicator *m_appProgressIndicator;
wxDECLARE_NO_COPY_CLASS(wxGaugeBase);
};
#if defined(__WXUNIVERSAL__)
#include "wx/univ/gauge.h"
#elif defined(__WXMSW__)
#include "wx/msw/gauge.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/gauge.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/gauge.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/gauge.h"
#elif defined(__WXMAC__)
#include "wx/osx/gauge.h"
#elif defined(__WXQT__)
#include "wx/qt/gauge.h"
#endif
#endif // wxUSE_GAUGE
#endif
// _WX_GAUGE_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/spinctrl.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/spinctrl.h
// Purpose: wxSpinCtrlBase class
// Author: Vadim Zeitlin
// Modified by:
// Created: 22.07.99
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SPINCTRL_H_
#define _WX_SPINCTRL_H_
#include "wx/defs.h"
#if wxUSE_SPINCTRL
#include "wx/spinbutt.h" // should make wxSpinEvent visible to the app
// Events
class WXDLLIMPEXP_FWD_CORE wxSpinDoubleEvent;
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SPINCTRL, wxSpinEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SPINCTRLDOUBLE, wxSpinDoubleEvent);
// ----------------------------------------------------------------------------
// A spin ctrl is a text control with a spin button which is usually used to
// prompt the user for a numeric input.
// There are two kinds for number types T=integer or T=double.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSpinCtrlBase : public wxControl
{
public:
wxSpinCtrlBase() {}
// accessor functions that derived classes are expected to have
// T GetValue() const
// T GetMin() const
// T GetMax() const
// T GetIncrement() const
virtual bool GetSnapToTicks() const = 0;
// unsigned GetDigits() const - wxSpinCtrlDouble only
// operation functions that derived classes are expected to have
virtual void SetValue(const wxString& value) = 0;
// void SetValue(T val)
// void SetRange(T minVal, T maxVal)
// void SetIncrement(T inc)
virtual void SetSnapToTicks(bool snap_to_ticks) = 0;
// void SetDigits(unsigned digits) - wxSpinCtrlDouble only
// The base for numbers display, e.g. 10 or 16.
virtual int GetBase() const = 0;
virtual bool SetBase(int base) = 0;
// Select text in the textctrl
virtual void SetSelection(long from, long to) = 0;
private:
wxDECLARE_NO_COPY_CLASS(wxSpinCtrlBase);
};
// ----------------------------------------------------------------------------
// wxSpinDoubleEvent - a wxSpinEvent for double valued controls
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSpinDoubleEvent : public wxNotifyEvent
{
public:
wxSpinDoubleEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
double value = 0)
: wxNotifyEvent(commandType, winid), m_value(value)
{
}
wxSpinDoubleEvent(const wxSpinDoubleEvent& event)
: wxNotifyEvent(event), m_value(event.GetValue())
{
}
double GetValue() const { return m_value; }
void SetValue(double value) { m_value = value; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxSpinDoubleEvent(*this); }
protected:
double m_value;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinDoubleEvent);
};
// ----------------------------------------------------------------------------
// wxSpinDoubleEvent event type, see also wxSpinEvent in wx/spinbutt.h
// ----------------------------------------------------------------------------
typedef void (wxEvtHandler::*wxSpinDoubleEventFunction)(wxSpinDoubleEvent&);
#define wxSpinDoubleEventHandler(func) \
wxEVENT_HANDLER_CAST(wxSpinDoubleEventFunction, func)
// macros for handling spinctrl events
#define EVT_SPINCTRL(id, fn) \
wx__DECLARE_EVT1(wxEVT_SPINCTRL, id, wxSpinEventHandler(fn))
#define EVT_SPINCTRLDOUBLE(id, fn) \
wx__DECLARE_EVT1(wxEVT_SPINCTRLDOUBLE, id, wxSpinDoubleEventHandler(fn))
// ----------------------------------------------------------------------------
// include the platform-dependent class implementation
// ----------------------------------------------------------------------------
// we may have a native wxSpinCtrl implementation, native wxSpinCtrl and
// wxSpinCtrlDouble implementations or neither, define the appropriate symbols
// and include the generic version if necessary to provide the missing class(es)
#if defined(__WXUNIVERSAL__)
// nothing, use generic controls
#elif defined(__WXMSW__)
#define wxHAS_NATIVE_SPINCTRL
#include "wx/msw/spinctrl.h"
#elif defined(__WXGTK20__)
#define wxHAS_NATIVE_SPINCTRL
#define wxHAS_NATIVE_SPINCTRLDOUBLE
#include "wx/gtk/spinctrl.h"
#elif defined(__WXGTK__)
#define wxHAS_NATIVE_SPINCTRL
#include "wx/gtk1/spinctrl.h"
#elif defined(__WXQT__)
#define wxHAS_NATIVE_SPINCTRL
#define wxHAS_NATIVE_SPINCTRLDOUBLE
#include "wx/qt/spinctrl.h"
#endif // platform
#if !defined(wxHAS_NATIVE_SPINCTRL) || !defined(wxHAS_NATIVE_SPINCTRLDOUBLE)
#include "wx/generic/spinctlg.h"
#endif
namespace wxPrivate
{
// This is an internal helper function currently used by all ports: return the
// string containing hexadecimal representation of the given number.
extern wxString wxSpinCtrlFormatAsHex(long val, long maxVal);
} // namespace wxPrivate
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_SPINCTRL_UPDATED wxEVT_SPINCTRL
#define wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED wxEVT_SPINCTRLDOUBLE
#endif // wxUSE_SPINCTRL
#endif // _WX_SPINCTRL_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dcgraph.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/dcgraph.h
// Purpose: graphics context device bridge header
// Author: Stefan Csomor
// Modified by:
// Created:
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GRAPHICS_DC_H_
#define _WX_GRAPHICS_DC_H_
#if wxUSE_GRAPHICS_CONTEXT
#include "wx/dc.h"
#include "wx/geometry.h"
#include "wx/graphics.h"
class WXDLLIMPEXP_FWD_CORE wxWindowDC;
class WXDLLIMPEXP_CORE wxGCDC: public wxDC
{
public:
wxGCDC( const wxWindowDC& dc );
wxGCDC( const wxMemoryDC& dc );
#if wxUSE_PRINTING_ARCHITECTURE
wxGCDC( const wxPrinterDC& dc );
#endif
#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
wxGCDC( const wxEnhMetaFileDC& dc );
#endif
wxGCDC(wxGraphicsContext* context);
wxGCDC();
virtual ~wxGCDC();
#ifdef __WXMSW__
// override wxDC virtual functions to provide access to HDC associated with
// this Graphics object (implemented in src/msw/graphics.cpp)
virtual WXHDC AcquireHDC() wxOVERRIDE;
virtual void ReleaseHDC(WXHDC hdc) wxOVERRIDE;
#endif // __WXMSW__
private:
wxDECLARE_DYNAMIC_CLASS(wxGCDC);
wxDECLARE_NO_COPY_CLASS(wxGCDC);
};
class WXDLLIMPEXP_CORE wxGCDCImpl: public wxDCImpl
{
public:
wxGCDCImpl( wxDC *owner, const wxWindowDC& dc );
wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc );
#if wxUSE_PRINTING_ARCHITECTURE
wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc );
#endif
#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
wxGCDCImpl( wxDC *owner, const wxEnhMetaFileDC& dc );
#endif
// Ctor using an existing graphics context given to wxGCDC ctor.
wxGCDCImpl(wxDC *owner, wxGraphicsContext* context);
wxGCDCImpl( wxDC *owner );
virtual ~wxGCDCImpl();
// implement base class pure virtuals
// ----------------------------------
virtual void Clear() wxOVERRIDE;
virtual bool StartDoc( const wxString& message ) wxOVERRIDE;
virtual void EndDoc() wxOVERRIDE;
virtual void StartPage() wxOVERRIDE;
virtual void EndPage() wxOVERRIDE;
// flushing the content of this dc immediately onto screen
virtual void Flush() wxOVERRIDE;
virtual void SetFont(const wxFont& font) wxOVERRIDE;
virtual void SetPen(const wxPen& pen) wxOVERRIDE;
virtual void SetBrush(const wxBrush& brush) wxOVERRIDE;
virtual void SetBackground(const wxBrush& brush) wxOVERRIDE;
virtual void SetBackgroundMode(int mode) wxOVERRIDE;
#if wxUSE_PALETTE
virtual void SetPalette(const wxPalette& palette) wxOVERRIDE;
#endif
virtual void DestroyClippingRegion() wxOVERRIDE;
virtual wxCoord GetCharHeight() const wxOVERRIDE;
virtual wxCoord GetCharWidth() const wxOVERRIDE;
virtual bool CanDrawBitmap() const wxOVERRIDE;
virtual bool CanGetTextExtent() const wxOVERRIDE;
virtual int GetDepth() const wxOVERRIDE;
virtual wxSize GetPPI() const wxOVERRIDE;
virtual void SetLogicalFunction(wxRasterOperationMode function) wxOVERRIDE;
virtual void SetTextForeground(const wxColour& colour) wxOVERRIDE;
virtual void SetTextBackground(const wxColour& colour) wxOVERRIDE;
virtual void ComputeScaleAndOrigin() wxOVERRIDE;
wxGraphicsContext* GetGraphicsContext() const wxOVERRIDE { return m_graphicContext; }
virtual void SetGraphicsContext( wxGraphicsContext* ctx ) wxOVERRIDE;
virtual void* GetHandle() const wxOVERRIDE;
#if wxUSE_DC_TRANSFORM_MATRIX
virtual bool CanUseTransformMatrix() const wxOVERRIDE;
virtual bool SetTransformMatrix(const wxAffineMatrix2D& matrix) wxOVERRIDE;
virtual wxAffineMatrix2D GetTransformMatrix() const wxOVERRIDE;
virtual void ResetTransformMatrix() wxOVERRIDE;
#endif // wxUSE_DC_TRANSFORM_MATRIX
// the true implementations
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE;
virtual void DoGradientFillLinear(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
wxDirection nDirection = wxEAST) wxOVERRIDE;
virtual void DoGradientFillConcentric(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
const wxPoint& circleCenter) wxOVERRIDE;
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const wxOVERRIDE;
virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE;
#if wxUSE_SPLINES
virtual void DoDrawSpline(const wxPointList *points) wxOVERRIDE;
#endif
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE;
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc) wxOVERRIDE;
virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
wxCoord width, wxCoord height) wxOVERRIDE;
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
double sa, double ea) wxOVERRIDE;
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE;
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
wxCoord width, wxCoord height,
double radius) wxOVERRIDE;
virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE;
virtual void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE;
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE;
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
bool useMask = false) wxOVERRIDE;
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE;
virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
double angle) wxOVERRIDE;
virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1) wxOVERRIDE;
virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
wxCoord dstWidth, wxCoord dstHeight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxCoord srcWidth, wxCoord srcHeight,
wxRasterOperationMode = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE;
virtual void DoGetSize(int *,int *) const wxOVERRIDE;
virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE;
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset) wxOVERRIDE;
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE;
virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle) wxOVERRIDE;
virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE;
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
wxCoord width, wxCoord height) wxOVERRIDE;
virtual bool DoGetClippingRect(wxRect& rect) const wxOVERRIDE;
virtual void DoGetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent = NULL,
wxCoord *externalLeading = NULL,
const wxFont *theFont = NULL) const wxOVERRIDE;
virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const wxOVERRIDE;
#ifdef __WXMSW__
virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const wxOVERRIDE;
#endif // __WXMSW__
// update the internal clip box variables
void UpdateClipBox();
protected:
// unused int parameter distinguishes this version, which does not create a
// wxGraphicsContext, in the expectation that the derived class will do it
wxGCDCImpl(wxDC* owner, int);
// scaling variables
bool m_logicalFunctionSupported;
wxGraphicsMatrix m_matrixOriginal;
wxGraphicsMatrix m_matrixCurrent;
#if wxUSE_DC_TRANSFORM_MATRIX
wxAffineMatrix2D m_matrixExtTransform;
#endif // wxUSE_DC_TRANSFORM_MATRIX
wxGraphicsContext* m_graphicContext;
bool m_isClipBoxValid;
private:
void Init(wxGraphicsContext*);
wxDECLARE_CLASS(wxGCDCImpl);
wxDECLARE_NO_COPY_CLASS(wxGCDCImpl);
};
#endif // wxUSE_GRAPHICS_CONTEXT
#endif // _WX_GRAPHICS_DC_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/file.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/file.h
// Purpose: wxFile - encapsulates low-level "file descriptor"
// wxTempFile - safely replace the old file
// Author: Vadim Zeitlin
// Modified by:
// Created: 29/01/98
// Copyright: (c) 1998 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FILEH__
#define _WX_FILEH__
#include "wx/defs.h"
#if wxUSE_FILE
#include "wx/string.h"
#include "wx/filefn.h"
#include "wx/convauto.h"
// ----------------------------------------------------------------------------
// class wxFile: raw file IO
//
// NB: for space efficiency this class has no virtual functions, including
// dtor which is _not_ virtual, so it shouldn't be used as a base class.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxFile
{
public:
// more file constants
// -------------------
// opening mode
enum OpenMode { read, write, read_write, write_append, write_excl };
// standard values for file descriptor
enum { fd_invalid = -1, fd_stdin, fd_stdout, fd_stderr };
// static functions
// ----------------
// check whether a regular file by this name exists
static bool Exists(const wxString& name);
// check whether we can access the given file in given mode
// (only read and write make sense here)
static bool Access(const wxString& name, OpenMode mode);
// ctors
// -----
// def ctor
wxFile() { m_fd = fd_invalid; m_lasterror = 0; }
// open specified file (may fail, use IsOpened())
wxFile(const wxString& fileName, OpenMode mode = read);
// attach to (already opened) file
wxFile(int lfd) { m_fd = lfd; m_lasterror = 0; }
// open/close
// create a new file (with the default value of bOverwrite, it will fail if
// the file already exists, otherwise it will overwrite it and succeed)
bool Create(const wxString& fileName, bool bOverwrite = false,
int access = wxS_DEFAULT);
bool Open(const wxString& fileName, OpenMode mode = read,
int access = wxS_DEFAULT);
bool Close(); // Close is a NOP if not opened
// assign an existing file descriptor and get it back from wxFile object
void Attach(int lfd) { Close(); m_fd = lfd; m_lasterror = 0; }
int Detach() { const int fdOld = m_fd; m_fd = fd_invalid; return fdOld; }
int fd() const { return m_fd; }
// read/write (unbuffered)
// read all data from the file into a string (useful for text files)
bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto());
// returns number of bytes read or wxInvalidOffset on error
ssize_t Read(void *pBuf, size_t nCount);
// returns the number of bytes written
size_t Write(const void *pBuf, size_t nCount);
// returns true on success
bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto());
// flush data not yet written
bool Flush();
// file pointer operations (return wxInvalidOffset on failure)
// move ptr ofs bytes related to start/current offset/end of file
wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart);
// move ptr to ofs bytes before the end
wxFileOffset SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); }
// get current offset
wxFileOffset Tell() const;
// get current file length
wxFileOffset Length() const;
// simple accessors
// is file opened?
bool IsOpened() const { return m_fd != fd_invalid; }
// is end of file reached?
bool Eof() const;
// has an error occurred?
bool Error() const { return m_lasterror != 0; }
// get last errno
int GetLastError() const { return m_lasterror; }
// reset error state
void ClearLastError() { m_lasterror = 0; }
// type such as disk or pipe
wxFileKind GetKind() const { return wxGetFileKind(m_fd); }
// dtor closes the file if opened
~wxFile() { Close(); }
private:
// copy ctor and assignment operator are private because
// it doesn't make sense to copy files this way:
// attempt to do it will provoke a compile-time error.
wxFile(const wxFile&);
wxFile& operator=(const wxFile&);
// Copy the value of errno into m_lasterror if rc == -1 and return true in
// this case (indicating that we've got an error). Otherwise return false.
//
// Notice that we use the possibly 64 bit wxFileOffset instead of int here so
// that it works for checking the result of functions such as tell() too.
bool CheckForError(wxFileOffset rc) const;
int m_fd; // file descriptor or INVALID_FD if not opened
int m_lasterror; // errno value of last error
};
// ----------------------------------------------------------------------------
// class wxTempFile: if you want to replace another file, create an instance
// of wxTempFile passing the name of the file to be replaced to the ctor. Then
// you can write to wxTempFile and call Commit() function to replace the old
// file (and close this one) or call Discard() to cancel the modification. If
// you call neither of them, dtor will call Discard().
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxTempFile
{
public:
// ctors
// default
wxTempFile() { }
// associates the temp file with the file to be replaced and opens it
wxTempFile(const wxString& strName);
// open the temp file (strName is the name of file to be replaced)
bool Open(const wxString& strName);
// is the file opened?
bool IsOpened() const { return m_file.IsOpened(); }
// get current file length
wxFileOffset Length() const { return m_file.Length(); }
// move ptr ofs bytes related to start/current offset/end of file
wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart)
{ return m_file.Seek(ofs, mode); }
// get current offset
wxFileOffset Tell() const { return m_file.Tell(); }
// I/O (both functions return true on success, false on failure)
bool Write(const void *p, size_t n) { return m_file.Write(p, n) == n; }
bool Write(const wxString& str, const wxMBConv& conv = wxMBConvUTF8())
{ return m_file.Write(str, conv); }
// flush data: can be called before closing file to ensure that data was
// correctly written out
bool Flush() { return m_file.Flush(); }
// different ways to close the file
// validate changes and delete the old file of name m_strName
bool Commit();
// discard changes
void Discard();
// dtor calls Discard() if file is still opened
~wxTempFile();
private:
// no copy ctor/assignment operator
wxTempFile(const wxTempFile&);
wxTempFile& operator=(const wxTempFile&);
wxString m_strName, // name of the file to replace in Commit()
m_strTemp; // temporary file name
wxFile m_file; // the temporary file
};
#endif // wxUSE_FILE
#endif // _WX_FILEH__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/filesys.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/filesys.h
// Purpose: class for opening files - virtual file system
// Author: Vaclav Slavik
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __FILESYS_H__
#define __FILESYS_H__
#include "wx/defs.h"
#if wxUSE_FILESYSTEM
#if !wxUSE_STREAMS
#error You cannot compile virtual file systems without wxUSE_STREAMS
#endif
#if wxUSE_HTML && !wxUSE_FILESYSTEM
#error You cannot compile wxHTML without virtual file systems
#endif
#include "wx/stream.h"
#include "wx/datetime.h"
#include "wx/filename.h"
#include "wx/hashmap.h"
class WXDLLIMPEXP_FWD_BASE wxFSFile;
class WXDLLIMPEXP_FWD_BASE wxFileSystemHandler;
class WXDLLIMPEXP_FWD_BASE wxFileSystem;
//--------------------------------------------------------------------------------
// wxFSFile
// This class is a file opened using wxFileSystem. It consists of
// input stream, location, mime type & optional anchor
// (in 'index.htm#chapter2', 'chapter2' is anchor)
//--------------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxFSFile : public wxObject
{
public:
wxFSFile(wxInputStream *stream, const wxString& loc,
const wxString& mimetype, const wxString& anchor
#if wxUSE_DATETIME
, wxDateTime modif
#endif // wxUSE_DATETIME
)
{
m_Stream = stream;
m_Location = loc;
m_MimeType = mimetype.Lower();
m_Anchor = anchor;
#if wxUSE_DATETIME
m_Modif = modif;
#endif // wxUSE_DATETIME
}
virtual ~wxFSFile() { delete m_Stream; }
// returns stream. This doesn't give away ownership of the stream object.
wxInputStream *GetStream() const { return m_Stream; }
// gives away the ownership of the current stream.
wxInputStream *DetachStream()
{
wxInputStream *stream = m_Stream;
m_Stream = NULL;
return stream;
}
// deletes the current stream and takes ownership of another.
void SetStream(wxInputStream *stream)
{
delete m_Stream;
m_Stream = stream;
}
// returns file's mime type
const wxString& GetMimeType() const;
// returns the original location (aka filename) of the file
const wxString& GetLocation() const { return m_Location; }
const wxString& GetAnchor() const { return m_Anchor; }
#if wxUSE_DATETIME
wxDateTime GetModificationTime() const { return m_Modif; }
#endif // wxUSE_DATETIME
private:
wxInputStream *m_Stream;
wxString m_Location;
wxString m_MimeType;
wxString m_Anchor;
#if wxUSE_DATETIME
wxDateTime m_Modif;
#endif // wxUSE_DATETIME
wxDECLARE_ABSTRACT_CLASS(wxFSFile);
wxDECLARE_NO_COPY_CLASS(wxFSFile);
};
//--------------------------------------------------------------------------------
// wxFileSystemHandler
// This class is FS handler for wxFileSystem. It provides
// interface to access certain
// kinds of files (HTPP, FTP, local, tar.gz etc..)
//--------------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxFileSystemHandler : public wxObject
{
public:
wxFileSystemHandler() : wxObject() {}
// returns true if this handler is able to open given location
virtual bool CanOpen(const wxString& location) = 0;
// opens given file and returns pointer to input stream.
// Returns NULL if opening failed.
// The location is always absolute path.
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0;
// Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting
// the query to directories or wxFILE for files only or 0 for either.
// Returns filename or empty string if no more matching file exists
virtual wxString FindFirst(const wxString& spec, int flags = 0);
virtual wxString FindNext();
// Returns MIME type of the file - w/o need to open it
// (default behaviour is that it returns type based on extension)
static wxString GetMimeTypeFromExt(const wxString& location);
protected:
// returns protocol ("file", "http", "tar" etc.) The last (most right)
// protocol is used:
// {it returns "tar" for "file:subdir/archive.tar.gz#tar:/README.txt"}
static wxString GetProtocol(const wxString& location);
// returns left part of address:
// {it returns "file:subdir/archive.tar.gz" for "file:subdir/archive.tar.gz#tar:/README.txt"}
static wxString GetLeftLocation(const wxString& location);
// returns anchor part of address:
// {it returns "anchor" for "file:subdir/archive.tar.gz#tar:/README.txt#anchor"}
// NOTE: anchor is NOT a part of GetLeftLocation()'s return value
static wxString GetAnchor(const wxString& location);
// returns right part of address:
// {it returns "/README.txt" for "file:subdir/archive.tar.gz#tar:/README.txt"}
static wxString GetRightLocation(const wxString& location);
wxDECLARE_ABSTRACT_CLASS(wxFileSystemHandler);
};
//--------------------------------------------------------------------------------
// wxFileSystem
// This class provides simple interface for opening various
// kinds of files (HTPP, FTP, local, tar.gz etc..)
//--------------------------------------------------------------------------------
// Open Bit Flags
enum wxFileSystemOpenFlags
{
wxFS_READ = 1, // Open for reading
wxFS_SEEKABLE = 4 // Returned stream will be seekable
};
WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(wxFileSystemHandler*, wxFSHandlerHash, class WXDLLIMPEXP_BASE);
class WXDLLIMPEXP_BASE wxFileSystem : public wxObject
{
public:
wxFileSystem() : wxObject() { m_FindFileHandler = NULL;}
virtual ~wxFileSystem();
// sets the current location. Every call to OpenFile is
// relative to this location.
// NOTE !!
// unless is_dir = true 'location' is *not* the directory but
// file contained in this directory
// (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/")
void ChangePathTo(const wxString& location, bool is_dir = false);
wxString GetPath() const {return m_Path;}
// opens given file and returns pointer to input stream.
// Returns NULL if opening failed.
// It first tries to open the file in relative scope
// (based on ChangePathTo()'s value) and then as an absolute
// path.
wxFSFile* OpenFile(const wxString& location, int flags = wxFS_READ);
// Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting
// the query to directories or wxFILE for files only or 0 for either.
// Returns filename or empty string if no more matching file exists
wxString FindFirst(const wxString& spec, int flags = 0);
wxString FindNext();
// find a file in a list of directories, returns false if not found
bool FindFileInPath(wxString *pStr,
const wxString& path, const wxString& file);
// Adds FS handler.
// In fact, this class is only front-end to the FS handlers :-)
static void AddHandler(wxFileSystemHandler *handler);
// Removes FS handler
static wxFileSystemHandler* RemoveHandler(wxFileSystemHandler *handler);
// Returns true if there is a handler which can open the given location.
static bool HasHandlerForPath(const wxString& location);
// remove all items from the m_Handlers list
static void CleanUpHandlers();
// Returns the native path for a file URL
static wxFileName URLToFileName(const wxString& url);
// Returns the file URL for a native path
static wxString FileNameToURL(const wxFileName& filename);
protected:
wxFileSystemHandler *MakeLocal(wxFileSystemHandler *h);
wxString m_Path;
// the path (location) we are currently in
// this is path, not file!
// (so if you opened test/demo.htm, it is
// "test/", not "test/demo.htm")
wxString m_LastName;
// name of last opened file (full path)
static wxList m_Handlers;
// list of FS handlers
wxFileSystemHandler *m_FindFileHandler;
// handler that succeed in FindFirst query
wxFSHandlerHash m_LocalHandlers;
// Handlers local to this instance
wxDECLARE_DYNAMIC_CLASS(wxFileSystem);
wxDECLARE_NO_COPY_CLASS(wxFileSystem);
};
/*
'location' syntax:
To determine FS type, we're using standard KDE notation:
file:/absolute/path/file.htm
file:relative_path/xxxxx.html
/some/path/x.file ('file:' is default)
http://www.gnome.org
file:subdir/archive.tar.gz#tar:/README.txt
special characters :
':' - FS identificator is before this char
'#' - separator. It can be either HTML anchor ("index.html#news")
(in case there is no ':' in the string to the right from it)
or FS separator
(example : http://www.wxhtml.org/wxhtml-0.1.tar.gz#tar:/include/wxhtml/filesys.h"
this would access tgz archive stored on web)
'/' - directory (path) separator. It is used to determine upper-level path.
HEY! Don't use \ even if you're on Windows!
*/
class WXDLLIMPEXP_BASE wxLocalFSHandler : public wxFileSystemHandler
{
public:
virtual bool CanOpen(const wxString& location) wxOVERRIDE;
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE;
virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE;
virtual wxString FindNext() wxOVERRIDE;
// wxLocalFSHandler will prefix all filenames with 'root' before accessing
// files on disk. This effectively makes 'root' the top-level directory
// and prevents access to files outside this directory.
// (This is similar to Unix command 'chroot'.)
static void Chroot(const wxString& root) { ms_root = root; }
protected:
static wxString ms_root;
};
// Stream reading data from wxFSFile: this allows to use virtual files with any
// wx functions accepting streams.
class WXDLLIMPEXP_BASE wxFSInputStream : public wxWrapperInputStream
{
public:
// Notice that wxFS_READ is implied in flags.
wxFSInputStream(const wxString& filename, int flags = 0);
virtual ~wxFSInputStream();
private:
wxFSFile* m_file;
wxDECLARE_NO_COPY_CLASS(wxFSInputStream);
};
#endif
// wxUSE_FILESYSTEM
#endif
// __FILESYS_H__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/region.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/region.h
// Purpose: Base header for wxRegion
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_REGION_H_BASE_
#define _WX_REGION_H_BASE_
#include "wx/gdiobj.h"
#include "wx/gdicmn.h"
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxColour;
class WXDLLIMPEXP_FWD_CORE wxRegion;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// result of wxRegion::Contains() call
enum wxRegionContain
{
wxOutRegion = 0,
wxPartRegion = 1,
wxInRegion = 2
};
// these constants are used with wxRegion::Combine() in the ports which have
// this method
enum wxRegionOp
{
// Creates the intersection of the two combined regions.
wxRGN_AND,
// Creates a copy of the region
wxRGN_COPY,
// Combines the parts of first region that are not in the second one
wxRGN_DIFF,
// Creates the union of two combined regions.
wxRGN_OR,
// Creates the union of two regions except for any overlapping areas.
wxRGN_XOR
};
// ----------------------------------------------------------------------------
// wxRegionBase defines wxRegion API
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRegionBase : public wxGDIObject
{
public:
// ctors
// -----
// none are defined here but the following should be available:
#if 0
wxRegion();
wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
wxRegion(const wxRect& rect);
wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
wxRegion(const wxBitmap& bmp);
wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0);
#endif // 0
// operators
// ---------
bool operator==(const wxRegion& region) const { return IsEqual(region); }
bool operator!=(const wxRegion& region) const { return !(*this == region); }
// accessors
// ---------
// Is region empty?
virtual bool IsEmpty() const = 0;
bool Empty() const { return IsEmpty(); }
// Is region equal (i.e. covers the same area as another one)?
bool IsEqual(const wxRegion& region) const;
// Get the bounding box
bool GetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const
{ return DoGetBox(x, y, w, h); }
wxRect GetBox() const
{
wxCoord x, y, w, h;
return DoGetBox(x, y, w, h) ? wxRect(x, y, w, h) : wxRect();
}
// Test if the given point or rectangle is inside this region
wxRegionContain Contains(wxCoord x, wxCoord y) const
{ return DoContainsPoint(x, y); }
wxRegionContain Contains(const wxPoint& pt) const
{ return DoContainsPoint(pt.x, pt.y); }
wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const
{ return DoContainsRect(wxRect(x, y, w, h)); }
wxRegionContain Contains(const wxRect& rect) const
{ return DoContainsRect(rect); }
// operations
// ----------
virtual void Clear() = 0;
// Move the region
bool Offset(wxCoord x, wxCoord y)
{ return DoOffset(x, y); }
bool Offset(const wxPoint& pt)
{ return DoOffset(pt.x, pt.y); }
// Union rectangle or region with this region.
bool Union(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{ return DoUnionWithRect(wxRect(x, y, w, h)); }
bool Union(const wxRect& rect)
{ return DoUnionWithRect(rect); }
bool Union(const wxRegion& region)
{ return DoUnionWithRegion(region); }
#if wxUSE_IMAGE
// Use the non-transparent pixels of a wxBitmap for the region to combine
// with this region. First version takes transparency from bitmap's mask,
// second lets the user specify the colour to be treated as transparent
// along with an optional tolerance value.
// NOTE: implemented in common/rgncmn.cpp
bool Union(const wxBitmap& bmp);
bool Union(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0);
#endif // wxUSE_IMAGE
// Intersect rectangle or region with this one.
bool Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
bool Intersect(const wxRect& rect);
bool Intersect(const wxRegion& region)
{ return DoIntersect(region); }
// Subtract rectangle or region from this:
// Combines the parts of 'this' that are not part of the second region.
bool Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
bool Subtract(const wxRect& rect);
bool Subtract(const wxRegion& region)
{ return DoSubtract(region); }
// XOR: the union of two combined regions except for any overlapping areas.
bool Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
bool Xor(const wxRect& rect);
bool Xor(const wxRegion& region)
{ return DoXor(region); }
// Convert the region to a B&W bitmap with the white pixels being inside
// the region.
wxBitmap ConvertToBitmap() const;
protected:
virtual bool DoIsEqual(const wxRegion& region) const = 0;
virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const = 0;
virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const = 0;
virtual wxRegionContain DoContainsRect(const wxRect& rect) const = 0;
virtual bool DoOffset(wxCoord x, wxCoord y) = 0;
virtual bool DoUnionWithRect(const wxRect& rect) = 0;
virtual bool DoUnionWithRegion(const wxRegion& region) = 0;
virtual bool DoIntersect(const wxRegion& region) = 0;
virtual bool DoSubtract(const wxRegion& region) = 0;
virtual bool DoXor(const wxRegion& region) = 0;
};
// some ports implement a generic Combine() function while others only
// implement individual wxRegion operations, factor out the common code for the
// ports with Combine() in this class
#if defined(__WXMSW__) || \
( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON )
#define wxHAS_REGION_COMBINE
class WXDLLIMPEXP_CORE wxRegionWithCombine : public wxRegionBase
{
public:
// these methods are not part of public API as they're not implemented on
// all ports
bool Combine(wxCoord x, wxCoord y, wxCoord w, wxCoord h, wxRegionOp op);
bool Combine(const wxRect& rect, wxRegionOp op);
bool Combine(const wxRegion& region, wxRegionOp op)
{ return DoCombine(region, op); }
protected:
// the real Combine() method, to be defined in the derived class
virtual bool DoCombine(const wxRegion& region, wxRegionOp op) = 0;
// implement some wxRegionBase pure virtuals in terms of Combine()
virtual bool DoUnionWithRect(const wxRect& rect) wxOVERRIDE;
virtual bool DoUnionWithRegion(const wxRegion& region) wxOVERRIDE;
virtual bool DoIntersect(const wxRegion& region) wxOVERRIDE;
virtual bool DoSubtract(const wxRegion& region) wxOVERRIDE;
virtual bool DoXor(const wxRegion& region) wxOVERRIDE;
};
#endif // ports with wxRegion::Combine()
#if defined(__WXMSW__)
#include "wx/msw/region.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/region.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/region.h"
#elif defined(__WXMOTIF__) || defined(__WXX11__)
#include "wx/x11/region.h"
#elif defined(__WXDFB__)
#include "wx/dfb/region.h"
#elif defined(__WXMAC__)
#include "wx/osx/region.h"
#elif defined(__WXQT__)
#include "wx/qt/region.h"
#endif
// ----------------------------------------------------------------------------
// inline functions implementation
// ----------------------------------------------------------------------------
// NB: these functions couldn't be defined in the class declaration as they use
// wxRegion and so can be only defined after including the header declaring
// the real class
inline bool wxRegionBase::Intersect(const wxRect& rect)
{
return DoIntersect(wxRegion(rect));
}
inline bool wxRegionBase::Subtract(const wxRect& rect)
{
return DoSubtract(wxRegion(rect));
}
inline bool wxRegionBase::Xor(const wxRect& rect)
{
return DoXor(wxRegion(rect));
}
// ...and these functions are here because they call the ones above, and its
// not really proper to call an inline function before its defined inline.
inline bool wxRegionBase::Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
return Intersect(wxRect(x, y, w, h));
}
inline bool wxRegionBase::Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
return Subtract(wxRect(x, y, w, h));
}
inline bool wxRegionBase::Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
return Xor(wxRect(x, y, w, h));
}
#ifdef wxHAS_REGION_COMBINE
inline bool wxRegionWithCombine::Combine(wxCoord x,
wxCoord y,
wxCoord w,
wxCoord h,
wxRegionOp op)
{
return DoCombine(wxRegion(x, y, w, h), op);
}
inline bool wxRegionWithCombine::Combine(const wxRect& rect, wxRegionOp op)
{
return DoCombine(wxRegion(rect), op);
}
#endif // wxHAS_REGION_COMBINE
#endif // _WX_REGION_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/eventfilter.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/eventfilter.h
// Purpose: wxEventFilter class declaration.
// Author: Vadim Zeitlin
// Created: 2011-11-21
// Copyright: (c) 2011 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_EVENTFILTER_H_
#define _WX_EVENTFILTER_H_
#include "wx/defs.h"
class WXDLLIMPEXP_FWD_BASE wxEvent;
class WXDLLIMPEXP_FWD_BASE wxEvtHandler;
// ----------------------------------------------------------------------------
// wxEventFilter is used with wxEvtHandler::AddFilter() and ProcessEvent().
// ----------------------------------------------------------------------------
class wxEventFilter
{
public:
// Possible return values for FilterEvent().
//
// Notice that the values of these enum elements are fixed due to backwards
// compatibility constraints.
enum
{
// Process event as usual.
Event_Skip = -1,
// Don't process the event normally at all.
Event_Ignore = 0,
// Event was already handled, don't process it normally.
Event_Processed = 1
};
wxEventFilter()
{
m_next = NULL;
}
virtual ~wxEventFilter()
{
wxASSERT_MSG( !m_next, "Forgot to call wxEvtHandler::RemoveFilter()?" );
}
// This method allows to filter all the events processed by the program, so
// you should try to return quickly from it to avoid slowing down the
// program to a crawl.
//
// Return value should be -1 to continue with the normal event processing,
// or true or false to stop further processing and pretend that the event
// had been already processed or won't be processed at all, respectively.
virtual int FilterEvent(wxEvent& event) = 0;
private:
// Objects of this class are made to be stored in a linked list in
// wxEvtHandler so put the next node ponter directly in the class itself.
wxEventFilter* m_next;
// And provide access to it for wxEvtHandler [only].
friend class wxEvtHandler;
wxDECLARE_NO_COPY_CLASS(wxEventFilter);
};
#endif // _WX_EVENTFILTER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/stopwatch.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/stopwatch.h
// Purpose: wxStopWatch and global time-related functions
// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch),
// Vadim Zeitlin (time functions, current wxStopWatch)
// Created: 26.06.03 (extracted from wx/timer.h)
// Copyright: (c) 1998-2003 Julian Smart, Sylvain Bougnoux
// (c) 2011 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STOPWATCH_H_
#define _WX_STOPWATCH_H_
#include "wx/defs.h"
#include "wx/longlong.h"
// Time-related functions are also available via this header for compatibility
// but you should include wx/time.h directly if you need only them and not
// wxStopWatch itself.
#include "wx/time.h"
// ----------------------------------------------------------------------------
// wxStopWatch: measure time intervals with up to 1ms resolution
// ----------------------------------------------------------------------------
#if wxUSE_STOPWATCH
class WXDLLIMPEXP_BASE wxStopWatch
{
public:
// ctor starts the stop watch
wxStopWatch() { m_pauseCount = 0; Start(); }
// Start the stop watch at the moment t0 expressed in milliseconds (i.e.
// calling Time() immediately afterwards returns t0). This can be used to
// restart an existing stopwatch.
void Start(long t0 = 0);
// pause the stop watch
void Pause()
{
if ( m_pauseCount++ == 0 )
m_elapsedBeforePause = GetCurrentClockValue() - m_t0;
}
// resume it
void Resume()
{
wxASSERT_MSG( m_pauseCount > 0,
wxT("Resuming stop watch which is not paused") );
if ( --m_pauseCount == 0 )
{
DoStart();
m_t0 -= m_elapsedBeforePause;
}
}
// Get elapsed time since the last Start() in microseconds.
wxLongLong TimeInMicro() const;
// get elapsed time since the last Start() in milliseconds
long Time() const { return (TimeInMicro()/1000).ToLong(); }
private:
// Really starts the stop watch. The initial time is set to current clock
// value.
void DoStart();
// Returns the current clock value in its native units.
wxLongLong GetCurrentClockValue() const;
// Return the frequency of the clock used in its ticks per second.
wxLongLong GetClockFreq() const;
// The clock value when the stop watch was last started. Its units vary
// depending on the platform.
wxLongLong m_t0;
// The elapsed time as of last Pause() call (only valid if m_pauseCount >
// 0) in the same units as m_t0.
wxLongLong m_elapsedBeforePause;
// if > 0, the stop watch is paused, otherwise it is running
int m_pauseCount;
};
#endif // wxUSE_STOPWATCH
#endif // _WX_STOPWATCH_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/init.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/init.h
// Purpose: wxWidgets initialization and finalization functions
// Author: Vadim Zeitlin
// Modified by:
// Created: 29.06.2003
// Copyright: (c) 2003 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_INIT_H_
#define _WX_INIT_H_
#include "wx/defs.h"
#include "wx/chartype.h"
// ----------------------------------------------------------------------------
// wxEntry helper functions which allow to have more fine grained control
// ----------------------------------------------------------------------------
// do common initialization, return true if ok (in this case wxEntryCleanup
// must be called later), otherwise the program can't use wxWidgets at all
//
// this function also creates wxTheApp as a side effect, if wxIMPLEMENT_APP
// hadn't been used a dummy default application object is created
//
// note that the parameters may be modified, this is why we pass them by
// reference!
extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, wxChar **argv);
// free the resources allocated by the library in wxEntryStart() and shut it
// down (wxEntryStart() may be called again afterwards if necessary)
extern void WXDLLIMPEXP_BASE wxEntryCleanup();
// ----------------------------------------------------------------------------
// wxEntry: this function initializes the library, runs the main event loop
// and cleans it up
// ----------------------------------------------------------------------------
// note that other, platform-specific, overloads of wxEntry may exist as well
// but this one always exists under all platforms
//
// returns the program exit code
extern int WXDLLIMPEXP_BASE wxEntry(int& argc, wxChar **argv);
// we overload wxEntry[Start]() to take "char **" pointers too
#if wxUSE_UNICODE
extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, char **argv);
extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv);
#endif// wxUSE_UNICODE
// Under Windows we define additional wxEntry() overloads with signature
// compatible with WinMain() and not the traditional main().
#ifdef __WINDOWS__
#include "wx/msw/init.h"
#endif
// ----------------------------------------------------------------------------
// Using the library without (explicit) application object: you may avoid using
// wxDECLARE_APP and wxIMPLEMENT_APP macros and call the functions below instead at
// the program startup and termination
// ----------------------------------------------------------------------------
// initialize the library (may be called as many times as needed, but each
// call to wxInitialize() must be matched by wxUninitialize())
extern bool WXDLLIMPEXP_BASE wxInitialize();
extern bool WXDLLIMPEXP_BASE wxInitialize(int& argc, wxChar **argv);
#if wxUSE_UNICODE
extern bool WXDLLIMPEXP_BASE wxInitialize(int& argc, char **argv);
#endif
// clean up -- the library can't be used any more after the last call to
// wxUninitialize()
extern void WXDLLIMPEXP_BASE wxUninitialize();
// create an object of this class on stack to initialize/cleanup the library
// automatically
class WXDLLIMPEXP_BASE wxInitializer
{
public:
// initialize the library
wxInitializer()
{
m_ok = wxInitialize();
}
wxInitializer(int& argc, wxChar **argv)
{
m_ok = wxInitialize(argc, argv);
}
#if wxUSE_UNICODE
wxInitializer(int& argc, char **argv)
{
m_ok = wxInitialize(argc, argv);
}
#endif // wxUSE_UNICODE
// has the initialization been successful? (explicit test)
bool IsOk() const { return m_ok; }
// has the initialization been successful? (implicit test)
operator bool() const { return m_ok; }
// dtor only does clean up if we initialized the library properly
~wxInitializer() { if ( m_ok ) wxUninitialize(); }
private:
bool m_ok;
};
#endif // _WX_INIT_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/textcompleter.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/textcompleter.h
// Purpose: Declaration of wxTextCompleter class.
// Author: Vadim Zeitlin
// Created: 2011-04-13
// Copyright: (c) 2011 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TEXTCOMPLETER_H_
#define _WX_TEXTCOMPLETER_H_
#include "wx/defs.h"
#include "wx/arrstr.h"
// ----------------------------------------------------------------------------
// wxTextCompleter: used by wxTextEnter::AutoComplete()
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTextCompleter
{
public:
wxTextCompleter() { }
// The virtual functions to be implemented by the derived classes: the
// first one is called to start preparing for completions for the given
// prefix and, if it returns true, GetNext() is called until it returns an
// empty string indicating that there are no more completions.
virtual bool Start(const wxString& prefix) = 0;
virtual wxString GetNext() = 0;
virtual ~wxTextCompleter();
private:
wxDECLARE_NO_COPY_CLASS(wxTextCompleter);
};
// ----------------------------------------------------------------------------
// wxTextCompleterSimple: returns the entire set of completions at once
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTextCompleterSimple : public wxTextCompleter
{
public:
wxTextCompleterSimple() { }
// Must be implemented to return all the completions for the given prefix.
virtual void GetCompletions(const wxString& prefix, wxArrayString& res) = 0;
virtual bool Start(const wxString& prefix) wxOVERRIDE;
virtual wxString GetNext() wxOVERRIDE;
private:
wxArrayString m_completions;
unsigned m_index;
wxDECLARE_NO_COPY_CLASS(wxTextCompleterSimple);
};
// ----------------------------------------------------------------------------
// wxTextCompleterFixed: Trivial wxTextCompleter implementation which always
// returns the same fixed array of completions.
// ----------------------------------------------------------------------------
// NB: This class is private and intentionally not documented as it is
// currently used only for implementation of completion with the fixed list
// of strings only by wxWidgets itself, do not use it outside of wxWidgets.
class wxTextCompleterFixed : public wxTextCompleterSimple
{
public:
void SetCompletions(const wxArrayString& strings)
{
m_strings = strings;
}
virtual void GetCompletions(const wxString& WXUNUSED(prefix),
wxArrayString& res) wxOVERRIDE
{
res = m_strings;
}
private:
wxArrayString m_strings;
};
#endif // _WX_TEXTCOMPLETER_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/datectrl.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/datectrl.h
// Purpose: implements wxDatePickerCtrl
// Author: Vadim Zeitlin
// Modified by:
// Created: 2005-01-09
// Copyright: (c) 2005 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DATECTRL_H_
#define _WX_DATECTRL_H_
#include "wx/defs.h"
#if wxUSE_DATEPICKCTRL
#include "wx/datetimectrl.h" // the base class
#define wxDatePickerCtrlNameStr wxT("datectrl")
// wxDatePickerCtrl styles
enum
{
// default style on this platform, either wxDP_SPIN or wxDP_DROPDOWN
wxDP_DEFAULT = 0,
// a spin control-like date picker (not supported in generic version)
wxDP_SPIN = 1,
// a combobox-like date picker (not supported in mac version)
wxDP_DROPDOWN = 2,
// always show century in the default date display (otherwise it depends on
// the system date format which may include the century or not)
wxDP_SHOWCENTURY = 4,
// allow not having any valid date in the control (by default it always has
// some date, today initially if no valid date specified in ctor)
wxDP_ALLOWNONE = 8
};
// ----------------------------------------------------------------------------
// wxDatePickerCtrl: allow the user to enter the date
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxDateTimePickerCtrl
{
public:
/*
The derived classes should implement ctor and Create() method with the
following signature:
bool Create(wxWindow *parent,
wxWindowID id,
const wxDateTime& dt = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxDatePickerCtrlNameStr);
*/
/*
We inherit the methods to set/get the date from the base class.
virtual void SetValue(const wxDateTime& dt) = 0;
virtual wxDateTime GetValue() const = 0;
*/
// And add methods to set/get the allowed valid range for the dates. If
// either/both of them are invalid, there is no corresponding limit and if
// neither is set, GetRange() returns false.
virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0;
virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0;
};
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/datectrl.h"
#define wxHAS_NATIVE_DATEPICKCTRL
#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__)
#include "wx/osx/datectrl.h"
#define wxHAS_NATIVE_DATEPICKCTRL
#else
#include "wx/generic/datectrl.h"
class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlGeneric
{
public:
wxDatePickerCtrl() { }
wxDatePickerCtrl(wxWindow *parent,
wxWindowID id,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxDatePickerCtrlNameStr)
: wxDatePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name)
{
}
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl);
};
#endif
#endif // wxUSE_DATEPICKCTRL
#endif // _WX_DATECTRL_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/webview.h | /////////////////////////////////////////////////////////////////////////////
// Name: webview.h
// Purpose: Common interface and events for web view component
// Author: Marianne Gagnon
// Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WEBVIEW_H_
#define _WX_WEBVIEW_H_
#include "wx/defs.h"
#if wxUSE_WEBVIEW
#include "wx/control.h"
#include "wx/event.h"
#include "wx/sstream.h"
#include "wx/sharedptr.h"
#include "wx/vector.h"
#if defined(__WXOSX__)
#include "wx/osx/webviewhistoryitem_webkit.h"
#elif defined(__WXGTK__)
#include "wx/gtk/webviewhistoryitem_webkit.h"
#elif defined(__WXMSW__)
#include "wx/msw/webviewhistoryitem_ie.h"
#else
#error "wxWebView not implemented on this platform."
#endif
class wxFSFile;
class wxFileSystem;
class wxWebView;
enum wxWebViewZoom
{
wxWEBVIEW_ZOOM_TINY,
wxWEBVIEW_ZOOM_SMALL,
wxWEBVIEW_ZOOM_MEDIUM,
wxWEBVIEW_ZOOM_LARGE,
wxWEBVIEW_ZOOM_LARGEST
};
enum wxWebViewZoomType
{
//Scales entire page, including images
wxWEBVIEW_ZOOM_TYPE_LAYOUT,
wxWEBVIEW_ZOOM_TYPE_TEXT
};
enum wxWebViewNavigationError
{
wxWEBVIEW_NAV_ERR_CONNECTION,
wxWEBVIEW_NAV_ERR_CERTIFICATE,
wxWEBVIEW_NAV_ERR_AUTH,
wxWEBVIEW_NAV_ERR_SECURITY,
wxWEBVIEW_NAV_ERR_NOT_FOUND,
wxWEBVIEW_NAV_ERR_REQUEST,
wxWEBVIEW_NAV_ERR_USER_CANCELLED,
wxWEBVIEW_NAV_ERR_OTHER
};
enum wxWebViewReloadFlags
{
//Default, may access cache
wxWEBVIEW_RELOAD_DEFAULT,
wxWEBVIEW_RELOAD_NO_CACHE
};
enum wxWebViewFindFlags
{
wxWEBVIEW_FIND_WRAP = 0x0001,
wxWEBVIEW_FIND_ENTIRE_WORD = 0x0002,
wxWEBVIEW_FIND_MATCH_CASE = 0x0004,
wxWEBVIEW_FIND_HIGHLIGHT_RESULT = 0x0008,
wxWEBVIEW_FIND_BACKWARDS = 0x0010,
wxWEBVIEW_FIND_DEFAULT = 0
};
enum wxWebViewNavigationActionFlags
{
wxWEBVIEW_NAV_ACTION_NONE,
wxWEBVIEW_NAV_ACTION_USER,
wxWEBVIEW_NAV_ACTION_OTHER
};
//Base class for custom scheme handlers
class WXDLLIMPEXP_WEBVIEW wxWebViewHandler
{
public:
wxWebViewHandler(const wxString& scheme) : m_scheme(scheme) {}
virtual ~wxWebViewHandler() {}
virtual wxString GetName() const { return m_scheme; }
virtual wxFSFile* GetFile(const wxString &uri) = 0;
private:
wxString m_scheme;
};
extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewNameStr[];
extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewDefaultURLStr[];
extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendDefault[];
extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendIE[];
extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendWebKit[];
class WXDLLIMPEXP_WEBVIEW wxWebViewFactory : public wxObject
{
public:
virtual wxWebView* Create() = 0;
virtual wxWebView* Create(wxWindow* parent,
wxWindowID id,
const wxString& url = wxWebViewDefaultURLStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxWebViewNameStr) = 0;
};
WX_DECLARE_STRING_HASH_MAP(wxSharedPtr<wxWebViewFactory>, wxStringWebViewFactoryMap);
class WXDLLIMPEXP_WEBVIEW wxWebView : public wxControl
{
public:
wxWebView()
{
m_showMenu = true;
m_runScriptCount = 0;
}
virtual ~wxWebView() {}
virtual bool Create(wxWindow* parent,
wxWindowID id,
const wxString& url = wxWebViewDefaultURLStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxWebViewNameStr) = 0;
// Factory methods allowing the use of custom factories registered with
// RegisterFactory
static wxWebView* New(const wxString& backend = wxWebViewBackendDefault);
static wxWebView* New(wxWindow* parent,
wxWindowID id,
const wxString& url = wxWebViewDefaultURLStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& backend = wxWebViewBackendDefault,
long style = 0,
const wxString& name = wxWebViewNameStr);
static void RegisterFactory(const wxString& backend,
wxSharedPtr<wxWebViewFactory> factory);
// General methods
virtual void EnableContextMenu(bool enable = true)
{
m_showMenu = enable;
}
virtual wxString GetCurrentTitle() const = 0;
virtual wxString GetCurrentURL() const = 0;
// TODO: handle choosing a frame when calling GetPageSource()?
virtual wxString GetPageSource() const = 0;
virtual wxString GetPageText() const = 0;
virtual bool IsBusy() const = 0;
virtual bool IsContextMenuEnabled() const { return m_showMenu; }
virtual bool IsEditable() const = 0;
virtual void LoadURL(const wxString& url) = 0;
virtual void Print() = 0;
virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler) = 0;
virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT) = 0;
virtual bool RunScript(const wxString& javascript, wxString* output = NULL) = 0;
virtual void SetEditable(bool enable = true) = 0;
void SetPage(const wxString& html, const wxString& baseUrl)
{
DoSetPage(html, baseUrl);
}
void SetPage(wxInputStream& html, wxString baseUrl)
{
wxStringOutputStream stream;
stream.Write(html);
DoSetPage(stream.GetString(), baseUrl);
}
virtual void Stop() = 0;
//History
virtual bool CanGoBack() const = 0;
virtual bool CanGoForward() const = 0;
virtual void GoBack() = 0;
virtual void GoForward() = 0;
virtual void ClearHistory() = 0;
virtual void EnableHistory(bool enable = true) = 0;
virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetBackwardHistory() = 0;
virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory() = 0;
virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item) = 0;
//Zoom
virtual bool CanSetZoomType(wxWebViewZoomType type) const = 0;
virtual wxWebViewZoom GetZoom() const = 0;
virtual wxWebViewZoomType GetZoomType() const = 0;
virtual void SetZoom(wxWebViewZoom zoom) = 0;
virtual void SetZoomType(wxWebViewZoomType zoomType) = 0;
//Selection
virtual void SelectAll() = 0;
virtual bool HasSelection() const = 0;
virtual void DeleteSelection() = 0;
virtual wxString GetSelectedText() const = 0;
virtual wxString GetSelectedSource() const = 0;
virtual void ClearSelection() = 0;
//Clipboard functions
virtual bool CanCut() const = 0;
virtual bool CanCopy() const = 0;
virtual bool CanPaste() const = 0;
virtual void Cut() = 0;
virtual void Copy() = 0;
virtual void Paste() = 0;
//Undo / redo functionality
virtual bool CanUndo() const = 0;
virtual bool CanRedo() const = 0;
virtual void Undo() = 0;
virtual void Redo() = 0;
//Get the pointer to the underlying native engine.
virtual void* GetNativeBackend() const = 0;
//Find function
virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT) = 0;
protected:
virtual void DoSetPage(const wxString& html, const wxString& baseUrl) = 0;
// Count the number of calls to RunScript() in order to prevent
// the_same variable from being used twice in more than one call.
int m_runScriptCount;
private:
static void InitFactoryMap();
static wxStringWebViewFactoryMap::iterator FindFactory(const wxString &backend);
bool m_showMenu;
static wxStringWebViewFactoryMap m_factoryMap;
wxDECLARE_ABSTRACT_CLASS(wxWebView);
};
class WXDLLIMPEXP_WEBVIEW wxWebViewEvent : public wxNotifyEvent
{
public:
wxWebViewEvent() {}
wxWebViewEvent(wxEventType type, int id, const wxString& url,
const wxString target,
wxWebViewNavigationActionFlags flags = wxWEBVIEW_NAV_ACTION_NONE)
: wxNotifyEvent(type, id), m_url(url), m_target(target),
m_actionFlags(flags)
{}
const wxString& GetURL() const { return m_url; }
const wxString& GetTarget() const { return m_target; }
wxWebViewNavigationActionFlags GetNavigationAction() const { return m_actionFlags; }
virtual wxEvent* Clone() const wxOVERRIDE { return new wxWebViewEvent(*this); }
private:
wxString m_url;
wxString m_target;
wxWebViewNavigationActionFlags m_actionFlags;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWebViewEvent);
};
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_NAVIGATING, wxWebViewEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_NAVIGATED, wxWebViewEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_LOADED, wxWebViewEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_ERROR, wxWebViewEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_NEWWINDOW, wxWebViewEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_TITLE_CHANGED, wxWebViewEvent );
typedef void (wxEvtHandler::*wxWebViewEventFunction)
(wxWebViewEvent&);
#define wxWebViewEventHandler(func) \
wxEVENT_HANDLER_CAST(wxWebViewEventFunction, func)
#define EVT_WEBVIEW_NAVIGATING(id, fn) \
wx__DECLARE_EVT1(wxEVT_WEBVIEW_NAVIGATING, id, \
wxWebViewEventHandler(fn))
#define EVT_WEBVIEW_NAVIGATED(id, fn) \
wx__DECLARE_EVT1(wxEVT_WEBVIEW_NAVIGATED, id, \
wxWebViewEventHandler(fn))
#define EVT_WEBVIEW_LOADED(id, fn) \
wx__DECLARE_EVT1(wxEVT_WEBVIEW_LOADED, id, \
wxWebViewEventHandler(fn))
#define EVT_WEBVIEW_ERROR(id, fn) \
wx__DECLARE_EVT1(wxEVT_WEBVIEW_ERROR, id, \
wxWebViewEventHandler(fn))
#define EVT_WEBVIEW_NEWWINDOW(id, fn) \
wx__DECLARE_EVT1(wxEVT_WEBVIEW_NEWWINDOW, id, \
wxWebViewEventHandler(fn))
#define EVT_WEBVIEW_TITLE_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_WEBVIEW_TITLE_CHANGED, id, \
wxWebViewEventHandler(fn))
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_WEBVIEW_NAVIGATING wxEVT_WEBVIEW_NAVIGATING
#define wxEVT_COMMAND_WEBVIEW_NAVIGATED wxEVT_WEBVIEW_NAVIGATED
#define wxEVT_COMMAND_WEBVIEW_LOADED wxEVT_WEBVIEW_LOADED
#define wxEVT_COMMAND_WEBVIEW_ERROR wxEVT_WEBVIEW_ERROR
#define wxEVT_COMMAND_WEBVIEW_NEWWINDOW wxEVT_WEBVIEW_NEWWINDOW
#define wxEVT_COMMAND_WEBVIEW_TITLE_CHANGED wxEVT_WEBVIEW_TITLE_CHANGED
#endif // wxUSE_WEBVIEW
#endif // _WX_WEBVIEW_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/list.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/list.h
// Purpose: wxList, wxStringList classes
// Author: Julian Smart
// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added
// Created: 29/01/98
// Copyright: (c) 1998 Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/*
All this is quite ugly but serves two purposes:
1. Be almost 100% compatible with old, untyped, wxList class
2. Ensure compile-time type checking for the linked lists
The idea is to have one base class (wxListBase) working with "void *" data,
but to hide these untyped functions - i.e. make them protected, so they
can only be used from derived classes which have inline member functions
working with right types. This achieves the 2nd goal. As for the first one,
we provide a special derivation of wxListBase called wxList which looks just
like the old class.
*/
#ifndef _WX_LIST_H_
#define _WX_LIST_H_
// -----------------------------------------------------------------------------
// headers
// -----------------------------------------------------------------------------
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/string.h"
#include "wx/vector.h"
#if wxUSE_STD_CONTAINERS
#include "wx/beforestd.h"
#include <algorithm>
#include <iterator>
#include <list>
#include "wx/afterstd.h"
#endif
// ----------------------------------------------------------------------------
// types
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_BASE wxObjectListNode;
typedef wxObjectListNode wxNode;
#if wxUSE_STD_CONTAINERS
#define wxLIST_COMPATIBILITY
#define WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl) \
WX_DECLARE_LIST_WITH_DECL(elT, liT, decl)
#define WX_DECLARE_LIST_PTR_3(elT, dummy1, liT, dummy2, decl) \
WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl)
#define WX_DECLARE_LIST_2(elT, liT, dummy, decl) \
WX_DECLARE_LIST_WITH_DECL(elT, liT, decl)
#define WX_DECLARE_LIST_PTR_2(elT, liT, dummy, decl) \
WX_DECLARE_LIST_2(elT, liT, dummy, decl) \
#define WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) \
WX_DECLARE_LIST_XO(elT*, liT, decl)
template<class T>
class wxList_SortFunction
{
public:
wxList_SortFunction(wxSortCompareFunction f) : m_f(f) { }
bool operator()(const T& i1, const T& i2)
{ return m_f((T*)&i1, (T*)&i2) < 0; }
private:
wxSortCompareFunction m_f;
};
/*
Note 1: the outer helper class _WX_LIST_HELPER_##liT below is a workaround
for mingw 3.2.3 compiler bug that prevents a static function of liT class
from being exported into dll. A minimal code snippet reproducing the bug:
struct WXDLLIMPEXP_CORE Foo
{
static void Bar();
struct SomeInnerClass
{
friend class Foo; // comment this out to make it link
};
~Foo()
{
Bar();
}
};
The program does not link under mingw_gcc 3.2.3 producing undefined
reference to Foo::Bar() function
Note 2: the EmptyList is needed to allow having a NULL pointer-like
invalid iterator. We used to use just an uninitialized iterator object
instead but this fails with some debug/checked versions of STL, notably the
glibc version activated with _GLIBCXX_DEBUG, so we need to have a separate
invalid iterator.
*/
// the real wxList-class declaration
#define WX_DECLARE_LIST_XO(elT, liT, decl) \
decl _WX_LIST_HELPER_##liT \
{ \
typedef elT _WX_LIST_ITEM_TYPE_##liT; \
typedef std::list<elT> BaseListType; \
public: \
static BaseListType EmptyList; \
static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \
}; \
\
class liT : public std::list<elT> \
{ \
private: \
typedef std::list<elT> BaseListType; \
\
bool m_destroy; \
\
public: \
class compatibility_iterator \
{ \
private: \
friend class liT; \
\
iterator m_iter; \
liT * m_list; \
\
public: \
compatibility_iterator() \
: m_iter(_WX_LIST_HELPER_##liT::EmptyList.end()), m_list( NULL ) {} \
compatibility_iterator( liT* li, iterator i ) \
: m_iter( i ), m_list( li ) {} \
compatibility_iterator( const liT* li, iterator i ) \
: m_iter( i ), m_list( const_cast< liT* >( li ) ) {} \
\
compatibility_iterator* operator->() { return this; } \
const compatibility_iterator* operator->() const { return this; } \
\
bool operator==(const compatibility_iterator& i) const \
{ \
wxASSERT_MSG( m_list && i.m_list, \
wxT("comparing invalid iterators is illegal") ); \
return (m_list == i.m_list) && (m_iter == i.m_iter); \
} \
bool operator!=(const compatibility_iterator& i) const \
{ return !( operator==( i ) ); } \
operator bool() const \
{ return m_list ? m_iter != m_list->end() : false; } \
bool operator !() const \
{ return !( operator bool() ); } \
\
elT GetData() const \
{ return *m_iter; } \
void SetData( elT e ) \
{ *m_iter = e; } \
\
compatibility_iterator GetNext() const \
{ \
iterator i = m_iter; \
return compatibility_iterator( m_list, ++i ); \
} \
compatibility_iterator GetPrevious() const \
{ \
if ( m_iter == m_list->begin() ) \
return compatibility_iterator(); \
\
iterator i = m_iter; \
return compatibility_iterator( m_list, --i ); \
} \
int IndexOf() const \
{ \
return *this ? (int)std::distance( m_list->begin(), m_iter ) \
: wxNOT_FOUND; \
} \
}; \
public: \
liT() : m_destroy( false ) {} \
\
compatibility_iterator Find( const elT e ) const \
{ \
liT* _this = const_cast< liT* >( this ); \
return compatibility_iterator( _this, \
std::find( _this->begin(), _this->end(), e ) ); \
} \
\
bool IsEmpty() const \
{ return empty(); } \
size_t GetCount() const \
{ return size(); } \
int Number() const \
{ return static_cast< int >( GetCount() ); } \
\
compatibility_iterator Item( size_t idx ) const \
{ \
iterator i = const_cast< liT* >(this)->begin(); \
std::advance( i, idx ); \
return compatibility_iterator( this, i ); \
} \
elT operator[](size_t idx) const \
{ \
return Item(idx).GetData(); \
} \
\
compatibility_iterator GetFirst() const \
{ \
return compatibility_iterator( this, \
const_cast< liT* >(this)->begin() ); \
} \
compatibility_iterator GetLast() const \
{ \
iterator i = const_cast< liT* >(this)->end(); \
return compatibility_iterator( this, !empty() ? --i : i ); \
} \
bool Member( elT e ) const \
{ return Find( e ); } \
compatibility_iterator Nth( int n ) const \
{ return Item( n ); } \
int IndexOf( elT e ) const \
{ return Find( e ).IndexOf(); } \
\
compatibility_iterator Append( elT e ) \
{ \
push_back( e ); \
return GetLast(); \
} \
compatibility_iterator Insert( elT e ) \
{ \
push_front( e ); \
return compatibility_iterator( this, begin() ); \
} \
compatibility_iterator Insert(const compatibility_iterator & i, elT e)\
{ \
return compatibility_iterator( this, insert( i.m_iter, e ) ); \
} \
compatibility_iterator Insert( size_t idx, elT e ) \
{ \
return compatibility_iterator( this, \
insert( Item( idx ).m_iter, e ) ); \
} \
\
void DeleteContents( bool destroy ) \
{ m_destroy = destroy; } \
bool GetDeleteContents() const \
{ return m_destroy; } \
void Erase( const compatibility_iterator& i ) \
{ \
if ( m_destroy ) \
_WX_LIST_HELPER_##liT::DeleteFunction( i->GetData() ); \
erase( i.m_iter ); \
} \
bool DeleteNode( const compatibility_iterator& i ) \
{ \
if( i ) \
{ \
Erase( i ); \
return true; \
} \
return false; \
} \
bool DeleteObject( elT e ) \
{ \
return DeleteNode( Find( e ) ); \
} \
void Clear() \
{ \
if ( m_destroy ) \
std::for_each( begin(), end(), \
_WX_LIST_HELPER_##liT::DeleteFunction ); \
clear(); \
} \
/* Workaround for broken VC6 std::list::sort() see above */ \
void Sort( wxSortCompareFunction compfunc ) \
{ sort( wxList_SortFunction<elT>(compfunc ) ); } \
~liT() { Clear(); } \
\
/* It needs access to our EmptyList */ \
friend class compatibility_iterator; \
}
#define WX_DECLARE_LIST(elementtype, listname) \
WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class)
#define WX_DECLARE_LIST_PTR(elementtype, listname) \
WX_DECLARE_LIST(elementtype, listname)
#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \
WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLIMPEXP_CORE)
#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \
WX_DECLARE_EXPORTED_LIST(elementtype, listname)
#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \
WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class usergoo)
#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \
WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo)
// this macro must be inserted in your program after
// #include "wx/listimpl.cpp"
#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!"
#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name)
#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name)
#else // if !wxUSE_STD_CONTAINERS
// undef it to get rid of old, deprecated functions
#define wxLIST_COMPATIBILITY
// -----------------------------------------------------------------------------
// key stuff: a list may be optionally keyed on integer or string key
// -----------------------------------------------------------------------------
union wxListKeyValue
{
long integer;
wxString *string;
};
// a struct which may contain both types of keys
//
// implementation note: on one hand, this class allows to have only one function
// for any keyed operation instead of 2 almost equivalent. OTOH, it's needed to
// resolve ambiguity which we would otherwise have with wxStringList::Find() and
// wxList::Find(const char *).
class WXDLLIMPEXP_BASE wxListKey
{
public:
// implicit ctors
wxListKey() : m_keyType(wxKEY_NONE)
{ }
wxListKey(long i) : m_keyType(wxKEY_INTEGER)
{ m_key.integer = i; }
wxListKey(const wxString& s) : m_keyType(wxKEY_STRING)
{ m_key.string = new wxString(s); }
wxListKey(const char *s) : m_keyType(wxKEY_STRING)
{ m_key.string = new wxString(s); }
wxListKey(const wchar_t *s) : m_keyType(wxKEY_STRING)
{ m_key.string = new wxString(s); }
// accessors
wxKeyType GetKeyType() const { return m_keyType; }
const wxString GetString() const
{ wxASSERT( m_keyType == wxKEY_STRING ); return *m_key.string; }
long GetNumber() const
{ wxASSERT( m_keyType == wxKEY_INTEGER ); return m_key.integer; }
// comparison
// Note: implementation moved to list.cpp to prevent BC++ inline
// expansion warning.
bool operator==(wxListKeyValue value) const ;
// dtor
~wxListKey()
{
if ( m_keyType == wxKEY_STRING )
delete m_key.string;
}
private:
wxKeyType m_keyType;
wxListKeyValue m_key;
};
// -----------------------------------------------------------------------------
// wxNodeBase class is a (base for) node in a double linked list
// -----------------------------------------------------------------------------
extern WXDLLIMPEXP_DATA_BASE(wxListKey) wxDefaultListKey;
class WXDLLIMPEXP_FWD_BASE wxListBase;
class WXDLLIMPEXP_BASE wxNodeBase
{
friend class wxListBase;
public:
// ctor
wxNodeBase(wxListBase *list = NULL,
wxNodeBase *previous = NULL,
wxNodeBase *next = NULL,
void *data = NULL,
const wxListKey& key = wxDefaultListKey);
virtual ~wxNodeBase();
// FIXME no check is done that the list is really keyed on strings
wxString GetKeyString() const { return *m_key.string; }
long GetKeyInteger() const { return m_key.integer; }
// Necessary for some existing code
void SetKeyString(const wxString& s) { m_key.string = new wxString(s); }
void SetKeyInteger(long i) { m_key.integer = i; }
#ifdef wxLIST_COMPATIBILITY
// compatibility methods, use Get* instead.
wxDEPRECATED( wxNode *Next() const );
wxDEPRECATED( wxNode *Previous() const );
wxDEPRECATED( wxObject *Data() const );
#endif // wxLIST_COMPATIBILITY
protected:
// all these are going to be "overloaded" in the derived classes
wxNodeBase *GetNext() const { return m_next; }
wxNodeBase *GetPrevious() const { return m_previous; }
void *GetData() const { return m_data; }
void SetData(void *data) { m_data = data; }
// get 0-based index of this node within the list or wxNOT_FOUND
int IndexOf() const;
virtual void DeleteData() { }
public:
// for wxList::iterator
void** GetDataPtr() const { return &(const_cast<wxNodeBase*>(this)->m_data); }
private:
// optional key stuff
wxListKeyValue m_key;
void *m_data; // user data
wxNodeBase *m_next, // next and previous nodes in the list
*m_previous;
wxListBase *m_list; // list we belong to
wxDECLARE_NO_COPY_CLASS(wxNodeBase);
};
// -----------------------------------------------------------------------------
// a double-linked list class
// -----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_BASE wxList;
class WXDLLIMPEXP_BASE wxListBase
{
friend class wxNodeBase; // should be able to call DetachNode()
friend class wxHashTableBase; // should be able to call untyped Find()
public:
// default ctor & dtor
wxListBase(wxKeyType keyType = wxKEY_NONE)
{ Init(keyType); }
virtual ~wxListBase();
// accessors
// count of items in the list
size_t GetCount() const { return m_count; }
// return true if this list is empty
bool IsEmpty() const { return m_count == 0; }
// operations
// delete all nodes
void Clear();
// instruct it to destroy user data when deleting nodes
void DeleteContents(bool destroy) { m_destroy = destroy; }
// query if to delete
bool GetDeleteContents() const
{ return m_destroy; }
// get the keytype
wxKeyType GetKeyType() const
{ return m_keyType; }
// set the keytype (required by the serial code)
void SetKeyType(wxKeyType keyType)
{ wxASSERT( m_count==0 ); m_keyType = keyType; }
#ifdef wxLIST_COMPATIBILITY
// compatibility methods from old wxList
wxDEPRECATED( int Number() const ); // use GetCount instead.
wxDEPRECATED( wxNode *First() const ); // use GetFirst
wxDEPRECATED( wxNode *Last() const ); // use GetLast
wxDEPRECATED( wxNode *Nth(size_t n) const ); // use Item
// kludge for typesafe list migration in core classes.
wxDEPRECATED( operator wxList&() const );
#endif // wxLIST_COMPATIBILITY
protected:
// all methods here are "overloaded" in derived classes to provide compile
// time type checking
// create a node for the list of this type
virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next,
void *data,
const wxListKey& key = wxDefaultListKey) = 0;
// ctors
// from an array
wxListBase(size_t count, void *elements[]);
// from a sequence of objects
wxListBase(void *object, ... /* terminate with NULL */);
protected:
void Assign(const wxListBase& list)
{ Clear(); DoCopy(list); }
// get list head/tail
wxNodeBase *GetFirst() const { return m_nodeFirst; }
wxNodeBase *GetLast() const { return m_nodeLast; }
// by (0-based) index
wxNodeBase *Item(size_t index) const;
// get the list item's data
void *operator[](size_t n) const
{
wxNodeBase *node = Item(n);
return node ? node->GetData() : NULL;
}
// operations
// append to end of list
wxNodeBase *Prepend(void *object)
{ return (wxNodeBase *)wxListBase::Insert(object); }
// append to beginning of list
wxNodeBase *Append(void *object);
// insert a new item at the beginning of the list
wxNodeBase *Insert(void *object)
{ return Insert(static_cast<wxNodeBase *>(NULL), object); }
// insert a new item at the given position
wxNodeBase *Insert(size_t pos, void *object)
{ return pos == GetCount() ? Append(object)
: Insert(Item(pos), object); }
// insert before given node or at front of list if prev == NULL
wxNodeBase *Insert(wxNodeBase *prev, void *object);
// keyed append
wxNodeBase *Append(long key, void *object);
wxNodeBase *Append(const wxString& key, void *object);
// removes node from the list but doesn't delete it (returns pointer
// to the node or NULL if it wasn't found in the list)
wxNodeBase *DetachNode(wxNodeBase *node);
// delete element from list, returns false if node not found
bool DeleteNode(wxNodeBase *node);
// finds object pointer and deletes node (and object if DeleteContents
// is on), returns false if object not found
bool DeleteObject(void *object);
// search (all return NULL if item not found)
// by data
wxNodeBase *Find(const void *object) const;
// by key
wxNodeBase *Find(const wxListKey& key) const;
// get 0-based index of object or wxNOT_FOUND
int IndexOf( void *object ) const;
// this function allows the sorting of arbitrary lists by giving
// a function to compare two list elements. The list is sorted in place.
void Sort(const wxSortCompareFunction compfunc);
// functions for iterating over the list
void *FirstThat(wxListIterateFunction func);
void ForEach(wxListIterateFunction func);
void *LastThat(wxListIterateFunction func);
// for STL interface, "last" points to one after the last node
// of the controlled sequence (NULL for the end of the list)
void Reverse();
void DeleteNodes(wxNodeBase* first, wxNodeBase* last);
private:
// common part of all ctors
void Init(wxKeyType keyType = wxKEY_NONE);
// helpers
// common part of copy ctor and assignment operator
void DoCopy(const wxListBase& list);
// common part of all Append()s
wxNodeBase *AppendCommon(wxNodeBase *node);
// free node's data and node itself
void DoDeleteNode(wxNodeBase *node);
size_t m_count; // number of elements in the list
bool m_destroy; // destroy user data when deleting list items?
wxNodeBase *m_nodeFirst, // pointers to the head and tail of the list
*m_nodeLast;
wxKeyType m_keyType; // type of our keys (may be wxKEY_NONE)
};
// -----------------------------------------------------------------------------
// macros for definition of "template" list type
// -----------------------------------------------------------------------------
// Helper macro defining common iterator typedefs
#if wxUSE_STD_CONTAINERS_COMPATIBLY
#include <iterator>
#define WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \
typedef std::ptrdiff_t difference_type; \
typedef std::bidirectional_iterator_tag iterator_category;
#else
#define WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY()
#endif
// and now some heavy magic...
// declare a list type named 'name' and containing elements of type 'T *'
// (as a by product of macro expansion you also get wx##name##Node
// wxNode-derived type)
//
// implementation details:
// 1. We define _WX_LIST_ITEM_TYPE_##name typedef to save in it the item type
// for the list of given type - this allows us to pass only the list name
// to WX_DEFINE_LIST() even if it needs both the name and the type
//
// 2. We redefine all non-type-safe wxList functions with type-safe versions
// which don't take any space (everything is inline), but bring compile
// time error checking.
//
// 3. The macro which is usually used (WX_DECLARE_LIST) is defined in terms of
// a more generic WX_DECLARE_LIST_2 macro which, in turn, uses the most
// generic WX_DECLARE_LIST_3 one. The last macro adds a sometimes
// interesting capability to store polymorphic objects in the list and is
// particularly useful with, for example, "wxWindow *" list where the
// wxWindowBase pointers are put into the list, but wxWindow pointers are
// retrieved from it.
//
// 4. final hack is that WX_DECLARE_LIST_3 is defined in terms of
// WX_DECLARE_LIST_4 to allow defining classes without operator->() as
// it results in compiler warnings when this operator doesn't make sense
// (i.e. stored elements are not pointers)
// common part of WX_DECLARE_LIST_3 and WX_DECLARE_LIST_PTR_3
#define WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, ptrop) \
typedef int (*wxSortFuncFor_##name)(const T **, const T **); \
\
classexp nodetype : public wxNodeBase \
{ \
public: \
nodetype(wxListBase *list = NULL, \
nodetype *previous = NULL, \
nodetype *next = NULL, \
T *data = NULL, \
const wxListKey& key = wxDefaultListKey) \
: wxNodeBase(list, previous, next, data, key) { } \
\
nodetype *GetNext() const \
{ return (nodetype *)wxNodeBase::GetNext(); } \
nodetype *GetPrevious() const \
{ return (nodetype *)wxNodeBase::GetPrevious(); } \
\
T *GetData() const \
{ return (T *)wxNodeBase::GetData(); } \
void SetData(T *data) \
{ wxNodeBase::SetData(data); } \
\
protected: \
virtual void DeleteData() wxOVERRIDE; \
\
wxDECLARE_NO_COPY_CLASS(nodetype); \
}; \
\
classexp name : public wxListBase \
{ \
public: \
typedef nodetype Node; \
classexp compatibility_iterator \
{ \
public: \
compatibility_iterator(Node *ptr = NULL) : m_ptr(ptr) { } \
\
Node *operator->() const { return m_ptr; } \
operator Node *() const { return m_ptr; } \
\
private: \
Node *m_ptr; \
}; \
\
name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType) \
{ } \
name(const name& list) : wxListBase(list.GetKeyType()) \
{ Assign(list); } \
name(size_t count, T *elements[]) \
: wxListBase(count, (void **)elements) { } \
\
name& operator=(const name& list) \
{ if (&list != this) Assign(list); return *this; } \
\
nodetype *GetFirst() const \
{ return (nodetype *)wxListBase::GetFirst(); } \
nodetype *GetLast() const \
{ return (nodetype *)wxListBase::GetLast(); } \
\
nodetype *Item(size_t index) const \
{ return (nodetype *)wxListBase::Item(index); } \
\
T *operator[](size_t index) const \
{ \
nodetype *node = Item(index); \
return node ? (T*)(node->GetData()) : NULL; \
} \
\
nodetype *Append(Tbase *object) \
{ return (nodetype *)wxListBase::Append(object); } \
nodetype *Insert(Tbase *object) \
{ return (nodetype *)Insert(static_cast<nodetype *>(NULL), \
object); } \
nodetype *Insert(size_t pos, Tbase *object) \
{ return (nodetype *)wxListBase::Insert(pos, object); } \
nodetype *Insert(nodetype *prev, Tbase *object) \
{ return (nodetype *)wxListBase::Insert(prev, object); } \
\
nodetype *Append(long key, void *object) \
{ return (nodetype *)wxListBase::Append(key, object); } \
nodetype *Append(const wxChar *key, void *object) \
{ return (nodetype *)wxListBase::Append(key, object); } \
\
nodetype *DetachNode(nodetype *node) \
{ return (nodetype *)wxListBase::DetachNode(node); } \
bool DeleteNode(nodetype *node) \
{ return wxListBase::DeleteNode(node); } \
bool DeleteObject(Tbase *object) \
{ return wxListBase::DeleteObject(object); } \
void Erase(nodetype *it) \
{ DeleteNode(it); } \
\
nodetype *Find(const Tbase *object) const \
{ return (nodetype *)wxListBase::Find(object); } \
\
virtual nodetype *Find(const wxListKey& key) const \
{ return (nodetype *)wxListBase::Find(key); } \
\
bool Member(const Tbase *object) const \
{ return Find(object) != NULL; } \
\
int IndexOf(Tbase *object) const \
{ return wxListBase::IndexOf(object); } \
\
void Sort(wxSortCompareFunction func) \
{ wxListBase::Sort(func); } \
void Sort(wxSortFuncFor_##name func) \
{ Sort((wxSortCompareFunction)func); } \
\
protected: \
virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, \
void *data, \
const wxListKey& key = wxDefaultListKey) \
wxOVERRIDE \
{ \
return new nodetype(this, \
(nodetype *)prev, (nodetype *)next, \
(T *)data, key); \
} \
/* STL interface */ \
public: \
typedef size_t size_type; \
typedef int difference_type; \
typedef T* value_type; \
typedef Tbase* base_value_type; \
typedef value_type& reference; \
typedef const value_type& const_reference; \
typedef base_value_type& base_reference; \
typedef const base_value_type& const_base_reference; \
\
classexp iterator \
{ \
public: \
WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \
typedef T* value_type; \
typedef value_type* pointer; \
typedef value_type& reference; \
\
typedef nodetype Node; \
typedef iterator itor; \
\
Node* m_node; \
Node* m_init; \
public: \
/* Compatibility typedefs, don't use */ \
typedef reference reference_type; \
typedef pointer pointer_type; \
\
iterator(Node* node, Node* init) : m_node(node), m_init(init) {}\
iterator() : m_node(NULL), m_init(NULL) { } \
reference_type operator*() const \
{ return *(pointer_type)m_node->GetDataPtr(); } \
ptrop \
itor& operator++() \
{ \
wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \
m_node = m_node->GetNext(); \
return *this; \
} \
const itor operator++(int) \
{ \
itor tmp = *this; \
wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \
m_node = m_node->GetNext(); \
return tmp; \
} \
itor& operator--() \
{ \
m_node = m_node ? m_node->GetPrevious() : m_init; \
return *this; \
} \
const itor operator--(int) \
{ \
itor tmp = *this; \
m_node = m_node ? m_node->GetPrevious() : m_init; \
return tmp; \
} \
bool operator!=(const itor& it) const \
{ return it.m_node != m_node; } \
bool operator==(const itor& it) const \
{ return it.m_node == m_node; } \
}; \
classexp const_iterator \
{ \
public: \
WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \
typedef T* value_type; \
typedef const value_type* pointer; \
typedef const value_type& reference; \
\
typedef nodetype Node; \
typedef const_iterator itor; \
\
Node* m_node; \
Node* m_init; \
public: \
typedef reference reference_type; \
typedef pointer pointer_type; \
\
const_iterator(Node* node, Node* init) \
: m_node(node), m_init(init) { } \
const_iterator() : m_node(NULL), m_init(NULL) { } \
const_iterator(const iterator& it) \
: m_node(it.m_node), m_init(it.m_init) { } \
reference_type operator*() const \
{ return *(pointer_type)m_node->GetDataPtr(); } \
ptrop \
itor& operator++() \
{ \
wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \
m_node = m_node->GetNext(); \
return *this; \
} \
const itor operator++(int) \
{ \
itor tmp = *this; \
wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \
m_node = m_node->GetNext(); \
return tmp; \
} \
itor& operator--() \
{ \
m_node = m_node ? m_node->GetPrevious() : m_init; \
return *this; \
} \
const itor operator--(int) \
{ \
itor tmp = *this; \
m_node = m_node ? m_node->GetPrevious() : m_init; \
return tmp; \
} \
bool operator!=(const itor& it) const \
{ return it.m_node != m_node; } \
bool operator==(const itor& it) const \
{ return it.m_node == m_node; } \
}; \
classexp reverse_iterator \
{ \
public: \
WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \
typedef T* value_type; \
typedef value_type* pointer; \
typedef value_type& reference; \
\
typedef nodetype Node; \
typedef reverse_iterator itor; \
\
Node* m_node; \
Node* m_init; \
public: \
typedef reference reference_type; \
typedef pointer pointer_type; \
\
reverse_iterator(Node* node, Node* init) \
: m_node(node), m_init(init) { } \
reverse_iterator() : m_node(NULL), m_init(NULL) { } \
reference_type operator*() const \
{ return *(pointer_type)m_node->GetDataPtr(); } \
ptrop \
itor& operator++() \
{ m_node = m_node->GetPrevious(); return *this; } \
const itor operator++(int) \
{ itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\
itor& operator--() \
{ m_node = m_node ? m_node->GetNext() : m_init; return *this; } \
const itor operator--(int) \
{ \
itor tmp = *this; \
m_node = m_node ? m_node->GetNext() : m_init; \
return tmp; \
} \
bool operator!=(const itor& it) const \
{ return it.m_node != m_node; } \
bool operator==(const itor& it) const \
{ return it.m_node == m_node; } \
}; \
classexp const_reverse_iterator \
{ \
public: \
WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \
typedef T* value_type; \
typedef const value_type* pointer; \
typedef const value_type& reference; \
\
typedef nodetype Node; \
typedef const_reverse_iterator itor; \
\
Node* m_node; \
Node* m_init; \
public: \
typedef reference reference_type; \
typedef pointer pointer_type; \
\
const_reverse_iterator(Node* node, Node* init) \
: m_node(node), m_init(init) { } \
const_reverse_iterator() : m_node(NULL), m_init(NULL) { } \
const_reverse_iterator(const reverse_iterator& it) \
: m_node(it.m_node), m_init(it.m_init) { } \
reference_type operator*() const \
{ return *(pointer_type)m_node->GetDataPtr(); } \
ptrop \
itor& operator++() \
{ m_node = m_node->GetPrevious(); return *this; } \
const itor operator++(int) \
{ itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\
itor& operator--() \
{ m_node = m_node ? m_node->GetNext() : m_init; return *this;}\
const itor operator--(int) \
{ \
itor tmp = *this; \
m_node = m_node ? m_node->GetNext() : m_init; \
return tmp; \
} \
bool operator!=(const itor& it) const \
{ return it.m_node != m_node; } \
bool operator==(const itor& it) const \
{ return it.m_node == m_node; } \
}; \
\
explicit name(size_type n, const_reference v = value_type()) \
{ assign(n, v); } \
name(const const_iterator& first, const const_iterator& last) \
{ assign(first, last); } \
iterator begin() { return iterator(GetFirst(), GetLast()); } \
const_iterator begin() const \
{ return const_iterator(GetFirst(), GetLast()); } \
iterator end() { return iterator(NULL, GetLast()); } \
const_iterator end() const { return const_iterator(NULL, GetLast()); }\
reverse_iterator rbegin() \
{ return reverse_iterator(GetLast(), GetFirst()); } \
const_reverse_iterator rbegin() const \
{ return const_reverse_iterator(GetLast(), GetFirst()); } \
reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); }\
const_reverse_iterator rend() const \
{ return const_reverse_iterator(NULL, GetFirst()); } \
void resize(size_type n, value_type v = value_type()) \
{ \
while (n < size()) \
pop_back(); \
while (n > size()) \
push_back(v); \
} \
size_type size() const { return GetCount(); } \
size_type max_size() const { return INT_MAX; } \
bool empty() const { return IsEmpty(); } \
reference front() { return *begin(); } \
const_reference front() const { return *begin(); } \
reference back() { iterator tmp = end(); return *--tmp; } \
const_reference back() const { const_iterator tmp = end(); return *--tmp; }\
void push_front(const_reference v = value_type()) \
{ Insert(GetFirst(), (const_base_reference)v); } \
void pop_front() { DeleteNode(GetFirst()); } \
void push_back(const_reference v = value_type()) \
{ Append((const_base_reference)v); } \
void pop_back() { DeleteNode(GetLast()); } \
void assign(const_iterator first, const const_iterator& last) \
{ \
clear(); \
for(; first != last; ++first) \
Append((const_base_reference)*first); \
} \
void assign(size_type n, const_reference v = value_type()) \
{ \
clear(); \
for(size_type i = 0; i < n; ++i) \
Append((const_base_reference)v); \
} \
iterator insert(const iterator& it, const_reference v) \
{ \
if ( it == end() ) \
{ \
Append((const_base_reference)v); \
/* \
note that this is the new end(), the old one was \
invalidated by the Append() call, and this is why we \
can't use the same code as in the normal case below \
*/ \
iterator itins(end()); \
return --itins; \
} \
else \
{ \
Insert(it.m_node, (const_base_reference)v); \
iterator itins(it); \
return --itins; \
} \
} \
void insert(const iterator& it, size_type n, const_reference v) \
{ \
for(size_type i = 0; i < n; ++i) \
insert(it, v); \
} \
void insert(const iterator& it, \
const_iterator first, const const_iterator& last) \
{ \
for(; first != last; ++first) \
insert(it, *first); \
} \
iterator erase(const iterator& it) \
{ \
iterator next = iterator(it.m_node->GetNext(), GetLast()); \
DeleteNode(it.m_node); return next; \
} \
iterator erase(const iterator& first, const iterator& last) \
{ \
iterator next = last; \
if ( next != end() ) \
++next; \
DeleteNodes(first.m_node, last.m_node); \
return next; \
} \
void clear() { Clear(); } \
void splice(const iterator& it, name& l, const iterator& first, const iterator& last)\
{ insert(it, first, last); l.erase(first, last); } \
void splice(const iterator& it, name& l) \
{ splice(it, l, l.begin(), l.end() ); } \
void splice(const iterator& it, name& l, const iterator& first) \
{ \
if ( it != first ) \
{ \
insert(it, *first); \
l.erase(first); \
} \
} \
void remove(const_reference v) \
{ DeleteObject((const_base_reference)v); } \
void reverse() \
{ Reverse(); } \
/* void swap(name& l) \
{ \
{ size_t t = m_count; m_count = l.m_count; l.m_count = t; } \
{ bool t = m_destroy; m_destroy = l.m_destroy; l.m_destroy = t; }\
{ wxNodeBase* t = m_nodeFirst; m_nodeFirst = l.m_nodeFirst; l.m_nodeFirst = t; }\
{ wxNodeBase* t = m_nodeLast; m_nodeLast = l.m_nodeLast; l.m_nodeLast = t; }\
{ wxKeyType t = m_keyType; m_keyType = l.m_keyType; l.m_keyType = t; }\
} */ \
}
#define WX_LIST_PTROP \
pointer_type operator->() const \
{ return (pointer_type)m_node->GetDataPtr(); }
#define WX_LIST_PTROP_NONE
#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype, classexp) \
WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP_NONE)
#define WX_DECLARE_LIST_PTR_3(T, Tbase, name, nodetype, classexp) \
WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP)
#define WX_DECLARE_LIST_2(elementtype, listname, nodename, classexp) \
WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename, classexp)
#define WX_DECLARE_LIST_PTR_2(elementtype, listname, nodename, classexp) \
WX_DECLARE_LIST_PTR_3(elementtype, elementtype, listname, nodename, classexp)
#define WX_DECLARE_LIST(elementtype, listname) \
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class)
#define WX_DECLARE_LIST_PTR(elementtype, listname) \
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class)
#define WX_DECLARE_LIST_WITH_DECL(elementtype, listname, decl) \
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, decl)
#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \
WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLIMPEXP_CORE)
#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class WXDLLIMPEXP_CORE)
#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class usergoo)
#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class usergoo)
// this macro must be inserted in your program after
// #include "wx/listimpl.cpp"
#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!"
#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name)
#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name)
#endif // !wxUSE_STD_CONTAINERS
// ============================================================================
// now we can define classes 100% compatible with the old ones
// ============================================================================
// ----------------------------------------------------------------------------
// commonly used list classes
// ----------------------------------------------------------------------------
#if defined(wxLIST_COMPATIBILITY)
// inline compatibility functions
#if !wxUSE_STD_CONTAINERS
// ----------------------------------------------------------------------------
// wxNodeBase deprecated methods
// ----------------------------------------------------------------------------
inline wxNode *wxNodeBase::Next() const { return (wxNode *)GetNext(); }
inline wxNode *wxNodeBase::Previous() const { return (wxNode *)GetPrevious(); }
inline wxObject *wxNodeBase::Data() const { return (wxObject *)GetData(); }
// ----------------------------------------------------------------------------
// wxListBase deprecated methods
// ----------------------------------------------------------------------------
inline int wxListBase::Number() const { return (int)GetCount(); }
inline wxNode *wxListBase::First() const { return (wxNode *)GetFirst(); }
inline wxNode *wxListBase::Last() const { return (wxNode *)GetLast(); }
inline wxNode *wxListBase::Nth(size_t n) const { return (wxNode *)Item(n); }
inline wxListBase::operator wxList&() const { return *(wxList*)this; }
#endif
// define this to make a lot of noise about use of the old wxList classes.
//#define wxWARN_COMPAT_LIST_USE
// ----------------------------------------------------------------------------
// wxList compatibility class: in fact, it's a list of wxObjects
// ----------------------------------------------------------------------------
WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode,
class WXDLLIMPEXP_BASE);
class WXDLLIMPEXP_BASE wxList : public wxObjectList
{
public:
#if defined(wxWARN_COMPAT_LIST_USE) && !wxUSE_STD_CONTAINERS
wxList() { }
wxDEPRECATED( wxList(int key_type) );
#elif !wxUSE_STD_CONTAINERS
wxList(int key_type = wxKEY_NONE);
#endif
// this destructor is required for Darwin
~wxList() { }
#if !wxUSE_STD_CONTAINERS
wxList& operator=(const wxList& list)
{ if (&list != this) Assign(list); return *this; }
// compatibility methods
void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); }
#endif // !wxUSE_STD_CONTAINERS
template<typename T>
wxVector<T> AsVector() const
{
wxVector<T> vector(size());
size_t i = 0;
for ( const_iterator it = begin(); it != end(); ++it )
{
vector[i++] = static_cast<T>(*it);
}
return vector;
}
};
#if !wxUSE_STD_CONTAINERS
// -----------------------------------------------------------------------------
// wxStringList class for compatibility with the old code
// -----------------------------------------------------------------------------
WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode, class WXDLLIMPEXP_BASE);
class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase
{
public:
// ctors and such
// default
#ifdef wxWARN_COMPAT_LIST_USE
wxStringList();
wxDEPRECATED( wxStringList(const wxChar *first ...) ); // FIXME-UTF8
#else
wxStringList();
wxStringList(const wxChar *first ...); // FIXME-UTF8
#endif
// copying the string list: the strings are copied, too (extremely
// inefficient!)
wxStringList(const wxStringList& other) : wxStringListBase() { DeleteContents(true); DoCopy(other); }
wxStringList& operator=(const wxStringList& other)
{
if (&other != this)
{
Clear();
DoCopy(other);
}
return *this;
}
// operations
// makes a copy of the string
wxNode *Add(const wxChar *s);
// Append to beginning of list
wxNode *Prepend(const wxChar *s);
bool Delete(const wxChar *s);
wxChar **ListToArray(bool new_copies = false) const;
bool Member(const wxChar *s) const;
// alphabetic sort
void Sort();
private:
void DoCopy(const wxStringList&); // common part of copy ctor and operator=
};
#else // if wxUSE_STD_CONTAINERS
WX_DECLARE_LIST_XO(wxString, wxStringListBase, class WXDLLIMPEXP_BASE);
class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase
{
public:
compatibility_iterator Append(wxChar* s)
{ wxString tmp = s; delete[] s; return wxStringListBase::Append(tmp); }
compatibility_iterator Insert(wxChar* s)
{ wxString tmp = s; delete[] s; return wxStringListBase::Insert(tmp); }
compatibility_iterator Insert(size_t pos, wxChar* s)
{
wxString tmp = s;
delete[] s;
return wxStringListBase::Insert(pos, tmp);
}
compatibility_iterator Add(const wxChar* s)
{ push_back(s); return GetLast(); }
compatibility_iterator Prepend(const wxChar* s)
{ push_front(s); return GetFirst(); }
};
#endif // wxUSE_STD_CONTAINERS
#endif // wxLIST_COMPATIBILITY
// delete all list elements
//
// NB: the class declaration of the list 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_LIST(type, list) \
{ \
type::iterator it, en; \
for( it = (list).begin(), en = (list).end(); it != en; ++it ) \
delete *it; \
(list).clear(); \
}
// append all element of one list to another one
#define WX_APPEND_LIST(list, other) \
{ \
wxList::compatibility_iterator node = other->GetFirst(); \
while ( node ) \
{ \
(list)->push_back(node->GetData()); \
node = node->GetNext(); \
} \
}
#endif // _WX_LISTH__
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/richtooltip.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/richtooltip.h
// Purpose: Declaration of wxRichToolTip class.
// Author: Vadim Zeitlin
// Created: 2011-10-07
// Copyright: (c) 2011 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHTOOLTIP_H_
#define _WX_RICHTOOLTIP_H_
#include "wx/defs.h"
#if wxUSE_RICHTOOLTIP
#include "wx/colour.h"
class WXDLLIMPEXP_FWD_CORE wxFont;
class WXDLLIMPEXP_FWD_CORE wxIcon;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class wxRichToolTipImpl;
// This enum describes the kind of the tip shown which combines both the tip
// position and appearance because the two are related (when the tip is
// positioned asymmetrically, a right handed triangle is used but an
// equilateral one when it's in the middle of a side).
//
// Automatic selects the tip appearance best suited for the current platform
// and the position best suited for the window the tooltip is shown for, i.e.
// chosen in such a way that the tooltip is always fully on screen.
//
// Other values describe the position of the tooltip itself, not the window it
// relates to. E.g. wxTipKind_Top places the tip on the top of the tooltip and
// so the tooltip itself is located beneath its associated window.
enum wxTipKind
{
wxTipKind_None,
wxTipKind_TopLeft,
wxTipKind_Top,
wxTipKind_TopRight,
wxTipKind_BottomLeft,
wxTipKind_Bottom,
wxTipKind_BottomRight,
wxTipKind_Auto
};
// ----------------------------------------------------------------------------
// wxRichToolTip: a customizable but not necessarily native tooltip.
// ----------------------------------------------------------------------------
// Notice that this class does not inherit from wxWindow.
class WXDLLIMPEXP_ADV wxRichToolTip
{
public:
// Ctor must specify the tooltip title and main message, additional
// attributes can be set later.
wxRichToolTip(const wxString& title, const wxString& message);
// Set the background colour: if two colours are specified, the background
// is drawn using a gradient from top to bottom, otherwise a single solid
// colour is used.
void SetBackgroundColour(const wxColour& col,
const wxColour& colEnd = wxColour());
// Set the small icon to show: either one of the standard information/
// warning/error ones (the question icon doesn't make sense for a tooltip)
// or a custom icon.
void SetIcon(int icon = wxICON_INFORMATION);
void SetIcon(const wxIcon& icon);
// Set timeout after which the tooltip should disappear, in milliseconds.
// By default the tooltip is hidden after system-dependent interval of time
// elapses but this method can be used to change this or also disable
// hiding the tooltip automatically entirely by passing 0 in this parameter
// (but doing this can result in native version not being used).
// Optionally specify a show delay.
void SetTimeout(unsigned milliseconds, unsigned millisecondsShowdelay = 0);
// Choose the tip kind, possibly none. By default the tip is positioned
// automatically, as if wxTipKind_Auto was used.
void SetTipKind(wxTipKind tipKind);
// Set the title text font. By default it's emphasized using the font style
// or colour appropriate for the current platform.
void SetTitleFont(const wxFont& font);
// Show the tooltip for the given window and optionally a specified area.
void ShowFor(wxWindow* win, const wxRect* rect = NULL);
// Non-virtual dtor as this class is not supposed to be derived from.
~wxRichToolTip();
private:
wxRichToolTipImpl* const m_impl;
wxDECLARE_NO_COPY_CLASS(wxRichToolTip);
};
#endif // wxUSE_RICHTOOLTIP
#endif // _WX_RICHTOOLTIP_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/evtloop.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/evtloop.h
// Purpose: declares wxEventLoop class
// Author: Vadim Zeitlin
// Modified by:
// Created: 01.06.01
// Copyright: (c) 2001 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_EVTLOOP_H_
#define _WX_EVTLOOP_H_
#include "wx/event.h"
#include "wx/utils.h"
// TODO: implement wxEventLoopSource for MSW (it should wrap a HANDLE and be
// monitored using MsgWaitForMultipleObjects())
#if defined(__WXOSX__) || (defined(__UNIX__) && !defined(__WINDOWS__))
#define wxUSE_EVENTLOOP_SOURCE 1
#else
#define wxUSE_EVENTLOOP_SOURCE 0
#endif
#if wxUSE_EVENTLOOP_SOURCE
class wxEventLoopSource;
class wxEventLoopSourceHandler;
#endif
/*
NOTE ABOUT wxEventLoopBase::YieldFor LOGIC
------------------------------------------
The YieldFor() function helps to avoid re-entrancy problems and problems
caused by out-of-order event processing
(see "wxYield-like problems" and "wxProgressDialog+threading BUG" wx-dev threads).
The logic behind YieldFor() is simple: it analyzes the queue of the native
events generated by the underlying GUI toolkit and picks out and processes
only those matching the given mask.
It's important to note that YieldFor() is used to selectively process the
events generated by the NATIVE toolkit.
Events syntethized by wxWidgets code or by user code are instead selectively
processed thanks to the logic built into wxEvtHandler::ProcessPendingEvents().
In fact, when wxEvtHandler::ProcessPendingEvents gets called from inside a
YieldFor() call, wxEventLoopBase::IsEventAllowedInsideYield is used to decide
if the pending events for that event handler can be processed.
If all the pending events associated with that event handler result as "not processable",
the event handler "delays" itself calling wxEventLoopBase::DelayPendingEventHandler
(so it's moved: m_handlersWithPendingEvents => m_handlersWithPendingDelayedEvents).
Last, wxEventLoopBase::ProcessPendingEvents() before exiting moves the delayed
event handlers back into the list of handlers with pending events
(m_handlersWithPendingDelayedEvents => m_handlersWithPendingEvents) so that
a later call to ProcessPendingEvents() (possibly outside the YieldFor() call)
will process all pending events as usual.
*/
// ----------------------------------------------------------------------------
// wxEventLoopBase: interface for wxEventLoop
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxEventLoopBase
{
public:
wxEventLoopBase();
virtual ~wxEventLoopBase();
// use this to check whether the event loop was successfully created before
// using it
virtual bool IsOk() const { return true; }
// returns true if this is the main loop
bool IsMain() const;
#if wxUSE_EVENTLOOP_SOURCE
// create a new event loop source wrapping the given file descriptor and
// monitor it for events occurring on this descriptor in all event loops
static wxEventLoopSource *
AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags);
#endif // wxUSE_EVENTLOOP_SOURCE
// dispatch&processing
// -------------------
// start the event loop, return the exit code when it is finished
//
// notice that wx ports should override DoRun(), this method is virtual
// only to allow overriding it in the user code for custom event loops
virtual int Run();
// is this event loop running now?
//
// notice that even if this event loop hasn't terminated yet but has just
// spawned a nested (e.g. modal) event loop, this would return false
bool IsRunning() const;
// exit from the loop with the given exit code
//
// this can be only used to exit the currently running loop, use
// ScheduleExit() if this might not be the case
virtual void Exit(int rc = 0);
// ask the event loop to exit with the given exit code, can be used even if
// this loop is not running right now but the loop must have been started,
// i.e. Run() should have been already called
virtual void ScheduleExit(int rc = 0) = 0;
// return true if any events are available
virtual bool Pending() const = 0;
// dispatch a single event, return false if we should exit from the loop
virtual bool Dispatch() = 0;
// same as Dispatch() but doesn't wait for longer than the specified (in
// ms) timeout, return true if an event was processed, false if we should
// exit the loop or -1 if timeout expired
virtual int DispatchTimeout(unsigned long timeout) = 0;
// implement this to wake up the loop: usually done by posting a dummy event
// to it (can be called from non main thread)
virtual void WakeUp() = 0;
// idle handling
// -------------
// make sure that idle events are sent again: this is just an obsolete
// synonym for WakeUp()
void WakeUpIdle() { WakeUp(); }
// this virtual function is called when the application
// becomes idle and by default it forwards to wxApp::ProcessIdle() and
// while it can be overridden in a custom event loop, you must call the
// base class version to ensure that idle events are still generated
//
// it should return true if more idle events are needed, false if not
virtual bool ProcessIdle();
// Yield-related hooks
// -------------------
// process all currently pending events right now
//
// if onlyIfNeeded is true, returns false without doing anything else if
// we're already inside Yield()
//
// WARNING: this function is dangerous as it can lead to unexpected
// reentrancies (i.e. when called from an event handler it
// may result in calling the same event handler again), use
// with _extreme_ care or, better, don't use at all!
bool Yield(bool onlyIfNeeded = false);
// more selective version of Yield()
//
// notice that it is virtual for backwards-compatibility but new code
// should override DoYieldFor() and not YieldFor() itself
virtual bool YieldFor(long eventsToProcess);
// returns true if the main thread is inside a Yield() call
virtual bool IsYielding() const
{ return m_yieldLevel != 0; }
// returns true if events of the given event category should be immediately
// processed inside a wxApp::Yield() call or rather should be queued for
// later processing by the main event loop
virtual bool IsEventAllowedInsideYield(wxEventCategory cat) const
{ return (m_eventsToProcessInsideYield & cat) != 0; }
// no SafeYield hooks since it uses wxWindow which is not available when wxUSE_GUI=0
// active loop
// -----------
// return currently active (running) event loop, may be NULL
static wxEventLoopBase *GetActive() { return ms_activeLoop; }
// set currently active (running) event loop
static void SetActive(wxEventLoopBase* loop);
protected:
// real implementation of Run()
virtual int DoRun() = 0;
// And the real, port-specific, implementation of YieldFor().
//
// The base class version is pure virtual to ensure that it is overridden
// in the derived classes but does have an implementation which processes
// pending events in wxApp if eventsToProcess allows it, and so should be
// called from the overridden version at an appropriate place (i.e. after
// processing the native events but before doing anything else that could
// be affected by pending events dispatching).
virtual void DoYieldFor(long eventsToProcess) = 0;
// this function should be called before the event loop terminates, whether
// this happens normally (because of Exit() call) or abnormally (because of
// an exception thrown from inside the loop)
virtual void OnExit();
// Return true if we're currently inside our Run(), even if another nested
// event loop is currently running, unlike IsRunning() (which should have
// been really called IsActive() but it's too late to change this now).
bool IsInsideRun() const { return m_isInsideRun; }
// the pointer to currently active loop
static wxEventLoopBase *ms_activeLoop;
// should we exit the loop?
bool m_shouldExit;
// incremented each time on entering Yield() and decremented on leaving it
int m_yieldLevel;
// the argument of the last call to YieldFor()
long m_eventsToProcessInsideYield;
private:
// this flag is set on entry into Run() and reset before leaving it
bool m_isInsideRun;
wxDECLARE_NO_COPY_CLASS(wxEventLoopBase);
};
#if defined(__WINDOWS__) || defined(__WXMAC__) || defined(__WXDFB__) || (defined(__UNIX__) && !defined(__WXOSX__))
// this class can be used to implement a standard event loop logic using
// Pending() and Dispatch()
//
// it also handles idle processing automatically
class WXDLLIMPEXP_BASE wxEventLoopManual : public wxEventLoopBase
{
public:
wxEventLoopManual();
// sets the "should exit" flag and wakes up the loop so that it terminates
// soon
virtual void ScheduleExit(int rc = 0) wxOVERRIDE;
protected:
// enters a loop calling OnNextIteration(), Pending() and Dispatch() and
// terminating when Exit() is called
virtual int DoRun() wxOVERRIDE;
// may be overridden to perform some action at the start of each new event
// loop iteration
virtual void OnNextIteration() { }
// the loop exit code
int m_exitcode;
private:
// process all already pending events and dispatch a new one (blocking
// until it appears in the event queue if necessary)
//
// returns the return value of Dispatch()
bool ProcessEvents();
wxDECLARE_NO_COPY_CLASS(wxEventLoopManual);
};
#endif // platforms using "manual" loop
// we're moving away from old m_impl wxEventLoop model as otherwise the user
// code doesn't have access to platform-specific wxEventLoop methods and this
// can sometimes be very useful (e.g. under MSW this is necessary for
// integration with MFC) but currently this is not done for all ports yet (e.g.
// wxX11) so fall back to the old wxGUIEventLoop definition below for them
#if defined(__DARWIN__)
// CoreFoundation-based event loop is currently in wxBase so include it in
// any case too (although maybe it actually shouldn't be there at all)
#include "wx/osx/core/evtloop.h"
#endif
// include the header defining wxConsoleEventLoop
#if defined(__UNIX__) && !defined(__WINDOWS__)
#include "wx/unix/evtloop.h"
#elif defined(__WINDOWS__)
#include "wx/msw/evtloopconsole.h"
#endif
#if wxUSE_GUI
// include the appropriate header defining wxGUIEventLoop
#if defined(__WXMSW__)
#include "wx/msw/evtloop.h"
#elif defined(__WXOSX__)
#include "wx/osx/evtloop.h"
#elif defined(__WXDFB__)
#include "wx/dfb/evtloop.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/evtloop.h"
#elif defined(__WXQT__)
#include "wx/qt/evtloop.h"
#else // other platform
#include "wx/stopwatch.h" // for wxMilliClock_t
class WXDLLIMPEXP_FWD_CORE wxEventLoopImpl;
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase
{
public:
wxGUIEventLoop() { m_impl = NULL; }
virtual ~wxGUIEventLoop();
virtual void ScheduleExit(int rc = 0);
virtual bool Pending() const;
virtual bool Dispatch();
virtual int DispatchTimeout(unsigned long timeout)
{
// TODO: this is, of course, horribly inefficient and a proper wait with
// timeout should be implemented for all ports natively...
const wxMilliClock_t timeEnd = wxGetLocalTimeMillis() + timeout;
for ( ;; )
{
if ( Pending() )
return Dispatch();
if ( wxGetLocalTimeMillis() >= timeEnd )
return -1;
}
}
virtual void WakeUp() { }
protected:
virtual int DoRun();
virtual void DoYieldFor(long eventsToProcess);
// the pointer to the port specific implementation class
wxEventLoopImpl *m_impl;
wxDECLARE_NO_COPY_CLASS(wxGUIEventLoop);
};
#endif // platforms
#endif // wxUSE_GUI
#if wxUSE_GUI
// we use a class rather than a typedef because wxEventLoop is
// forward-declared in many places
class wxEventLoop : public wxGUIEventLoop { };
#else // !wxUSE_GUI
// we can't define wxEventLoop differently in GUI and base libraries so use
// a #define to still allow writing wxEventLoop in the user code
#if wxUSE_CONSOLE_EVENTLOOP && (defined(__WINDOWS__) || defined(__UNIX__))
#define wxEventLoop wxConsoleEventLoop
#else // we still must define it somehow for the code below...
#define wxEventLoop wxEventLoopBase
#endif
#endif
inline bool wxEventLoopBase::IsRunning() const { return GetActive() == this; }
#if wxUSE_GUI && !defined(__WXOSX__)
// ----------------------------------------------------------------------------
// wxModalEventLoop
// ----------------------------------------------------------------------------
// this is a naive generic implementation which uses wxWindowDisabler to
// implement modality, we will surely need platform-specific implementations
// too, this generic implementation is here only temporarily to see how it
// works
class WXDLLIMPEXP_CORE wxModalEventLoop : public wxGUIEventLoop
{
public:
wxModalEventLoop(wxWindow *winModal)
{
m_windowDisabler = new wxWindowDisabler(winModal);
}
protected:
virtual void OnExit() wxOVERRIDE
{
delete m_windowDisabler;
m_windowDisabler = NULL;
wxGUIEventLoop::OnExit();
}
private:
wxWindowDisabler *m_windowDisabler;
};
#endif //wxUSE_GUI
// ----------------------------------------------------------------------------
// wxEventLoopActivator: helper class for wxEventLoop implementations
// ----------------------------------------------------------------------------
// this object sets the wxEventLoop given to the ctor as the currently active
// one and unsets it in its dtor, this is especially useful in presence of
// exceptions but is more tidy even when we don't use them
class wxEventLoopActivator
{
public:
wxEventLoopActivator(wxEventLoopBase *evtLoop)
{
m_evtLoopOld = wxEventLoopBase::GetActive();
wxEventLoopBase::SetActive(evtLoop);
}
~wxEventLoopActivator()
{
// restore the previously active event loop
wxEventLoopBase::SetActive(m_evtLoopOld);
}
private:
wxEventLoopBase *m_evtLoopOld;
};
#if wxUSE_GUI || wxUSE_CONSOLE_EVENTLOOP
class wxEventLoopGuarantor
{
public:
wxEventLoopGuarantor()
{
m_evtLoopNew = NULL;
if (!wxEventLoop::GetActive())
{
m_evtLoopNew = new wxEventLoop;
wxEventLoop::SetActive(m_evtLoopNew);
}
}
~wxEventLoopGuarantor()
{
if (m_evtLoopNew)
{
wxEventLoop::SetActive(NULL);
delete m_evtLoopNew;
}
}
private:
wxEventLoop *m_evtLoopNew;
};
#endif // wxUSE_GUI || wxUSE_CONSOLE_EVENTLOOP
#endif // _WX_EVTLOOP_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/listbase.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/listbase.h
// Purpose: wxListCtrl class
// Author: Vadim Zeitlin
// Modified by:
// Created: 04.12.99
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LISTBASE_H_BASE_
#define _WX_LISTBASE_H_BASE_
#include "wx/colour.h"
#include "wx/font.h"
#include "wx/gdicmn.h"
#include "wx/event.h"
#include "wx/control.h"
#include "wx/itemattr.h"
#include "wx/systhemectrl.h"
class WXDLLIMPEXP_FWD_CORE wxImageList;
// ----------------------------------------------------------------------------
// types
// ----------------------------------------------------------------------------
// type of compare function for wxListCtrl sort operation
typedef
int (wxCALLBACK *wxListCtrlCompare)(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData);
// ----------------------------------------------------------------------------
// wxListCtrl constants
// ----------------------------------------------------------------------------
// style flags
#define wxLC_VRULES 0x0001
#define wxLC_HRULES 0x0002
#define wxLC_ICON 0x0004
#define wxLC_SMALL_ICON 0x0008
#define wxLC_LIST 0x0010
#define wxLC_REPORT 0x0020
#define wxLC_ALIGN_TOP 0x0040
#define wxLC_ALIGN_LEFT 0x0080
#define wxLC_AUTOARRANGE 0x0100
#define wxLC_VIRTUAL 0x0200
#define wxLC_EDIT_LABELS 0x0400
#define wxLC_NO_HEADER 0x0800
#define wxLC_NO_SORT_HEADER 0x1000
#define wxLC_SINGLE_SEL 0x2000
#define wxLC_SORT_ASCENDING 0x4000
#define wxLC_SORT_DESCENDING 0x8000
#define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
#define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT)
#define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING)
// for compatibility only
#define wxLC_USER_TEXT wxLC_VIRTUAL
// Omitted because
// (a) too much detail
// (b) not enough style flags
// (c) not implemented anyhow in the generic version
//
// #define wxLC_NO_SCROLL
// #define wxLC_NO_LABEL_WRAP
// #define wxLC_OWNERDRAW_FIXED
// #define wxLC_SHOW_SEL_ALWAYS
// Mask flags to tell app/GUI what fields of wxListItem are valid
#define wxLIST_MASK_STATE 0x0001
#define wxLIST_MASK_TEXT 0x0002
#define wxLIST_MASK_IMAGE 0x0004
#define wxLIST_MASK_DATA 0x0008
#define wxLIST_SET_ITEM 0x0010
#define wxLIST_MASK_WIDTH 0x0020
#define wxLIST_MASK_FORMAT 0x0040
// State flags for indicating the state of an item
#define wxLIST_STATE_DONTCARE 0x0000
#define wxLIST_STATE_DROPHILITED 0x0001 // MSW only
#define wxLIST_STATE_FOCUSED 0x0002
#define wxLIST_STATE_SELECTED 0x0004
#define wxLIST_STATE_CUT 0x0008 // MSW only
#define wxLIST_STATE_DISABLED 0x0010 // Not used
#define wxLIST_STATE_FILTERED 0x0020 // Not used
#define wxLIST_STATE_INUSE 0x0040 // Not used
#define wxLIST_STATE_PICKED 0x0080 // Not used
#define wxLIST_STATE_SOURCE 0x0100 // Not used
// Hit test flags, used in HitTest
#define wxLIST_HITTEST_ABOVE 0x0001 // Above the control's client area.
#define wxLIST_HITTEST_BELOW 0x0002 // Below the control's client area.
#define wxLIST_HITTEST_NOWHERE 0x0004 // Inside the control's client area but not over an item.
#define wxLIST_HITTEST_ONITEMICON 0x0020 // Over an item's icon.
#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // Over an item's text.
#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // Not used
#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // Over the checkbox of an item.
#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the control's client area.
#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the control's client area.
#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON)
// GetSubItemRect constants
#define wxLIST_GETSUBITEMRECT_WHOLEITEM -1l
// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL)
enum
{
wxLIST_NEXT_ABOVE, // Searches for an item above the specified item
wxLIST_NEXT_ALL, // Searches for subsequent item by index
wxLIST_NEXT_BELOW, // Searches for an item below the specified item
wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
};
// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT)
enum
{
wxLIST_ALIGN_DEFAULT,
wxLIST_ALIGN_LEFT,
wxLIST_ALIGN_TOP,
wxLIST_ALIGN_SNAP_TO_GRID
};
// Column format (MSW only except wxLIST_FORMAT_LEFT)
enum wxListColumnFormat
{
wxLIST_FORMAT_LEFT,
wxLIST_FORMAT_RIGHT,
wxLIST_FORMAT_CENTRE,
wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
};
// Autosize values for SetColumnWidth
enum
{
wxLIST_AUTOSIZE = -1,
wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version
};
// Flag values for GetItemRect
enum
{
wxLIST_RECT_BOUNDS,
wxLIST_RECT_ICON,
wxLIST_RECT_LABEL
};
// Flag values for FindItem (MSW only)
enum
{
wxLIST_FIND_UP,
wxLIST_FIND_DOWN,
wxLIST_FIND_LEFT,
wxLIST_FIND_RIGHT
};
// For compatibility, define the old name for this class. There is no need to
// deprecate it as it doesn't cost us anything to keep this typedef, but the
// new code should prefer to use the new wxItemAttr name.
typedef wxItemAttr wxListItemAttr;
// ----------------------------------------------------------------------------
// wxListItem: the item or column info, used to exchange data with wxListCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxListItem : public wxObject
{
public:
wxListItem() { Init(); m_attr = NULL; }
wxListItem(const wxListItem& item)
: wxObject(),
m_mask(item.m_mask),
m_itemId(item.m_itemId),
m_col(item.m_col),
m_state(item.m_state),
m_stateMask(item.m_stateMask),
m_text(item.m_text),
m_image(item.m_image),
m_data(item.m_data),
m_format(item.m_format),
m_width(item.m_width),
m_attr(NULL)
{
// copy list item attributes
if ( item.HasAttributes() )
m_attr = new wxItemAttr(*item.GetAttributes());
}
wxListItem& operator=(const wxListItem& item)
{
if ( &item != this )
{
m_mask = item.m_mask;
m_itemId = item.m_itemId;
m_col = item.m_col;
m_state = item.m_state;
m_stateMask = item.m_stateMask;
m_text = item.m_text;
m_image = item.m_image;
m_data = item.m_data;
m_format = item.m_format;
m_width = item.m_width;
m_attr = item.m_attr ? new wxItemAttr(*item.m_attr) : NULL;
}
return *this;
}
virtual ~wxListItem() { delete m_attr; }
// resetting
void Clear() { Init(); m_text.clear(); ClearAttributes(); }
void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = NULL; } }
// setters
void SetMask(long mask)
{ m_mask = mask; }
void SetId(long id)
{ m_itemId = id; }
void SetColumn(int col)
{ m_col = col; }
void SetState(long state)
{ m_mask |= wxLIST_MASK_STATE; m_state = state; m_stateMask |= state; }
void SetStateMask(long stateMask)
{ m_stateMask = stateMask; }
void SetText(const wxString& text)
{ m_mask |= wxLIST_MASK_TEXT; m_text = text; }
void SetImage(int image)
{ m_mask |= wxLIST_MASK_IMAGE; m_image = image; }
void SetData(long data)
{ m_mask |= wxLIST_MASK_DATA; m_data = data; }
void SetData(void *data)
{ m_mask |= wxLIST_MASK_DATA; m_data = wxPtrToUInt(data); }
void SetWidth(int width)
{ m_mask |= wxLIST_MASK_WIDTH; m_width = width; }
void SetAlign(wxListColumnFormat align)
{ m_mask |= wxLIST_MASK_FORMAT; m_format = align; }
void SetTextColour(const wxColour& colText)
{ Attributes().SetTextColour(colText); }
void SetBackgroundColour(const wxColour& colBack)
{ Attributes().SetBackgroundColour(colBack); }
void SetFont(const wxFont& font)
{ Attributes().SetFont(font); }
// accessors
long GetMask() const { return m_mask; }
long GetId() const { return m_itemId; }
int GetColumn() const { return m_col; }
long GetState() const { return m_state & m_stateMask; }
const wxString& GetText() const { return m_text; }
int GetImage() const { return m_image; }
wxUIntPtr GetData() const { return m_data; }
int GetWidth() const { return m_width; }
wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; }
wxItemAttr *GetAttributes() const { return m_attr; }
bool HasAttributes() const { return m_attr != NULL; }
wxColour GetTextColour() const
{ return HasAttributes() ? m_attr->GetTextColour() : wxNullColour; }
wxColour GetBackgroundColour() const
{ return HasAttributes() ? m_attr->GetBackgroundColour()
: wxNullColour; }
wxFont GetFont() const
{ return HasAttributes() ? m_attr->GetFont() : wxNullFont; }
// this conversion is necessary to make old code using GetItem() to
// compile
operator long() const { return m_itemId; }
// these members are public for compatibility
long m_mask; // Indicates what fields are valid
long m_itemId; // The zero-based item position
int m_col; // Zero-based column, if in report mode
long m_state; // The state of the item
long m_stateMask;// Which flags of m_state are valid (uses same flags)
wxString m_text; // The label/header text
int m_image; // The zero-based index into an image list
wxUIntPtr m_data; // App-defined data
// For columns only
int m_format; // left, right, centre
int m_width; // width of column
protected:
// creates m_attr if we don't have it yet
wxItemAttr& Attributes()
{
if ( !m_attr )
m_attr = new wxItemAttr;
return *m_attr;
}
void Init()
{
m_mask = 0;
m_itemId = -1;
m_col = 0;
m_state = 0;
m_stateMask = 0;
m_image = -1;
m_data = 0;
m_format = wxLIST_FORMAT_CENTRE;
m_width = 0;
}
wxItemAttr *m_attr; // optional pointer to the items style
private:
wxDECLARE_DYNAMIC_CLASS(wxListItem);
};
// ----------------------------------------------------------------------------
// wxListCtrlBase: the base class for the main control itself.
// ----------------------------------------------------------------------------
// Unlike other base classes, this class doesn't currently define the API of
// the real control class but is just used for implementation convenience. We
// should define the public class functions as pure virtual here in the future
// however.
class WXDLLIMPEXP_CORE wxListCtrlBase : public wxSystemThemedControl<wxControl>
{
public:
wxListCtrlBase() { }
// Image list methods.
// -------------------
// Associate the given (possibly NULL to indicate that no images will be
// used) image list with the control. The ownership of the image list
// passes to the control, i.e. it will be deleted when the control itself
// is destroyed.
//
// The value of "which" must be one of wxIMAGE_LIST_{NORMAL,SMALL,STATE}.
virtual void AssignImageList(wxImageList* imageList, int which) = 0;
// Same as AssignImageList() but the control does not delete the image list
// so it can be shared among several controls.
virtual void SetImageList(wxImageList* imageList, int which) = 0;
// Return the currently used image list, may be NULL.
virtual wxImageList* GetImageList(int which) const = 0;
// Column-related methods.
// -----------------------
// All these methods can only be used in report view mode.
// Appends a new column.
//
// Returns the index of the newly inserted column or -1 on error.
long AppendColumn(const wxString& heading,
wxListColumnFormat format = wxLIST_FORMAT_LEFT,
int width = -1);
// Add a new column to the control at the position "col".
//
// Returns the index of the newly inserted column or -1 on error.
long InsertColumn(long col, const wxListItem& info);
long InsertColumn(long col,
const wxString& heading,
int format = wxLIST_FORMAT_LEFT,
int width = wxLIST_AUTOSIZE);
// Delete the given or all columns.
virtual bool DeleteColumn(int col) = 0;
virtual bool DeleteAllColumns() = 0;
// Return the current number of columns.
virtual int GetColumnCount() const = 0;
// Get or update information about the given column. Set item mask to
// indicate the fields to retrieve or change.
//
// Returns false on error, e.g. if the column index is invalid.
virtual bool GetColumn(int col, wxListItem& item) const = 0;
virtual bool SetColumn(int col, const wxListItem& item) = 0;
// Convenient wrappers for the above methods which get or update just the
// column width.
virtual int GetColumnWidth(int col) const = 0;
virtual bool SetColumnWidth(int col, int width) = 0;
// return the attribute for the item (may return NULL if none)
virtual wxItemAttr *OnGetItemAttr(long item) const;
// Other miscellaneous accessors.
// ------------------------------
// Convenient functions for testing the list control mode:
bool InReportView() const { return HasFlag(wxLC_REPORT); }
bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); }
// 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) { }
void EnableAlternateRowColours(bool enable = true);
void SetAlternateRowColour(const wxColour& colour);
wxColour GetAlternateRowColour() const { return m_alternateRowColour.GetBackgroundColour(); }
// Header attributes support: only implemented in wxMSW currently.
virtual bool SetHeaderAttr(const wxItemAttr& WXUNUSED(attr)) { return false; }
// Checkboxes support.
virtual bool HasCheckBoxes() const { return false; }
virtual bool EnableCheckBoxes(bool WXUNUSED(enable) = true) { return false; }
virtual bool IsItemChecked(long WXUNUSED(item)) const { return false; }
virtual void CheckItem(long WXUNUSED(item), bool WXUNUSED(check)) { }
protected:
// Real implementations methods to which our public forwards.
virtual long DoInsertColumn(long col, const wxListItem& info) = 0;
// Overridden methods of the base class.
virtual wxSize DoGetBestClientSize() const wxOVERRIDE;
private:
// user defined color to draw row lines, may be invalid
wxItemAttr m_alternateRowColour;
};
// ----------------------------------------------------------------------------
// wxListEvent - the event class for the wxListCtrl notifications
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxListEvent : public wxNotifyEvent
{
public:
wxListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
: wxNotifyEvent(commandType, winid)
, m_code(-1)
, m_oldItemIndex(-1)
, m_itemIndex(-1)
, m_col(-1)
, m_pointDrag()
, m_item()
, m_editCancelled(false)
{ }
wxListEvent(const wxListEvent& event)
: wxNotifyEvent(event)
, m_code(event.m_code)
, m_oldItemIndex(event.m_oldItemIndex)
, m_itemIndex(event.m_itemIndex)
, m_col(event.m_col)
, m_pointDrag(event.m_pointDrag)
, m_item(event.m_item)
, m_editCancelled(event.m_editCancelled)
{ }
int GetKeyCode() const { return m_code; }
long GetIndex() const { return m_itemIndex; }
int GetColumn() const { return m_col; }
wxPoint GetPoint() const { return m_pointDrag; }
const wxString& GetLabel() const { return m_item.m_text; }
const wxString& GetText() const { return m_item.m_text; }
int GetImage() const { return m_item.m_image; }
wxUIntPtr GetData() const { return m_item.m_data; }
long GetMask() const { return m_item.m_mask; }
const wxListItem& GetItem() const { return m_item; }
void SetKeyCode(int code) { m_code = code; }
void SetIndex(long index) { m_itemIndex = index; }
void SetColumn(int col) { m_col = col; }
void SetPoint(const wxPoint& point) { m_pointDrag = point; }
void SetItem(const wxListItem& item) { m_item = item; }
// for wxEVT_LIST_CACHE_HINT only
long GetCacheFrom() const { return m_oldItemIndex; }
long GetCacheTo() const { return m_itemIndex; }
void SetCacheFrom(long cacheFrom) { m_oldItemIndex = cacheFrom; }
void SetCacheTo(long cacheTo) { m_itemIndex = cacheTo; }
// was label editing canceled? (for wxEVT_LIST_END_LABEL_EDIT only)
bool IsEditCancelled() const { return m_editCancelled; }
void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxListEvent(*this); }
//protected: -- not for backwards compatibility
int m_code;
long m_oldItemIndex; // only for wxEVT_LIST_CACHE_HINT
long m_itemIndex;
int m_col;
wxPoint m_pointDrag;
wxListItem m_item;
protected:
bool m_editCancelled;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListEvent);
};
// ----------------------------------------------------------------------------
// wxListCtrl event macros
// ----------------------------------------------------------------------------
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_BEGIN_DRAG, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_BEGIN_RDRAG, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_BEGIN_LABEL_EDIT, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_END_LABEL_EDIT, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_DELETE_ITEM, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_DELETE_ALL_ITEMS, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_SELECTED, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_DESELECTED, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_KEY_DOWN, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_INSERT_ITEM, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_CLICK, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_RIGHT_CLICK, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_MIDDLE_CLICK, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_ACTIVATED, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_CACHE_HINT, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_RIGHT_CLICK, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_BEGIN_DRAG, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_DRAGGING, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_END_DRAG, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_FOCUSED, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_CHECKED, wxListEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_UNCHECKED, wxListEvent );
typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
#define wxListEventHandler(func) \
wxEVENT_HANDLER_CAST(wxListEventFunction, func)
#define wx__DECLARE_LISTEVT(evt, id, fn) \
wx__DECLARE_EVT1(wxEVT_LIST_ ## evt, id, wxListEventHandler(fn))
#define EVT_LIST_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_DRAG, id, fn)
#define EVT_LIST_BEGIN_RDRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_RDRAG, id, fn)
#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(BEGIN_LABEL_EDIT, id, fn)
#define EVT_LIST_END_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(END_LABEL_EDIT, id, fn)
#define EVT_LIST_DELETE_ITEM(id, fn) wx__DECLARE_LISTEVT(DELETE_ITEM, id, fn)
#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) wx__DECLARE_LISTEVT(DELETE_ALL_ITEMS, id, fn)
#define EVT_LIST_KEY_DOWN(id, fn) wx__DECLARE_LISTEVT(KEY_DOWN, id, fn)
#define EVT_LIST_INSERT_ITEM(id, fn) wx__DECLARE_LISTEVT(INSERT_ITEM, id, fn)
#define EVT_LIST_COL_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_CLICK, id, fn)
#define EVT_LIST_COL_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_RIGHT_CLICK, id, fn)
#define EVT_LIST_COL_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_BEGIN_DRAG, id, fn)
#define EVT_LIST_COL_DRAGGING(id, fn) wx__DECLARE_LISTEVT(COL_DRAGGING, id, fn)
#define EVT_LIST_COL_END_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_END_DRAG, id, fn)
#define EVT_LIST_ITEM_SELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_SELECTED, id, fn)
#define EVT_LIST_ITEM_DESELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_DESELECTED, id, fn)
#define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_RIGHT_CLICK, id, fn)
#define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_MIDDLE_CLICK, id, fn)
#define EVT_LIST_ITEM_ACTIVATED(id, fn) wx__DECLARE_LISTEVT(ITEM_ACTIVATED, id, fn)
#define EVT_LIST_ITEM_FOCUSED(id, fn) wx__DECLARE_LISTEVT(ITEM_FOCUSED, id, fn)
#define EVT_LIST_ITEM_CHECKED(id, fn) wx__DECLARE_LISTEVT(ITEM_CHECKED, id, fn)
#define EVT_LIST_ITEM_UNCHECKED(id, fn) wx__DECLARE_LISTEVT(ITEM_UNCHECKED, id, fn)
#define EVT_LIST_CACHE_HINT(id, fn) wx__DECLARE_LISTEVT(CACHE_HINT, id, fn)
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_LIST_BEGIN_DRAG wxEVT_LIST_BEGIN_DRAG
#define wxEVT_COMMAND_LIST_BEGIN_RDRAG wxEVT_LIST_BEGIN_RDRAG
#define wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT wxEVT_LIST_BEGIN_LABEL_EDIT
#define wxEVT_COMMAND_LIST_END_LABEL_EDIT wxEVT_LIST_END_LABEL_EDIT
#define wxEVT_COMMAND_LIST_DELETE_ITEM wxEVT_LIST_DELETE_ITEM
#define wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS wxEVT_LIST_DELETE_ALL_ITEMS
#define wxEVT_COMMAND_LIST_ITEM_SELECTED wxEVT_LIST_ITEM_SELECTED
#define wxEVT_COMMAND_LIST_ITEM_DESELECTED wxEVT_LIST_ITEM_DESELECTED
#define wxEVT_COMMAND_LIST_KEY_DOWN wxEVT_LIST_KEY_DOWN
#define wxEVT_COMMAND_LIST_INSERT_ITEM wxEVT_LIST_INSERT_ITEM
#define wxEVT_COMMAND_LIST_COL_CLICK wxEVT_LIST_COL_CLICK
#define wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK wxEVT_LIST_ITEM_RIGHT_CLICK
#define wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK wxEVT_LIST_ITEM_MIDDLE_CLICK
#define wxEVT_COMMAND_LIST_ITEM_ACTIVATED wxEVT_LIST_ITEM_ACTIVATED
#define wxEVT_COMMAND_LIST_CACHE_HINT wxEVT_LIST_CACHE_HINT
#define wxEVT_COMMAND_LIST_COL_RIGHT_CLICK wxEVT_LIST_COL_RIGHT_CLICK
#define wxEVT_COMMAND_LIST_COL_BEGIN_DRAG wxEVT_LIST_COL_BEGIN_DRAG
#define wxEVT_COMMAND_LIST_COL_DRAGGING wxEVT_LIST_COL_DRAGGING
#define wxEVT_COMMAND_LIST_COL_END_DRAG wxEVT_LIST_COL_END_DRAG
#define wxEVT_COMMAND_LIST_ITEM_FOCUSED wxEVT_LIST_ITEM_FOCUSED
#endif
// _WX_LISTCTRL_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/ipc.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/ipc.h
// Purpose: wrapper around different wxIPC classes implementations
// Author: Vadim Zeitlin
// Modified by:
// Created: 15.04.02
// Copyright: (c) 2002 Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_IPC_H_
#define _WX_IPC_H_
// Set wxUSE_DDE_FOR_IPC to 1 to use DDE for IPC under Windows. If it is set to
// 0, or if the platform is not Windows, use TCP/IP for IPC implementation
#if !defined(wxUSE_DDE_FOR_IPC)
#ifdef __WINDOWS__
#define wxUSE_DDE_FOR_IPC 1
#else
#define wxUSE_DDE_FOR_IPC 0
#endif
#endif // !defined(wxUSE_DDE_FOR_IPC)
#if !defined(__WINDOWS__)
#undef wxUSE_DDE_FOR_IPC
#define wxUSE_DDE_FOR_IPC 0
#endif
#if wxUSE_DDE_FOR_IPC
#define wxConnection wxDDEConnection
#define wxServer wxDDEServer
#define wxClient wxDDEClient
#include "wx/dde.h"
#else // !wxUSE_DDE_FOR_IPC
#define wxConnection wxTCPConnection
#define wxServer wxTCPServer
#define wxClient wxTCPClient
#include "wx/sckipc.h"
#endif // wxUSE_DDE_FOR_IPC/!wxUSE_DDE_FOR_IPC
#endif // _WX_IPC_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/palette.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/palette.h
// Purpose: Common header and base class for wxPalette
// Author: Julian Smart
// Modified by:
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PALETTE_H_BASE_
#define _WX_PALETTE_H_BASE_
#include "wx/defs.h"
#if wxUSE_PALETTE
#include "wx/object.h"
#include "wx/gdiobj.h"
// wxPaletteBase
class WXDLLIMPEXP_CORE wxPaletteBase: public wxGDIObject
{
public:
virtual ~wxPaletteBase() { }
virtual int GetColoursCount() const { wxFAIL_MSG( wxT("not implemented") ); return 0; }
};
#if defined(__WXMSW__)
#include "wx/msw/palette.h"
#elif defined(__WXX11__) || defined(__WXMOTIF__)
#include "wx/x11/palette.h"
#elif defined(__WXGTK__)
#include "wx/generic/paletteg.h"
#elif defined(__WXMAC__)
#include "wx/osx/palette.h"
#elif defined(__WXQT__)
#include "wx/qt/palette.h"
#endif
#endif // wxUSE_PALETTE
#endif // _WX_PALETTE_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/affinematrix2dbase.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/affinematrix2dbase.h
// Purpose: Common interface for 2D transformation matrices.
// Author: Catalin Raceanu
// Created: 2011-04-06
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AFFINEMATRIX2DBASE_H_
#define _WX_AFFINEMATRIX2DBASE_H_
#include "wx/defs.h"
#if wxUSE_GEOMETRY
#include "wx/geometry.h"
struct wxMatrix2D
{
wxMatrix2D(wxDouble v11 = 1,
wxDouble v12 = 0,
wxDouble v21 = 0,
wxDouble v22 = 1)
{
m_11 = v11; m_12 = v12;
m_21 = v21; m_22 = v22;
}
wxDouble m_11, m_12, m_21, m_22;
};
// A 2x3 matrix representing an affine 2D transformation.
//
// This is an abstract base class implemented by wxAffineMatrix2D only so far,
// but in the future we also plan to derive wxGraphicsMatrix from it (it should
// also be documented then as currently only wxAffineMatrix2D itself is).
class WXDLLIMPEXP_CORE wxAffineMatrix2DBase
{
public:
wxAffineMatrix2DBase() {}
virtual ~wxAffineMatrix2DBase() {}
// sets the matrix to the respective values
virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr) = 0;
// gets the component valuess of the matrix
virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const = 0;
// concatenates the matrix
virtual void Concat(const wxAffineMatrix2DBase& t) = 0;
// makes this the inverse matrix
virtual bool Invert() = 0;
// return true if this is the identity matrix
virtual bool IsIdentity() const = 0;
// returns true if the elements of the transformation matrix are equal ?
virtual bool IsEqual(const wxAffineMatrix2DBase& t) const = 0;
bool operator==(const wxAffineMatrix2DBase& t) const { return IsEqual(t); }
bool operator!=(const wxAffineMatrix2DBase& t) const { return !IsEqual(t); }
//
// transformations
//
// add the translation to this matrix
virtual void Translate(wxDouble dx, wxDouble dy) = 0;
// add the scale to this matrix
virtual void Scale(wxDouble xScale, wxDouble yScale) = 0;
// add the rotation to this matrix (counter clockwise, radians)
virtual void Rotate(wxDouble ccRadians) = 0;
// add mirroring to this matrix
void Mirror(int direction = wxHORIZONTAL)
{
wxDouble x = (direction & wxHORIZONTAL) ? -1 : 1;
wxDouble y = (direction & wxVERTICAL) ? -1 : 1;
Scale(x, y);
}
// applies that matrix to the point
wxPoint2DDouble TransformPoint(const wxPoint2DDouble& src) const
{
return DoTransformPoint(src);
}
void TransformPoint(wxDouble* x, wxDouble* y) const
{
wxCHECK_RET( x && y, "Can't be NULL" );
const wxPoint2DDouble dst = DoTransformPoint(wxPoint2DDouble(*x, *y));
*x = dst.m_x;
*y = dst.m_y;
}
// applies the matrix except for translations
wxPoint2DDouble TransformDistance(const wxPoint2DDouble& src) const
{
return DoTransformDistance(src);
}
void TransformDistance(wxDouble* dx, wxDouble* dy) const
{
wxCHECK_RET( dx && dy, "Can't be NULL" );
const wxPoint2DDouble
dst = DoTransformDistance(wxPoint2DDouble(*dx, *dy));
*dx = dst.m_x;
*dy = dst.m_y;
}
protected:
virtual
wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const = 0;
virtual
wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const = 0;
};
#endif // wxUSE_GEOMETRY
#endif // _WX_AFFINEMATRIX2DBASE_H_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/menu.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/menu.h
// Purpose: wxMenu and wxMenuBar classes
// Author: Vadim Zeitlin
// Modified by:
// Created: 26.10.99
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MENU_H_BASE_
#define _WX_MENU_H_BASE_
#include "wx/defs.h"
#if wxUSE_MENUS
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/list.h" // for "template" list classes
#include "wx/window.h" // base class for wxMenuBar
// also include this one to ensure compatibility with old code which only
// included wx/menu.h
#include "wx/menuitem.h"
class WXDLLIMPEXP_FWD_CORE wxFrame;
class WXDLLIMPEXP_FWD_CORE wxMenu;
class WXDLLIMPEXP_FWD_CORE wxMenuBarBase;
class WXDLLIMPEXP_FWD_CORE wxMenuBar;
class WXDLLIMPEXP_FWD_CORE wxMenuItem;
// pseudo template list classes
WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList);
WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList);
// ----------------------------------------------------------------------------
// wxMenu
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMenuBase : public wxEvtHandler
{
public:
// create a menu
static wxMenu *New(const wxString& title = wxEmptyString, long style = 0);
// ctors
wxMenuBase(const wxString& title, long style = 0) : m_title(title)
{ Init(style); }
wxMenuBase(long style = 0)
{ Init(style); }
// dtor deletes all the menu items we own
virtual ~wxMenuBase();
// menu construction
// -----------------
// append any kind of item (normal/check/radio/separator)
wxMenuItem* Append(int itemid,
const wxString& text = wxEmptyString,
const wxString& help = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL)
{
return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, kind));
}
// append a separator to the menu
wxMenuItem* AppendSeparator() { return Append(wxID_SEPARATOR); }
// append a check item
wxMenuItem* AppendCheckItem(int itemid,
const wxString& text,
const wxString& help = wxEmptyString)
{
return Append(itemid, text, help, wxITEM_CHECK);
}
// append a radio item
wxMenuItem* AppendRadioItem(int itemid,
const wxString& text,
const wxString& help = wxEmptyString)
{
return Append(itemid, text, help, wxITEM_RADIO);
}
// append a submenu
wxMenuItem* AppendSubMenu(wxMenu *submenu,
const wxString& text,
const wxString& help = wxEmptyString)
{
return DoAppend(wxMenuItem::New((wxMenu *)this, wxID_ANY, text, help,
wxITEM_NORMAL, submenu));
}
// the most generic form of Append() - append anything
wxMenuItem* Append(wxMenuItem *item) { return DoAppend(item); }
// insert a break in the menu (only works when appending the items, not
// inserting them)
virtual void Break() { }
// insert an item before given position
wxMenuItem* Insert(size_t pos, wxMenuItem *item);
// insert an item before given position
wxMenuItem* Insert(size_t pos,
int itemid,
const wxString& text = wxEmptyString,
const wxString& help = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL)
{
return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, kind));
}
// insert a separator
wxMenuItem* InsertSeparator(size_t pos)
{
return Insert(pos, wxMenuItem::New((wxMenu *)this, wxID_SEPARATOR));
}
// insert a check item
wxMenuItem* InsertCheckItem(size_t pos,
int itemid,
const wxString& text,
const wxString& help = wxEmptyString)
{
return Insert(pos, itemid, text, help, wxITEM_CHECK);
}
// insert a radio item
wxMenuItem* InsertRadioItem(size_t pos,
int itemid,
const wxString& text,
const wxString& help = wxEmptyString)
{
return Insert(pos, itemid, text, help, wxITEM_RADIO);
}
// insert a submenu
wxMenuItem* Insert(size_t pos,
int itemid,
const wxString& text,
wxMenu *submenu,
const wxString& help = wxEmptyString)
{
return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help,
wxITEM_NORMAL, submenu));
}
// prepend an item to the menu
wxMenuItem* Prepend(wxMenuItem *item)
{
return Insert(0u, item);
}
// prepend any item to the menu
wxMenuItem* Prepend(int itemid,
const wxString& text = wxEmptyString,
const wxString& help = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL)
{
return Insert(0u, itemid, text, help, kind);
}
// prepend a separator
wxMenuItem* PrependSeparator()
{
return InsertSeparator(0u);
}
// prepend a check item
wxMenuItem* PrependCheckItem(int itemid,
const wxString& text,
const wxString& help = wxEmptyString)
{
return InsertCheckItem(0u, itemid, text, help);
}
// prepend a radio item
wxMenuItem* PrependRadioItem(int itemid,
const wxString& text,
const wxString& help = wxEmptyString)
{
return InsertRadioItem(0u, itemid, text, help);
}
// prepend a submenu
wxMenuItem* Prepend(int itemid,
const wxString& text,
wxMenu *submenu,
const wxString& help = wxEmptyString)
{
return Insert(0u, itemid, text, submenu, help);
}
// detach an item from the menu, but don't delete it so that it can be
// added back later (but if it's not, the caller is responsible for
// deleting it!)
wxMenuItem *Remove(int itemid) { return Remove(FindChildItem(itemid)); }
wxMenuItem *Remove(wxMenuItem *item);
// delete an item from the menu (submenus are not destroyed by this
// function, see Destroy)
bool Delete(int itemid) { return Delete(FindChildItem(itemid)); }
bool Delete(wxMenuItem *item);
// delete the item from menu and destroy it (if it's a submenu)
bool Destroy(int itemid) { return Destroy(FindChildItem(itemid)); }
bool Destroy(wxMenuItem *item);
// menu items access
// -----------------
// get the items
size_t GetMenuItemCount() const { return m_items.GetCount(); }
const wxMenuItemList& GetMenuItems() const { return m_items; }
wxMenuItemList& GetMenuItems() { return m_items; }
// search
virtual int FindItem(const wxString& item) const;
wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const;
// find by position
wxMenuItem* FindItemByPosition(size_t position) const;
// get/set items attributes
void Enable(int itemid, bool enable);
bool IsEnabled(int itemid) const;
void Check(int itemid, bool check);
bool IsChecked(int itemid) const;
void SetLabel(int itemid, const wxString& label);
wxString GetLabel(int itemid) const;
// Returns the stripped label
wxString GetLabelText(int itemid) const { return wxMenuItem::GetLabelText(GetLabel(itemid)); }
virtual void SetHelpString(int itemid, const wxString& helpString);
virtual wxString GetHelpString(int itemid) const;
// misc accessors
// --------------
// the title
virtual void SetTitle(const wxString& title) { m_title = title; }
const wxString& GetTitle() const { return m_title; }
// event handler
void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
// Invoking window: this is set by wxWindow::PopupMenu() before showing a
// popup menu and reset after it's hidden. Notice that you probably want to
// use GetWindow() below instead of GetInvokingWindow() as the latter only
// returns non-NULL for the top level menus
//
// NB: avoid calling SetInvokingWindow() directly if possible, use
// wxMenuInvokingWindowSetter class below instead
void SetInvokingWindow(wxWindow *win);
wxWindow *GetInvokingWindow() const { return m_invokingWindow; }
// the window associated with this menu: this is the invoking window for
// popup menus or the top level window to which the menu bar is attached
// for menus which are part of a menu bar
wxWindow *GetWindow() const;
// style
long GetStyle() const { return m_style; }
// implementation helpers
// ----------------------
// Updates the UI for a menu and all submenus recursively by generating
// wxEVT_UPDATE_UI for all the items.
//
// Do not use the "source" argument, it allows to override the event
// handler to use for these events, but this should never be needed.
void UpdateUI(wxEvtHandler* source = NULL);
// get the menu bar this menu is attached to (may be NULL, always NULL for
// popup menus). Traverse up the menu hierarchy to find it.
wxMenuBar *GetMenuBar() const;
// called when the menu is attached/detached to/from a menu bar
virtual void Attach(wxMenuBarBase *menubar);
virtual void Detach();
// is the menu attached to a menu bar (or is it a popup one)?
bool IsAttached() const { return GetMenuBar() != NULL; }
// set/get the parent of this menu
void SetParent(wxMenu *parent) { m_menuParent = parent; }
wxMenu *GetParent() const { return m_menuParent; }
// implementation only from now on
// -------------------------------
// unlike FindItem(), this function doesn't recurse but only looks through
// our direct children and also may return the index of the found child if
// pos != NULL
wxMenuItem *FindChildItem(int itemid, size_t *pos = NULL) const;
// called to generate a wxCommandEvent, return true if it was processed,
// false otherwise
//
// the checked parameter may have boolean value or -1 for uncheckable items
bool SendEvent(int itemid, int checked = -1);
// called to dispatch a wxMenuEvent to the right recipients, menu pointer
// can be NULL if we failed to find the associated menu (this happens at
// least in wxMSW for the events from the system menus)
static
bool ProcessMenuEvent(wxMenu* menu, wxMenuEvent& event, wxWindow* win);
// compatibility: these functions are deprecated, use the new ones instead
// -----------------------------------------------------------------------
// use the versions taking wxItem_XXX now instead, they're more readable
// and allow adding the radio items as well
void Append(int itemid,
const wxString& text,
const wxString& help,
bool isCheckable)
{
Append(itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL);
}
// use more readable and not requiring unused itemid AppendSubMenu() instead
wxMenuItem* Append(int itemid,
const wxString& text,
wxMenu *submenu,
const wxString& help = wxEmptyString)
{
return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help,
wxITEM_NORMAL, submenu));
}
void Insert(size_t pos,
int itemid,
const wxString& text,
const wxString& help,
bool isCheckable)
{
Insert(pos, itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL);
}
void Prepend(int itemid,
const wxString& text,
const wxString& help,
bool isCheckable)
{
Insert(0u, itemid, text, help, isCheckable);
}
static void LockAccels(bool locked)
{
ms_locked = locked;
}
protected:
// virtuals to override in derived classes
// ---------------------------------------
virtual wxMenuItem* DoAppend(wxMenuItem *item);
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
virtual wxMenuItem *DoRemove(wxMenuItem *item);
virtual bool DoDelete(wxMenuItem *item);
virtual bool DoDestroy(wxMenuItem *item);
// helpers
// -------
// common part of all ctors
void Init(long style);
// associate the submenu with this menu
void AddSubMenu(wxMenu *submenu);
wxMenuBar *m_menuBar; // menubar we belong to or NULL
wxMenu *m_menuParent; // parent menu or NULL
wxString m_title; // the menu title or label
wxMenuItemList m_items; // the list of menu items
wxWindow *m_invokingWindow; // for popup menus
long m_style; // combination of wxMENU_XXX flags
wxEvtHandler *m_eventHandler; // a pluggable in event handler
static bool ms_locked;
private:
// Common part of SendEvent() and ProcessMenuEvent(): sends the event to
// its intended recipients, returns true if it was processed.
static bool DoProcessEvent(wxMenuBase* menu, wxEvent& event, wxWindow* win);
wxDECLARE_NO_COPY_CLASS(wxMenuBase);
};
#if wxUSE_EXTENDED_RTTI
// ----------------------------------------------------------------------------
// XTI accessor
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMenuInfoHelper : public wxObject
{
public:
wxMenuInfoHelper() { m_menu = NULL; }
virtual ~wxMenuInfoHelper() { }
bool Create( wxMenu *menu, const wxString &title )
{
m_menu = menu;
m_title = title;
return true;
}
wxMenu* GetMenu() const { return m_menu; }
wxString GetTitle() const { return m_title; }
private:
wxMenu *m_menu;
wxString m_title;
wxDECLARE_DYNAMIC_CLASS(wxMenuInfoHelper);
};
WX_DECLARE_EXPORTED_LIST(wxMenuInfoHelper, wxMenuInfoHelperList );
#endif
// ----------------------------------------------------------------------------
// wxMenuBar
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMenuBarBase : public wxWindow
{
public:
// default ctor
wxMenuBarBase();
// dtor will delete all menus we own
virtual ~wxMenuBarBase();
// menu bar construction
// ---------------------
// append a menu to the end of menubar, return true if ok
virtual bool Append(wxMenu *menu, const wxString& title);
// insert a menu before the given position into the menubar, return true
// if inserted ok
virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
// menu bar items access
// ---------------------
// get the number of menus in the menu bar
size_t GetMenuCount() const { return m_menus.GetCount(); }
// get the menu at given position
wxMenu *GetMenu(size_t pos) const;
// replace the menu at given position with another one, returns the
// previous menu (which should be deleted by the caller)
virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
// delete the menu at given position from the menu bar, return the pointer
// to the menu (which should be deleted by the caller)
virtual wxMenu *Remove(size_t pos);
// enable or disable a submenu
virtual void EnableTop(size_t pos, bool enable) = 0;
// is the menu enabled?
virtual bool IsEnabledTop(size_t WXUNUSED(pos)) const { return true; }
// get or change the label of the menu at given position
virtual void SetMenuLabel(size_t pos, const wxString& label) = 0;
virtual wxString GetMenuLabel(size_t pos) const = 0;
// get the stripped label of the menu at given position
virtual wxString GetMenuLabelText(size_t pos) const { return wxMenuItem::GetLabelText(GetMenuLabel(pos)); }
// item search
// -----------
// by menu and item names, returns wxNOT_FOUND if not found or id of the
// found item
virtual int FindMenuItem(const wxString& menu, const wxString& item) const;
// find item by id (in any menu), returns NULL if not found
//
// if menu is !NULL, it will be filled with wxMenu this item belongs to
virtual wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const;
// find menu by its caption, return wxNOT_FOUND on failure
int FindMenu(const wxString& title) const;
// item access
// -----------
// all these functions just use FindItem() and then call an appropriate
// method on it
//
// NB: under MSW, these methods can only be used after the menubar had
// been attached to the frame
void Enable(int itemid, bool enable);
void Check(int itemid, bool check);
bool IsChecked(int itemid) const;
bool IsEnabled(int itemid) const;
virtual bool IsEnabled() const { return wxWindow::IsEnabled(); }
void SetLabel(int itemid, const wxString &label);
wxString GetLabel(int itemid) const;
void SetHelpString(int itemid, const wxString& helpString);
wxString GetHelpString(int itemid) const;
// implementation helpers
// get the frame we are attached to (may return NULL)
wxFrame *GetFrame() const { return m_menuBarFrame; }
// returns true if we're attached to a frame
bool IsAttached() const { return GetFrame() != NULL; }
// associate the menubar with the frame
virtual void Attach(wxFrame *frame);
// called before deleting the menubar normally
virtual void Detach();
// need to override these ones to avoid virtual function hiding
virtual bool Enable(bool enable = true) wxOVERRIDE { return wxWindow::Enable(enable); }
virtual void SetLabel(const wxString& s) wxOVERRIDE { wxWindow::SetLabel(s); }
virtual wxString GetLabel() const wxOVERRIDE { return wxWindow::GetLabel(); }
// don't want menu bars to accept the focus by tabbing to them
virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE { return false; }
// update all menu item states in all menus
virtual void UpdateMenus();
virtual bool CanBeOutsideClientArea() const wxOVERRIDE { return true; }
#if wxUSE_EXTENDED_RTTI
// XTI helpers:
bool AppendMenuInfo( const wxMenuInfoHelper *info )
{ return Append( info->GetMenu(), info->GetTitle() ); }
const wxMenuInfoHelperList& GetMenuInfos() const;
#endif
#if WXWIN_COMPATIBILITY_2_8
// get or change the label of the menu at given position
// Deprecated in favour of SetMenuLabel
wxDEPRECATED( void SetLabelTop(size_t pos, const wxString& label) );
// Deprecated in favour of GetMenuLabelText
wxDEPRECATED( wxString GetLabelTop(size_t pos) const );
#endif
protected:
// the list of all our menus
wxMenuList m_menus;
#if wxUSE_EXTENDED_RTTI
// used by XTI
wxMenuInfoHelperList m_menuInfos;
#endif
// the frame we are attached to (may be NULL)
wxFrame *m_menuBarFrame;
wxDECLARE_NO_COPY_CLASS(wxMenuBarBase);
};
// ----------------------------------------------------------------------------
// include the real class declaration
// ----------------------------------------------------------------------------
#ifdef wxUSE_BASE_CLASSES_ONLY
#define wxMenuItem wxMenuItemBase
#else // !wxUSE_BASE_CLASSES_ONLY
#if defined(__WXUNIVERSAL__)
#include "wx/univ/menu.h"
#elif defined(__WXMSW__)
#include "wx/msw/menu.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/menu.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/menu.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/menu.h"
#elif defined(__WXMAC__)
#include "wx/osx/menu.h"
#elif defined(__WXQT__)
#include "wx/qt/menu.h"
#endif
#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY
// ----------------------------------------------------------------------------
// Helper class used in the implementation only: sets the invoking window of
// the given menu in its ctor and resets it in dtor.
// ----------------------------------------------------------------------------
class wxMenuInvokingWindowSetter
{
public:
// Ctor sets the invoking window for the given menu.
//
// The menu lifetime must be greater than that of this class.
wxMenuInvokingWindowSetter(wxMenu& menu, wxWindow *win)
: m_menu(menu)
{
menu.SetInvokingWindow(win);
}
// Dtor resets the invoking window.
~wxMenuInvokingWindowSetter()
{
m_menu.SetInvokingWindow(NULL);
}
private:
wxMenu& m_menu;
wxDECLARE_NO_COPY_CLASS(wxMenuInvokingWindowSetter);
};
#endif // wxUSE_MENUS
#endif // _WX_MENU_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/colour.h | /////////////////////////////////////////////////////////////////////////////
// Name: wx/colour.h
// Purpose: wxColourBase definition
// Author: Julian Smart
// Modified by: Francesco Montorsi
// Created:
// Copyright: Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLOUR_H_BASE_
#define _WX_COLOUR_H_BASE_
#include "wx/defs.h"
#include "wx/gdiobj.h"
class WXDLLIMPEXP_FWD_CORE wxColour;
// A macro to define the standard wxColour constructors:
//
// It avoids the need to repeat these lines across all colour.h files, since
// Set() is a virtual function and thus cannot be called by wxColourBase ctors
#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \
wxColour() { Init(); } \
wxColour(ChannelType red, \
ChannelType green, \
ChannelType blue, \
ChannelType alpha = wxALPHA_OPAQUE) \
{ Init(); Set(red, green, blue, alpha); } \
wxColour(unsigned long colRGB) { Init(); Set(colRGB ); } \
wxColour(const wxString& colourName) { Init(); Set(colourName); } \
wxColour(const char *colourName) { Init(); Set(colourName); } \
wxColour(const wchar_t *colourName) { Init(); Set(colourName); }
// flags for wxColour -> wxString conversion (see wxColour::GetAsString)
enum {
wxC2S_NAME = 1, // return colour name, when possible
wxC2S_CSS_SYNTAX = 2, // return colour in rgb(r,g,b) syntax
wxC2S_HTML_SYNTAX = 4 // return colour in #rrggbb syntax
};
const unsigned char wxALPHA_TRANSPARENT = 0;
const unsigned char wxALPHA_OPAQUE = 0xff;
// a valid but fully transparent colour
#define wxTransparentColour wxColour(0, 0, 0, wxALPHA_TRANSPARENT)
#define wxTransparentColor wxTransparentColour
// ----------------------------------------------------------------------------
// wxVariant support
// ----------------------------------------------------------------------------
#if wxUSE_VARIANT
#include "wx/variant.h"
DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLIMPEXP_CORE)
#endif
//-----------------------------------------------------------------------------
// wxColourBase: this class has no data members, just some functions to avoid
// code redundancy in all native wxColour implementations
//-----------------------------------------------------------------------------
/* Transition from wxGDIObject to wxObject is incomplete. If your port does
not need the wxGDIObject machinery to handle colors, please add it to the
list of ports which do not need it.
*/
#if defined( __WXMSW__ ) || defined( __WXQT__ )
#define wxCOLOUR_IS_GDIOBJECT 0
#else
#define wxCOLOUR_IS_GDIOBJECT 1
#endif
class WXDLLIMPEXP_CORE wxColourBase : public
#if wxCOLOUR_IS_GDIOBJECT
wxGDIObject
#else
wxObject
#endif
{
public:
// type of a single colour component
typedef unsigned char ChannelType;
wxColourBase() {}
virtual ~wxColourBase() {}
// Set() functions
// ---------------
void Set(ChannelType red,
ChannelType green,
ChannelType blue,
ChannelType alpha = wxALPHA_OPAQUE)
{ InitRGBA(red, green, blue, alpha); }
// implemented in colourcmn.cpp
bool Set(const wxString &str)
{ return FromString(str); }
void Set(unsigned long colRGB)
{
// we don't need to know sizeof(long) here because we assume that the three
// least significant bytes contain the R, G and B values
Set((ChannelType)(0xFF & colRGB),
(ChannelType)(0xFF & (colRGB >> 8)),
(ChannelType)(0xFF & (colRGB >> 16)));
}
// accessors
// ---------
virtual ChannelType Red() const = 0;
virtual ChannelType Green() const = 0;
virtual ChannelType Blue() const = 0;
virtual ChannelType Alpha() const
{ return wxALPHA_OPAQUE ; }
virtual bool IsSolid() const
{ return true; }
// implemented in colourcmn.cpp
virtual wxString GetAsString(long flags = wxC2S_NAME | wxC2S_CSS_SYNTAX) const;
void SetRGB(wxUint32 colRGB)
{
Set((ChannelType)(0xFF & colRGB),
(ChannelType)(0xFF & (colRGB >> 8)),
(ChannelType)(0xFF & (colRGB >> 16)));
}
void SetRGBA(wxUint32 colRGBA)
{
Set((ChannelType)(0xFF & colRGBA),
(ChannelType)(0xFF & (colRGBA >> 8)),
(ChannelType)(0xFF & (colRGBA >> 16)),
(ChannelType)(0xFF & (colRGBA >> 24)));
}
wxUint32 GetRGB() const
{ return Red() | (Green() << 8) | (Blue() << 16); }
wxUint32 GetRGBA() const
{ return Red() | (Green() << 8) | (Blue() << 16) | (Alpha() << 24); }
#if !wxCOLOUR_IS_GDIOBJECT
virtual bool IsOk() const= 0;
// older version, for backwards compatibility only (but not deprecated
// because it's still widely used)
bool Ok() const { return IsOk(); }
#endif
// manipulation
// ------------
// These methods are static because they are mostly used
// within tight loops (where we don't want to instantiate wxColour's)
static void MakeMono (unsigned char* r, unsigned char* g, unsigned char* b, bool on);
static void MakeDisabled(unsigned char* r, unsigned char* g, unsigned char* b, unsigned char brightness = 255);
static void MakeGrey (unsigned char* r, unsigned char* g, unsigned char* b); // integer version
static void MakeGrey (unsigned char* r, unsigned char* g, unsigned char* b,
double weight_r, double weight_g, double weight_b); // floating point version
static unsigned char AlphaBlend (unsigned char fg, unsigned char bg, double alpha);
static void ChangeLightness(unsigned char* r, unsigned char* g, unsigned char* b, int ialpha);
wxColour ChangeLightness(int ialpha) const;
wxColour& MakeDisabled(unsigned char brightness = 255);
protected:
// Some ports need Init() and while we don't, provide a stub so that the
// ports which don't need it are not forced to define it
void Init() { }
virtual void
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0;
virtual bool FromString(const wxString& s);
#if wxCOLOUR_IS_GDIOBJECT
// wxColour doesn't use reference counted data (at least not in all ports)
// so provide stubs for the functions which need to be defined if we do use
// them
virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE
{
wxFAIL_MSG( "must be overridden if used" );
return NULL;
}
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const wxOVERRIDE
{
wxFAIL_MSG( "must be overridden if used" );
return NULL;
}
#endif
};
// wxColour <-> wxString utilities, used by wxConfig, defined in colourcmn.cpp
WXDLLIMPEXP_CORE wxString wxToString(const wxColourBase& col);
WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxColourBase* col);
#if defined(__WXMSW__)
#include "wx/msw/colour.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/colour.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/colour.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/colour.h"
#elif defined(__WXDFB__)
#include "wx/generic/colour.h"
#elif defined(__WXX11__)
#include "wx/x11/colour.h"
#elif defined(__WXMAC__)
#include "wx/osx/colour.h"
#elif defined(__WXQT__)
#include "wx/qt/colour.h"
#endif
#define wxColor wxColour
#endif // _WX_COLOUR_H_BASE_
| h |
rticonnextdds-usecases | data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/checkbox.h | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/checkbox.h
// Purpose: wxCheckBox class interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 07.09.00
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CHECKBOX_H_BASE_
#define _WX_CHECKBOX_H_BASE_
#include "wx/defs.h"
#if wxUSE_CHECKBOX
#include "wx/control.h"
/*
* wxCheckBox style flags
* (Using wxCHK_* because wxCB_* is used by wxComboBox).
* Determine whether to use a 3-state or 2-state
* checkbox. 3-state enables to differentiate
* between 'unchecked', 'checked' and 'undetermined'.
*
* In addition to the styles here it is also possible to specify just 0 which
* is treated the same as wxCHK_2STATE for compatibility (but using explicit
* flag is preferred).
*/
#define wxCHK_2STATE 0x4000
#define wxCHK_3STATE 0x1000
/*
* If this style is set the user can set the checkbox to the
* undetermined state. If not set the undetermined set can only
* be set programmatically.
* This style can only be used with 3 state checkboxes.
*/
#define wxCHK_ALLOW_3RD_STATE_FOR_USER 0x2000
extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[];
// ----------------------------------------------------------------------------
// wxCheckBox: a control which shows a label and a box which may be checked
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCheckBoxBase : public wxControl
{
public:
wxCheckBoxBase() { }
// set/get the checked status of the listbox
virtual void SetValue(bool value) = 0;
virtual bool GetValue() const = 0;
bool IsChecked() const
{
wxASSERT_MSG( !Is3State(), wxT("Calling IsChecked() doesn't make sense for")
wxT(" a three state checkbox, Use Get3StateValue() instead") );
return GetValue();
}
wxCheckBoxState Get3StateValue() const
{
wxCheckBoxState state = DoGet3StateValue();
if ( state == wxCHK_UNDETERMINED && !Is3State() )
{
// Undetermined state with a 2-state checkbox??
wxFAIL_MSG( wxT("DoGet3StateValue() says the 2-state checkbox is ")
wxT("in an undetermined/third state") );
state = wxCHK_UNCHECKED;
}
return state;
}
void Set3StateValue(wxCheckBoxState state)
{
if ( state == wxCHK_UNDETERMINED && !Is3State() )
{
wxFAIL_MSG(wxT("Setting a 2-state checkbox to undetermined state"));
state = wxCHK_UNCHECKED;
}
DoSet3StateValue(state);
}
bool Is3State() const { return HasFlag(wxCHK_3STATE); }
bool Is3rdStateAllowedForUser() const
{
return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER);
}
virtual bool HasTransparentBackground() wxOVERRIDE { return true; }
// wxCheckBox-specific processing after processing the update event
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE
{
wxControl::DoUpdateWindowUI(event);
if ( event.GetSetChecked() )
SetValue(event.GetChecked());
}
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; }
virtual wxCheckBoxState DoGet3StateValue() const
{
wxFAIL;
return wxCHK_UNCHECKED;
}
// Helper function to be called from derived classes Create()
// implementations: it checks that the style doesn't contain any
// incompatible bits and modifies it to be sane if it does.
static void WXValidateStyle(long *stylePtr)
{
long& style = *stylePtr;
if ( !(style & (wxCHK_2STATE | wxCHK_3STATE)) )
{
// For compatibility we use absence of style flags as wxCHK_2STATE
// because wxCHK_2STATE used to have the value of 0 and some
// existing code uses 0 instead of it. Moreover, some code even
// uses some non-0 style, e.g. wxBORDER_XXX, but doesn't specify
// neither wxCHK_2STATE nor wxCHK_3STATE -- to avoid breaking it,
// assume (much more common) 2 state checkbox by default.
style |= wxCHK_2STATE;
}
if ( style & wxCHK_3STATE )
{
if ( style & wxCHK_2STATE )
{
wxFAIL_MSG( "wxCHK_2STATE and wxCHK_3STATE can't be used "
"together" );
style &= ~wxCHK_3STATE;
}
}
else // No wxCHK_3STATE
{
if ( style & wxCHK_ALLOW_3RD_STATE_FOR_USER )
{
wxFAIL_MSG( "wxCHK_ALLOW_3RD_STATE_FOR_USER doesn't make sense "
"without wxCHK_3STATE" );
style &= ~wxCHK_ALLOW_3RD_STATE_FOR_USER;
}
}
}
private:
wxDECLARE_NO_COPY_CLASS(wxCheckBoxBase);
};
// Most ports support 3 state checkboxes so define this by default.
#define wxHAS_3STATE_CHECKBOX
#if defined(__WXUNIVERSAL__)
#include "wx/univ/checkbox.h"
#elif defined(__WXMSW__)
#include "wx/msw/checkbox.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/checkbox.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/checkbox.h"
#elif defined(__WXGTK__)
#undef wxHAS_3STATE_CHECKBOX
#include "wx/gtk1/checkbox.h"
#elif defined(__WXMAC__)
#include "wx/osx/checkbox.h"
#elif defined(__WXQT__)
#include "wx/qt/checkbox.h"
#endif
#endif // wxUSE_CHECKBOX
#endif // _WX_CHECKBOX_H_BASE_
| h |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.