adding new files for xti merge
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66544 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
323
include/wx/rtti.h
Normal file
323
include/wx/rtti.h
Normal file
@@ -0,0 +1,323 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/rtti.h
|
||||
// Purpose: old RTTI macros (use XTI when possible instead)
|
||||
// Author: Julian Smart
|
||||
// Modified by: Ron Lee
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id: rtti.h 48412 2007-08-27 17:04:02Z FM $
|
||||
// Copyright: (c) 1997 Julian Smart
|
||||
// (c) 2001 Ron Lee <ron@debian.org>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_RTTIH__
|
||||
#define _WX_RTTIH__
|
||||
|
||||
#if !wxUSE_EXTENDED_RTTI // XTI system is meant to replace these macros
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/memory.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxObject;
|
||||
class WXDLLIMPEXP_FWD_BASE wxClassInfo;
|
||||
class WXDLLIMPEXP_FWD_BASE wxHashTable;
|
||||
class WXDLLIMPEXP_FWD_BASE wxObject;
|
||||
class WXDLLIMPEXP_FWD_BASE wxPluginLibrary;
|
||||
class WXDLLIMPEXP_FWD_BASE wxHashTable_Node;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxClassInfo
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
typedef wxObject *(*wxObjectConstructorFn)(void);
|
||||
|
||||
class WXDLLIMPEXP_BASE wxClassInfo
|
||||
{
|
||||
friend class WXDLLIMPEXP_FWD_BASE wxObject;
|
||||
friend WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name);
|
||||
public:
|
||||
wxClassInfo( const wxChar *className,
|
||||
const wxClassInfo *baseInfo1,
|
||||
const wxClassInfo *baseInfo2,
|
||||
int size,
|
||||
wxObjectConstructorFn ctor )
|
||||
: m_className(className)
|
||||
, m_objectSize(size)
|
||||
, m_objectConstructor(ctor)
|
||||
, m_baseInfo1(baseInfo1)
|
||||
, m_baseInfo2(baseInfo2)
|
||||
, m_next(sm_first)
|
||||
{
|
||||
sm_first = this;
|
||||
Register();
|
||||
}
|
||||
|
||||
~wxClassInfo();
|
||||
|
||||
wxObject *CreateObject() const
|
||||
{ return m_objectConstructor ? (*m_objectConstructor)() : 0; }
|
||||
bool IsDynamic() const { return (NULL != m_objectConstructor); }
|
||||
|
||||
const wxChar *GetClassName() const { return m_className; }
|
||||
const wxChar *GetBaseClassName1() const
|
||||
{ return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; }
|
||||
const wxChar *GetBaseClassName2() const
|
||||
{ return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; }
|
||||
const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; }
|
||||
const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; }
|
||||
int GetSize() const { return m_objectSize; }
|
||||
|
||||
wxObjectConstructorFn GetConstructor() const
|
||||
{ return m_objectConstructor; }
|
||||
static const wxClassInfo *GetFirst() { return sm_first; }
|
||||
const wxClassInfo *GetNext() const { return m_next; }
|
||||
static wxClassInfo *FindClass(const wxString& className);
|
||||
|
||||
// Climb upwards through inheritance hierarchy.
|
||||
// Dual inheritance is catered for.
|
||||
|
||||
bool IsKindOf(const wxClassInfo *info) const
|
||||
{
|
||||
return info != 0 &&
|
||||
( info == this ||
|
||||
( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) ||
|
||||
( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) );
|
||||
}
|
||||
|
||||
wxDECLARE_CLASS_INFO_ITERATORS()
|
||||
|
||||
private:
|
||||
const wxChar *m_className;
|
||||
int m_objectSize;
|
||||
wxObjectConstructorFn m_objectConstructor;
|
||||
|
||||
// Pointers to base wxClassInfos
|
||||
|
||||
const wxClassInfo *m_baseInfo1;
|
||||
const wxClassInfo *m_baseInfo2;
|
||||
|
||||
// class info object live in a linked list:
|
||||
// pointers to its head and the next element in it
|
||||
|
||||
static wxClassInfo *sm_first;
|
||||
wxClassInfo *m_next;
|
||||
|
||||
static wxHashTable *sm_classTable;
|
||||
|
||||
protected:
|
||||
// registers the class
|
||||
void Register();
|
||||
void Unregister();
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxClassInfo)
|
||||
};
|
||||
|
||||
WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Dynamic class macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxDECLARE_ABSTRACT_CLASS(name) \
|
||||
public: \
|
||||
static wxClassInfo ms_classInfo; \
|
||||
virtual wxClassInfo *GetClassInfo() const
|
||||
|
||||
#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \
|
||||
wxDECLARE_NO_ASSIGN_CLASS(name); \
|
||||
wxDECLARE_DYNAMIC_CLASS(name)
|
||||
|
||||
#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \
|
||||
wxDECLARE_NO_COPY_CLASS(name); \
|
||||
wxDECLARE_DYNAMIC_CLASS(name)
|
||||
|
||||
#define wxDECLARE_DYNAMIC_CLASS(name) \
|
||||
wxDECLARE_ABSTRACT_CLASS(name); \
|
||||
static wxObject* wxCreateObject()
|
||||
|
||||
#define wxDECLARE_CLASS(name) \
|
||||
wxDECLARE_DYNAMIC_CLASS(name)
|
||||
|
||||
|
||||
// common part of the macros below
|
||||
#define wxIMPLEMENT_CLASS_COMMON(name, basename, baseclsinfo2, func) \
|
||||
wxClassInfo name::ms_classInfo(wxT(#name), \
|
||||
&basename::ms_classInfo, \
|
||||
baseclsinfo2, \
|
||||
(int) sizeof(name), \
|
||||
func); \
|
||||
\
|
||||
wxClassInfo *name::GetClassInfo() const \
|
||||
{ return &name::ms_classInfo; }
|
||||
|
||||
#define wxIMPLEMENT_CLASS_COMMON1(name, basename, func) \
|
||||
wxIMPLEMENT_CLASS_COMMON(name, basename, NULL, func)
|
||||
|
||||
#define wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, func) \
|
||||
wxIMPLEMENT_CLASS_COMMON(name, basename1, &basename2::ms_classInfo, func)
|
||||
|
||||
// -----------------------------------
|
||||
// for concrete classes
|
||||
// -----------------------------------
|
||||
|
||||
// Single inheritance with one base class
|
||||
#define wxIMPLEMENT_DYNAMIC_CLASS(name, basename) \
|
||||
wxIMPLEMENT_CLASS_COMMON1(name, basename, name::wxCreateObject) \
|
||||
wxObject* name::wxCreateObject() \
|
||||
{ return new name; }
|
||||
|
||||
// Multiple inheritance with two base classes
|
||||
#define wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \
|
||||
wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, \
|
||||
name::wxCreateObject) \
|
||||
wxObject* name::wxCreateObject() \
|
||||
{ return new name; }
|
||||
|
||||
// -----------------------------------
|
||||
// for abstract classes
|
||||
// -----------------------------------
|
||||
|
||||
// Single inheritance with one base class
|
||||
#define wxIMPLEMENT_ABSTRACT_CLASS(name, basename) \
|
||||
wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL)
|
||||
|
||||
// Multiple inheritance with two base classes
|
||||
#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
|
||||
wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL)
|
||||
|
||||
#define wxIMPLEMENT_CLASS(name, basename) \
|
||||
wxIMPLEMENT_ABSTRACT_CLASS(name, basename)
|
||||
|
||||
#define wxIMPLEMENT_CLASS2(name, basename1, basename2) \
|
||||
IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2)
|
||||
|
||||
// -----------------------------------
|
||||
// XTI-compatible macros
|
||||
// -----------------------------------
|
||||
|
||||
#include "wx/flags.h"
|
||||
|
||||
// these macros only do something when wxUSE_EXTENDED_RTTI=1
|
||||
// (and in that case they are defined by xti.h); however to avoid
|
||||
// to be forced to wrap these macros (in user's source files) with
|
||||
//
|
||||
// #if wxUSE_EXTENDED_RTTI
|
||||
// ...
|
||||
// #endif
|
||||
//
|
||||
// blocks, we define them here as empty.
|
||||
|
||||
#define wxEMPTY_PARAMETER_VALUE /**/
|
||||
|
||||
#define wxBEGIN_ENUM( e ) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxENUM_MEMBER( v ) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxEND_ENUM( e ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxIMPLEMENT_SET_STREAMING(SetName,e) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxBEGIN_FLAGS( e ) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxFLAGS_MEMBER( v ) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxEND_FLAGS( e ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxCOLLECTION_TYPE_INFO( element, collection ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxHANDLER(name,eventClassType) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxBEGIN_HANDLERS_TABLE(theClass) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxEND_HANDLERS_TABLE() wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxIMPLEMENT_DYNAMIC_CLASS_XTI( name, basename, unit ) wxIMPLEMENT_DYNAMIC_CLASS( name, basename )
|
||||
#define wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name, basename, unit, callback ) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name, basename, unit ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name, basename, \
|
||||
unit, toString, \
|
||||
fromString ) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name, unit ) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name, basename, unit ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxIMPLEMENT_DYNAMIC_CLASS2_XTI( name, basename, basename2, unit) wxIMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2 )
|
||||
|
||||
#define wxCONSTRUCTOR_0(klass) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxCONSTRUCTOR_DUMMY(klass) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxDIRECT_CONSTRUCTOR_0(klass) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxCONSTRUCTOR_1(klass,t0,v0) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxDIRECT_CONSTRUCTOR_1(klass,t0,v0) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxDIRECT_CONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxDIRECT_CONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxDIRECT_CONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
#define wxDIRECT_CONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxSETTER( property, Klass, valueType, setterMethod ) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxGETTER( property, Klass, valueType, gettermethod ) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxADDER( property, Klass, valueType, addermethod ) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxCOLLECTION_GETTER( property, Klass, valueType, gettermethod ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxBEGIN_PROPERTIES_TABLE(theClass) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxEND_PROPERTIES_TABLE() wxEMPTY_PARAMETER_VALUE
|
||||
#define wxHIDE_PROPERTY( pname ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \
|
||||
wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxPROPERTY_FLAGS( pname, flags, type, setter, getter,defaultValue, \
|
||||
pflags, help, group) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxREADONLY_PROPERTY( pname, type, getter,defaultValue, flags, help, group) \
|
||||
wxGETTER( pname, class_t, type, getter ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxREADONLY_PROPERTY_FLAGS( pname, flags, type, getter,defaultValue, \
|
||||
pflags, help, group) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxPROPERTY_COLLECTION( pname, colltype, addelemtype, adder, getter, \
|
||||
flags, help, group ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxREADONLY_PROPERTY_COLLECTION( pname, colltype, addelemtype, getter, \
|
||||
flags, help, group) wxEMPTY_PARAMETER_VALUE
|
||||
#define wxEVENT_PROPERTY( name, eventType, eventClass ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxEVENT_RANGE_PROPERTY( name, eventType, lastEventType, eventClass ) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxIMPLEMENT_PROPERTY(name, type) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#define wxEMPTY_HANDLERS_TABLE(name) wxEMPTY_PARAMETER_VALUE
|
||||
|
||||
#endif // !wxUSE_EXTENDED_RTTI
|
||||
#endif // _WX_RTTIH__
|
279
include/wx/variantbase.h
Normal file
279
include/wx/variantbase.h
Normal file
@@ -0,0 +1,279 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
// RCS-ID: $Id: variant.h 44625 2007-03-07 11:35:04Z VZ $
|
||||
// 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(wxTEMPLATED_MEMBER_FIX(T))
|
||||
{
|
||||
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(wxTEMPLATED_MEMBER_FIX(T)) 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(wxTEMPLATED_MEMBER_FIX(T)) 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 wxTEMPLATED_FUNCTION_FIX(T)) \
|
||||
{ wxStringWriteValue( s, v.wxTEMPLATED_MEMBER_CALL(Get, T) ); }
|
||||
|
||||
template<typename T>
|
||||
void wxFromStringConverter( const wxString &s, wxVariantBase &v wxTEMPLATED_FUNCTION_FIX(T)) \
|
||||
{ T d; wxStringReadValue( s, d ); v = wxVariantBase(d); }
|
||||
|
||||
|
||||
#endif // wxUSE_VARIANT
|
||||
#endif // _WX_VARIANTBASE_H_
|
520
include/wx/xtictor.h
Normal file
520
include/wx/xtictor.h
Normal file
@@ -0,0 +1,520 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/xtictor.h
|
||||
// Purpose: XTI constructors
|
||||
// Author: Stefan Csomor
|
||||
// Modified by: Francesco Montorsi
|
||||
// Created: 27/07/03
|
||||
// RCS-ID: $Id: xti.h 47299 2007-07-10 15:58:27Z FM $
|
||||
// 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/string.h"
|
||||
#include "wx/variant.h"
|
||||
|
||||
class WXDLLIMPEXP_BASE wxObject;
|
||||
class WXDLLIMPEXP_BASE wxClassInfo;
|
||||
class WXDLLIMPEXP_BASE wxDynamicClassInfo;
|
||||
class WXDLLIMPEXP_BASE wxHashTable;
|
||||
class WXDLLIMPEXP_BASE wxHashTable_Node;
|
||||
class WXDLLIMPEXP_BASE wxObjectRefData;
|
||||
class WXDLLIMPEXP_BASE wxEvent;
|
||||
class WXDLLIMPEXP_BASE wxEvtHandler;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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, wxVariantBase *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, wxVariantBase *args) = 0;
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Constructor Bridges for all Numbers of Params
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// no params
|
||||
|
||||
template<typename Class>
|
||||
struct wxObjectAllocatorAndCreator_0 : public wxObjectAllocatorAndCreator
|
||||
{
|
||||
bool Create(wxObject * &o, wxVariantBase *)
|
||||
{
|
||||
Class *obj = wx_dynamic_cast(Class*, o);
|
||||
return obj->Create();
|
||||
}
|
||||
};
|
||||
|
||||
struct wxObjectAllocatorAndCreator_Dummy : public wxObjectAllocatorAndCreator
|
||||
{
|
||||
bool Create(wxObject *&, wxVariantBase *)
|
||||
{
|
||||
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, wxVariantBase *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, wxVariantBase *args)
|
||||
{
|
||||
Class *obj = wx_dynamic_cast(Class*, o);
|
||||
return obj->Create(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#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, wxVariantBase *args)
|
||||
{
|
||||
o = new Class(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0)
|
||||
);
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
Class *obj = wx_dynamic_cast(Class*, o);
|
||||
return obj->Create(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#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, wxVariantBase *args)
|
||||
{
|
||||
o = new Class(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1)
|
||||
);
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
Class *obj = wx_dynamic_cast(Class*, o);
|
||||
return obj->Create(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
o = new Class(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2)
|
||||
);
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
Class *obj = wx_dynamic_cast(Class*, o);
|
||||
return obj->Create(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
o = new Class(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3)
|
||||
);
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
Class *obj = wx_dynamic_cast(Class*, o);
|
||||
return obj->Create(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
o = new Class(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4)
|
||||
);
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
Class *obj = wx_dynamic_cast(Class*, o);
|
||||
return obj->Create(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
|
||||
args[5].wxTEMPLATED_MEMBER_CALL(Get, T5)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
o = new Class(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
|
||||
args[5].wxTEMPLATED_MEMBER_CALL(Get, T5)
|
||||
);
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
Class *obj = wx_dynamic_cast(Class*, o);
|
||||
return obj->Create(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
|
||||
args[5].wxTEMPLATED_MEMBER_CALL(Get, T5),
|
||||
args[6].wxTEMPLATED_MEMBER_CALL(Get, T6)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
o = new Class(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T5),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T6)
|
||||
);
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
Class *obj = wx_dynamic_cast(Class*, o);
|
||||
return obj->Create(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
|
||||
args[5].wxTEMPLATED_MEMBER_CALL(Get, T5),
|
||||
args[6].wxTEMPLATED_MEMBER_CALL(Get, T6),
|
||||
args[7].wxTEMPLATED_MEMBER_CALL(Get, T7)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
|
||||
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, wxVariantBase *args)
|
||||
{
|
||||
o = new Class(
|
||||
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
|
||||
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
|
||||
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
|
||||
args[3].wxTEMPLATED_MEMBER_CALL(Get, T5),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T6),
|
||||
args[4].wxTEMPLATED_MEMBER_CALL(Get, T7)
|
||||
);
|
||||
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_
|
110
include/wx/xtihandler.h
Normal file
110
include/wx/xtihandler.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/xtihandler.h
|
||||
// Purpose: XTI handlers
|
||||
// Author: Stefan Csomor
|
||||
// Modified by: Francesco Montorsi
|
||||
// Created: 27/07/03
|
||||
// RCS-ID: $Id: xti.h 47299 2007-07-10 15:58:27Z FM $
|
||||
// Copyright: (c) 1997 Julian Smart
|
||||
// (c) 2003 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _XTIHANDLER_H_
|
||||
#define _XTIHANDLER_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_EXTENDED_RTTI
|
||||
|
||||
#include "wx/string.h"
|
||||
|
||||
class WXDLLIMPEXP_BASE wxObject;
|
||||
class WXDLLIMPEXP_BASE wxClassInfo;
|
||||
class WXDLLIMPEXP_BASE wxDynamicClassInfo;
|
||||
class WXDLLIMPEXP_BASE wxHashTable;
|
||||
class WXDLLIMPEXP_BASE wxHashTable_Node;
|
||||
class WXDLLIMPEXP_BASE wxObjectRefData;
|
||||
class WXDLLIMPEXP_BASE wxEvent;
|
||||
class WXDLLIMPEXP_BASE wxEvtHandler;
|
||||
|
||||
typedef void (wxObject::*wxObjectEventFunction)(wxEvent&);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Handler Info
|
||||
//
|
||||
// this describes an event sink
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_BASE wxHandlerInfo
|
||||
{
|
||||
friend class WXDLLIMPEXP_BASE wxDynamicClassInfo;
|
||||
|
||||
public:
|
||||
wxHandlerInfo(wxHandlerInfo* &iter,
|
||||
wxClassInfo* itsClass,
|
||||
const wxString& name,
|
||||
wxObjectEventFunction address,
|
||||
const wxClassInfo* eventClassInfo) :
|
||||
m_eventFunction(address),
|
||||
m_name(name),
|
||||
m_eventClassInfo(eventClassInfo),
|
||||
m_itsClass(itsClass)
|
||||
{
|
||||
Insert(iter);
|
||||
}
|
||||
|
||||
~wxHandlerInfo()
|
||||
{ Remove(); }
|
||||
|
||||
// return the name of this handler
|
||||
const wxString& GetName() const { return m_name; }
|
||||
|
||||
// return the class info of the event
|
||||
const wxClassInfo *GetEventClassInfo() const { return m_eventClassInfo; }
|
||||
|
||||
// get the handler function pointer
|
||||
wxObjectEventFunction GetEventFunction() const { return m_eventFunction; }
|
||||
|
||||
// returns NULL if this is the last handler of this class
|
||||
wxHandlerInfo* GetNext() const { return m_next; }
|
||||
|
||||
// return the class this property is declared in
|
||||
const wxClassInfo* GetDeclaringClass() const { return m_itsClass; }
|
||||
|
||||
private:
|
||||
|
||||
// inserts this handler at the end of the linked chain which begins
|
||||
// with "iter" handler.
|
||||
void Insert(wxHandlerInfo* &iter);
|
||||
|
||||
// removes this handler from the linked chain of the m_itsClass handlers.
|
||||
void Remove();
|
||||
|
||||
wxObjectEventFunction m_eventFunction;
|
||||
wxString m_name;
|
||||
const wxClassInfo* m_eventClassInfo;
|
||||
wxHandlerInfo* m_next;
|
||||
wxClassInfo* m_itsClass;
|
||||
};
|
||||
|
||||
#define wxHANDLER(name,eventClassType) \
|
||||
static wxHandlerInfo _handlerInfo##name( first, class_t::GetClassInfoStatic(), \
|
||||
wxT(#name), (wxObjectEventFunction) (wxEventFunction) &name, \
|
||||
CLASSINFO( eventClassType ) );
|
||||
|
||||
#define wxBEGIN_HANDLERS_TABLE(theClass) \
|
||||
wxHandlerInfo *theClass::GetHandlersStatic() \
|
||||
{ \
|
||||
typedef theClass class_t; \
|
||||
static wxHandlerInfo* first = NULL;
|
||||
|
||||
#define wxEND_HANDLERS_TABLE() \
|
||||
return first; }
|
||||
|
||||
#define wxEMPTY_HANDLERS_TABLE(theClass) \
|
||||
wxBEGIN_HANDLERS_TABLE(theClass) \
|
||||
wxEND_HANDLERS_TABLE()
|
||||
|
||||
#endif // wxUSE_EXTENDED_RTTI
|
||||
#endif // _XTIHANDLER_H_
|
597
include/wx/xtiprop.h
Normal file
597
include/wx/xtiprop.h
Normal file
@@ -0,0 +1,597 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/xtiprop.h
|
||||
// Purpose: XTI properties
|
||||
// Author: Stefan Csomor
|
||||
// Modified by: Francesco Montorsi
|
||||
// Created: 27/07/03
|
||||
// RCS-ID: $Id: xti.h 47299 2007-07-10 15:58:27Z FM $
|
||||
// Copyright: (c) 1997 Julian Smart
|
||||
// (c) 2003 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _XTIPROP_H_
|
||||
#define _XTIPROP_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_EXTENDED_RTTI
|
||||
|
||||
#include "wx/string.h"
|
||||
#include "wx/variant.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/xtitypes.h"
|
||||
|
||||
class WXDLLIMPEXP_BASE wxObject;
|
||||
class WXDLLIMPEXP_BASE wxClassInfo;
|
||||
class WXDLLIMPEXP_BASE wxDynamicClassInfo;
|
||||
class WXDLLIMPEXP_BASE wxHashTable;
|
||||
class WXDLLIMPEXP_BASE wxHashTable_Node;
|
||||
class WXDLLIMPEXP_BASE wxObjectRefData;
|
||||
class WXDLLIMPEXP_BASE wxEvent;
|
||||
class WXDLLIMPEXP_BASE wxEvtHandler;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Property Accessors
|
||||
//
|
||||
// wxPropertySetter/Getter/CollectionGetter/CollectionAdder are all property
|
||||
// accessors which are managed by wxPropertyAccessor class which in turn is
|
||||
// handled by wxPropertyInfo.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_BASE wxPropertySetter
|
||||
{
|
||||
public:
|
||||
wxPropertySetter( const wxString name ) { m_name = name; }
|
||||
virtual ~wxPropertySetter() {}
|
||||
|
||||
virtual void Set( wxObject *object, const wxVariantBase &variantValue ) const = 0;
|
||||
const wxString& GetName() const { return m_name; }
|
||||
|
||||
private:
|
||||
wxString m_name;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxPropertyGetter
|
||||
{
|
||||
public:
|
||||
wxPropertyGetter( const wxString name ) { m_name = name; }
|
||||
virtual ~wxPropertyGetter() {}
|
||||
|
||||
virtual void Get( const wxObject *object, wxVariantBase& result) const = 0;
|
||||
const wxString& GetName() const { return m_name; }
|
||||
|
||||
private:
|
||||
wxString m_name;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxPropertyCollectionGetter
|
||||
{
|
||||
public:
|
||||
wxPropertyCollectionGetter( const wxString name ) { m_name = name; }
|
||||
virtual ~wxPropertyCollectionGetter() {}
|
||||
|
||||
virtual void Get( const wxObject *object, wxVariantBaseArray& result) const = 0;
|
||||
const wxString& GetName() const { return m_name; }
|
||||
|
||||
private:
|
||||
wxString m_name;
|
||||
};
|
||||
|
||||
template<typename coll_t> void WXDLLIMPEXP_BASE \
|
||||
wxCollectionToVariantArray( const coll_t& coll, wxVariantBaseArray& result );
|
||||
|
||||
class WXDLLIMPEXP_BASE wxPropertyCollectionAdder
|
||||
{
|
||||
public:
|
||||
wxPropertyCollectionAdder( const wxString name ) { m_name = name; }
|
||||
virtual ~wxPropertyCollectionAdder() {}
|
||||
|
||||
virtual void Add( wxObject *object, const wxVariantBase &variantValue ) const= 0;
|
||||
const wxString& GetName() const { return m_name; }
|
||||
|
||||
private:
|
||||
wxString m_name;
|
||||
};
|
||||
|
||||
#define wxPROPERTY_SETTER( property, Klass, valueType, setterMethod ) \
|
||||
class wxPropertySetter##property : public wxPropertySetter \
|
||||
{ \
|
||||
public: \
|
||||
wxINFUNC_CLASS_TYPE_FIX(Klass) \
|
||||
wxPropertySetter##property() : wxPropertySetter( wxT(#setterMethod) ) {} \
|
||||
virtual ~wxPropertySetter##property() {} \
|
||||
\
|
||||
void Set( wxObject *object, const wxVariantBase &variantValue ) const \
|
||||
{ \
|
||||
Klass *obj = dynamic_cast<Klass*>(object); \
|
||||
if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \
|
||||
obj->setterMethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType)); \
|
||||
else \
|
||||
obj->setterMethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType*)); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define wxPROPERTY_GETTER( property, Klass, valueType, gettermethod ) \
|
||||
class wxPropertyGetter##property : public wxPropertyGetter \
|
||||
{ \
|
||||
public: \
|
||||
wxINFUNC_CLASS_TYPE_FIX(Klass) \
|
||||
wxPropertyGetter##property() : wxPropertyGetter( wxT(#gettermethod) ) {} \
|
||||
virtual ~wxPropertyGetter##property() {} \
|
||||
\
|
||||
void Get( const wxObject *object, wxVariantBase &result) const \
|
||||
{ \
|
||||
const Klass *obj = dynamic_cast<const Klass*>(object); \
|
||||
result = wxVariantBase( obj->gettermethod() ); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define wxPROPERTY_COLLECTION_ADDER( property, Klass, valueType, addermethod ) \
|
||||
class wxPropertyCollectionAdder##property : public wxPropertyCollectionAdder \
|
||||
{ \
|
||||
public: \
|
||||
wxINFUNC_CLASS_TYPE_FIX(Klass) \
|
||||
wxPropertyCollectionAdder##property() : wxPropertyCollectionAdder( wxT(#addermethod) ) {} \
|
||||
virtual ~wxPropertyCollectionAdder##property() {} \
|
||||
\
|
||||
void Add( wxObject *object, const wxVariantBase &variantValue ) const \
|
||||
{ \
|
||||
Klass *obj = dynamic_cast<Klass*>(object); \
|
||||
if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \
|
||||
obj->addermethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType)); \
|
||||
else \
|
||||
obj->addermethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType*)); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define wxPROPERTY_COLLECTION_GETTER( property, Klass, valueType, gettermethod ) \
|
||||
class wxPropertyCollectionGetter##property : public wxPropertyCollectionGetter \
|
||||
{ \
|
||||
public: \
|
||||
wxINFUNC_CLASS_TYPE_FIX(Klass) \
|
||||
wxPropertyCollectionGetter##property() : wxPropertyCollectionGetter( wxT(#gettermethod) ) {} \
|
||||
virtual ~wxPropertyCollectionGetter##property() {} \
|
||||
\
|
||||
void Get( const wxObject *object, wxVariantBaseArray &result) const \
|
||||
{ \
|
||||
const Klass *obj = dynamic_cast<const Klass*>(object); \
|
||||
wxCollectionToVariantArray( obj->gettermethod(), result ); \
|
||||
} \
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxPropertyAccessor
|
||||
{
|
||||
public:
|
||||
wxPropertyAccessor( wxPropertySetter *setter, wxPropertyGetter *getter,
|
||||
wxPropertyCollectionAdder *adder, wxPropertyCollectionGetter *collectionGetter )
|
||||
{ m_setter = setter; m_getter = getter; m_adder = adder;
|
||||
m_collectionGetter = collectionGetter; }
|
||||
|
||||
virtual ~wxPropertyAccessor() {}
|
||||
|
||||
// Setting a simple property (non-collection)
|
||||
virtual void SetProperty(wxObject *object, const wxVariantBase &value) const
|
||||
{
|
||||
if ( m_setter )
|
||||
m_setter->Set( object, value );
|
||||
else
|
||||
wxLogError( _("SetProperty called w/o valid setter") );
|
||||
}
|
||||
|
||||
// Getting a simple property (non-collection)
|
||||
virtual void GetProperty(const wxObject *object, wxVariantBase &result) const
|
||||
{
|
||||
if ( m_getter )
|
||||
m_getter->Get( object, result );
|
||||
else
|
||||
wxLogError( _("GetProperty called w/o valid getter") );
|
||||
}
|
||||
|
||||
// Adding an element to a collection property
|
||||
virtual void AddToPropertyCollection(wxObject *object, const wxVariantBase &value) const
|
||||
{
|
||||
if ( m_adder )
|
||||
m_adder->Add( object, value );
|
||||
else
|
||||
wxLogError( _("AddToPropertyCollection called w/o valid adder") );
|
||||
}
|
||||
|
||||
// Getting a collection property
|
||||
virtual void GetPropertyCollection( const wxObject *obj, wxVariantBaseArray &result) const
|
||||
{
|
||||
if ( m_collectionGetter )
|
||||
m_collectionGetter->Get( obj, result);
|
||||
else
|
||||
wxLogError( _("GetPropertyCollection called w/o valid collection getter") );
|
||||
}
|
||||
|
||||
virtual bool HasSetter() const { return m_setter != NULL; }
|
||||
virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL; }
|
||||
virtual bool HasGetter() const { return m_getter != NULL; }
|
||||
virtual bool HasAdder() const { return m_adder != NULL; }
|
||||
|
||||
virtual const wxString& GetCollectionGetterName() const
|
||||
{ return m_collectionGetter->GetName(); }
|
||||
virtual const wxString& GetGetterName() const
|
||||
{ return m_getter->GetName(); }
|
||||
virtual const wxString& GetSetterName() const
|
||||
{ return m_setter->GetName(); }
|
||||
virtual const wxString& GetAdderName() const
|
||||
{ return m_adder->GetName(); }
|
||||
|
||||
protected:
|
||||
wxPropertySetter *m_setter;
|
||||
wxPropertyCollectionAdder *m_adder;
|
||||
wxPropertyGetter *m_getter;
|
||||
wxPropertyCollectionGetter* m_collectionGetter;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxGenericPropertyAccessor : public wxPropertyAccessor
|
||||
{
|
||||
public:
|
||||
wxGenericPropertyAccessor( const wxString &propName );
|
||||
virtual ~wxGenericPropertyAccessor();
|
||||
|
||||
void RenameProperty( const wxString& WXUNUSED_UNLESS_DEBUG(oldName),
|
||||
const wxString& newName )
|
||||
{
|
||||
wxASSERT( oldName == m_propertyName ); m_propertyName = newName;
|
||||
}
|
||||
|
||||
virtual bool HasSetter() const { return true; }
|
||||
virtual bool HasGetter() const { return true; }
|
||||
virtual bool HasAdder() const { return false; }
|
||||
virtual bool HasCollectionGetter() const { return false; }
|
||||
|
||||
virtual const wxString& GetGetterName() const
|
||||
{ return m_getterName; }
|
||||
virtual const wxString& GetSetterName() const
|
||||
{ return m_setterName; }
|
||||
|
||||
virtual void SetProperty(wxObject *object, const wxVariantBase &value) const;
|
||||
virtual void GetProperty(const wxObject *object, wxVariantBase &value) const;
|
||||
|
||||
// Adding an element to a collection property
|
||||
virtual void AddToPropertyCollection(wxObject *WXUNUSED(object),
|
||||
const wxVariantBase &WXUNUSED(value)) const
|
||||
{
|
||||
wxLogError( _("AddToPropertyCollection called on a generic accessor") );
|
||||
}
|
||||
|
||||
// Getting a collection property
|
||||
virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj),
|
||||
wxVariantBaseArray &WXUNUSED(result)) const
|
||||
{
|
||||
wxLogError ( _("GetPropertyCollection called on a generic accessor") );
|
||||
}
|
||||
|
||||
private:
|
||||
struct wxGenericPropertyAccessorInternal;
|
||||
wxGenericPropertyAccessorInternal* m_data;
|
||||
wxString m_propertyName;
|
||||
wxString m_setterName;
|
||||
wxString m_getterName;
|
||||
};
|
||||
|
||||
typedef long wxPropertyInfoFlags;
|
||||
enum
|
||||
{
|
||||
// will be removed in future releases
|
||||
wxPROP_DEPRECATED = 0x00000001,
|
||||
|
||||
// object graph property, will be streamed with priority (after constructor properties)
|
||||
wxPROP_OBJECT_GRAPH = 0x00000002,
|
||||
|
||||
// this will only be streamed out and in as enum/set, the internal representation
|
||||
// is still a long
|
||||
wxPROP_ENUM_STORE_LONG = 0x00000004,
|
||||
|
||||
// don't stream out this property, needed eg to avoid streaming out children
|
||||
// that are always created by their parents
|
||||
wxPROP_DONT_STREAM = 0x00000008
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Property Support
|
||||
//
|
||||
// wxPropertyInfo is used to inquire of the property by name. It doesn't
|
||||
// provide access to the property, only information about it. If you
|
||||
// want access, look at wxPropertyAccessor.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_BASE wxPropertyInfo
|
||||
{
|
||||
friend class WXDLLIMPEXP_BASE wxDynamicClassInfo;
|
||||
|
||||
public:
|
||||
wxPropertyInfo(wxPropertyInfo* &iter,
|
||||
wxClassInfo* itsClass,
|
||||
const wxString& name,
|
||||
const wxString& typeName,
|
||||
wxPropertyAccessor *accessor,
|
||||
wxVariantBase dv,
|
||||
wxPropertyInfoFlags flags = 0,
|
||||
const wxString& helpString = wxEmptyString,
|
||||
const wxString& groupString = wxEmptyString) :
|
||||
m_itsClass(itsClass),
|
||||
m_name(name),
|
||||
m_typeInfo(NULL),
|
||||
m_typeName(typeName),
|
||||
m_collectionElementTypeInfo(NULL),
|
||||
m_accessor(accessor),
|
||||
m_defaultValue(dv),
|
||||
m_flags(flags),
|
||||
m_helpString(helpString),
|
||||
m_groupString(groupString)
|
||||
{
|
||||
Insert(iter);
|
||||
}
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxPropertyInfo(wxPropertyInfo* &iter,
|
||||
wxClassInfo* itsClass,
|
||||
const wxString& name,
|
||||
const char* typeName,
|
||||
wxPropertyAccessor *accessor,
|
||||
wxVariantBase dv,
|
||||
wxPropertyInfoFlags flags = 0,
|
||||
const wxString& helpString = wxEmptyString,
|
||||
const wxString& groupString = wxEmptyString) :
|
||||
m_itsClass(itsClass),
|
||||
m_name(name),
|
||||
m_typeInfo(NULL),
|
||||
m_typeName(wxString::FromAscii(typeName)),
|
||||
m_collectionElementTypeInfo(NULL),
|
||||
m_accessor(accessor),
|
||||
m_defaultValue(dv),
|
||||
m_flags(flags),
|
||||
m_helpString(helpString),
|
||||
m_groupString(groupString)
|
||||
{
|
||||
Insert(iter);
|
||||
}
|
||||
#endif
|
||||
wxPropertyInfo(wxPropertyInfo* &iter,
|
||||
wxClassInfo* itsClass,
|
||||
const wxString& name,
|
||||
wxEventSourceTypeInfo* type,
|
||||
wxPropertyAccessor *accessor,
|
||||
wxVariantBase dv,
|
||||
wxPropertyInfoFlags flags = 0,
|
||||
const wxString& helpString = wxEmptyString,
|
||||
const wxString& groupString = wxEmptyString) :
|
||||
m_itsClass(itsClass),
|
||||
m_name(name),
|
||||
m_typeInfo(type),
|
||||
m_collectionElementTypeInfo(NULL),
|
||||
m_accessor(accessor),
|
||||
m_defaultValue(dv),
|
||||
m_flags(flags),
|
||||
m_helpString(helpString),
|
||||
m_groupString(groupString)
|
||||
{
|
||||
Insert(iter);
|
||||
}
|
||||
|
||||
wxPropertyInfo(wxPropertyInfo* &iter,
|
||||
wxClassInfo* itsClass, const wxString& name,
|
||||
const wxString& collectionTypeName,
|
||||
const wxString& elementTypeName,
|
||||
wxPropertyAccessor *accessor,
|
||||
wxPropertyInfoFlags flags = 0,
|
||||
const wxString& helpString = wxEmptyString,
|
||||
const wxString& groupString = wxEmptyString) :
|
||||
m_itsClass(itsClass),
|
||||
m_name(name),
|
||||
m_typeInfo(NULL),
|
||||
m_typeName(collectionTypeName),
|
||||
m_collectionElementTypeInfo(NULL),
|
||||
m_collectionElementTypeName(elementTypeName),
|
||||
m_accessor(accessor),
|
||||
m_flags(flags),
|
||||
m_helpString(helpString),
|
||||
m_groupString(groupString)
|
||||
{
|
||||
Insert(iter);
|
||||
}
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxPropertyInfo(wxPropertyInfo* &iter,
|
||||
wxClassInfo* itsClass, const wxString& name,
|
||||
const char* collectionTypeName,
|
||||
const char* elementTypeName,
|
||||
wxPropertyAccessor *accessor,
|
||||
wxPropertyInfoFlags flags = 0,
|
||||
const wxString& helpString = wxEmptyString,
|
||||
const wxString& groupString = wxEmptyString) :
|
||||
m_itsClass(itsClass),
|
||||
m_name(name),
|
||||
m_typeInfo(NULL),
|
||||
m_typeName(wxString::FromAscii(collectionTypeName)),
|
||||
m_collectionElementTypeInfo(NULL),
|
||||
m_collectionElementTypeName(wxString::FromAscii(elementTypeName)),
|
||||
m_accessor(accessor),
|
||||
m_flags(flags),
|
||||
m_helpString(helpString),
|
||||
m_groupString(groupString)
|
||||
{
|
||||
Insert(iter);
|
||||
}
|
||||
#endif
|
||||
~wxPropertyInfo()
|
||||
{ Remove(); }
|
||||
|
||||
// return the class this property is declared in
|
||||
const wxClassInfo* GetDeclaringClass() const { return m_itsClass; }
|
||||
|
||||
// return the name of this property
|
||||
const wxString& GetName() const { return m_name; }
|
||||
|
||||
// returns the flags of this property
|
||||
wxPropertyInfoFlags GetFlags() const { return m_flags; }
|
||||
|
||||
// returns the short help string of this property
|
||||
const wxString& GetHelpString() const { return m_helpString; }
|
||||
|
||||
// returns the group string of this property
|
||||
const wxString& GetGroupString() const { return m_groupString; }
|
||||
|
||||
// return the element type info of this property (for collections, otherwise NULL)
|
||||
const wxTypeInfo * GetCollectionElementTypeInfo() const
|
||||
{
|
||||
if ( m_collectionElementTypeInfo == NULL )
|
||||
m_collectionElementTypeInfo = wxTypeInfo::FindType(m_collectionElementTypeName);
|
||||
return m_collectionElementTypeInfo;
|
||||
}
|
||||
|
||||
// return the type info of this property
|
||||
const wxTypeInfo * GetTypeInfo() const
|
||||
{
|
||||
if ( m_typeInfo == NULL )
|
||||
m_typeInfo = wxTypeInfo::FindType(m_typeName);
|
||||
return m_typeInfo;
|
||||
}
|
||||
|
||||
// return the accessor for this property
|
||||
wxPropertyAccessor* GetAccessor() const { return m_accessor; }
|
||||
|
||||
// returns NULL if this is the last property of this class
|
||||
wxPropertyInfo* GetNext() const { return m_next; }
|
||||
|
||||
// returns the default value of this property, its kind may be wxT_VOID if it is not valid
|
||||
wxVariantBase GetDefaultValue() const { return m_defaultValue; }
|
||||
|
||||
private:
|
||||
|
||||
// inserts this property at the end of the linked chain which begins
|
||||
// with "iter" property.
|
||||
void Insert(wxPropertyInfo* &iter);
|
||||
|
||||
// removes this property from the linked chain of the m_itsClass properties.
|
||||
void Remove();
|
||||
|
||||
wxClassInfo* m_itsClass;
|
||||
wxString m_name;
|
||||
mutable wxTypeInfo* m_typeInfo;
|
||||
wxString m_typeName;
|
||||
mutable wxTypeInfo* m_collectionElementTypeInfo;
|
||||
wxString m_collectionElementTypeName;
|
||||
wxPropertyAccessor* m_accessor;
|
||||
wxVariantBase m_defaultValue;
|
||||
wxPropertyInfoFlags m_flags;
|
||||
wxString m_helpString;
|
||||
wxString m_groupString;
|
||||
wxPropertyInfo* m_next;
|
||||
|
||||
// FIXME: what's this comment about??
|
||||
// string representation of the default value
|
||||
// to be assigned by the designer to the property
|
||||
// when the component is dropped on the container.
|
||||
};
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMap,
|
||||
class WXDLLIMPEXP_BASE );
|
||||
|
||||
#define wxBEGIN_PROPERTIES_TABLE(theClass) \
|
||||
wxPropertyInfo *theClass::GetPropertiesStatic() \
|
||||
{ \
|
||||
typedef theClass class_t; \
|
||||
static wxPropertyInfo* first = NULL;
|
||||
|
||||
#define wxEND_PROPERTIES_TABLE() \
|
||||
return first; }
|
||||
|
||||
#define wxHIDE_PROPERTY( pname ) \
|
||||
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
|
||||
wxT(#pname), typeid(void).name(), NULL, wxVariantBase(), wxPROP_DONT_STREAM, \
|
||||
wxEmptyString, wxEmptyString );
|
||||
|
||||
#define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \
|
||||
wxPROPERTY_SETTER( pname, class_t, type, setter ) \
|
||||
static wxPropertySetter##pname _setter##pname; \
|
||||
wxPROPERTY_GETTER( pname, class_t, type, getter ) \
|
||||
static wxPropertyGetter##pname _getter##pname; \
|
||||
static wxPropertyAccessor _accessor##pname( &_setter##pname, \
|
||||
&_getter##pname, NULL, NULL ); \
|
||||
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
|
||||
wxT(#pname), typeid(type).name(), &_accessor##pname, \
|
||||
wxVariantBase(defaultValue), flags, group, help );
|
||||
|
||||
#define wxPROPERTY_FLAGS( pname, flags, type, setter, getter,defaultValue, \
|
||||
pflags, help, group) \
|
||||
wxPROPERTY_SETTER( pname, class_t, type, setter ) \
|
||||
static wxPropertySetter##pname _setter##pname; \
|
||||
wxPROPERTY_GETTER( pname, class_t, type, getter ) \
|
||||
static wxPropertyGetter##pname _getter##pname; \
|
||||
static wxPropertyAccessor _accessor##pname( &_setter##pname, \
|
||||
&_getter##pname, NULL, NULL ); \
|
||||
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
|
||||
wxT(#pname), typeid(flags).name(), &_accessor##pname, \
|
||||
wxVariantBase(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group );
|
||||
|
||||
#define wxREADONLY_PROPERTY( pname, type, getter,defaultValue, flags, help, group) \
|
||||
wxPROPERTY_GETTER( pname, class_t, type, getter ) \
|
||||
static wxPropertyGetter##pname _getter##pname; \
|
||||
static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \
|
||||
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
|
||||
wxT(#pname), typeid(type).name(),&_accessor##pname, \
|
||||
wxVariantBase(defaultValue), flags, help, group );
|
||||
|
||||
#define wxREADONLY_PROPERTY_FLAGS( pname, flags, type, getter,defaultValue, \
|
||||
pflags, help, group) \
|
||||
wxPROPERTY_GETTER( pname, class_t, type, getter ) \
|
||||
static wxPropertyGetter##pname _getter##pname; \
|
||||
static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \
|
||||
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
|
||||
wxT(#pname), typeid(flags).name(),&_accessor##pname, \
|
||||
wxVariantBase(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group );
|
||||
|
||||
#define wxPROPERTY_COLLECTION( pname, colltype, addelemtype, adder, getter, \
|
||||
flags, help, group ) \
|
||||
wxPROPERTY_COLLECTION_ADDER( pname, class_t, addelemtype, adder ) \
|
||||
static wxPropertyCollectionAdder##pname _adder##pname; \
|
||||
wxPROPERTY_COLLECTION_GETTER( pname, class_t, colltype, getter ) \
|
||||
static wxPropertyCollectionGetter##pname _collectionGetter##pname; \
|
||||
static wxPropertyAccessor _accessor##pname( NULL, NULL,&_adder##pname, \
|
||||
&_collectionGetter##pname ); \
|
||||
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
|
||||
wxT(#pname), typeid(colltype).name(),typeid(addelemtype).name(), \
|
||||
&_accessor##pname, flags, help, group );
|
||||
|
||||
#define wxREADONLY_PROPERTY_COLLECTION( pname, colltype, addelemtype, getter, \
|
||||
flags, help, group) \
|
||||
wxPROPERTY_COLLECTION_GETTER( pname, class_t, colltype, getter ) \
|
||||
static wxPropertyCollectionGetter##pname _collectionGetter##pname; \
|
||||
static wxPropertyAccessor _accessor##pname( NULL, NULL, NULL, \
|
||||
&_collectionGetter##pname ); \
|
||||
static wxPropertyInfo _propertyInfo##pname( first,class_t::GetClassInfoStatic(), \
|
||||
wxT(#pname), typeid(colltype).name(),typeid(addelemtype).name(), \
|
||||
&_accessor##pname, flags, help, group );
|
||||
|
||||
#define wxEVENT_PROPERTY( name, eventType, eventClass ) \
|
||||
static wxEventSourceTypeInfo _typeInfo##name( eventType, CLASSINFO( eventClass ) ); \
|
||||
static wxPropertyInfo _propertyInfo##name( first,class_t::GetClassInfoStatic(), \
|
||||
wxT(#name), &_typeInfo##name, NULL, wxVariantBase() );
|
||||
|
||||
#define wxEVENT_RANGE_PROPERTY( name, eventType, lastEventType, eventClass ) \
|
||||
static wxEventSourceTypeInfo _typeInfo##name( eventType, lastEventType, \
|
||||
CLASSINFO( eventClass ) ); \
|
||||
static wxPropertyInfo _propertyInfo##name( first, class_t::GetClassInfoStatic(), \
|
||||
wxT(#name), &_typeInfo##name, NULL, wxVariantBase() );
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Implementation Helper for Simple Properties
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxIMPLEMENT_PROPERTY(name, type) \
|
||||
private: \
|
||||
type m_##name; \
|
||||
public: \
|
||||
void Set##name( type const & p) { m_##name = p; } \
|
||||
type const & Get##name() const { return m_##name; }
|
||||
|
||||
#endif // wxUSE_EXTENDED_RTTI
|
||||
#endif // _XTIPROP_H_
|
581
include/wx/xtitypes.h
Normal file
581
include/wx/xtitypes.h
Normal file
@@ -0,0 +1,581 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/xtitypes.h
|
||||
// Purpose: enum, set, basic types support
|
||||
// Author: Stefan Csomor
|
||||
// Modified by: Francesco Montorsi
|
||||
// Created: 27/07/03
|
||||
// RCS-ID: $Id: xti.h 47299 2007-07-10 15:58:27Z FM $
|
||||
// Copyright: (c) 1997 Julian Smart
|
||||
// (c) 2003 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _XTITYPES_H_
|
||||
#define _XTITYPES_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_EXTENDED_RTTI
|
||||
|
||||
#include "wx/string.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/arrstr.h"
|
||||
#include "wx/flags.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#include <typeinfo>
|
||||
|
||||
class WXDLLIMPEXP_BASE wxClassInfo;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Enum Support
|
||||
//
|
||||
// In the header files XTI requires no change from pure c++ code, however in the
|
||||
// implementation, an enum needs to be enumerated eg:
|
||||
//
|
||||
// wxBEGIN_ENUM( wxFlavor )
|
||||
// wxENUM_MEMBER( Vanilla )
|
||||
// wxENUM_MEMBER( Chocolate )
|
||||
// wxENUM_MEMBER( Strawberry )
|
||||
// wxEND_ENUM( wxFlavor )
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct WXDLLIMPEXP_BASE wxEnumMemberData
|
||||
{
|
||||
const wxChar* m_name;
|
||||
int m_value;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxEnumData
|
||||
{
|
||||
public:
|
||||
wxEnumData( wxEnumMemberData* data );
|
||||
|
||||
// returns true if the member has been found and sets the int value
|
||||
// pointed to accordingly (if ptr != null )
|
||||
// if not found returns false, value left unchanged
|
||||
bool HasEnumMemberValue( const wxChar *name, int *value = NULL ) const;
|
||||
|
||||
// returns the value of the member, if not found in debug mode an
|
||||
// assert is issued, in release 0 is returned
|
||||
int GetEnumMemberValue(const wxChar *name ) const;
|
||||
|
||||
// returns the name of the enum member having the passed in value
|
||||
// returns an emtpy string if not found
|
||||
const wxChar *GetEnumMemberName(int value) const;
|
||||
|
||||
// returns the number of members in this enum
|
||||
int GetEnumCount() const { return m_count; }
|
||||
|
||||
// returns the value of the nth member
|
||||
int GetEnumMemberValueByIndex( int n ) const;
|
||||
|
||||
// returns the value of the nth member
|
||||
const wxChar *GetEnumMemberNameByIndex( int n ) const;
|
||||
|
||||
private:
|
||||
wxEnumMemberData *m_members;
|
||||
int m_count;
|
||||
};
|
||||
|
||||
#define wxBEGIN_ENUM( e ) \
|
||||
wxEnumMemberData s_enumDataMembers##e[] = {
|
||||
|
||||
#define wxENUM_MEMBER( v ) { wxT(#v), v },
|
||||
|
||||
#define wxEND_ENUM( e ) \
|
||||
{ NULL, 0 } }; \
|
||||
wxEnumData s_enumData##e( s_enumDataMembers##e ); \
|
||||
wxEnumData *wxGetEnumData(e) { return &s_enumData##e; } \
|
||||
template<> void wxStringReadValue(const wxString& s, e &data ) \
|
||||
{ data = (e) s_enumData##e.GetEnumMemberValue(s); } \
|
||||
template<> void wxStringWriteValue(wxString &s, const e &data ) \
|
||||
{ s = s_enumData##e.GetEnumMemberName((int)data); } \
|
||||
void FromLong##e( long data, wxVariantBase& result ) \
|
||||
{ result = wxVariantBase((e)data); } \
|
||||
void ToLong##e( const wxVariantBase& data, long &result ) \
|
||||
{ result = (long) data.wxTEMPLATED_MEMBER_CALL(Get, e); } \
|
||||
\
|
||||
wxTO_STRING_IMP( e ) \
|
||||
wxFROM_STRING_IMP( e ) \
|
||||
wxEnumTypeInfo s_typeInfo##e(wxT_ENUM, &s_enumData##e, \
|
||||
&wxTO_STRING( e ), &wxFROM_STRING( e ), &ToLong##e, \
|
||||
&FromLong##e, typeid(e).name() );
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Set Support
|
||||
//
|
||||
// in the header :
|
||||
//
|
||||
// enum wxFlavor
|
||||
// {
|
||||
// Vanilla,
|
||||
// Chocolate,
|
||||
// Strawberry,
|
||||
// };
|
||||
//
|
||||
// typedef wxBitset<wxFlavor> wxCoupe;
|
||||
//
|
||||
// in the implementation file :
|
||||
//
|
||||
// wxBEGIN_ENUM( wxFlavor )
|
||||
// wxENUM_MEMBER( Vanilla )
|
||||
// wxENUM_MEMBER( Chocolate )
|
||||
// wxENUM_MEMBER( Strawberry )
|
||||
// wxEND_ENUM( wxFlavor )
|
||||
//
|
||||
// wxIMPLEMENT_SET_STREAMING( wxCoupe, wxFlavor )
|
||||
//
|
||||
// implementation note: no partial specialization for streaming, but a delegation
|
||||
// to a different class
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// in order to remove dependancy on string tokenizer
|
||||
void WXDLLIMPEXP_BASE wxSetStringToArray( const wxString &s, wxArrayString &array );
|
||||
|
||||
template<typename e>
|
||||
void wxSetFromString(const wxString &s, wxBitset<e> &data )
|
||||
{
|
||||
wxEnumData* edata = wxGetEnumData((e) 0);
|
||||
data.reset();
|
||||
|
||||
wxArrayString array;
|
||||
wxSetStringToArray( s, array );
|
||||
wxString flag;
|
||||
for ( int i = 0; i < array.Count(); ++i )
|
||||
{
|
||||
flag = array[i];
|
||||
int ivalue;
|
||||
if ( edata->HasEnumMemberValue( flag, &ivalue ) )
|
||||
{
|
||||
data.set( (e) ivalue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename e>
|
||||
void wxSetToString( wxString &s, const wxBitset<e> &data )
|
||||
{
|
||||
wxEnumData* edata = wxGetEnumData((e) 0);
|
||||
int count = edata->GetEnumCount();
|
||||
int i;
|
||||
s.Clear();
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
e value = (e) edata->GetEnumMemberValueByIndex(i);
|
||||
if ( data.test( value ) )
|
||||
{
|
||||
// this could also be done by the templated calls
|
||||
if ( !s.empty() )
|
||||
s += wxT("|");
|
||||
s += edata->GetEnumMemberNameByIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define wxIMPLEMENT_SET_STREAMING(SetName,e) \
|
||||
template<> void wxStringReadValue(const wxString &s, wxBitset<e> &data ) \
|
||||
{ wxSetFromString( s, data ); } \
|
||||
template<> void wxStringWriteValue( wxString &s, const wxBitset<e> &data ) \
|
||||
{ wxSetToString( s, data ); } \
|
||||
void FromLong##SetName( long data, wxVariantBase& result ) \
|
||||
{ result = wxVariantBase(SetName((unsigned long)data)); } \
|
||||
void ToLong##SetName( const wxVariantBase& data, long &result ) \
|
||||
{ result = (long) data.wxTEMPLATED_MEMBER_CALL(Get, SetName).to_ulong(); } \
|
||||
wxTO_STRING_IMP( SetName ) \
|
||||
wxFROM_STRING_IMP( SetName ) \
|
||||
wxEnumTypeInfo s_typeInfo##SetName(wxT_SET, &s_enumData##e, \
|
||||
&wxTO_STRING( SetName ), &wxFROM_STRING( SetName ), \
|
||||
&ToLong##SetName, &FromLong##SetName, typeid(SetName).name() );
|
||||
|
||||
template<typename e>
|
||||
void wxFlagsFromString(const wxString &s, e &data )
|
||||
{
|
||||
wxEnumData* edata = wxGetEnumData((e*) 0);
|
||||
data.m_data = 0;
|
||||
|
||||
wxArrayString array;
|
||||
wxSetStringToArray( s, array );
|
||||
wxString flag;
|
||||
for ( size_t i = 0; i < array.Count(); ++i )
|
||||
{
|
||||
flag = array[i];
|
||||
int ivalue;
|
||||
if ( edata->HasEnumMemberValue( flag, &ivalue ) )
|
||||
{
|
||||
data.m_data |= ivalue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename e>
|
||||
void wxFlagsToString( wxString &s, const e& data )
|
||||
{
|
||||
wxEnumData* edata = wxGetEnumData((e*) 0);
|
||||
int count = edata->GetEnumCount();
|
||||
int i;
|
||||
s.Clear();
|
||||
long dataValue = data.m_data;
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
int value = edata->GetEnumMemberValueByIndex(i);
|
||||
// make this to allow for multi-bit constants to work
|
||||
if ( value && ( dataValue & value ) == value )
|
||||
{
|
||||
// clear the flags we just set
|
||||
dataValue &= ~value;
|
||||
// this could also be done by the templated calls
|
||||
if ( !s.empty() )
|
||||
s +=wxT("|");
|
||||
s += edata->GetEnumMemberNameByIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define wxBEGIN_FLAGS( e ) \
|
||||
wxEnumMemberData s_enumDataMembers##e[] = {
|
||||
|
||||
#define wxFLAGS_MEMBER( v ) { wxT(#v), v },
|
||||
|
||||
#define wxEND_FLAGS( e ) \
|
||||
{ NULL, 0 } }; \
|
||||
wxEnumData s_enumData##e( s_enumDataMembers##e ); \
|
||||
wxEnumData *wxGetEnumData(e*) { return &s_enumData##e; } \
|
||||
template<> void wxStringReadValue(const wxString &s, e &data ) \
|
||||
{ wxFlagsFromString<e>( s, data ); } \
|
||||
template<> void wxStringWriteValue( wxString &s, const e& data ) \
|
||||
{ wxFlagsToString<e>( s, data ); } \
|
||||
void FromLong##e( long data, wxVariantBase& result ) \
|
||||
{ result = wxVariantBase(e(data)); } \
|
||||
void ToLong##e( const wxVariantBase& data, long &result ) \
|
||||
{ result = (long) data.wxTEMPLATED_MEMBER_CALL(Get, e).m_data; } \
|
||||
wxTO_STRING_IMP( e ) \
|
||||
wxFROM_STRING_IMP( e ) \
|
||||
wxEnumTypeInfo s_typeInfo##e(wxT_SET, &s_enumData##e, \
|
||||
&wxTO_STRING( e ), &wxFROM_STRING( e ), &ToLong##e, \
|
||||
&FromLong##e, typeid(e).name() );
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Type Information
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// All data exposed by the RTTI is characterized using the following classes.
|
||||
// The first characterization is done by wxTypeKind. All enums up to and including
|
||||
// wxT_CUSTOM represent so called simple types. These cannot be divided any further.
|
||||
// They can be converted to and from wxStrings, that's all.
|
||||
// Other wxTypeKinds can instead be splitted recursively into smaller parts until
|
||||
// the simple types are reached.
|
||||
|
||||
enum wxTypeKind
|
||||
{
|
||||
wxT_VOID = 0, // unknown type
|
||||
wxT_BOOL,
|
||||
wxT_CHAR,
|
||||
wxT_UCHAR,
|
||||
wxT_INT,
|
||||
wxT_UINT,
|
||||
wxT_LONG,
|
||||
wxT_ULONG,
|
||||
wxT_FLOAT,
|
||||
wxT_DOUBLE,
|
||||
wxT_STRING, // must be wxString
|
||||
wxT_SET, // must be wxBitset<> template
|
||||
wxT_ENUM,
|
||||
wxT_CUSTOM, // user defined type (e.g. wxPoint)
|
||||
|
||||
wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM,
|
||||
|
||||
wxT_OBJECT_PTR, // object reference
|
||||
wxT_OBJECT, // embedded object
|
||||
wxT_COLLECTION, // collection
|
||||
|
||||
wxT_DELEGATE, // for connecting against an event source
|
||||
|
||||
wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxVariantBase;
|
||||
class WXDLLIMPEXP_BASE wxTypeInfo;
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo*, wxTypeInfoMap, class WXDLLIMPEXP_BASE );
|
||||
|
||||
class WXDLLIMPEXP_BASE wxTypeInfo
|
||||
{
|
||||
public:
|
||||
typedef void (*wxVariant2StringFnc)( const wxVariantBase& data, wxString &result );
|
||||
typedef void (*wxString2VariantFnc)( const wxString& data, wxVariantBase &result );
|
||||
|
||||
wxTypeInfo(wxTypeKind kind,
|
||||
wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL,
|
||||
const wxString &name = wxEmptyString):
|
||||
m_toString(to), m_fromString(from), m_kind(kind), m_name(name)
|
||||
{
|
||||
Register();
|
||||
}
|
||||
#if wxUSE_UNICODE
|
||||
wxTypeInfo(wxTypeKind kind,
|
||||
wxVariant2StringFnc to, wxString2VariantFnc from,
|
||||
const char *name):
|
||||
m_toString(to), m_fromString(from), m_kind(kind),
|
||||
m_name(wxString::FromAscii(name))
|
||||
{
|
||||
Register();
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual ~wxTypeInfo()
|
||||
{
|
||||
Unregister();
|
||||
}
|
||||
|
||||
// return the kind of this type (wxT_... constants)
|
||||
wxTypeKind GetKind() const { return m_kind; }
|
||||
|
||||
// returns the unique name of this type
|
||||
const wxString& GetTypeName() const { return m_name; }
|
||||
|
||||
// is this type a delegate type
|
||||
bool IsDelegateType() const { return m_kind == wxT_DELEGATE; }
|
||||
|
||||
// is this type a custom type
|
||||
bool IsCustomType() const { return m_kind == wxT_CUSTOM; }
|
||||
|
||||
// is this type an object type
|
||||
bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR; }
|
||||
|
||||
// can the content of this type be converted to and from strings ?
|
||||
bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL; }
|
||||
|
||||
// convert a wxVariantBase holding data of this type into a string
|
||||
void ConvertToString( const wxVariantBase& data, wxString &result ) const
|
||||
{
|
||||
if ( m_toString )
|
||||
(*m_toString)( data, result );
|
||||
else
|
||||
wxLogError( wxGetTranslation(_T("String conversions not supported")) );
|
||||
}
|
||||
|
||||
// convert a string into a wxVariantBase holding the corresponding data in this type
|
||||
void ConvertFromString( const wxString& data, wxVariantBase &result ) const
|
||||
{
|
||||
if( m_fromString )
|
||||
(*m_fromString)( data, result );
|
||||
else
|
||||
wxLogError( wxGetTranslation(_T("String conversions not supported")) );
|
||||
}
|
||||
|
||||
// statics:
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
static wxTypeInfo *FindType(const char *typeName)
|
||||
{ return FindType( wxString::FromAscii(typeName) ); }
|
||||
#endif
|
||||
static wxTypeInfo *FindType(const wxChar *typeName);
|
||||
static wxTypeInfo *FindType(const wxString& typeName)
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
return FindType( typeName.wchar_str() );
|
||||
#else
|
||||
return FindType( typeName.char_str() );
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
void Register();
|
||||
void Unregister();
|
||||
|
||||
wxVariant2StringFnc m_toString;
|
||||
wxString2VariantFnc m_fromString;
|
||||
|
||||
wxTypeKind m_kind;
|
||||
wxString m_name;
|
||||
|
||||
// the static list of all types we know about
|
||||
static wxTypeInfoMap* ms_typeTable;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo
|
||||
{
|
||||
public:
|
||||
wxBuiltInTypeInfo( wxTypeKind kind, wxVariant2StringFnc to = NULL,
|
||||
wxString2VariantFnc from = NULL,
|
||||
const wxString &name = wxEmptyString ) :
|
||||
wxTypeInfo( kind, to, from, name )
|
||||
{ wxASSERT_MSG( GetKind() < wxT_SET, wxT("Illegal Kind for Base Type") ); }
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxBuiltInTypeInfo( wxTypeKind kind, wxVariant2StringFnc to,
|
||||
wxString2VariantFnc from , const char *name ) :
|
||||
wxTypeInfo( kind, to, from, name )
|
||||
{ wxASSERT_MSG( GetKind() < wxT_SET, wxT("Illegal Kind for Base Type") ); }
|
||||
#endif
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo
|
||||
{
|
||||
public:
|
||||
wxCustomTypeInfo( const wxString &name, wxVariant2StringFnc to,
|
||||
wxString2VariantFnc from ) :
|
||||
wxTypeInfo( wxT_CUSTOM, to, from, name )
|
||||
{}
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxCustomTypeInfo( const char *name , wxVariant2StringFnc to,
|
||||
wxString2VariantFnc from ) :
|
||||
wxTypeInfo( wxT_CUSTOM, to, from, name )
|
||||
{}
|
||||
#endif
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo
|
||||
{
|
||||
public:
|
||||
typedef void (*converterToLong_t)( const wxVariantBase& data, long &result );
|
||||
typedef void (*converterFromLong_t)( long data, wxVariantBase &result );
|
||||
|
||||
wxEnumTypeInfo( wxTypeKind kind, wxEnumData* enumInfo, wxVariant2StringFnc to,
|
||||
wxString2VariantFnc from, converterToLong_t toLong,
|
||||
converterFromLong_t fromLong, const wxString &name ) :
|
||||
wxTypeInfo( kind, to, from, name ), m_toLong( toLong ), m_fromLong( fromLong )
|
||||
{
|
||||
wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET,
|
||||
wxT("Illegal Kind for Enum Type"));
|
||||
m_enumInfo = enumInfo;
|
||||
}
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxEnumTypeInfo( wxTypeKind kind, wxEnumData* enumInfo, wxVariant2StringFnc to,
|
||||
wxString2VariantFnc from, converterToLong_t toLong,
|
||||
converterFromLong_t fromLong, const char * name ) :
|
||||
wxTypeInfo( kind, to, from, name ), m_toLong( toLong ), m_fromLong( fromLong )
|
||||
{
|
||||
wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET,
|
||||
wxT("Illegal Kind for Enum Type"));
|
||||
m_enumInfo = enumInfo;
|
||||
}
|
||||
#endif
|
||||
const wxEnumData* GetEnumData() const { return m_enumInfo; }
|
||||
|
||||
// convert a wxVariantBase holding data of this type into a long
|
||||
void ConvertToLong( const wxVariantBase& data, long &result ) const
|
||||
{
|
||||
if( m_toLong )
|
||||
(*m_toLong)( data, result );
|
||||
else
|
||||
wxLogError( wxGetTranslation(_T("Long Conversions not supported")) );
|
||||
}
|
||||
|
||||
// convert a long into a wxVariantBase holding the corresponding data in this type
|
||||
void ConvertFromLong( long data, wxVariantBase &result ) const
|
||||
{
|
||||
if( m_fromLong )
|
||||
(*m_fromLong)( data, result );
|
||||
else
|
||||
wxLogError( wxGetTranslation(_T("Long Conversions not supported")) );
|
||||
}
|
||||
|
||||
private:
|
||||
converterToLong_t m_toLong;
|
||||
converterFromLong_t m_fromLong;
|
||||
|
||||
wxEnumData *m_enumInfo; // Kind == wxT_ENUM or Kind == wxT_SET
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo
|
||||
{
|
||||
public:
|
||||
wxClassTypeInfo( wxTypeKind kind, wxClassInfo* classInfo,
|
||||
wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL,
|
||||
const wxString &name = wxEmptyString);
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxClassTypeInfo( wxTypeKind kind, wxClassInfo* classInfo, wxVariant2StringFnc to,
|
||||
wxString2VariantFnc from , const char *name );
|
||||
#endif
|
||||
|
||||
const wxClassInfo *GetClassInfo() const { return m_classInfo; }
|
||||
|
||||
private:
|
||||
wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo
|
||||
{
|
||||
public:
|
||||
wxCollectionTypeInfo( const wxString &elementName, wxVariant2StringFnc to,
|
||||
wxString2VariantFnc from , const wxString &name) :
|
||||
wxTypeInfo( wxT_COLLECTION, to, from, name )
|
||||
{ m_elementTypeName = elementName; m_elementType = NULL; }
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
wxCollectionTypeInfo( const char *elementName, wxVariant2StringFnc to,
|
||||
wxString2VariantFnc from , const char *name ) :
|
||||
wxTypeInfo( wxT_COLLECTION, to, from, name )
|
||||
{ m_elementTypeName = wxString::FromAscii( elementName ); m_elementType = NULL; }
|
||||
#endif
|
||||
|
||||
const wxTypeInfo* GetElementType() const
|
||||
{
|
||||
if ( m_elementType == NULL )
|
||||
m_elementType = wxTypeInfo::FindType( m_elementTypeName );
|
||||
return m_elementType;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable wxTypeInfo * m_elementType;
|
||||
wxString m_elementTypeName;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxEventSourceTypeInfo : public wxTypeInfo
|
||||
{
|
||||
public:
|
||||
wxEventSourceTypeInfo( int eventType, wxClassInfo* eventClass,
|
||||
wxVariant2StringFnc to = NULL,
|
||||
wxString2VariantFnc from = NULL );
|
||||
wxEventSourceTypeInfo( int eventType, int lastEventType, wxClassInfo* eventClass,
|
||||
wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL );
|
||||
|
||||
int GetEventType() const { return m_eventType; }
|
||||
int GetLastEventType() const { return m_lastEventType; }
|
||||
const wxClassInfo* GetEventClass() const { return m_eventClass; }
|
||||
|
||||
private:
|
||||
const wxClassInfo *m_eventClass; // (extended will merge into classinfo)
|
||||
int m_eventType;
|
||||
int m_lastEventType;
|
||||
};
|
||||
|
||||
template<typename T> const wxTypeInfo* wxGetTypeInfo( T * ) \
|
||||
{ return wxTypeInfo::FindType(typeid(T).name()); }
|
||||
|
||||
// this macro is for usage with custom, non-object derived classes and structs,
|
||||
// wxPoint is such a custom type
|
||||
|
||||
#if wxUSE_FUNC_TEMPLATE_POINTER
|
||||
#define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \
|
||||
wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), &toString, &fromString);
|
||||
#else
|
||||
#define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \
|
||||
void ToString##e( const wxVariantBase& data, wxString &result ) \
|
||||
{ toString(data, result); } \
|
||||
void FromString##e( const wxString& data, wxVariantBase &result ) \
|
||||
{ fromString(data, result); } \
|
||||
wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), \
|
||||
&ToString##e, &FromString##e);
|
||||
#endif
|
||||
|
||||
#define wxCOLLECTION_TYPE_INFO( element, collection ) \
|
||||
wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name(), \
|
||||
NULL, NULL, typeid(collection).name() );
|
||||
|
||||
// sometimes a compiler invents specializations that are nowhere called,
|
||||
// use this macro to satisfy the refs, currently we don't have to play
|
||||
// tricks, but if we will have to according to the compiler, we will use
|
||||
// that macro for that
|
||||
|
||||
#define wxILLEGAL_TYPE_SPECIALIZATION( a )
|
||||
|
||||
#endif // wxUSE_EXTENDED_RTTI
|
||||
#endif // _XTITYPES_H_
|
204
samples/xti/Makefile.in
Normal file
204
samples/xti/Makefile.in
Normal file
@@ -0,0 +1,204 @@
|
||||
# =========================================================================
|
||||
# This makefile was generated by
|
||||
# Bakefile 0.2.2 (http://www.bakefile.org)
|
||||
# Do not modify, all changes will be overwritten!
|
||||
# =========================================================================
|
||||
|
||||
|
||||
@MAKE_SET@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
INSTALL = @INSTALL@
|
||||
EXEEXT = @EXEEXT@
|
||||
WINDRES = @WINDRES@
|
||||
REZ = @REZ@
|
||||
SETFILE = @SETFILE@
|
||||
NM = @NM@
|
||||
BK_DEPS = @BK_DEPS@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
LIBS = @LIBS@
|
||||
LDFLAGS_GUI = @LDFLAGS_GUI@
|
||||
CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
WX_LIB_FLAVOUR = @WX_LIB_FLAVOUR@
|
||||
TOOLKIT = @TOOLKIT@
|
||||
TOOLKIT_LOWERCASE = @TOOLKIT_LOWERCASE@
|
||||
TOOLKIT_VERSION = @TOOLKIT_VERSION@
|
||||
TOOLCHAIN_FULLNAME = @TOOLCHAIN_FULLNAME@
|
||||
EXTRALIBS = @EXTRALIBS@
|
||||
EXTRALIBS_XML = @EXTRALIBS_XML@
|
||||
EXTRALIBS_GUI = @EXTRALIBS_GUI@
|
||||
CXXWARNINGS = @CXXWARNINGS@
|
||||
HOST_SUFFIX = @HOST_SUFFIX@
|
||||
SAMPLES_RPATH_FLAG = @SAMPLES_RPATH_FLAG@
|
||||
SAMPLES_RPATH_POSTLINK = @SAMPLES_RPATH_POSTLINK@
|
||||
wx_top_builddir = @wx_top_builddir@
|
||||
|
||||
### Variables: ###
|
||||
|
||||
DESTDIR =
|
||||
WX_RELEASE = 2.9
|
||||
WX_VERSION = $(WX_RELEASE).0
|
||||
LIBDIRNAME = $(wx_top_builddir)/lib
|
||||
XTI_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
|
||||
-I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples $(CXXWARNINGS) \
|
||||
$(CPPFLAGS) $(CXXFLAGS)
|
||||
XTI_OBJECTS = \
|
||||
$(__xti___win32rc) \
|
||||
$(__xti_os2_lib_res) \
|
||||
xti_xti.o \
|
||||
xti_classlist.o \
|
||||
xti_codereadercallback.o
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
@COND_DEPS_TRACKING_0@CXXC = $(CXX)
|
||||
@COND_DEPS_TRACKING_1@CXXC = $(BK_DEPS) $(CXX)
|
||||
@COND_USE_GUI_0@PORTNAME = base
|
||||
@COND_USE_GUI_1@PORTNAME = $(TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
|
||||
@COND_TOOLKIT_MAC@WXBASEPORT = _carbon
|
||||
@COND_BUILD_DEBUG_DEBUG_FLAG_DEFAULT@WXDEBUGFLAG = d
|
||||
@COND_DEBUG_FLAG_1@WXDEBUGFLAG = d
|
||||
@COND_UNICODE_1@WXUNICODEFLAG = u
|
||||
@COND_WXUNIV_1@WXUNIVNAME = univ
|
||||
@COND_MONOLITHIC_0@EXTRALIBS_FOR_BASE = $(EXTRALIBS)
|
||||
@COND_MONOLITHIC_1@EXTRALIBS_FOR_BASE = $(EXTRALIBS) $(EXTRALIBS_GUI)
|
||||
@COND_MONOLITHIC_0@EXTRALIBS_FOR_GUI = $(EXTRALIBS_GUI)
|
||||
@COND_MONOLITHIC_1@EXTRALIBS_FOR_GUI =
|
||||
@COND_PLATFORM_MAC_1@__xti___mac_setfilecmd = $(SETFILE) -a C xti$(EXEEXT)
|
||||
@COND_PLATFORM_MAC_1@__xti___mac_rezcmd = $(__MACOSX_RESOURCES_p_1)
|
||||
@COND_WXUNIV_1@__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
|
||||
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_1 = -d __WXUNIVERSAL__
|
||||
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_2 = --define __WXUNIVERSAL__
|
||||
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
|
||||
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_1 = -d wxNO_EXCEPTIONS
|
||||
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_2 = --define wxNO_EXCEPTIONS
|
||||
@COND_USE_RTTI_0@__RTTI_DEFINE_p = -DwxNO_RTTI
|
||||
@COND_USE_RTTI_0@__RTTI_DEFINE_p_1 = -d wxNO_RTTI
|
||||
@COND_USE_RTTI_0@__RTTI_DEFINE_p_2 = --define wxNO_RTTI
|
||||
@COND_USE_THREADS_0@__THREAD_DEFINE_p = -DwxNO_THREADS
|
||||
@COND_USE_THREADS_0@__THREAD_DEFINE_p_1 = -d wxNO_THREADS
|
||||
@COND_USE_THREADS_0@__THREAD_DEFINE_p_2 = --define wxNO_THREADS
|
||||
@COND_SHARED_1@__DLLFLAG_p = -DWXUSINGDLL
|
||||
@COND_SHARED_1@__DLLFLAG_p_1 = -d WXUSINGDLL
|
||||
@COND_SHARED_1@__DLLFLAG_p_2 = --define WXUSINGDLL
|
||||
COND_PLATFORM_OS2_1___xti___os2_emxbindcmd = $(NM) xti$(EXEEXT) | if grep -q \
|
||||
pmwin.763 ; then emxbind -ep xti$(EXEEXT) ; fi
|
||||
@COND_PLATFORM_OS2_1@__xti___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___xti___os2_emxbindcmd)
|
||||
@COND_TOOLKIT_MSW@__RCDEFDIR_p = -i \
|
||||
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
|
||||
@COND_TOOLKIT_MSW@__RCDEFDIR_p_1 = --include-dir \
|
||||
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
|
||||
@COND_PLATFORM_WIN32_1@__xti___win32rc = xti_sample_rc.o
|
||||
@COND_PLATFORM_OS2_1@__xti_os2_lib_res = \
|
||||
@COND_PLATFORM_OS2_1@ $(top_srcdir)/include/wx/os2/wx.res
|
||||
@COND_PLATFORM_MACOSX_1@__xti_bundle___depname = xti_bundle
|
||||
@COND_TOOLKIT_COCOA@____xti_BUNDLE_TGT_REF_DEP = xti.app/Contents/PkgInfo
|
||||
@COND_TOOLKIT_MAC@____xti_BUNDLE_TGT_REF_DEP = xti.app/Contents/PkgInfo
|
||||
COND_MONOLITHIC_0___WXLIB_CORE_p = \
|
||||
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_0@__WXLIB_CORE_p = $(COND_MONOLITHIC_0___WXLIB_CORE_p)
|
||||
COND_MONOLITHIC_0___WXLIB_XML_p = \
|
||||
-lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_0@__WXLIB_XML_p = $(COND_MONOLITHIC_0___WXLIB_XML_p)
|
||||
COND_MONOLITHIC_0___WXLIB_BASE_p = \
|
||||
-lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_0@__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p)
|
||||
COND_MONOLITHIC_1___WXLIB_MONO_p = \
|
||||
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_MONOLITHIC_1@__WXLIB_MONO_p = $(COND_MONOLITHIC_1___WXLIB_MONO_p)
|
||||
@COND_USE_GUI_1_WXUSE_LIBTIFF_BUILTIN@__LIB_TIFF_p \
|
||||
@COND_USE_GUI_1_WXUSE_LIBTIFF_BUILTIN@ = \
|
||||
@COND_USE_GUI_1_WXUSE_LIBTIFF_BUILTIN@ -lwxtiff$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_USE_GUI_1_WXUSE_LIBJPEG_BUILTIN@__LIB_JPEG_p \
|
||||
@COND_USE_GUI_1_WXUSE_LIBJPEG_BUILTIN@ = \
|
||||
@COND_USE_GUI_1_WXUSE_LIBJPEG_BUILTIN@ -lwxjpeg$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_USE_GUI_1_WXUSE_LIBPNG_BUILTIN@__LIB_PNG_p \
|
||||
@COND_USE_GUI_1_WXUSE_LIBPNG_BUILTIN@ = \
|
||||
@COND_USE_GUI_1_WXUSE_LIBPNG_BUILTIN@ -lwxpng$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_WXUSE_ZLIB_BUILTIN@__LIB_ZLIB_p = \
|
||||
@COND_WXUSE_ZLIB_BUILTIN@ -lwxzlib$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_WXUSE_ODBC_BUILTIN@__LIB_ODBC_p = \
|
||||
@COND_WXUSE_ODBC_BUILTIN@ -lwxodbc$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
COND_WXUSE_REGEX_BUILTIN___LIB_REGEX_p = \
|
||||
-lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
@COND_WXUSE_REGEX_BUILTIN@__LIB_REGEX_p = $(COND_WXUSE_REGEX_BUILTIN___LIB_REGEX_p)
|
||||
@COND_WXUSE_EXPAT_BUILTIN@__LIB_EXPAT_p = \
|
||||
@COND_WXUSE_EXPAT_BUILTIN@ -lwxexpat$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
|
||||
COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_1 = $(REZ) -d __DARWIN__ -t APPL -d \
|
||||
__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) \
|
||||
$(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) -i $(srcdir) $(__DLLFLAG_p_1) -i \
|
||||
$(srcdir)/../../samples $(__RCDEFDIR_p) -i $(top_srcdir)/include -o \
|
||||
xti$(EXEEXT) Carbon.r sample.r
|
||||
@COND_TOOLKIT_MAC@__MACOSX_RESOURCES_p_1 = $(COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_1)
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: xti$(EXEEXT) $(__xti_bundle___depname)
|
||||
|
||||
install: all
|
||||
|
||||
uninstall:
|
||||
|
||||
install-strip: install
|
||||
|
||||
clean:
|
||||
rm -rf ./.deps ./.pch
|
||||
rm -f ./*.o
|
||||
rm -f xti$(EXEEXT)
|
||||
rm -rf xti.app
|
||||
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
|
||||
|
||||
xti$(EXEEXT): $(XTI_OBJECTS) $(__xti___win32rc)
|
||||
$(CXX) -o $@ $(XTI_OBJECTS) $(LDFLAGS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LIBS) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_ODBC_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE)
|
||||
$(__xti___mac_rezcmd)
|
||||
$(__xti___mac_setfilecmd)
|
||||
$(__xti___os2_emxbindcmd)
|
||||
$(SAMPLES_RPATH_POSTLINK)
|
||||
|
||||
xti.app/Contents/PkgInfo: xti$(EXEEXT) $(top_srcdir)/src/mac/carbon/Info.plist.in $(top_srcdir)/src/mac/carbon/wxmac.icns
|
||||
mkdir -p xti.app/Contents
|
||||
mkdir -p xti.app/Contents/MacOS
|
||||
mkdir -p xti.app/Contents/Resources
|
||||
|
||||
|
||||
sed -e "s/IDENTIFIER/`echo $(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`/" \
|
||||
-e "s/EXECUTABLE/xti/" \
|
||||
-e "s/VERSION/$(WX_VERSION)/" \
|
||||
$(top_srcdir)/src/mac/carbon/Info.plist.in >xti.app/Contents/Info.plist
|
||||
|
||||
|
||||
echo -n "APPL????" >xti.app/Contents/PkgInfo
|
||||
|
||||
|
||||
ln -f xti$(EXEEXT) xti.app/Contents/MacOS/xti
|
||||
|
||||
|
||||
cp -f $(top_srcdir)/src/mac/carbon/wxmac.icns xti.app/Contents/Resources/wxmac.icns
|
||||
|
||||
@COND_PLATFORM_MACOSX_1@xti_bundle: $(____xti_BUNDLE_TGT_REF_DEP)
|
||||
|
||||
xti_sample_rc.o: $(srcdir)/../../samples/sample.rc
|
||||
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_2) $(__EXCEPTIONS_DEFINE_p_2) $(__RTTI_DEFINE_p_2) $(__THREAD_DEFINE_p_2) --include-dir $(srcdir) $(__DLLFLAG_p_2) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p_1) --include-dir $(top_srcdir)/include
|
||||
|
||||
xti_xti.o: $(srcdir)/xti.cpp
|
||||
$(CXXC) -c -o $@ $(XTI_CXXFLAGS) $(srcdir)/xti.cpp
|
||||
|
||||
xti_classlist.o: $(srcdir)/classlist.cpp
|
||||
$(CXXC) -c -o $@ $(XTI_CXXFLAGS) $(srcdir)/classlist.cpp
|
||||
|
||||
xti_codereadercallback.o: $(srcdir)/codereadercallback.cpp
|
||||
$(CXXC) -c -o $@ $(XTI_CXXFLAGS) $(srcdir)/codereadercallback.cpp
|
||||
|
||||
|
||||
# Include dependency info, if present:
|
||||
@IF_GNU_MAKE@-include .deps/*.d
|
||||
|
||||
.PHONY: all install uninstall clean distclean xti_bundle
|
560
samples/xti/classlist.cpp
Normal file
560
samples/xti/classlist.cpp
Normal file
@@ -0,0 +1,560 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: classlist.cpp
|
||||
// Purpose: ClassListDialog implementation
|
||||
// Author: Francesco Montorsi
|
||||
// Modified by:
|
||||
// Created: 03/06/2007 14:49:55
|
||||
// RCS-ID: $Id: classlist.cpp 48186 2007-08-19 19:59:54Z FM $
|
||||
// Copyright: (c) 2007 Francesco Montorsi
|
||||
// Licence: wxWidgets license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "classlist.h"
|
||||
|
||||
#if !wxUSE_EXTENDED_RTTI
|
||||
#error This sample requires XTI (eXtended RTTI) enabled
|
||||
#endif
|
||||
|
||||
// IMPLEMENT_DYNAMIC_CLASS( ClassListDialog, wxDialog ) -- see the header
|
||||
BEGIN_EVENT_TABLE( ClassListDialog, wxDialog )
|
||||
EVT_LISTBOX( ID_LISTBOX, ClassListDialog::OnListboxSelected )
|
||||
EVT_TREE_SEL_CHANGED( ID_TREECTRL, ClassListDialog::OnTreectrlSelChanged )
|
||||
EVT_CHOICEBOOK_PAGE_CHANGED( ID_LISTMODE, ClassListDialog::OnChoiceBookPageChange )
|
||||
|
||||
EVT_CHECKBOX( ID_SHOW_ONLY_XTI, ClassListDialog::OnShowOnlyXTICheckbox )
|
||||
EVT_CHECKBOX( ID_SHOW_PROPERTIES_RECURSIVELY, ClassListDialog::OnShowRecursiveInfoCheckbox )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// defined later
|
||||
wxString DumpClassInfo(const wxClassInfo*, bool recursive);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ClassListDialog
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
ClassListDialog::ClassListDialog()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ClassListDialog::ClassListDialog( wxWindow* parent, wxWindowID id,
|
||||
const wxString& caption, const wxPoint& pos,
|
||||
const wxSize& size, long style )
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, caption, pos, size, style);
|
||||
}
|
||||
|
||||
bool ClassListDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption,
|
||||
const wxPoint& pos, const wxSize& size, long style )
|
||||
{
|
||||
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||
|
||||
CreateControls();
|
||||
if (GetSizer())
|
||||
{
|
||||
GetSizer()->SetSizeHints(this);
|
||||
}
|
||||
Centre();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ClassListDialog::~ClassListDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void ClassListDialog::Init()
|
||||
{
|
||||
m_pClassCountText = NULL;
|
||||
m_pRawListBox = NULL;
|
||||
m_pParentTreeCtrl = NULL;
|
||||
m_pSizeListBox = NULL;
|
||||
m_pTextCtrl = NULL;
|
||||
}
|
||||
|
||||
void ClassListDialog::CreateControls()
|
||||
{
|
||||
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
|
||||
this->SetSizer(itemBoxSizer2);
|
||||
|
||||
wxStaticText* itemStaticText3 = new wxStaticText( this, wxID_STATIC, _("This is the list of wxWidgets classes registered in the XTI system.\nNote that not all wxWidgets classes are registered nor all registered classes are completely _described_ using XTI metadata."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
|
||||
// filters
|
||||
wxBoxSizer* filters = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemBoxSizer2->Add(filters, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||
filters->Add(new wxCheckBox(this, ID_SHOW_ONLY_XTI,
|
||||
wxT("Show only classes with eXtended infos")));
|
||||
filters->AddSpacer(10);
|
||||
filters->Add(new wxCheckBox(this, ID_SHOW_PROPERTIES_RECURSIVELY,
|
||||
wxT("Show properties of parent classes")));
|
||||
|
||||
// show how many have we filtered out
|
||||
m_pClassCountText = new wxStaticText( this, wxID_STATIC,
|
||||
wxT("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pClassCountText->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxBOLD, false, wxT("Tahoma")));
|
||||
itemBoxSizer2->Add(m_pClassCountText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||
|
||||
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemBoxSizer2->Add(itemBoxSizer5, 1, wxGROW, 5);
|
||||
|
||||
m_pChoiceBook = new wxChoicebook( this, ID_LISTMODE, wxDefaultPosition, wxDefaultSize, wxCHB_DEFAULT );
|
||||
|
||||
// raw-list page
|
||||
wxPanel* itemPanel7 = new wxPanel( m_pChoiceBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemPanel7->SetSizer(itemBoxSizer8);
|
||||
|
||||
wxArrayString m_pRawListBoxStrings;
|
||||
m_pRawListBox = new wxListBox( itemPanel7, ID_LISTBOX, wxDefaultPosition, wxDefaultSize, m_pRawListBoxStrings, wxLB_SINGLE );
|
||||
itemBoxSizer8->Add(m_pRawListBox, 1, wxGROW, 5);
|
||||
|
||||
m_pChoiceBook->AddPage(itemPanel7, _("Raw list"));
|
||||
|
||||
// by-size page
|
||||
wxPanel* itemPanel13 = new wxPanel( m_pChoiceBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemPanel13->SetSizer(itemBoxSizer14);
|
||||
|
||||
wxArrayString m_pSizeListBoxStrings;
|
||||
m_pSizeListBox = new wxListBox( itemPanel13, ID_LISTBOX, wxDefaultPosition, wxDefaultSize, m_pSizeListBoxStrings, wxLB_SINGLE );
|
||||
itemBoxSizer14->Add(m_pSizeListBox, 1, wxGROW, 5);
|
||||
|
||||
m_pChoiceBook->AddPage(itemPanel13, _("Classes by size"));
|
||||
|
||||
// tree page
|
||||
wxPanel* itemPanel10 = new wxPanel( m_pChoiceBook, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
|
||||
itemPanel10->SetSizer(itemBoxSizer11);
|
||||
|
||||
m_pParentTreeCtrl = new wxTreeCtrl( itemPanel10, ID_TREECTRL, wxDefaultPosition, wxSize(100, 100), wxTR_HAS_BUTTONS |wxTR_SINGLE );
|
||||
itemBoxSizer11->Add(m_pParentTreeCtrl, 1, wxGROW, 5);
|
||||
|
||||
m_pChoiceBook->AddPage(itemPanel10, _("Classes by parent"));
|
||||
|
||||
|
||||
itemBoxSizer5->Add(m_pChoiceBook, 0, wxGROW|wxALL, 5);
|
||||
|
||||
m_pTextCtrl = new wxTextCtrl( this, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(500, -1), wxTE_MULTILINE|wxTE_READONLY );
|
||||
itemBoxSizer5->Add(m_pTextCtrl, 3, wxGROW|wxALL, 5);
|
||||
|
||||
wxStdDialogButtonSizer* itemStdDialogButtonSizer17 = new wxStdDialogButtonSizer;
|
||||
|
||||
itemBoxSizer2->Add(itemStdDialogButtonSizer17, 0, wxGROW|wxALL, 5);
|
||||
wxButton* itemButton18 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemStdDialogButtonSizer17->AddButton(itemButton18);
|
||||
|
||||
wxButton* itemButton19 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemStdDialogButtonSizer17->AddButton(itemButton19);
|
||||
|
||||
itemStdDialogButtonSizer17->Realize();
|
||||
|
||||
InitControls();
|
||||
}
|
||||
|
||||
int ClassListDialog::AddClassesWithParent(const wxClassInfo *parent, const wxTreeItemId &id)
|
||||
{
|
||||
const wxClassInfo *ci = wxClassInfo::GetFirst();
|
||||
int count = 0;
|
||||
while (ci)
|
||||
{
|
||||
// is this class derived from the given parent?
|
||||
if (wxString(ci->GetBaseClassName1()) == parent->GetClassName() ||
|
||||
wxString(ci->GetBaseClassName2()) == parent->GetClassName())
|
||||
{
|
||||
wxTreeItemId child = m_pParentTreeCtrl->AppendItem(id, ci->GetClassName());
|
||||
|
||||
// update the name of this child with the count of the children classes
|
||||
int ret = AddClassesWithParent(ci, child);
|
||||
m_pParentTreeCtrl->SetItemText(child,
|
||||
m_pParentTreeCtrl->GetItemText(child) +
|
||||
wxString::Format(wxT(" [%d]"), ret));
|
||||
count += ret+1;
|
||||
}
|
||||
|
||||
ci = ci->GetNext();
|
||||
}
|
||||
|
||||
// reorder all the children we've just added
|
||||
m_pParentTreeCtrl->SortChildren(id);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
int GetSizeOfClass(const wxString &cn)
|
||||
{
|
||||
const wxClassInfo *ci = wxClassInfo::FindClass(cn);
|
||||
if (ci)
|
||||
return ci->GetSize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CompareClassSizes(const wxString &class1, const wxString &class2)
|
||||
{
|
||||
return GetSizeOfClass(class1) - GetSizeOfClass(class2);
|
||||
}
|
||||
|
||||
void ClassListDialog::InitControls()
|
||||
{
|
||||
// create a wxArrayString with the names of all classes:
|
||||
const wxClassInfo *ci = wxClassInfo::GetFirst();
|
||||
wxArrayString arr;
|
||||
while (ci)
|
||||
{
|
||||
arr.Add(ci->GetClassName());
|
||||
ci = ci->GetNext();
|
||||
}
|
||||
|
||||
arr.Sort(); // sort alphabetically
|
||||
|
||||
// now add it to the raw-mode listbox
|
||||
for (unsigned int i=0; i<arr.GetCount(); i++)
|
||||
if (!IsToDiscard(arr[i]))
|
||||
m_pRawListBox->Append(arr[i]);
|
||||
m_nCount = m_pRawListBox->GetCount();
|
||||
|
||||
// sort again using size as sortkey
|
||||
arr.Sort((wxArrayString::CompareFunction)CompareClassSizes);
|
||||
|
||||
// now add it to the size-mode listbox
|
||||
for (unsigned int i=0; i<arr.GetCount(); i++)
|
||||
if (!IsToDiscard(arr[i]))
|
||||
m_pSizeListBox->Append(arr[i]);
|
||||
|
||||
// add root item to parent-mode treectrl
|
||||
wxTreeItemId id = m_pParentTreeCtrl->AddRoot(_T("wxObject"));
|
||||
|
||||
// recursively add all leaves to the treectrl
|
||||
int count = AddClassesWithParent(CLASSINFO(wxObject), id);
|
||||
m_pParentTreeCtrl->SetItemText(id, m_pParentTreeCtrl->GetItemText(id) +
|
||||
wxString::Format(wxT(" [%d]"), count));
|
||||
|
||||
// initially expand the root item
|
||||
m_pParentTreeCtrl->Expand(id);
|
||||
|
||||
m_nTotalCount = arr.GetCount();
|
||||
UpdateFilterText();
|
||||
|
||||
// don't leave blank the XTI info display
|
||||
m_pChoiceBook->ChangeSelection(0);
|
||||
m_pRawListBox->Select(0);
|
||||
UpdateClassInfo(m_pRawListBox->GetStringSelection());
|
||||
}
|
||||
|
||||
bool ClassListDialog::IsToDiscard(const wxString &classname) const
|
||||
{
|
||||
wxCheckBox *cb = wx_static_cast(wxCheckBox*, FindWindow(ID_SHOW_ONLY_XTI));
|
||||
if (!cb || !cb->IsChecked())
|
||||
return false;
|
||||
|
||||
// check if this class has XTI infos
|
||||
wxClassInfo *info = wxClassInfo::FindClass(classname);
|
||||
if (!info)
|
||||
return false;
|
||||
if (info->GetFirstProperty() != NULL || info->GetFirstHandler() != NULL)
|
||||
return false; // has XTI info
|
||||
return true; // no XTI info
|
||||
}
|
||||
|
||||
void ClassListDialog::UpdateFilterText()
|
||||
{
|
||||
// tell the user how many registered classes are present and
|
||||
// how many are we showing
|
||||
m_pClassCountText->SetLabel(
|
||||
wxString::Format(
|
||||
wxT("Showing %d classes on a total of %d registered classes in wxXTI."),
|
||||
m_nCount, m_nTotalCount));
|
||||
}
|
||||
|
||||
void ClassListDialog::UpdateClassInfo(const wxString &itemName)
|
||||
{
|
||||
wxString classname = itemName.BeforeFirst(_T(' '));
|
||||
wxCheckBox *cb = wx_static_cast(wxCheckBox*, FindWindow(ID_SHOW_PROPERTIES_RECURSIVELY));
|
||||
|
||||
m_pTextCtrl->SetValue(
|
||||
DumpClassInfo(wxClassInfo::FindClass(classname), cb->IsChecked()));
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ClassListDialog - event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ClassListDialog::OnShowOnlyXTICheckbox( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
m_pRawListBox->Clear();
|
||||
m_pParentTreeCtrl->DeleteAllItems();
|
||||
m_pSizeListBox->Clear();
|
||||
|
||||
InitControls();
|
||||
}
|
||||
|
||||
void ClassListDialog::OnShowRecursiveInfoCheckbox( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
m_pRawListBox->Clear();
|
||||
m_pParentTreeCtrl->DeleteAllItems();
|
||||
m_pSizeListBox->Clear();
|
||||
|
||||
InitControls();
|
||||
}
|
||||
|
||||
void ClassListDialog::OnListboxSelected( wxCommandEvent& event )
|
||||
{
|
||||
UpdateClassInfo(event.GetString());
|
||||
}
|
||||
|
||||
void ClassListDialog::OnTreectrlSelChanged( wxTreeEvent& event )
|
||||
{
|
||||
UpdateClassInfo(m_pParentTreeCtrl->GetItemText(event.GetItem()));
|
||||
}
|
||||
|
||||
void ClassListDialog::OnChoiceBookPageChange( wxChoicebookEvent& event )
|
||||
{
|
||||
switch (event.GetSelection())
|
||||
{
|
||||
case 0:
|
||||
if (m_pRawListBox->GetCount())
|
||||
{
|
||||
m_pRawListBox->Select(0);
|
||||
UpdateClassInfo(m_pRawListBox->GetStringSelection());
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (m_pSizeListBox->GetCount())
|
||||
{
|
||||
m_pSizeListBox->Select(0);
|
||||
UpdateClassInfo(m_pSizeListBox->GetStringSelection());
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
wxTreeItemId root = m_pParentTreeCtrl->GetRootItem();
|
||||
if (root.IsOk())
|
||||
{
|
||||
m_pParentTreeCtrl->SelectItem(root);
|
||||
UpdateClassInfo(m_pParentTreeCtrl->GetItemText(root));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// dump functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxString DumpStr(const wxString &str)
|
||||
{
|
||||
if (str.empty())
|
||||
return wxT("none");
|
||||
return str;
|
||||
}
|
||||
|
||||
wxString DumpTypeInfo(const wxTypeInfo *ti)
|
||||
{
|
||||
if (!ti)
|
||||
return _T("none");
|
||||
|
||||
return DumpStr(ti->GetTypeName());
|
||||
}
|
||||
|
||||
wxString DumpPropertyAccessor(const wxPropertyAccessor *acc, int indent)
|
||||
{
|
||||
wxString ind = _T("\n") + wxString(indent, wxT(' '));
|
||||
wxString infostr;
|
||||
|
||||
if (!acc)
|
||||
return ind + _T("no property accessors");
|
||||
|
||||
if (acc->HasSetter())
|
||||
infostr << ind << _T("setter name: ") << acc->GetSetterName();
|
||||
if (acc->HasCollectionGetter())
|
||||
infostr << ind << _T("collection getter name: ") << acc->GetCollectionGetterName();
|
||||
if (acc->HasGetter())
|
||||
infostr << ind << _T("getter name: ") << acc->GetGetterName();
|
||||
if (acc->HasAdder())
|
||||
infostr << ind << _T("adder name: ") << acc->GetAdderName();
|
||||
|
||||
return infostr;
|
||||
}
|
||||
|
||||
wxString DumpPropertyInfo(const wxPropertyInfo *prop, int indent)
|
||||
{
|
||||
wxString ind = _T("\n") + wxString(indent, wxT(' '));
|
||||
wxString infostr;
|
||||
|
||||
if (!prop)
|
||||
return ind + _T("none");
|
||||
|
||||
infostr << ind << _T("flags: ");
|
||||
if (prop->GetFlags() & wxPROP_DEPRECATED)
|
||||
infostr << _T("wxPROP_DEPRECATED,");
|
||||
if (prop->GetFlags() & wxPROP_OBJECT_GRAPH)
|
||||
infostr << _T("wxPROP_OBJECT_GRAPH,");
|
||||
if (prop->GetFlags() & wxPROP_ENUM_STORE_LONG)
|
||||
infostr << _T("wxPROP_ENUM_STORE_LONG,");
|
||||
if (prop->GetFlags() & wxPROP_DONT_STREAM)
|
||||
infostr << _T("wxPROP_DONT_STREAM,");
|
||||
|
||||
if (prop->GetFlags() == 0)
|
||||
infostr << _T("none");
|
||||
else
|
||||
infostr.RemoveLast(); // remove last comma
|
||||
|
||||
infostr << ind << _T("help string: ") << DumpStr(prop->GetHelpString());
|
||||
infostr << ind << _T("group string: ") << DumpStr(prop->GetGroupString());
|
||||
|
||||
infostr << ind << _T("collection element type: ") << DumpTypeInfo(prop->GetCollectionElementTypeInfo());
|
||||
infostr << ind << _T("type: ") << DumpTypeInfo(prop->GetTypeInfo());
|
||||
|
||||
infostr << ind << _T("default value: ") << DumpStr(prop->GetDefaultValue().GetAsString());
|
||||
infostr << DumpPropertyAccessor(prop->GetAccessor(), indent+1);
|
||||
|
||||
return infostr;
|
||||
}
|
||||
|
||||
wxString DumpHandlerInfo(const wxHandlerInfo *phdlr, int indent)
|
||||
{
|
||||
wxString ind = _T("\n") + wxString(indent, wxT(' '));
|
||||
wxString infostr;
|
||||
|
||||
if (!phdlr)
|
||||
return ind + _T("none");
|
||||
|
||||
infostr << ind << _T("event class: ") <<
|
||||
(phdlr->GetEventClassInfo() ? phdlr->GetEventClassInfo()->GetClassName() : wxT("none"));
|
||||
|
||||
return infostr;
|
||||
}
|
||||
|
||||
int DumpProperties(const wxClassInfo *info, wxString& infostr, bool recursive)
|
||||
{
|
||||
const wxPropertyInfo *prop;
|
||||
int pcount;
|
||||
for (prop = info->GetFirstProperty(), pcount = 0;
|
||||
prop;
|
||||
prop = prop->GetNext(), pcount++)
|
||||
{
|
||||
infostr << _T("\n\n [") << pcount+1 << _T("] Property: ") << prop->GetName();
|
||||
infostr << DumpPropertyInfo(prop, 4);
|
||||
}
|
||||
|
||||
if (pcount == 0)
|
||||
infostr << _T("\n None");
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
const wxClassInfo **parent = info->GetParents();
|
||||
wxString str;
|
||||
|
||||
for (int i=0; parent[i] != NULL; i++)
|
||||
{
|
||||
int ppcount = DumpProperties(parent[i], str, recursive);
|
||||
if (ppcount)
|
||||
{
|
||||
pcount += ppcount;
|
||||
infostr << _T("\n\n ") << parent[i]->GetClassName() << _T(" PARENT'S PROPERTIES:");
|
||||
infostr << str;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pcount;
|
||||
}
|
||||
|
||||
int DumpHandlers(const wxClassInfo *info, wxString& infostr, bool recursive)
|
||||
{
|
||||
const wxHandlerInfo *h;
|
||||
int hcount;
|
||||
for (h = info->GetFirstHandler(), hcount = 0;
|
||||
h;
|
||||
h = h->GetNext(), hcount++)
|
||||
{
|
||||
infostr << _T("\n\n [") << hcount+1 << _T("] Handler: ") << h->GetName();
|
||||
infostr << DumpHandlerInfo(h, 4);
|
||||
}
|
||||
|
||||
if (hcount == 0)
|
||||
infostr << _T("\n None");
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
const wxClassInfo **parent = info->GetParents();
|
||||
wxString str;
|
||||
|
||||
for (int i=0; parent[i] != NULL; i++)
|
||||
{
|
||||
int hhcount = DumpHandlers(parent[i], str, recursive);
|
||||
if (hhcount)
|
||||
{
|
||||
hcount += hhcount;
|
||||
infostr << _T("\n\n ") << parent[i]->GetClassName() << _T(" PARENT'S HANDLERS:");
|
||||
infostr << str;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hcount;
|
||||
}
|
||||
|
||||
wxString DumpClassInfo(const wxClassInfo *info, bool recursive)
|
||||
{
|
||||
wxString infostr;
|
||||
|
||||
if (!info)
|
||||
return wxEmptyString;
|
||||
|
||||
// basic stuff:
|
||||
|
||||
infostr << _T("\n BASIC RTTI INFO ABOUT ") << info->GetClassName();
|
||||
infostr << _T("\n =================================================");
|
||||
infostr << _T("\n Base class #1: ") << DumpStr(info->GetBaseClassName1());
|
||||
infostr << _T("\n Base class #2: ") << DumpStr(info->GetBaseClassName2());
|
||||
infostr << _T("\n Include file: ") << DumpStr(info->GetIncludeName());
|
||||
infostr << _T("\n Size: ") << info->GetSize();
|
||||
infostr << _T("\n Dynamic: ") << (info->IsDynamic() ? _T("true") : _T("false"));
|
||||
|
||||
|
||||
// advanced stuff:
|
||||
|
||||
infostr << _T("\n\n\n ADVANCED RTTI INFO ABOUT ") << info->GetClassName();
|
||||
infostr << _T("\n =================================================\n");
|
||||
infostr << _T("\n PROPERTIES");
|
||||
infostr << _T("\n -----------------------------------------");
|
||||
int pcount = DumpProperties(info, infostr, recursive);
|
||||
infostr << _T("\n\n HANDLERS");
|
||||
infostr << _T("\n -----------------------------------------");
|
||||
int hcount = DumpHandlers(info, infostr, recursive);
|
||||
|
||||
if (pcount+hcount == 0)
|
||||
infostr << _T("\n\n no advanced info\n");
|
||||
else
|
||||
{
|
||||
infostr << _T("\n\n Total count of properties: ") << pcount;
|
||||
infostr << _T("\n Total count of handlers: ") << hcount << _T("\n");
|
||||
}
|
||||
|
||||
return infostr;
|
||||
}
|
108
samples/xti/classlist.h
Normal file
108
samples/xti/classlist.h
Normal file
@@ -0,0 +1,108 @@
|
||||
////////////////////////////////////////////////////
|
||||
// Name: classlist.h
|
||||
// Purpose: ClassListDialog definition
|
||||
// Author: Francesco Montorsi
|
||||
// Modified by:
|
||||
// Created: 03/06/2007 14:49:55
|
||||
// RCS-ID: $Id: classlist.h 47845 2007-08-01 12:53:50Z FM $
|
||||
// Copyright: (c) 2007 Francesco Montorsi
|
||||
// Licence: wxWidgets license
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _CLASSLIST_H_
|
||||
#define _CLASSLIST_H_
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// includes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/choicebk.h"
|
||||
#include "wx/treectrl.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IDs
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define ID_LISTMODE 10006
|
||||
#define ID_LISTBOX 10003
|
||||
#define ID_PANEL 10007
|
||||
#define ID_TREECTRL 10008
|
||||
#define ID_TEXTCTRL 10004
|
||||
#define ID_SHOW_ONLY_XTI 10005
|
||||
#define ID_SHOW_PROPERTIES_RECURSIVELY 10002
|
||||
#define SYMBOL_CLASSLISTDIALOG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
|
||||
#define SYMBOL_CLASSLISTDIALOG_TITLE _("wxWidgets class list")
|
||||
#define SYMBOL_CLASSLISTDIALOG_IDNAME wxID_ANY
|
||||
#define SYMBOL_CLASSLISTDIALOG_SIZE wxSize(400, 300)
|
||||
#define SYMBOL_CLASSLISTDIALOG_POSITION wxDefaultPosition
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ClassListDialog
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ClassListDialog: public wxDialog
|
||||
{
|
||||
// we explicitely don't want to use the following macro:
|
||||
// DECLARE_DYNAMIC_CLASS( ClassListDialog )
|
||||
// as otherwise the ClassListDialog class would appear in the list
|
||||
// shown by this dialog!
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
ClassListDialog();
|
||||
ClassListDialog( wxWindow* parent, wxWindowID id = SYMBOL_CLASSLISTDIALOG_IDNAME,
|
||||
const wxString& caption = SYMBOL_CLASSLISTDIALOG_TITLE,
|
||||
const wxPoint& pos = SYMBOL_CLASSLISTDIALOG_POSITION,
|
||||
const wxSize& size = SYMBOL_CLASSLISTDIALOG_SIZE,
|
||||
long style = SYMBOL_CLASSLISTDIALOG_STYLE );
|
||||
|
||||
// Creation
|
||||
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CLASSLISTDIALOG_IDNAME,
|
||||
const wxString& caption = SYMBOL_CLASSLISTDIALOG_TITLE,
|
||||
const wxPoint& pos = SYMBOL_CLASSLISTDIALOG_POSITION,
|
||||
const wxSize& size = SYMBOL_CLASSLISTDIALOG_SIZE,
|
||||
long style = SYMBOL_CLASSLISTDIALOG_STYLE );
|
||||
|
||||
// Destructor
|
||||
~ClassListDialog();
|
||||
|
||||
public: // misc
|
||||
|
||||
void Init();
|
||||
void CreateControls();
|
||||
void InitControls();
|
||||
|
||||
void UpdateClassInfo(const wxString &itemName);
|
||||
void UpdateFilterText();
|
||||
bool IsToDiscard(const wxString &classname) const;
|
||||
|
||||
int AddClassesWithParent(const wxClassInfo *parent, const wxTreeItemId &id);
|
||||
|
||||
public: // event handlers
|
||||
|
||||
void OnListboxSelected( wxCommandEvent& event );
|
||||
void OnTreectrlSelChanged( wxTreeEvent& event );
|
||||
void OnChoiceBookPageChange( wxChoicebookEvent& event );
|
||||
void OnShowOnlyXTICheckbox( wxCommandEvent& event );
|
||||
void OnShowRecursiveInfoCheckbox( wxCommandEvent& event );
|
||||
|
||||
// Should we show tooltips?
|
||||
static bool ShowToolTips();
|
||||
|
||||
protected:
|
||||
wxChoicebook* m_pChoiceBook;
|
||||
wxStaticText* m_pClassCountText;
|
||||
wxListBox* m_pRawListBox;
|
||||
wxTreeCtrl* m_pParentTreeCtrl;
|
||||
wxListBox* m_pSizeListBox;
|
||||
wxTextCtrl* m_pTextCtrl;
|
||||
|
||||
int m_nTotalCount; // number of classes in wxXTI system
|
||||
int m_nCount; // number of shown classes
|
||||
};
|
||||
|
||||
#endif
|
||||
// _CLASSLIST_H_
|
276
samples/xti/codereadercallback.cpp
Normal file
276
samples/xti/codereadercallback.cpp
Normal file
@@ -0,0 +1,276 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/xtistrm.cpp
|
||||
// Purpose: streaming runtime metadata information
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 27/07/03
|
||||
// RCS-ID: $Id: xtistrm.cpp 47828 2007-07-31 19:26:56Z FM $
|
||||
// Copyright: (c) 2003 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/xtistrm.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/object.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/event.h"
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "wx/tokenzr.h"
|
||||
#include "wx/txtstrm.h"
|
||||
#include "codereadercallback.h"
|
||||
|
||||
#if !wxUSE_EXTENDED_RTTI
|
||||
#error This sample requires XTI (eXtended RTTI) enabled
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxObjectCodeReaderCallback - depersisting to code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct wxObjectCodeReaderCallback::wxObjectCodeReaderCallbackInternal
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
map<int,wstring> m_objectNames;
|
||||
#else
|
||||
map<int,string> m_objectNames;
|
||||
#endif
|
||||
|
||||
void SetObjectName(int objectID, const wxString &name )
|
||||
{
|
||||
if ( m_objectNames.find(objectID) != m_objectNames.end() )
|
||||
{
|
||||
wxLogError( _("Passing a already registered object to SetObjectName") );
|
||||
return ;
|
||||
}
|
||||
m_objectNames[objectID] = (const wxChar *)name;
|
||||
}
|
||||
|
||||
wxString GetObjectName( int objectID )
|
||||
{
|
||||
if ( objectID == wxNullObjectID )
|
||||
return wxT("NULL");
|
||||
|
||||
if ( m_objectNames.find(objectID) == m_objectNames.end() )
|
||||
{
|
||||
wxLogError( _("Passing an unkown object to GetObject") );
|
||||
return wxEmptyString;
|
||||
}
|
||||
return wxString( m_objectNames[objectID].c_str() );
|
||||
}
|
||||
};
|
||||
|
||||
wxObjectCodeReaderCallback::wxObjectCodeReaderCallback(wxTextOutputStream *out)
|
||||
: m_fp(out)
|
||||
{
|
||||
m_data = new wxObjectCodeReaderCallbackInternal;
|
||||
}
|
||||
|
||||
wxObjectCodeReaderCallback::~wxObjectCodeReaderCallback()
|
||||
{
|
||||
delete m_data;
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *classInfo,
|
||||
wxVariantBaseArray &WXUNUSED(metadata))
|
||||
{
|
||||
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID );
|
||||
m_fp->WriteString( wxString::Format( wxT("\t%s *%s = new %s;\n"),
|
||||
classInfo->GetClassName(),
|
||||
objectName.c_str(),
|
||||
classInfo->GetClassName()) );
|
||||
m_data->SetObjectName( objectID, objectName );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo))
|
||||
{
|
||||
m_fp->WriteString( wxString::Format( wxT("\tdelete %s;\n"),
|
||||
m_data->GetObjectName( objectID).c_str() ) );
|
||||
}
|
||||
|
||||
wxString wxObjectCodeReaderCallback::ValueAsCode( const wxVariantBase ¶m )
|
||||
{
|
||||
wxString value;
|
||||
const wxTypeInfo* type = param.GetTypeInfo();
|
||||
if ( type->GetKind() == wxT_CUSTOM )
|
||||
{
|
||||
const wxCustomTypeInfo* cti = wx_dynamic_cast(const wxCustomTypeInfo*, type);
|
||||
if ( cti )
|
||||
{
|
||||
value.Printf( wxT("%s(%s)"), cti->GetTypeName().c_str(),
|
||||
param.GetAsString().c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError ( _("Internal error, illegal wxCustomTypeInfo") );
|
||||
}
|
||||
}
|
||||
else if ( type->GetKind() == wxT_STRING )
|
||||
{
|
||||
value.Printf( wxT("\"%s\""),param.GetAsString().c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
value.Printf( wxT("%s"), param.GetAsString().c_str() );
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::CreateObject(int objectID,
|
||||
const wxClassInfo *WXUNUSED(classInfo),
|
||||
int paramCount,
|
||||
wxVariantBase *params,
|
||||
int *objectIDValues,
|
||||
const wxClassInfo **WXUNUSED(objectClassInfos),
|
||||
wxVariantBaseArray &WXUNUSED(metadata)
|
||||
)
|
||||
{
|
||||
int i;
|
||||
m_fp->WriteString( wxString::Format( wxT("\t%s->Create("),
|
||||
m_data->GetObjectName(objectID).c_str() ) );
|
||||
for (i = 0; i < paramCount; i++)
|
||||
{
|
||||
if ( objectIDValues[i] != wxInvalidObjectID )
|
||||
{
|
||||
wxString str =
|
||||
wxString::Format( wxT("%s"),
|
||||
m_data->GetObjectName( objectIDValues[i] ).c_str() );
|
||||
m_fp->WriteString( str );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fp->WriteString(
|
||||
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) );
|
||||
}
|
||||
if (i < paramCount - 1)
|
||||
m_fp->WriteString( wxT(", "));
|
||||
}
|
||||
m_fp->WriteString( wxT(");\n") );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::ConstructObject(int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
int paramCount,
|
||||
wxVariantBase *params,
|
||||
int *objectIDValues,
|
||||
const wxClassInfo **WXUNUSED(objectClassInfos),
|
||||
wxVariantBaseArray &WXUNUSED(metadata)
|
||||
)
|
||||
{
|
||||
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID );
|
||||
m_fp->WriteString( wxString::Format( wxT("\t%s *%s = new %s("),
|
||||
classInfo->GetClassName(),
|
||||
objectName.c_str(),
|
||||
classInfo->GetClassName()) );
|
||||
m_data->SetObjectName( objectID, objectName );
|
||||
|
||||
int i;
|
||||
for (i = 0; i < paramCount; i++)
|
||||
{
|
||||
if ( objectIDValues[i] != wxInvalidObjectID )
|
||||
m_fp->WriteString( wxString::Format( wxT("%s"),
|
||||
m_data->GetObjectName( objectIDValues[i] ).c_str() ) );
|
||||
else
|
||||
{
|
||||
m_fp->WriteString(
|
||||
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) );
|
||||
}
|
||||
if (i < paramCount - 1)
|
||||
m_fp->WriteString( wxT(", ") );
|
||||
}
|
||||
m_fp->WriteString( wxT(");\n") );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::SetProperty(int objectID,
|
||||
const wxClassInfo *WXUNUSED(classInfo),
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
const wxVariantBase &value)
|
||||
{
|
||||
m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"),
|
||||
m_data->GetObjectName(objectID).c_str(),
|
||||
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
||||
ValueAsCode(value).c_str()) );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::SetPropertyAsObject(int objectID,
|
||||
const wxClassInfo *WXUNUSED(classInfo),
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
int valueObjectId)
|
||||
{
|
||||
if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT )
|
||||
m_fp->WriteString( wxString::Format( wxT("\t%s->%s(*%s);\n"),
|
||||
m_data->GetObjectName(objectID).c_str(),
|
||||
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
||||
m_data->GetObjectName( valueObjectId).c_str() ) );
|
||||
else
|
||||
m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"),
|
||||
m_data->GetObjectName(objectID).c_str(),
|
||||
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
||||
m_data->GetObjectName( valueObjectId).c_str() ) );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::AddToPropertyCollection( int objectID,
|
||||
const wxClassInfo *WXUNUSED(classInfo),
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
const wxVariantBase &value)
|
||||
{
|
||||
m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"),
|
||||
m_data->GetObjectName(objectID).c_str(),
|
||||
propertyInfo->GetAccessor()->GetAdderName().c_str(),
|
||||
ValueAsCode(value).c_str()) );
|
||||
}
|
||||
|
||||
// sets the corresponding property (value is an object)
|
||||
void wxObjectCodeReaderCallback::
|
||||
AddToPropertyCollectionAsObject(int WXUNUSED(objectID),
|
||||
const wxClassInfo *WXUNUSED(classInfo),
|
||||
const wxPropertyInfo* WXUNUSED(propertyInfo),
|
||||
int WXUNUSED(valueObjectId))
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::SetConnect(int eventSourceObjectID,
|
||||
const wxClassInfo *WXUNUSED(eventSourceClassInfo),
|
||||
const wxPropertyInfo *delegateInfo,
|
||||
const wxClassInfo *eventSinkClassInfo,
|
||||
const wxHandlerInfo* handlerInfo,
|
||||
int eventSinkObjectID )
|
||||
{
|
||||
wxString ehsource = m_data->GetObjectName( eventSourceObjectID );
|
||||
wxString ehsink = m_data->GetObjectName(eventSinkObjectID);
|
||||
wxString ehsinkClass = eventSinkClassInfo->GetClassName();
|
||||
const wxEventSourceTypeInfo *delegateTypeInfo =
|
||||
wx_dynamic_cast(const wxEventSourceTypeInfo*, delegateInfo->GetTypeInfo());
|
||||
if ( delegateTypeInfo )
|
||||
{
|
||||
int eventType = delegateTypeInfo->GetEventType();
|
||||
wxString handlerName = handlerInfo->GetName();
|
||||
|
||||
wxString code =
|
||||
wxString::Format(
|
||||
wxT("\t%s->Connect( %s->GetId(), %d, ")
|
||||
wxT("(wxObjectEventFunction)(wxEventFunction) & %s::%s, NULL, %s );"),
|
||||
ehsource.c_str(), ehsource.c_str(), eventType, ehsinkClass.c_str(),
|
||||
handlerName.c_str(), ehsink.c_str() );
|
||||
|
||||
m_fp->WriteString( code );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError(_("delegate has no type info"));
|
||||
}
|
||||
}
|
104
samples/xti/codereadercallback.h
Normal file
104
samples/xti/codereadercallback.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/xtistrm.h
|
||||
// Purpose: streaming runtime metadata information (extended class info)
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 27/07/03
|
||||
// RCS-ID: $Id: xtistrm.h 47827 2007-07-31 19:25:09Z FM $
|
||||
// Copyright: (c) 2003 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _CODEDEPERSISTER_
|
||||
#define _CODEDEPERSISTER_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
/*
|
||||
wxObjectCodeReaderCallback implements the callbacks that will depersist
|
||||
an object into a C++ initialization function.
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_BASE wxTextOutputStream;
|
||||
|
||||
class WXDLLIMPEXP_BASE wxObjectCodeReaderCallback: public wxObjectWriterCallback
|
||||
{
|
||||
private:
|
||||
struct wxObjectCodeReaderCallbackInternal;
|
||||
wxObjectCodeReaderCallbackInternal * m_data;
|
||||
wxTextOutputStream *m_fp;
|
||||
wxString ValueAsCode( const wxVariantBase ¶m );
|
||||
|
||||
public:
|
||||
wxObjectCodeReaderCallback(wxTextOutputStream *out);
|
||||
virtual ~wxObjectCodeReaderCallback();
|
||||
|
||||
// allocate the new object on the heap, that object will have the passed in ID
|
||||
virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
|
||||
wxVariantBaseArray &metadata);
|
||||
|
||||
// initialize the already allocated object having the ID objectID
|
||||
// with the Create method creation parameters which are objects are
|
||||
// having their Ids passed in objectIDValues having objectId <> wxInvalidObjectID
|
||||
|
||||
virtual void CreateObject(int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
int paramCount,
|
||||
wxVariantBase *variantValues,
|
||||
int *objectIDValues,
|
||||
const wxClassInfo **objectClassInfos,
|
||||
wxVariantBaseArray &metadata
|
||||
);
|
||||
|
||||
// construct the new object on the heap, that object will have the
|
||||
// passed in ID (for objects that don't support allocate-create type
|
||||
// of creation) creation parameters which are objects are having their
|
||||
// Ids passed in objectIDValues having objectId <> wxInvalidObjectID
|
||||
|
||||
virtual void ConstructObject(int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
int paramCount,
|
||||
wxVariantBase *VariantValues,
|
||||
int *objectIDValues,
|
||||
const wxClassInfo **objectClassInfos,
|
||||
wxVariantBaseArray &metadata);
|
||||
|
||||
// destroy the heap-allocated object having the ID objectID, this may
|
||||
// be used if an object is embedded in another object and set via value
|
||||
// semantics, so the intermediate object can be destroyed after safely
|
||||
virtual void DestroyObject(int objectID, wxClassInfo *classInfo);
|
||||
|
||||
// set the corresponding property
|
||||
virtual void SetProperty(int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
const wxVariantBase &variantValue);
|
||||
|
||||
// sets the corresponding property (value is an object)
|
||||
virtual void SetPropertyAsObject(int objectId,
|
||||
const wxClassInfo *classInfo,
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
int valueObjectId);
|
||||
|
||||
// adds an element to a property collection
|
||||
virtual void AddToPropertyCollection( int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
const wxVariantBase &VariantValue);
|
||||
|
||||
// sets the corresponding property (value is an object)
|
||||
virtual void AddToPropertyCollectionAsObject(int objectID,
|
||||
const wxClassInfo *classInfo,
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
int valueObjectId);
|
||||
|
||||
// sets the corresponding event handler
|
||||
virtual void SetConnect(int eventSourceObjectID,
|
||||
const wxClassInfo *eventSourceClassInfo,
|
||||
const wxPropertyInfo *delegateInfo,
|
||||
const wxClassInfo *eventSinkClassInfo,
|
||||
const wxHandlerInfo* handlerInfo,
|
||||
int eventSinkObjectID );
|
||||
};
|
||||
|
||||
#endif
|
16
samples/xti/xti.bkl
Normal file
16
samples/xti/xti.bkl
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!-- $Id: xti.bkl 48186 2007-08-19 19:59:54Z FM $ -->
|
||||
|
||||
<makefile>
|
||||
|
||||
<include file="../../build/bakefiles/common_samples.bkl"/>
|
||||
|
||||
<exe id="xti" template="wx_sample" template_append="wx_append">
|
||||
<sources>xti.cpp classlist.cpp codereadercallback.cpp</sources>
|
||||
|
||||
<wx-lib>core</wx-lib>
|
||||
<wx-lib>xml</wx-lib>
|
||||
<wx-lib>base</wx-lib>
|
||||
</exe>
|
||||
|
||||
</makefile>
|
735
samples/xti/xti.cpp
Normal file
735
samples/xti/xti.cpp
Normal file
@@ -0,0 +1,735 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xti.cpp
|
||||
// Purpose: eXtended RTTI support sample
|
||||
// Author: Stefan Csomor, Francesco Montorsi
|
||||
// Modified by:
|
||||
// Created: 13/5/2007
|
||||
// RCS-ID: $Id: xti.cpp 48407 2007-08-26 23:17:23Z FM $
|
||||
// Copyright: (c) Stefan Csomor, Francesco Montorsi
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWidgets headers)
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/variant.h"
|
||||
#include "wx/xml/xml.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/event.h"
|
||||
#include "wx/spinbutt.h"
|
||||
#include "wx/spinctrl.h"
|
||||
|
||||
#include "wx/xtistrm.h"
|
||||
#include "wx/xtixml.h"
|
||||
#include "wx/txtstrm.h"
|
||||
#include "wx/wfstream.h"
|
||||
#include "wx/sstream.h"
|
||||
#include "wx/spinctrl.h"
|
||||
|
||||
#include "classlist.h"
|
||||
#include "codereadercallback.h"
|
||||
|
||||
#if !wxUSE_EXTENDED_RTTI
|
||||
#error This sample requires XTI (eXtended RTTI) enabled
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// resources
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if !defined(__WXMSW__) && !defined(__WXPM__)
|
||||
#include "../sample.xpm"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Define a new application type, each program should derive a class from wxApp
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
};
|
||||
|
||||
// Define a new frame type: this is going to be our main frame
|
||||
class MyFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
// ctor(s)
|
||||
MyFrame(const wxString& title);
|
||||
|
||||
void OnPersist(wxCommandEvent& event);
|
||||
void OnDepersist(wxCommandEvent& event);
|
||||
void OnGenerateCode(wxCommandEvent& event);
|
||||
void OnDumpClasses(wxCommandEvent& event);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
// any class wishing to process wxWidgets events must use this macro
|
||||
wxDECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// IDs for the controls and the menu commands
|
||||
enum
|
||||
{
|
||||
// menu items
|
||||
Minimal_Persist = wxID_HIGHEST,
|
||||
Minimal_Depersist,
|
||||
Minimal_GenerateCode,
|
||||
Minimal_DumpClasses,
|
||||
Minimal_Quit = wxID_EXIT,
|
||||
Minimal_About = wxID_ABOUT
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables and other macros for wxWidgets
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(Minimal_Persist, MyFrame::OnPersist)
|
||||
EVT_MENU(Minimal_Depersist, MyFrame::OnDepersist)
|
||||
EVT_MENU(Minimal_GenerateCode, MyFrame::OnGenerateCode)
|
||||
EVT_MENU(Minimal_DumpClasses, MyFrame::OnDumpClasses)
|
||||
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxIMPLEMENT_APP(MyApp)
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
void RegisterFrameRTTI();
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the application class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
if ( !wxApp::OnInit() )
|
||||
return false;
|
||||
|
||||
RegisterFrameRTTI();
|
||||
|
||||
// create the main application window
|
||||
MyFrame *frame = new MyFrame(_T("Extended RTTI sample"));
|
||||
|
||||
// and show it (the frames, unlike simple controls, are not shown when
|
||||
// created initially)
|
||||
frame->Show(true);
|
||||
|
||||
// success: wxApp::OnRun() will be called which will enter the main message
|
||||
// loop and the application will run. If we returned false here, the
|
||||
// application would exit immediately.
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// main frame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
MyFrame::MyFrame(const wxString& title)
|
||||
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(300, 200))
|
||||
{
|
||||
// set the frame icon
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// create a menu bar
|
||||
wxMenu *fileMenu = new wxMenu;
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append(Minimal_About, _T("&About...\tF1"), _T("Show about dialog"));
|
||||
|
||||
fileMenu->Append(Minimal_Persist, _T("Persist a wxFrame to XML..."),
|
||||
_T("Creates a wxFrame using wxXTI and saves its description as XML"));
|
||||
fileMenu->Append(Minimal_Depersist, _T("Depersist XML file..."),
|
||||
_T("Loads the description of wxFrame from XML"));
|
||||
fileMenu->Append(Minimal_GenerateCode, _T("Generate code for a wxFrame saved to XML..."),
|
||||
_T("Generates the C++ code which belong to a persisted wxFrame"));
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append(Minimal_DumpClasses, _T("Dump registered classes..."),
|
||||
_T("Dumps the description of all wxWidgets classes registered in XTI"));
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append(Minimal_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(fileMenu, _T("&File"));
|
||||
menuBar->Append(helpMenu, _T("&Help"));
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(_T("Welcome to wxWidgets!"));
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI sample code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// this is the kind of source code that would end up being generated by a
|
||||
// designer corresponding to the information we are setting up via RTTI
|
||||
// in the CreateFrameRTTI function:
|
||||
//
|
||||
// class MyXTIFrame : public wxFrame
|
||||
// {
|
||||
// public:
|
||||
// // construction
|
||||
// MyXTIFrame()
|
||||
// {
|
||||
// Init();
|
||||
// m_button = NULL;
|
||||
// }
|
||||
//
|
||||
// bool Create(wxWindow *parent,
|
||||
// wxWindowID id,
|
||||
// const wxString& title,
|
||||
// const wxPoint& pos = wxDefaultPosition,
|
||||
// const wxSize& size = wxDefaultSize,
|
||||
// long style = wxDEFAULT_FRAME_STYLE,
|
||||
// const wxString& name = wxFrameNameStr)
|
||||
// {
|
||||
// return wxFrame::Create( parent, id, title, pos, size, style, name );
|
||||
// }
|
||||
//
|
||||
// void SetButton( wxButton * button ) { m_button = button; }
|
||||
// wxButton* GetButton() const { return m_button; }
|
||||
//
|
||||
// void ButtonClickHandler( wxEvent & WXUNUSED(event) )
|
||||
// {
|
||||
// wxMessageBox( "Button Clicked ", "Hi!", wxOK );
|
||||
// }
|
||||
//
|
||||
// protected:
|
||||
// wxButton* m_button;
|
||||
//
|
||||
// DECLARE_EVENT_TABLE()
|
||||
// DECLARE_DYNAMIC_CLASS_NO_COPY(MyXTIFrame)
|
||||
// };
|
||||
//
|
||||
// IMPLEMENT_DYNAMIC_CLASS_XTI(MyXTIFrame, MyXTIFrame, "x.h")
|
||||
//
|
||||
// WX_BEGIN_PROPERTIES_TABLE(MyXTIFrame)
|
||||
// WX_PROPERTY( Button, wxButton*, SetButton, GetButton, )
|
||||
// WX_END_PROPERTIES_TABLE()
|
||||
//
|
||||
// WX_BEGIN_HANDLERS_TABLE(MyXTIFrame)
|
||||
// WX_HANDLER( ButtonClickHandler, wxCommandEvent )
|
||||
// WX_END_HANDLERS_TABLE()
|
||||
//
|
||||
// WX_CONSTRUCTOR_5( MyXTIFrame, wxWindow*, Parent, wxWindowID, Id,
|
||||
// wxString, Title, wxPoint, Position, wxSize, Size )
|
||||
//
|
||||
// BEGIN_EVENT_TABLE(MyXTIFrame, wxFrame)
|
||||
// END_EVENT_TABLE()
|
||||
|
||||
// the following class "persists" (i.e. saves) a wxFrame into a wxObjectWriter
|
||||
|
||||
class MyDesignerPersister : public wxObjectReaderCallback
|
||||
{
|
||||
public:
|
||||
MyDesignerPersister( wxDynamicObject * frame)
|
||||
{
|
||||
m_frame = frame;
|
||||
}
|
||||
|
||||
virtual bool BeforeWriteDelegate( wxObjectWriter *WXUNUSED(writer),
|
||||
const wxObject *object,
|
||||
const wxClassInfo* WXUNUSED(classInfo),
|
||||
const wxPropertyInfo *propInfo,
|
||||
const wxObject *&eventSink,
|
||||
const wxHandlerInfo* &handlerInfo )
|
||||
{
|
||||
// this approach would be used it the handler would not
|
||||
// be connected really in the designer, so we have to supply
|
||||
// the information
|
||||
if ( object == m_frame->GetProperty(wxT("Button")).GetAsObject() &&
|
||||
propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo("OnClick") )
|
||||
{
|
||||
eventSink = m_frame;
|
||||
handlerInfo = m_frame->GetClassInfo()->
|
||||
FindHandlerInfo("ButtonClickHandler");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
wxDynamicObject *m_frame;
|
||||
};
|
||||
|
||||
// sometimes linkers (at least MSVC and GCC ones) optimize the final EXE
|
||||
// even in debug mode pruning the object files which he "thinks" are useless;
|
||||
// thus the classes defined in those files won't be available in the XTI
|
||||
// table and the program will fail to allocate them.
|
||||
// The following macro implements a simple hack to ensure that a given
|
||||
// class is linked in.
|
||||
//
|
||||
// TODO: in wx/link.h there are already similar macros (also more "optimized":
|
||||
// don't need the creation of fake object) which however require to use
|
||||
// the wxFORCE_LINK_THIS_MODULE() macro inside the source files corresponding
|
||||
// to the class being discarded.
|
||||
//
|
||||
#define wxENSURE_CLASS_IS_LINKED(x) { x test; }
|
||||
|
||||
void RegisterFrameRTTI()
|
||||
{
|
||||
// set up the RTTI info for a class (MyXTIFrame) which
|
||||
// is not defined anywhere in this program
|
||||
wxDynamicClassInfo *dyninfo =
|
||||
wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass(wxT("MyXTIFrame")));
|
||||
if ( dyninfo == NULL )
|
||||
{
|
||||
dyninfo = new wxDynamicClassInfo(wxT("myxtiframe.h"),
|
||||
wxT("MyXTIFrame"),
|
||||
CLASSINFO(wxFrame) );
|
||||
|
||||
// this class has a property named "Button" and the relative handler:
|
||||
dyninfo->AddProperty("Button", wxGetTypeInfo((wxButton**) NULL));
|
||||
dyninfo->AddHandler("ButtonClickHandler",
|
||||
NULL /* no instance of the handler method */, CLASSINFO( wxEvent ) );
|
||||
}
|
||||
}
|
||||
|
||||
wxDynamicObject* CreateFrameRTTI()
|
||||
{
|
||||
int baseID = 100;
|
||||
wxVariantBase Params[10];
|
||||
|
||||
// the class is now part of XTI internal table so that we can
|
||||
// get a pointer to it just searching it like any other class:
|
||||
wxFrame* frame;
|
||||
wxClassInfo *info = wxClassInfo::FindClass(wxT("MyXTIFrame"));
|
||||
wxASSERT( info );
|
||||
wxDynamicObject* frameWrapper =
|
||||
wx_dynamic_cast(wxDynamicObject*, info->CreateObject() );
|
||||
Params[0] = wxVariantBase((wxWindow*)(NULL));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxString(wxT("This is a frame created from XTI")));
|
||||
Params[3] = wxVariantBase(wxPoint(-1,-1));
|
||||
Params[4] = wxVariantBase(wxSize(400,300));
|
||||
Params[5] = wxVariantBase((long)wxDEFAULT_FRAME_STYLE);
|
||||
wxASSERT( info->Create(frameWrapper, 6, Params ));
|
||||
frame = wx_dynamic_cast(wxFrame*, frameWrapper->GetSuperClassInstance());
|
||||
|
||||
// now build a notebook inside it:
|
||||
wxNotebook* notebook;
|
||||
info = wxClassInfo::FindClass("wxNotebook");
|
||||
wxASSERT( info );
|
||||
notebook = wxDynamicCast( info->CreateObject(), wxNotebook );
|
||||
Params[0] = wxVariantBase((wxWindow*)frame);
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxPoint( 10, 10 ));
|
||||
Params[3] = wxVariantBase(wxDefaultSize);
|
||||
Params[4] = wxVariantBase((long)0);
|
||||
wxASSERT( info->Create(notebook, 5, Params ));
|
||||
|
||||
// button page
|
||||
|
||||
wxPanel* panel;
|
||||
info = wxClassInfo::FindClass("wxPanel");
|
||||
wxASSERT( info );
|
||||
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
||||
Params[0] = wxVariantBase((wxWindow*)(notebook));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxPoint(-1,-1));
|
||||
Params[3] = wxVariantBase(wxSize(-1,-1));
|
||||
Params[4] = wxVariantBase((long)0);
|
||||
Params[5] = wxVariantBase(wxString(wxT("Hello")));
|
||||
wxASSERT( info->Create(panel, 6, Params ));
|
||||
notebook->AddPage( panel, "Buttons" );
|
||||
|
||||
wxButton* button;
|
||||
info = wxClassInfo::FindClass("wxButton");
|
||||
wxASSERT( info );
|
||||
button = wxDynamicCast( info->CreateObject(), wxButton );
|
||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxString(wxT("Click Me!")));
|
||||
Params[3] = wxVariantBase(wxPoint( 10, 10 ));
|
||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
||||
Params[5] = wxVariantBase((long)0);
|
||||
wxASSERT( info->Create(button, 6, Params ));
|
||||
frameWrapper->SetProperty( "Button", wxVariantBase( button ) );
|
||||
|
||||
// other controls page
|
||||
|
||||
info = wxClassInfo::FindClass("wxPanel");
|
||||
wxASSERT( info );
|
||||
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
||||
Params[0] = wxVariantBase((wxWindow*)(notebook));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxPoint(-1,-1));
|
||||
Params[3] = wxVariantBase(wxSize(-1,-1));
|
||||
Params[4] = wxVariantBase((long)0);
|
||||
Params[5] = wxVariantBase(wxString(wxT("Hello")));
|
||||
wxASSERT( info->Create(panel, 6, Params ));
|
||||
notebook->AddPage( panel, "Other Standard controls" );
|
||||
|
||||
wxControl* control;
|
||||
info = wxClassInfo::FindClass("wxCheckBox");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxString(wxT("A Checkbox")));
|
||||
Params[3] = wxVariantBase(wxPoint( 10, 10 ));
|
||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
||||
Params[5] = wxVariantBase((long)0);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
info = wxClassInfo::FindClass("wxRadioButton");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxString(wxT("A Radiobutton")));
|
||||
Params[3] = wxVariantBase(wxPoint( 10, 30 ));
|
||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
||||
Params[5] = wxVariantBase((long)0);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxString(wxT("Another One")));
|
||||
Params[3] = wxVariantBase(wxPoint( 10, 50 ));
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
info = wxClassInfo::FindClass("wxStaticText");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxString(wxT("A Static Text!")));
|
||||
Params[3] = wxVariantBase(wxPoint( 10, 70 ));
|
||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
||||
Params[5] = wxVariantBase((long)0);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
info = wxClassInfo::FindClass("wxStaticBox");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxString(wxT("A Static Box")));
|
||||
Params[3] = wxVariantBase(wxPoint( 10, 90 ));
|
||||
Params[4] = wxVariantBase(wxSize(100,80));
|
||||
Params[5] = wxVariantBase((long)0);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
info = wxClassInfo::FindClass("wxTextCtrl");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxString(wxT("A Text Control")));
|
||||
Params[3] = wxVariantBase(wxPoint( 10, 200 ));
|
||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
||||
Params[5] = wxVariantBase((long)0);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
// spins and gauges page
|
||||
|
||||
info = wxClassInfo::FindClass("wxPanel");
|
||||
wxASSERT( info );
|
||||
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
||||
Params[0] = wxVariantBase((wxWindow*)(notebook));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxPoint(-1,-1));
|
||||
Params[3] = wxVariantBase(wxSize(-1,-1));
|
||||
Params[4] = wxVariantBase((long)0);
|
||||
Params[5] = wxVariantBase(wxString(wxT("Hello")));
|
||||
wxASSERT( info->Create(panel, 6, Params ));
|
||||
notebook->AddPage( panel, "Spins and Sliders" );
|
||||
|
||||
wxENSURE_CLASS_IS_LINKED(wxSpinButton);
|
||||
|
||||
info = wxClassInfo::FindClass("wxSpinButton");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxPoint( 10, 10 ));
|
||||
Params[3] = wxVariantBase(wxSize(-1,-1));
|
||||
Params[4] = wxVariantBase((long)wxSP_VERTICAL | wxSP_ARROW_KEYS);
|
||||
wxASSERT( info->Create(control, 5, Params ));
|
||||
|
||||
wxENSURE_CLASS_IS_LINKED(wxSpinCtrl);
|
||||
|
||||
info = wxClassInfo::FindClass("wxSpinCtrl");
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase(wxString("20"));
|
||||
Params[3] = wxVariantBase(wxPoint( 40, 10 ));
|
||||
Params[4] = wxVariantBase(wxSize(40,-1));
|
||||
Params[5] = wxVariantBase((long) wxSP_ARROW_KEYS);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
// MSVC likes to exclude from link wxGauge...
|
||||
wxENSURE_CLASS_IS_LINKED(wxGauge)
|
||||
wxENSURE_CLASS_IS_LINKED(wxCheckBox)
|
||||
wxENSURE_CLASS_IS_LINKED(wxSpinCtrl)
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// under wxMSW wxGauge is simply #defined to wxGauge95
|
||||
info = wxClassInfo::FindClass("wxGauge95");
|
||||
#else
|
||||
info = wxClassInfo::FindClass("wxGauge");
|
||||
#endif
|
||||
wxASSERT( info );
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
||||
Params[2] = wxVariantBase((int) 100);
|
||||
Params[3] = wxVariantBase(wxPoint( 10, 50 ));
|
||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
||||
Params[5] = wxVariantBase((long) wxGA_HORIZONTAL);
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
wx_dynamic_cast(wxGauge*, control)->SetValue(20);
|
||||
|
||||
return frameWrapper;
|
||||
}
|
||||
|
||||
bool SaveFrameRTTI(const wxString &testFileName, wxDynamicObject *frame)
|
||||
{
|
||||
// setup the XML document
|
||||
wxXmlDocument xml;
|
||||
wxXmlNode *root = new wxXmlNode(wxXML_ELEMENT_NODE,
|
||||
"TestXTI", "This is the content");
|
||||
xml.SetRoot(root);
|
||||
|
||||
// setup the XTI writer and persister
|
||||
wxObjectXmlWriter writer(root);
|
||||
MyDesignerPersister persister(frame);
|
||||
|
||||
// write the given wxObject into the XML document
|
||||
wxVariantBaseArray empty;
|
||||
writer.WriteObject( frame, frame->GetClassInfo(), &persister,
|
||||
wxString("myTestFrame"), empty );
|
||||
|
||||
return xml.Save(testFileName);
|
||||
}
|
||||
|
||||
wxDynamicObject* LoadFrameRTTI(const wxString &fileName)
|
||||
{
|
||||
// load the XML document
|
||||
wxXmlDocument xml;
|
||||
if (!xml.Load(fileName))
|
||||
return NULL;
|
||||
|
||||
wxXmlNode *root = xml.GetRoot();
|
||||
if (root->GetName() != "TestXTI")
|
||||
return NULL;
|
||||
|
||||
// now depersist the wxFrame we saved into it using wxObjectRuntimeReaderCallback
|
||||
wxObjectRuntimeReaderCallback Callbacks;
|
||||
wxObjectXmlReader Reader( root );
|
||||
int obj = Reader.ReadObject( wxString("myTestFrame"), &Callbacks );
|
||||
return (wxDynamicObject*)Callbacks.GetObject( obj );
|
||||
}
|
||||
|
||||
bool GenerateFrameRTTICode(const wxString &inFileName, const wxString &outFileName)
|
||||
{
|
||||
// is loading the streamed out component from xml and writing code that
|
||||
// will create the same component
|
||||
|
||||
wxFFileOutputStream fos( outFileName );
|
||||
wxTextOutputStream tos( fos );
|
||||
if (!fos.IsOk())
|
||||
return false;
|
||||
|
||||
wxXmlDocument xml;
|
||||
if (!xml.Load(inFileName))
|
||||
return false;
|
||||
|
||||
wxXmlNode *root = xml.GetRoot();
|
||||
if (root->GetName() != "TestXTI")
|
||||
return false;
|
||||
|
||||
// read the XML file using the wxObjectCodeReaderCallback
|
||||
wxObjectCodeReaderCallback Callbacks(&tos);
|
||||
wxObjectXmlReader Reader(root);
|
||||
|
||||
// ReadObject will return the ID of the object read??
|
||||
Reader.ReadObject( wxString("myTestFrame"), &Callbacks );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MyFrame event handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// first create a frame using XTI calls
|
||||
wxDynamicObject *frame = CreateFrameRTTI();
|
||||
if (!frame)
|
||||
{
|
||||
wxLogError(wxT("Cannot create the XTI frame!"));
|
||||
return;
|
||||
}
|
||||
|
||||
// show the frame we're going to save to the user
|
||||
wxFrame *trueFrame = wx_dynamic_cast(wxFrame *, frame->GetSuperClassInstance() );
|
||||
trueFrame->Show();
|
||||
|
||||
// ask the user where to save it
|
||||
wxFileDialog dlg(this, wxT("Where should the frame be saved?"),
|
||||
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"),
|
||||
wxFD_SAVE);
|
||||
if (dlg.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
// then save it to a test XML file
|
||||
if (!SaveFrameRTTI(dlg.GetPath(), frame))
|
||||
{
|
||||
wxLogError(wxT("Cannot save the XTI frame into '%s'"), dlg.GetPath());
|
||||
return;
|
||||
}
|
||||
|
||||
// now simply delete it
|
||||
delete frame;
|
||||
}
|
||||
|
||||
void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// ask the user which file to load
|
||||
wxFileDialog dlg(this, wxT("Which file contains the frame to depersist?"),
|
||||
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"),
|
||||
wxFD_OPEN);
|
||||
if (dlg.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
wxObject *frame = LoadFrameRTTI(dlg.GetPath());
|
||||
if (!frame)
|
||||
{
|
||||
wxLogError(wxT("Could not depersist the wxFrame from '%s'"), dlg.GetPath());
|
||||
return;
|
||||
}
|
||||
|
||||
wxFrame *trueFrame = wx_dynamic_cast(wxFrame*, frame );
|
||||
if ( !trueFrame )
|
||||
{
|
||||
wxDynamicObject* dyno = wx_dynamic_cast(wxDynamicObject*, frame );
|
||||
if ( dyno )
|
||||
trueFrame = wx_dynamic_cast(wxFrame *, dyno->GetSuperClassInstance() );
|
||||
}
|
||||
|
||||
if ( trueFrame )
|
||||
trueFrame->Show();
|
||||
else
|
||||
wxLogError(wxT("Could not show the frame"));
|
||||
}
|
||||
|
||||
void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// ask the user which file to load
|
||||
wxFileDialog dlg(this, wxT("Which file contains the frame to work on?"),
|
||||
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"),
|
||||
wxFD_OPEN);
|
||||
if (dlg.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
// ask the user which file to load
|
||||
wxFileDialog dlg2(this, wxT("Where should the C++ code be saved?"),
|
||||
wxEmptyString, wxT("test.cpp"), wxT("Source files (*.cpp)|*.cpp"),
|
||||
wxFD_SAVE);
|
||||
if (dlg2.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
// do generate code
|
||||
if (!GenerateFrameRTTICode(dlg.GetPath(), dlg2.GetPath()))
|
||||
{
|
||||
wxLogError(wxT("Could not generate the code for the frame!"));
|
||||
return;
|
||||
}
|
||||
|
||||
// show the generated code
|
||||
{
|
||||
wxFileInputStream f(dlg2.GetPath());
|
||||
wxStringOutputStream str;
|
||||
f.Read(str);
|
||||
|
||||
wxDialog dlg(this, wxID_ANY, wxT("Generated code"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE);
|
||||
wxPanel *panel = new wxPanel(&dlg);
|
||||
wxSizer *sz = new wxBoxSizer(wxVERTICAL);
|
||||
sz->Add(new wxTextCtrl(panel, wxID_ANY, str.GetString(),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE|wxTE_READONLY|wxTE_DONTWRAP),
|
||||
1, wxGROW|wxALL, 5);
|
||||
sz->Add(new wxButton(panel, wxID_OK), 0, wxALIGN_RIGHT|wxALL, 5);
|
||||
panel->SetSizerAndFit(sz);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnDumpClasses(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
ClassListDialog dlg(this);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// true is to force the frame to close
|
||||
Close(true);
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxString::Format(
|
||||
_T("Welcome to %s!\n")
|
||||
_T("\n")
|
||||
_T("This sample demonstrates wxWidgets eXtended RTTI (XTI) system."),
|
||||
wxVERSION_STRING
|
||||
),
|
||||
_T("About wxWidgets XTI sample"),
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
}
|
3
samples/xti/xti.rc
Normal file
3
samples/xti/xti.rc
Normal file
@@ -0,0 +1,3 @@
|
||||
mondrian ICON "sample.ico"
|
||||
#include "wx/msw/wx.rc"
|
||||
|
93
src/common/bmpbtncmn.cpp
Normal file
93
src/common/bmpbtncmn.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/bmpbtncmn.cpp
|
||||
// Purpose: wxBitmapButton common code
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id: bmpbuttn.cpp 45338 2007-04-08 22:18:35Z VZ $
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_BMPBUTTON
|
||||
|
||||
#include "wx/bmpbuttn.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/image.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxBitmapButtonStyle )
|
||||
wxBEGIN_FLAGS( wxBitmapButtonStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
|
||||
wxFLAGS_MEMBER(wxBU_AUTODRAW)
|
||||
wxFLAGS_MEMBER(wxBU_LEFT)
|
||||
wxFLAGS_MEMBER(wxBU_RIGHT)
|
||||
wxFLAGS_MEMBER(wxBU_TOP)
|
||||
wxFLAGS_MEMBER(wxBU_BOTTOM)
|
||||
wxEND_FLAGS( wxBitmapButtonStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxBitmapButton, wxButton, "wx/bmpbuttn.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxBitmapButton)
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxBitmapButtonStyle, long, \
|
||||
SetWindowStyleFlag, GetWindowStyleFlag, \
|
||||
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), \
|
||||
wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxBitmapButton)
|
||||
|
||||
wxCONSTRUCTOR_5( wxBitmapButton, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxBitmap, Bitmap, wxPoint, Position, wxSize, Size )
|
||||
|
||||
/*
|
||||
TODO PROPERTIES :
|
||||
|
||||
long "style" , wxBU_AUTODRAW
|
||||
bool "default" , 0
|
||||
bitmap "selected" ,
|
||||
bitmap "focus" ,
|
||||
bitmap "disabled" ,
|
||||
*/
|
||||
|
||||
#endif // wxUSE_BMPBUTTON
|
89
src/common/checkboxcmn.cpp
Normal file
89
src/common/checkboxcmn.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/checkboxcmn.cpp
|
||||
// Purpose: wxCheckBox common code
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id: checkbox.cpp 45492 2007-04-16 00:53:05Z VZ $
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_CHECKBOX
|
||||
|
||||
#include "wx/checkbox.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxCheckBoxStyle )
|
||||
wxBEGIN_FLAGS( wxCheckBoxStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxNO_BORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
|
||||
wxEND_FLAGS( wxCheckBoxStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckBox, wxControl, "wx/checkbox.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxCheckBox)
|
||||
wxEVENT_PROPERTY( Click, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEvent )
|
||||
|
||||
wxPROPERTY( Font, wxFont, SetFont, GetFont, wxEMPTY_PARAMETER_VALUE, \
|
||||
0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString(), \
|
||||
0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( Value,bool, SetValue, GetValue, wxEMPTY_PARAMETER_VALUE, \
|
||||
0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
||||
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxCheckBoxStyle, long, SetWindowStyleFlag, \
|
||||
GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxCheckBox)
|
||||
|
||||
wxCONSTRUCTOR_6( wxCheckBox, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxString, Label, wxPoint, Position, wxSize, Size, long, WindowStyle )
|
||||
|
||||
|
||||
#endif // wxUSE_CHECKBOX
|
103
src/common/checklstcmn.cpp
Normal file
103
src/common/checklstcmn.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/checklstcmn.cpp
|
||||
// Purpose: wxCheckListBox common code
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 16.11.97
|
||||
// RCS-ID: $Id: checklst.cpp 45515 2007-04-17 01:19:43Z VZ $
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_CHECKLISTBOX && wxUSE_OWNER_DRAWN
|
||||
|
||||
#include "wx/checklst.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/msw/wrapcctl.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/colour.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/window.h"
|
||||
#include "wx/listbox.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxCheckListBoxStyle )
|
||||
wxBEGIN_FLAGS( wxCheckListBoxStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
|
||||
wxFLAGS_MEMBER(wxLB_SINGLE)
|
||||
wxFLAGS_MEMBER(wxLB_MULTIPLE)
|
||||
wxFLAGS_MEMBER(wxLB_EXTENDED)
|
||||
wxFLAGS_MEMBER(wxLB_HSCROLL)
|
||||
wxFLAGS_MEMBER(wxLB_ALWAYS_SB)
|
||||
wxFLAGS_MEMBER(wxLB_NEEDED_SB)
|
||||
wxFLAGS_MEMBER(wxLB_SORT)
|
||||
wxFLAGS_MEMBER(wxLB_OWNERDRAW)
|
||||
|
||||
wxEND_FLAGS( wxCheckListBoxStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox, "wx/checklst.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxCheckListBox)
|
||||
wxEVENT_PROPERTY( Toggle, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, wxCommandEvent )
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxCheckListBoxStyle, long, SetWindowStyleFlag, \
|
||||
GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, wxLB_OWNERDRAW /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxCheckListBox)
|
||||
|
||||
wxCONSTRUCTOR_4( wxCheckListBox, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxPoint, Position, wxSize, Size )
|
||||
|
||||
|
||||
#endif
|
85
src/common/dirctrlcmn.cpp
Normal file
85
src/common/dirctrlcmn.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/dirctrlcmn.cpp
|
||||
// Purpose: wxGenericDirCtrl common code
|
||||
// Author: Harm van der Heijden, Robert Roebling, Julian Smart
|
||||
// Modified by:
|
||||
// Created: 12/12/98
|
||||
// RCS-ID: $Id: dirctrlg.cpp 45395 2007-04-11 00:23:19Z VZ $
|
||||
// Copyright: (c) Harm van der Heijden, Robert Roebling and Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_DIRDLG || wxUSE_FILEDLG
|
||||
|
||||
#include "wx/generic/dirctrlg.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// XTI
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxGenericDirCtrlStyle )
|
||||
wxBEGIN_FLAGS( wxGenericDirCtrlStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
|
||||
wxFLAGS_MEMBER(wxDIRCTRL_DIR_ONLY)
|
||||
wxFLAGS_MEMBER(wxDIRCTRL_3D_INTERNAL)
|
||||
wxFLAGS_MEMBER(wxDIRCTRL_SELECT_FIRST)
|
||||
wxFLAGS_MEMBER(wxDIRCTRL_SHOW_FILTERS)
|
||||
wxEND_FLAGS( wxGenericDirCtrlStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericDirCtrl, wxControl, "wx/dirctrl.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxGenericDirCtrl)
|
||||
wxHIDE_PROPERTY( Children )
|
||||
|
||||
wxPROPERTY( DefaultPath, wxString, SetDefaultPath, GetDefaultPath, \
|
||||
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( Filter, wxString, SetFilter, GetFilter, wxEMPTY_PARAMETER_VALUE, \
|
||||
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||
wxPROPERTY( DefaultFilter, int, SetFilterIndex, GetFilterIndex, \
|
||||
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxGenericDirCtrlStyle, long, SetWindowStyleFlag, \
|
||||
GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0, wxT("Helpstring"), \
|
||||
wxT("group") )
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxGenericDirCtrl)
|
||||
|
||||
wxCONSTRUCTOR_8( wxGenericDirCtrl, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxString, DefaultPath, wxPoint, Position, wxSize, Size, \
|
||||
long, WindowStyle, wxString, Filter, int, DefaultFilter )
|
||||
|
||||
#endif // wxUSE_DIRDLG || wxUSE_FILEDLG
|
89
src/common/gridcmn.cpp
Normal file
89
src/common/gridcmn.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/gridcmn.cpp
|
||||
// Purpose: wxGrid common code
|
||||
// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn)
|
||||
// Modified by: Robin Dunn, Vadim Zeitlin, Santiago Palacios
|
||||
// Created: 1/08/1999
|
||||
// RCS-ID: $Id: grid.cpp 45814 2007-05-05 10:16:40Z RR $
|
||||
// Copyright: (c) Michael Bedward (mbedward@ozemail.com.au)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_GRID
|
||||
|
||||
#include "wx/grid.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/valtext.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/math.h"
|
||||
#include "wx/listbox.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxGridStyle )
|
||||
wxBEGIN_FLAGS( wxGridStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB)
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
wxEND_FLAGS( wxGridStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGrid, wxScrolledWindow, "wx/grid.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxGrid)
|
||||
wxHIDE_PROPERTY( Children )
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxGridStyle, long, SetWindowStyleFlag, \
|
||||
GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxGrid)
|
||||
|
||||
wxCONSTRUCTOR_5( wxGrid, wxWindow*, Parent, wxWindowID, Id, wxPoint, Position, \
|
||||
wxSize, Size, long, WindowStyle )
|
||||
|
||||
/*
|
||||
TODO : Expose more information of a list's layout, etc. via appropriate objects (e.g., NotebookPageInfo)
|
||||
*/
|
||||
|
||||
#endif // wxUSE_GRID
|
55
src/common/odcombocmn.cpp
Normal file
55
src/common/odcombocmn.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/odcombocmn.cpp
|
||||
// Purpose: wxOwnerDrawnComboBox common code
|
||||
// Author: Jaakko Salli
|
||||
// Modified by:
|
||||
// Created: Apr-30-2006
|
||||
// RCS-ID: $Id: odcombo.cpp 45397 2007-04-11 10:32:01Z MBN $
|
||||
// Copyright: (c) 2005 Jaakko Salli
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_ODCOMBOBOX
|
||||
|
||||
#include "wx/odcombo.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/dialog.h"
|
||||
#endif
|
||||
|
||||
#include "wx/combo.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS2_XTI(wxOwnerDrawnComboBox, wxComboCtrl, \
|
||||
wxControlWithItems, "wx/odcombo.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxOwnerDrawnComboBox)
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxOwnerDrawnComboBox)
|
||||
|
||||
wxCONSTRUCTOR_5( wxOwnerDrawnComboBox , wxWindow* , Parent , wxWindowID , \
|
||||
Id , wxString , Value , wxPoint , Position , wxSize , Size )
|
||||
|
||||
#endif // wxUSE_ODCOMBOBOX
|
87
src/common/panelcmn.cpp
Normal file
87
src/common/panelcmn.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/panelcmn.cpp
|
||||
// Purpose: wxPanel common code
|
||||
// Author: Julian Smart, Robert Roebling, Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id: panelg.cpp 45056 2007-03-25 22:41:11Z VZ $
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/object.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/colour.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/panel.h"
|
||||
#include "wx/containr.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxPanelStyle )
|
||||
wxBEGIN_FLAGS( wxPanelStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB)
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
wxEND_FLAGS( wxPanelStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel, wxWindow, "wx/panel.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxPanel)
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxPanelStyle, long, \
|
||||
SetWindowStyleFlag, GetWindowStyleFlag, \
|
||||
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group")) // style
|
||||
// style wxTAB_TRAVERSAL
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxPanel)
|
||||
|
||||
wxCONSTRUCTOR_6( wxPanel, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxPoint, Position, wxSize, Size, long, WindowStyle, \
|
||||
wxString, Name)
|
||||
|
||||
|
93
src/common/radiobtncmn.cpp
Normal file
93
src/common/radiobtncmn.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/radiobtncmn.cpp
|
||||
// Purpose: wxRadioButton common code
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id: radiobut.cpp 41144 2006-09-10 23:08:13Z VZ $
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_RADIOBTN
|
||||
|
||||
#include "wx/radiobut.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/settings.h"
|
||||
#include "wx/dcscreen.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxRadioButtonStyle )
|
||||
wxBEGIN_FLAGS( wxRadioButtonStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
|
||||
wxFLAGS_MEMBER(wxRB_GROUP)
|
||||
wxEND_FLAGS( wxRadioButtonStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioButton, wxControl, "wx/radiobut.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxRadioButton)
|
||||
wxEVENT_PROPERTY( Click, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEvent )
|
||||
wxPROPERTY( Font, wxFont, SetFont, GetFont , wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString(), 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group") )
|
||||
wxPROPERTY( Value,bool, SetValue, GetValue, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group") )
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxRadioButtonStyle, long, SetWindowStyleFlag, \
|
||||
GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxRadioButton)
|
||||
|
||||
wxCONSTRUCTOR_6( wxRadioButton, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxString, Label, wxPoint, Position, wxSize, Size, long, WindowStyle )
|
||||
|
||||
|
||||
#endif // wxUSE_RADIOBTN
|
90
src/common/scrolbarcmn.cpp
Normal file
90
src/common/scrolbarcmn.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/scrolbarcmn.cpp
|
||||
// Purpose: wxScrollBar common code
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id: scrolbar.cpp 39476 2006-05-30 13:43:18Z ABX $
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_SCROLLBAR
|
||||
|
||||
#include "wx/scrolbar.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/utils.h"
|
||||
#include "wx/settings.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxScrollBarStyle )
|
||||
wxBEGIN_FLAGS( wxScrollBarStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
|
||||
wxFLAGS_MEMBER(wxSB_HORIZONTAL)
|
||||
wxFLAGS_MEMBER(wxSB_VERTICAL)
|
||||
wxEND_FLAGS( wxScrollBarStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxScrollBar, wxControl, "wx/scrolbar.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxScrollBar)
|
||||
wxEVENT_RANGE_PROPERTY( Scroll, wxEVT_SCROLL_TOP, \
|
||||
wxEVT_SCROLL_CHANGED, wxScrollEvent )
|
||||
|
||||
wxPROPERTY( ThumbPosition, int, SetThumbPosition, GetThumbPosition, 0, \
|
||||
0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( Range, int, SetRange, GetRange, 0, \
|
||||
0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( ThumbSize, int, SetThumbSize, GetThumbSize, 0, \
|
||||
0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( PageSize, int, SetPageSize, GetPageSize, 0, \
|
||||
0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
||||
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxScrollBarStyle, long, SetWindowStyleFlag, \
|
||||
GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxScrollBar)
|
||||
|
||||
wxCONSTRUCTOR_5( wxScrollBar, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxPoint, Position, wxSize, Size, long, WindowStyle )
|
||||
|
||||
#endif // wxUSE_SCROLLBAR
|
108
src/common/slidercmn.cpp
Normal file
108
src/common/slidercmn.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/slidercmn.cpp
|
||||
// Purpose: wxSlider common code
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id: slider95.cpp 41054 2006-09-07 19:01:45Z ABX $
|
||||
// Copyright: (c) Julian Smart 1998
|
||||
// Vadim Zeitlin 2004
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_SLIDER
|
||||
|
||||
#include "wx/slider.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxSliderStyle )
|
||||
wxBEGIN_FLAGS( wxSliderStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
|
||||
wxFLAGS_MEMBER(wxSL_HORIZONTAL)
|
||||
wxFLAGS_MEMBER(wxSL_VERTICAL)
|
||||
wxFLAGS_MEMBER(wxSL_AUTOTICKS)
|
||||
wxFLAGS_MEMBER(wxSL_LABELS)
|
||||
wxFLAGS_MEMBER(wxSL_LEFT)
|
||||
wxFLAGS_MEMBER(wxSL_TOP)
|
||||
wxFLAGS_MEMBER(wxSL_RIGHT)
|
||||
wxFLAGS_MEMBER(wxSL_BOTTOM)
|
||||
wxFLAGS_MEMBER(wxSL_BOTH)
|
||||
wxFLAGS_MEMBER(wxSL_SELRANGE)
|
||||
wxFLAGS_MEMBER(wxSL_INVERSE)
|
||||
wxEND_FLAGS( wxSliderStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl, "wx/slider.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxSlider)
|
||||
wxEVENT_RANGE_PROPERTY( Scroll, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxScrollEvent )
|
||||
wxEVENT_PROPERTY( Updated, wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEvent )
|
||||
|
||||
wxPROPERTY( Value, int, SetValue, GetValue, 0, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( Minimum, int, SetMin, GetMin, 0, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( Maximum, int, SetMax, GetMax, 0, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( PageSize, int, SetPageSize, GetLineSize, 1, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( LineSize, int, SetLineSize, GetLineSize, 1, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( ThumbLength, int, SetThumbLength, GetThumbLength, 1, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxSliderStyle, long, SetWindowStyleFlag, \
|
||||
GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxSlider)
|
||||
|
||||
wxCONSTRUCTOR_8( wxSlider, wxWindow*, Parent, wxWindowID, Id, int, Value, \
|
||||
int, Minimum, int, Maximum, wxPoint, Position, wxSize, Size, \
|
||||
long, WindowStyle )
|
||||
|
||||
#endif // wxUSE_SLIDER
|
100
src/common/spinbtncmn.cpp
Normal file
100
src/common/spinbtncmn.cpp
Normal file
@@ -0,0 +1,100 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/spinbtncmn.cpp
|
||||
// Purpose: wxSpinButton common code
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id: spinbutt.cpp 44657 2007-03-07 22:56:34Z VZ $
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/msw/wrapcctl.h" // include <commctrl.h> "properly"
|
||||
#include "wx/app.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_SPINBTN
|
||||
|
||||
#include "wx/spinbutt.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxSpinButtonStyle )
|
||||
wxBEGIN_FLAGS( wxSpinButtonStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
|
||||
wxFLAGS_MEMBER(wxSP_HORIZONTAL)
|
||||
wxFLAGS_MEMBER(wxSP_VERTICAL)
|
||||
wxFLAGS_MEMBER(wxSP_ARROW_KEYS)
|
||||
wxFLAGS_MEMBER(wxSP_WRAP)
|
||||
wxEND_FLAGS( wxSpinButtonStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinButton, wxControl, "wx/spinbut.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxSpinButton)
|
||||
wxEVENT_RANGE_PROPERTY( Spin, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxSpinEvent )
|
||||
|
||||
wxPROPERTY( Value, int, SetValue, GetValue, 0, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( Min, int, SetMin, GetMin, 0, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY( Max, int, SetMax, GetMax, 0, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxSpinButtonStyle, long, SetWindowStyleFlag, \
|
||||
GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxSpinButton)
|
||||
|
||||
wxCONSTRUCTOR_5( wxSpinButton, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxPoint, Position, wxSize, Size, long, WindowStyle )
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
|
||||
|
||||
|
||||
#endif // wxUSE_SPINBTN
|
85
src/common/statbmpcmn.cpp
Normal file
85
src/common/statbmpcmn.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/statbmpcmn.cpp
|
||||
// Purpose: wxStaticBitmap common code
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id: statbmp.cpp 42816 2006-10-31 08:50:17Z RD $
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ===========================================================================
|
||||
// declarations
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_STATBMP
|
||||
|
||||
#include "wx/statbmp.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxStaticBitmapStyle )
|
||||
wxBEGIN_FLAGS( wxStaticBitmapStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
|
||||
wxEND_FLAGS( wxStaticBitmapStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBitmap, wxControl, "wx/statbmp.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxStaticBitmap)
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxStaticBitmapStyle, long, \
|
||||
SetWindowStyleFlag, GetWindowStyleFlag, \
|
||||
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), \
|
||||
wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxStaticBitmap)
|
||||
|
||||
wxCONSTRUCTOR_5( wxStaticBitmap, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxBitmap, Bitmap, wxPoint, Position, wxSize, Size )
|
||||
|
||||
/*
|
||||
TODO PROPERTIES :
|
||||
bitmap
|
||||
*/
|
||||
|
||||
#endif // wxUSE_STATBMP
|
81
src/common/statboxcmn.cpp
Normal file
81
src/common/statboxcmn.cpp
Normal file
@@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/statboxcmn.cpp
|
||||
// Purpose: wxStaticBox common code
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id: statbox.cpp 45008 2007-03-22 02:28:06Z VZ $
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_STATBOX
|
||||
|
||||
#include "wx/statbox.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxStaticBoxStyle )
|
||||
wxBEGIN_FLAGS( wxStaticBoxStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
wxEND_FLAGS( wxStaticBoxStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBox, wxControl, "wx/statbox.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxStaticBox)
|
||||
wxPROPERTY( Label, wxString, SetLabel, GetLabel, wxString(), 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group"))
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxStaticBoxStyle, long, SetWindowStyleFlag, \
|
||||
GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxStaticBox)
|
||||
|
||||
wxCONSTRUCTOR_6( wxStaticBox, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxString, Label, wxPoint, Position, wxSize, Size, \
|
||||
long, WindowStyle )
|
||||
|
||||
#endif // wxUSE_STATBOX
|
80
src/common/statlinecmn.cpp
Normal file
80
src/common/statlinecmn.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/statlinecmn.cpp
|
||||
// Purpose: wxStaticLine common code
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 28.06.99
|
||||
// Version: $Id: statline.cpp 41054 2006-09-07 19:01:45Z ABX $
|
||||
// Copyright: (c) 1998 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/statline.h"
|
||||
|
||||
#if wxUSE_STATLINE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XTI
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_FLAGS( wxStaticLineStyle )
|
||||
wxBEGIN_FLAGS( wxStaticLineStyle )
|
||||
// new style border flags, we put them first to
|
||||
// use them for streaming out
|
||||
wxFLAGS_MEMBER(wxBORDER_SIMPLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_SUNKEN)
|
||||
wxFLAGS_MEMBER(wxBORDER_DOUBLE)
|
||||
wxFLAGS_MEMBER(wxBORDER_RAISED)
|
||||
wxFLAGS_MEMBER(wxBORDER_STATIC)
|
||||
wxFLAGS_MEMBER(wxBORDER_NONE)
|
||||
|
||||
// old style border flags
|
||||
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
|
||||
wxFLAGS_MEMBER(wxDOUBLE_BORDER)
|
||||
wxFLAGS_MEMBER(wxRAISED_BORDER)
|
||||
wxFLAGS_MEMBER(wxSTATIC_BORDER)
|
||||
wxFLAGS_MEMBER(wxBORDER)
|
||||
|
||||
// standard window styles
|
||||
wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
|
||||
wxFLAGS_MEMBER(wxCLIP_CHILDREN)
|
||||
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
|
||||
wxFLAGS_MEMBER(wxWANTS_CHARS)
|
||||
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
|
||||
wxFLAGS_MEMBER(wxVSCROLL)
|
||||
wxFLAGS_MEMBER(wxHSCROLL)
|
||||
|
||||
wxFLAGS_MEMBER(wxLI_HORIZONTAL)
|
||||
wxFLAGS_MEMBER(wxLI_VERTICAL)
|
||||
wxEND_FLAGS( wxStaticLineStyle )
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticLine, wxControl, "wx/statline.h")
|
||||
|
||||
wxBEGIN_PROPERTIES_TABLE(wxStaticLine)
|
||||
wxPROPERTY_FLAGS( WindowStyle, wxStaticLineStyle, long, SetWindowStyleFlag, \
|
||||
GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
|
||||
wxT("Helpstring"), wxT("group")) // style
|
||||
wxEND_PROPERTIES_TABLE()
|
||||
|
||||
wxEMPTY_HANDLERS_TABLE(wxStaticLine)
|
||||
|
||||
wxCONSTRUCTOR_5( wxStaticLine, wxWindow*, Parent, wxWindowID, Id, \
|
||||
wxPoint, Position, wxSize, Size, long, WindowStyle)
|
||||
|
||||
#endif // wxUSE_STATLINE
|
Reference in New Issue
Block a user