27 #include "wx/hashmap.h"
28 #include "wx/filename.h"
29 #include "wx/tipwin.h"
40 #define CLASSNAME(name) wxT(#name)
66 virtual wxString GetIdClassName() {
return wxT(
"a2dIdBase" ); }
161 flag_none = 0x00000000,
163 flag_temporary = 0x00000001,
169 flag_transfer = 0x00000002,
171 flag_onlymember = 0x00000004,
179 flag_onlymemberhint = 0x00000008,
184 flag_listfirst = 0x00000010,
188 flag_multiple = 0x00000020,
196 flag_clonedeep = 0x00000040,
201 flag_listonly = 0x00000080,
204 flag_norender = 0x00000100,
207 flag_userDefined = 0x00000200,
210 flag_isEditable = 0x00000400,
213 flag_notify = 0x00000800
215 friend Flags
operator | ( Flags a, Flags b ) {
return ( Flags )( ( int )a | (
int )b ); }
216 friend Flags operator & ( Flags a, Flags b ) {
return ( Flags )( ( int )a & (
int )b ); }
222 set_none = 0x00000000,
228 set_onlymember = 0x00000010,
231 set_remove_non_member = 0x00000020,
234 set_remove_property = 0x00000040
236 friend SetFlags
operator | ( SetFlags a, SetFlags b ) {
return ( SetFlags )( ( int )a | (
int )b ); }
245 virtual wxString
GetName()
const {
return m_name; }
247 void SetName(
const wxString& name ) { m_name = name; }
253 virtual bool operator == (
const a2dPropertyId& other )
const {
return &other ==
this; }
263 bool IsCloneDeep()
const {
return ( m_flags & flag_clonedeep ) != 0; }
265 bool IsTemporary()
const {
return ( m_flags & flag_temporary ) != 0; }
267 bool IsTransfer()
const {
return ( m_flags & flag_transfer ) != 0; }
269 bool IsOnlyMember()
const {
return ( m_flags & flag_onlymember ) != 0; }
273 bool IsListFirst()
const {
return ( m_flags & flag_listfirst ) != 0; }
275 bool IsListOnly()
const {
return ( m_flags & flag_listonly ) != 0; }
279 bool IsEditable()
const {
return ( m_flags & flag_isEditable ) != 0; }
291 void RemovePropertyFromObject(
a2dObject* obj )
const;
308 inline bool DoIgnoreIfNotMember(
a2dObject* obj )
const;
341 bool SmrtPtrRelease()
344 wxASSERT_MSG( m_refcount >= 0, wxT(
"a2dPropertyId Own/Release not matched (extra Release calls)" ) );
345 if ( m_refcount <= 0 )
357 #if defined(WXDOCVIEW_USINGDLL)
358 template class A2DGENERALDLLEXP std::allocator<a2dPropertyId* >;
359 template class A2DGENERALDLLEXP std::allocator< std::_List_nod<a2dPropertyId*, std::allocator<a2dPropertyId* > >::_Node >;
360 template class A2DGENERALDLLEXP std::allocator< std::_List_ptr<a2dPropertyId*, std::allocator<a2dPropertyId* > >::_Nodeptr >;
361 template class A2DGENERALDLLEXP std::list<a2dPropertyId* >;
363 template class A2DGENERALDLLEXP a2dPtrList<a2dPropertyId>;
365 template class A2DGENERALDLLEXP std::allocator<wxUint16 >;
366 template class A2DGENERALDLLEXP std::allocator< std::_List_nod<wxUint16, std::allocator<wxUint16 > >::_Node >;
367 template class A2DGENERALDLLEXP std::allocator< std::_List_ptr<wxUint16, std::allocator<wxUint16 > >::_Nodeptr >;
368 template class A2DGENERALDLLEXP std::list<wxUint16 >;
396 template<
class proptype>
408 void SetPropertyToObject(
a2dObject* obj,
const proptype& value )
const;
410 void SetPropertyToObject(
a2dObject* obj, proptype* value )
const;
419 proptype* GetPropertyClone(
const a2dObject* obj )
const;
434 proptype* GetProperty(
a2dObject* obj )
const;
436 const proptype* GetProperty(
const a2dObject* obj )
const;
476 template<
class basetype,
class proptype>
482 typedef basetype ( wxObject::*Get )()
const;
483 typedef const basetype& ( wxObject::*ConstGet )()
const;
484 typedef void ( wxObject::*Set )( basetype );
485 typedef void ( wxObject::*ConstSet )(
const basetype& value );
486 typedef basetype wxObject::* Mptr;
509 Get getFunc, Set setFunc );
520 Get getFunc, ConstSet setFunc );
523 ConstGet getFunc, ConstSet setFunc );
538 void SetPropertyToObject(
a2dObject* obj,
const basetype& value,
SetFlags setflags = set_none )
const;
544 void SetPropertyToObject(
a2dObject* obj, proptype* property,
SetFlags setflags = set_none )
const;
553 proptype* GetPropertyClone(
const a2dObject* obj )
const;
561 proptype* GetPropertyListOnly(
const a2dObject* obj )
const;
564 basetype GetPropertyValue(
const a2dObject* obj )
const;
567 basetype GetPropertyValue(
const a2dObject* obj,
const basetype& defaultvalue )
const;
570 basetype* GetPropertyValuePtr(
a2dObject* obj )
const;
618 #if defined(A2DGENERALMAKINGDLL) || defined(WXDOCVIEW_USINGDLL)
690 #define A2D_PROPID_GSI_F( type, classname , propname, defaultval, flags ) \
691 PROPID_##propname = new type( wxT(#propname), \
693 static_cast < type::Get >( &classname::Get##propname), \
694 static_cast < type::Set >( &classname::Set##propname) ); \
695 AddPropertyId( PROPID_##propname );
698 #define A2D_PROPID_GSI( type, classname , propname, defaultval ) \
699 A2D_PROPID_GSI_F( type, classname, propname, defaultval, a2dPropertyId::flag_none )
702 #define A2D_PROPID_GS_F( type, classname, propname, defaultval, fget, fset, flags ) \
703 PROPID_##propname = new type( wxT(#propname), \
705 static_cast < type::Get >( &classname::fget), \
706 static_cast < type::Set >( &classname::fset) ) ; \
707 AddPropertyId( PROPID_##propname );
710 #define A2D_PROPID_GS( type, classname , propname, defaultval, fget, fset ) \
711 A2D_PROPID_GS_F( type, classname, propname, defaultval, fget, fset, a2dPropertyId::flag_none )
714 #define A2D_PROPID_D_F( type, propname, defaultval, flags ) \
715 PROPID_##propname = new type( wxT(#propname), \
716 flags, defaultval ); \
717 AddPropertyId( PROPID_##propname );
719 #define A2D_PROPID_D( type, propname, defaultval ) \
720 A2D_PROPID_D_F( type, propname, defaultval, a2dPropertyId::flag_none )
723 #define A2D_PROPID_M_F( type, classname , propname, defaultval, mptr, flags ) \
724 PROPID_##propname = new type( wxT(#propname), \
726 static_cast < type::Mptr >( &classname::mptr) ); \
727 AddPropertyId( PROPID_##propname );
730 #define A2D_PROPID_M( type, classname, propname, defaultval, mptr ) \
731 A2D_PROPID_M_F( type, classname, propname, defaultval, mptr, a2dPropertyId::flag_none )
737 template<
class basetype,
class proptype >
743 typedef basetype ( a2dObject::*
Get )()
const;
745 typedef void ( a2dObject::*
Set )( basetype );
747 typedef void ( a2dObject::*
ConstSet )(
const basetype& value );
749 typedef basetype a2dObject::*
Mptr;
768 basetype
GetPropertyValue(
const a2dObject* obj,
const basetype& defaultvalue )
const;
785 template<
class basetype,
class proptype>
791 bool SetPropertyToObject( a2dObject* obj,
const basetype& value )
const;
792 proptype* GetPropertyClone(
const a2dObject* obj )
const;
798 basetype
GetPropertyValue(
const a2dObject* obj,
const basetype& defaultvalue )
const;
806 #if defined(WXDOCVIEW_USINGDLL)
a2dPropertyIdTyped< wxMenu *, a2dMenuProperty > a2dPropertyIdMenu
property of this type
property to hold an unsigned 4 byte integer type variable to be associated with a a2dObject ...
(In) Visible property that can be added to Docview Objects.
basetype(a2dObject::* Get)() const
get method
bool SetPropertyToObject(a2dObject *obj, const basetype &value) const
Set the property value in obj.
property to hold a a2dObject pointer type variable to be associated with a a2dObject ...
a2dPropertyIdProp(const wxString &name, Flags flags)
Default constructor.
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
a2dPropertyIdTyped< wxUint32, a2dUint32Property > a2dPropertyIdUint32
property of this type
a2dDocumentRenderStyle operator|(a2dDocumentRenderStyle a, a2dDocumentRenderStyle b)
OR-ing a2dDocumentRenderStyle is allowed.
virtual wxString GetName() const
Get the ids print and serialization name.
a2dPropertyIdGetSet(const wxString &name, a2dPropertyId::Flags flags, const basetype &defaultvalue, Get getFunc, Set setFunc)
constructor
a2dPropertyIdTyped< wxString, a2dStringProperty > a2dPropertyIdString
property of this type
a2dMemberDclrTyped< wxFileName, a2dFileNameProperty > wxMemberDclrFileName
for member associated properties of this type
Flags
Flags for property ids.
a2dMemberDclrTyped< wxInt32, a2dInt32Property > wxMemberDclrInt32
for member associated properties of this type
a2dPropertyIdTyped< wxURI, a2dUriProperty > a2dPropertyIdUri
property of this type
This template class is for property ids meant for properties that do not encapsulate another type...
a2dPropertyIdTyped< wxFileName, a2dFileNameProperty > a2dPropertyIdFileName
property of this type
void(a2dObject::* Set)(basetype)
set method
property to hold a double type variable to be associated with a a2dObject
a2dPropertyIdTyped< wxInt32, a2dInt32Property > a2dPropertyIdInt32
property of this type
property to hold a bool type variable to be associated with a a2dObject
void SetName(const wxString &name)
Set the ids print and serialization name.
bool IsCloneDeep() const
Test if this id identifies a property that needs to be cloned deep.
bool IsOnlyMember() const
true if this property is only set as member
proptype * GetPropertyClone(const a2dObject *obj) const
Get the property in obj (cloned)
a2dPropertyIdGetSet< bool, a2dBoolProperty > a2dPropertyIdBoolGetSet
bool IsOnlyMemberHint() const
true if this property has the only set as member hint set
a2dPropertyIdTyped< bool, a2dBoolProperty > a2dPropertyIdBool
property of this type
property to hold a wxURI type variable to be associated with a a2dObject
A trivial base class for a2dSmrtPtr. Non-template class, so that it can.
list of a2dNamedProperty objects
bool IsTemporary() const
Test if this id identifies a temporary property.
a2dPropertyIdTyped< float, a2dFloatProperty > a2dPropertyIdFloat
property of this type
a2dPropertyIdTyped< wxArrayString, a2dArrayStringProperty > a2dPropertyIdArrayString
property of this type
a2dPropertyIdProp()
this constructor is only for property ids referencing other property ids
property to hold a window type variable (for example wxTipWindow) to be associated with a a2dObject ...
a2dPropertyIdTyped< a2dSmrtPtr< a2dObject >, a2dProperty > a2dPropertyIdRefObject
property of this type
property to hold a FileName type variable to be associated with a a2dObject
property to hold a a2dObjectPtr smart pointer type variable to be associated with a a2dObject ...
property to hold a wxArrayString type variable to be associated with a a2dObject
virtual ~a2dPropertyId()
destructor
property to hold a 2 byte integer type variable to be associated with a a2dObject ...
bool IsListFirst() const
true if this property searches the list first, then members
a2dMemberDclrTyped< wxArrayString, a2dArrayStringProperty > wxMemberDclrArrayString
for member associated properties of this type
property to hold a wxDateTime type variable to be associated with a a2dObject
SetFlags
Flags used for manipulating the way a property is set to a2dObject.
const basetype & GetDefaultValue() const
Get the default value for this property.
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
property to hold a 2 byte integer type variable to be associated with a a2dObject ...
a2dPropertyIdTyped< wxDateTime, a2dDateTimeProperty > a2dPropertyIdDateTime
property of this type
bool CheckFlags(Flags flags) const
check a flag mask (all given flags must be set)
a2dPropertyIdTyped< wxObject, a2dObjectProperty > a2dPropertyIdObject
property of this type
bool IsUserDefined() const
true if this property is user defined
a2dPropertyIdTyped< wxUint16, a2dUint16Property > a2dPropertyIdUint16
property of this type
bool IsListOnly() const
true if this property searches the list only
void(a2dObject::* ConstSet)(const basetype &value)
constant get method
virtual const a2dPropertyId * GetSubID() const
Get the sub (post-dot) part of a hierarchical id.
A class for id's of various kinds.
WX_DECLARE_STRING_HASH_MAP(a2dPropertyId *, a2dPropertyIdHashMap)
Declaration of the hash map type to convert prop names to prop id objects.
basetype a2dObject::* Mptr
member pointer
a2dMemberDclrTyped< wxUint32, a2dUint32Property > wxMemberDclrUint32
for member associated properties of this type
property to hold a tip window type variable to be associated with a a2dObject
property to hold a wxString type variable to be associated with a a2dObject
basetype a2dObject::* m_ptm
pointer to member
virtual const a2dPropertyId * GetMainID() const
Get the main (pre-dot) part of a hierarchical id.
a2dPropertyIdTyped< a2dAutoZeroPtr< a2dObject >, a2dAutoZeroProperty > a2dPropertyIdRefObjectAutoZero
property of this type
a2dPropertyIdTyped()
this constructor is only for property ids referencing other property ids
property to hold a void pointer type variable to be associated with a a2dObject
bool IsTransfer() const
true if this property is transfered via e.g. a command processor
This is the base class for all kinds of property id's for a2dObject.
a2dMemberDclrTyped< wxUint16, a2dUint16Property > wxMemberDclrUint16
for member associated properties of this type
a2dMemberDclrTyped< void *, a2dVoidPtrProperty > wxMemberDclrVoidPtr
for member associated properties of this type
property to hold a wxObject variable to be associated with a a2dObject
smart pointer class and list.
basetype m_defaultvalue
this is the value returned if e.g. a property is not found
a2dMemberDclrTyped< wxInt16, a2dInt16Property > wxMemberDclrInt16
for member associated properties of this type
a2dMemberDclrTyped< bool, a2dBoolProperty > wxMemberDclrBool
for member associated properties of this type
a2dMemberDclrTyped< wxString, a2dStringProperty > wxMemberDclrString
for member associated properties of this type
a2dPropertyIdTyped< wxInt16, a2dInt16Property > a2dPropertyIdInt16
property of this type
bool IsEditable() const
true if this property is editable ( can be tested in a property editor ).
a2dMemberDclrTyped< wxColour, a2dColourProperty > wxMemberDclrColour
for member associated properties of this type
This template class is for property ids with a known data type.
bool CheckCollect(const a2dPropertyId *id, Flags flags) const
check a property id and flags to see if the property shall be collected
Like a2dPropertyIdTyped, but always references a certain member in a certain class.
property to hold a FileName type variable to be associated with a a2dObject
a2dPropertyIdTyped< wxWindow *, a2dWindowProperty > a2dPropertyIdWindow
property of this type
a2dMemberDclrTyped< double, a2dDoubleProperty > wxMemberDclrDouble
for member associated properties of this type
property to hold a float type variable to be associated with a a2dObject
virtual a2dNamedProperty * CreatePropertyFromString(const wxString &value) const
Create a new property object from a value string.
property to hold an unsigned 2 byte integer type variable to be associated with a a2dObject ...
a2dPropertyIdTyped< double, a2dDoubleProperty > a2dPropertyIdDouble
property of this type
a2dPropertyIdTyped< void *, a2dVoidPtrProperty > a2dPropertyIdVoidPtr
property of this type
a2dSmrtPtrList< a2dPropertyId > a2dPropertyIdList
list to hold a set of property id objects pointers