Crazy Eddie's GUI System
0.8.7
|
29 #ifndef _CEGUIPropertySet_h_
30 #define _CEGUIPropertySet_h_
32 #include "CEGUI/Base.h"
33 #include "CEGUI/String.h"
34 #include "CEGUI/IteratorBase.h"
35 #include "CEGUI/Property.h"
36 #include "CEGUI/PropertyHelper.h"
37 #include "CEGUI/TypedProperty.h"
40 #include "CEGUI/TplWindowProperty.h"
41 #include "CEGUI/Exceptions.h"
45 # pragma warning(push)
46 # pragma warning(disable : 4251)
107 class CEGUIEXPORT PropertySet :
public PropertyReceiver
121 virtual ~PropertySet(
void) {}
138 void addProperty(Property* property);
148 void removeProperty(
const String& name);
161 Property* getPropertyInstance(
const String& name)
const;
168 void clearProperties(
void);
181 bool isPropertyPresent(
const String& name)
const;
196 const String& getPropertyHelp(
const String& name)
const;
211 String getProperty(
const String& name)
const;
220 typename PropertyHelper<T>::return_type getProperty(
const String& name)
const
222 PropertyRegistry::const_iterator pos = d_properties.find(name);
224 if (pos == d_properties.end())
226 CEGUI_THROW(UnknownObjectException(
"There is no Property named '" + name +
"' available in the set."));
229 Property* baseProperty = pos->second;
230 TypedProperty<T>* typedProperty =
dynamic_cast<TypedProperty<T>*
>(baseProperty);
235 return typedProperty->getNative(
this);
240 return PropertyHelper<T>::fromString(baseProperty->get(
this));
257 void setProperty(
const String& name,
const String& value);
268 PropertyRegistry::iterator pos = d_properties.find(name);
270 if (pos == d_properties.end())
275 Property* baseProperty = pos->second;
301 bool isPropertyDefault(
const String& name)
const;
319 PropertyRegistry d_properties;
333 PropertyIterator getPropertyIterator(
void)
const;
352 #define CEGUI_DEFINE_PROPERTY(class_type, property_native_type, name, help, setter, getter, default_value)\
354 static ::CEGUI::TplWindowProperty<class_type, property_native_type> sProperty(\
355 name, help, propertyOrigin, setter, getter, default_value);\
357 this->addProperty(&sProperty);\
381 #define CEGUI_DEFINE_PROPERTY_NO_XML(class_type, property_native_type, name, help, setter, getter, default_value)\
383 static ::CEGUI::TplWindowProperty<class_type, property_native_type> sProperty(\
384 name, help, propertyOrigin, setter, getter, default_value, false);\
386 this->addProperty(&sProperty);\
391 #if defined(_MSC_VER)
392 # pragma warning(pop)
395 #endif // end of guard _CEGUIPropertySet_h_
Functor that can be used as comparator in a std::map with String keys. It's faster than using the def...
Definition: String.h:5600
base class for properties able to do native set/get
Definition: TypedProperty.h:73
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
virtual void setNative(PropertyReceiver *receiver, typename Helper::pass_type value)
native set method, sets the property given a native type
Definition: TypedProperty.h:130
Exception class used when a request was made for an unknown object.
Definition: Exceptions.h:268
iterator class for maps
Definition: IteratorBase.h:218
String class used within the GUI system.
Definition: String.h:83
virtual void set(PropertyReceiver *receiver, const String &value)=0
Sets the value of the property.
An abstract class that defines the interface to access object properties by name.
Definition: Property.h:83
Helper class used to convert various data types to and from the format expected in Property strings.
Definition: ForwardRefs.h:105