35 template<
class proptype>
38 obj->
SetProperty( value.Clone( a2dObject::clone_flat ) );
41 template<
class proptype>
45 if( property->GetId() == this )
47 if ( obj->HasPropertyId(
this ) )
65 existprop->
Assign( *property );
73 obj->
AddProperty( property->Clone( a2dObject::clone_flat ) );
81 warn.Printf( wxT(
"object with name %s does not have propertyId with name: %s"), obj->
GetName().c_str(), GetName().c_str() );
88 warn.Printf( wxT(
"a2dNamedProperty Id with name %s does not fit propertyId to set with name: %s"), property->GetName().c_str(), GetName().c_str() );
94 template<
class proptype>
97 proptype *castprop = wxStaticCastTmpl( nprop, proptype );
99 SetPropertyToObject( obj, castprop );
102 template<
class proptype>
105 return GetPropertyClone( obj );
108 template<
class proptype>
114 proptype *prop2 = wxStaticCastTmpl( prop->
Clone( a2dObject::clone_deep ), proptype );
120 template<
class proptype>
126 proptype *prop2 = wxStaticCastTmpl( prop, proptype );
133 template<
class proptype>
139 const proptype *prop2 = wxStaticCastTmpl( prop, proptype );
151 template<
class basetype,
class proptype>
163 template<
class basetype,
class proptype>
175 template<
class basetype,
class proptype >
187 template<
class basetype,
class proptype >
194 m_constset = setFunc;
199 template<
class basetype,
class proptype >
206 m_constget = getFunc;
207 m_constset = setFunc;
211 template<
class basetype,
class proptype >
223 template<
class basetype,
class proptype>
226 proptype *castprop = wxStaticCastTmpl( nprop, proptype );
231 template<
class basetype,
class proptype>
234 return GetPropertyClone( obj );
237 template<
class basetype,
class proptype>
241 proptype prop(
this, value );
242 SetPropertyToObject( obj, &prop, setflags );
245 template<
class basetype,
class proptype>
248 if( property->GetId() == this )
250 if ( obj->HasPropertyId(
this ) )
257 proptype *castprop = wxStaticCastTmpl( property, proptype );
260 obj->*m_ptm = castprop->GetValue();
265 (obj->*m_set)( castprop->GetValue() );
270 (obj->*m_constset)( castprop->GetValue() );
289 existprop->
Assign( *property );
297 obj->
AddProperty( property->Clone( a2dObject::clone_flat ) );
305 warn.Printf( wxT(
"object with name %s does not have propertyId with name: %s"), obj->
GetName().c_str(), GetName().c_str() );
306 wxLogWarning( warn );
312 warn.Printf( wxT(
"a2dNamedProperty Id with name %s does not fit propertyId to set with name: %s"), property->GetName().c_str(), GetName().c_str() );
313 wxLogWarning( warn );
317 template<
class basetype,
class proptype>
321 return wxStaticCastNullTmpl( prop, proptype );
324 template<
class basetype,
class proptype>
331 return (obj->*m_get)();
333 return (obj->*m_constget)();
338 proptype *prop2 = wxStaticCastTmpl( prop, proptype );
339 return prop2->GetValue();
341 return GetDefaultValue();
344 template<
class basetype,
class proptype>
351 return (obj->*m_get)();
353 return (obj->*m_constget)();
359 proptype *prop2 = wxStaticCastTmpl( prop, proptype );
360 return prop2->GetValue();
365 template<
class basetype,
class proptype>
372 proptype *prop2 = wxStaticCastTmpl( prop, proptype );
373 return prop2->GetValuePtr();
381 template<
class basetype,
class proptype>
384 return proptype::CreatePropertyFromString(
this, value );
388 template<
class basetype,
class proptype>
395 template<
class basetype,
class proptype>
400 return new proptype(
this, obj->*m_ptm );
404 basetype val = (obj->*m_get)();
405 return new proptype(
this, val );
409 basetype val = (obj->*m_constget)();
410 return new proptype(
this, val );
416 proptype *prop2 = wxStaticCastTmpl( prop->
Clone( a2dObject::clone_deep ), proptype );
426 template<
class basetype,
class proptype >
428 :
a2dPropertyIdTyped<basetype, proptype>( name, flags, defaultvalue, getFunc, setFunc )
432 template<
class basetype,
class proptype >
434 :
a2dPropertyIdTyped<basetype, proptype>( name, flags, defaultvalue, getFunc, setFunc )
438 template<
class basetype,
class proptype >
448 template<
class basetype,
class proptype >
458 template<
class basetype,
class proptype >
468 template<
class basetype,
class proptype >
476 return new proptype( *
this, val );
479 template<
class basetype,
class proptype >
482 return GetPropertyClone( obj );
490 template<
class basetype,
class proptype>
498 template<
class basetype,
class proptype >
506 template<
class basetype,
class proptype >
514 template<
class basetype,
class proptype>
517 return new proptype( *
this, obj->*m_ptm );
virtual void Assign(const a2dNamedProperty &other)=0
Virtual assignment operator.
proptype * GetPropertyClone(const a2dObject *obj) const
retrieve in form of a a2dNamedProperty the value of the property identified with this id ...
(In) Visible property that can be added to Docview Objects.
set the property also to all childs
virtual wxString GetName() const
Returns the name of this object, if no name is given the internal id will be returned.
bool SetPropertyToObject(a2dObject *obj, const basetype &value) const
Set the property value in obj.
fundamental classes used by all other modules.
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
a2dNamedProperty * CreatePropertyFromString(const wxString &value) const
Create a new property object from a value string.
a2dPropertyIdGetSet(const wxString &name, a2dPropertyId::Flags flags, const basetype &defaultvalue, Get getFunc, Set setFunc)
constructor
static a2dPropertyIdTyped< basetype, proptype > * GetDummy()
returns a dummy property id of this type, that can be used in non-id applications ...
const a2dPropertyId * m_id
The property id object identifying this property.
void SetPropertyToObject(a2dObject *obj, const proptype &value) const
Set the property in obj to value (cloning value)
proptype * GetPropertyListOnly(const a2dObject *obj) const
Get the property from the list in obj ( no members, not cloned )
Flags
Flags for property ids.
basetype * GetPropertyValuePtr(a2dObject *obj) const
Get a pointer to the property value in obj.
proptype * GetProperty(a2dObject *obj) const
Get the property in obj (not cloned)
proptype * GetPropertyClone(const a2dObject *obj) const
Get the property in obj (cloned)
void SetNamedPropertyToObject(a2dObject *obj, a2dNamedProperty *nprop, SetFlags setflags=set_none) const
Set the property in obj to value (not cloning value)
void SetProperty(a2dNamedProperty *propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none)
Set the property to the this object.
virtual void OnPropertyChanged(const a2dPropertyId *id)
This function is called after a property changed.
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.
a2dNamedProperty * GetPropertyAsNamedProperty(const a2dObject *obj) const
retrieve in form of a a2dNamedProperty the property identified with this id
void SetPropertyToObject(a2dObject *obj, const basetype &value, SetFlags setflags=set_none) const
Set the property in obj to value.
a2dNamedProperty * Clone(a2dObject::CloneOptions options, a2dRefMap *refs=NULL) const
Virtual copy constructor.
static void DoSetPropertyId(a2dNamedProperty *prop, a2dPropertyId *id)
this is called by derived classes to change an id in a property
remove the property, don't set it as member
void SetNamedPropertyToObject(a2dObject *obj, a2dNamedProperty *nprop, SetFlags setflags=set_none) const
Set the property in obj to value (not cloning value)
a2dPropertyIdTyped()
this constructor is only for property ids referencing other property ids
virtual bool DoIgnoreIfNotMember(const a2dPropertyId *id) const
used to decide if a property shall be ignored, if it is not a member
virtual bool AddProperty(a2dNamedProperty *property)
This function is called by a2dPropertyId to add a property to the list.
This is the base class for all kinds of property id's for a2dObject.
proptype * GetPropertyClone(const a2dObject *obj) const
retrieve in form of a a2dNamedProperty the value of the property identified with this id ...
basetype m_defaultvalue
this is the value returned if e.g. a property is not found
Allow adding a specific property with ID more than once to a list.
virtual bool RemoveProperty(const a2dPropertyId *id, bool all=true)
This function is called by a2dPropertyId to remove a property from the list.
bool DoIgnoreIfNotMember(a2dObject *obj) const
this is called by derived to check if a property should be added as non-member
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
virtual a2dNamedProperty * FindProperty(const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none)
Find a dynamic property with given id in the property list.
This template class is for property ids with a known data type.
Like a2dPropertyIdTyped, but always references a certain member in a certain class.