Crazy Eddie's GUI System
0.8.7
|
27 #ifndef _CEGUIFalPropertyLinkDefinition_h_
28 #define _CEGUIFalPropertyLinkDefinition_h_
30 #include "CEGUI/falagard/FalagardPropertyBase.h"
31 #include "CEGUI/falagard/XMLHandler.h"
32 #include "CEGUI/IteratorBase.h"
35 #if defined (_MSC_VER)
36 # pragma warning(push)
37 # pragma warning(disable : 4251)
51 class PropertyLinkDefinition :
public FalagardPropertyBase<T>
55 typedef typename TypedProperty<T>::Helper Helper;
58 PropertyLinkDefinition(
const String& propertyName,
const String& widgetName,
59 const String& targetProperty,
const String& initialValue,
61 bool redrawOnWrite,
bool layoutOnWrite,
62 const String& fireEvent,
const String& eventNamespace) :
63 FalagardPropertyBase<T>(propertyName,
64 Falagard_xmlHandler::PropertyLinkDefinitionHelpDefaultValue,
66 redrawOnWrite, layoutOnWrite,
67 fireEvent, eventNamespace)
71 if (!widgetName.empty() || !targetProperty.empty())
79 void addLinkTarget(
const String& widget,
const String& property)
81 d_targets.push_back(std::make_pair(widget,property));
94 bool isTargetProperty(
const String& widget,
const String& property)
const
96 LinkTargetCollection::const_iterator i =
d_targets.begin();
99 if (property == i->second && widget == i->first)
121 typename Helper::safe_method_return_type
122 getNative_impl(
const PropertyReceiver* receiver)
const
124 const LinkTargetCollection::const_iterator i(
d_targets.begin());
126 const Window*
const target_wnd =
135 return Helper::fromString(target_wnd->getProperty(i->second.empty() ?
141 typename Helper::pass_type value)
143 updateLinkTargets(receiver, value);
150 void updateLinkTargets(PropertyReceiver* receiver,
151 typename Helper::pass_type value)
const
153 LinkTargetCollection::const_iterator i =
d_targets.begin();
163 target_wnd->setProperty(propertyName, propertyValue);
164 target_wnd->banPropertyFromXML(propertyName);
173 writeFalagardXMLAttributes(xml_stream);
174 writeDefinitionXMLAdditionalAttributes(xml_stream);
178 void writeDefinitionXMLAdditionalAttributes(XMLSerializer& xml_stream)
const
188 void writeFalagardXMLAttributes(XMLSerializer& xml_stream)
const
195 LinkTargetCollection::const_iterator i(
d_targets.begin());
200 if (!i->first.empty())
203 if (!i->second.empty())
213 if (!i->first.empty())
216 if (!i->second.empty())
219 xml_stream.closeTag();
227 const String& name)
const
230 return static_cast<const Window*>(receiver);
234 return static_cast<const Window*>(receiver)->
getParent();
236 return static_cast<const Window*>(receiver)->
getChild(name);
242 const String& name)
const
244 return const_cast<Window*>(
245 getTargetWindow(static_cast<const PropertyReceiver*>(receiver), name));
249 typedef std::pair<String,String> StringPair;
259 LinkTargetIterator getLinkTargetIterator()
const
267 #if defined (_MSC_VER)
268 # pragma warning(pop)
std::vector< StringPair CEGUI_VECTOR_ALLOC(StringPair)> LinkTargetCollection
type used for the collection of targets.
Definition: PropertyLinkDefinition.h:271
static const String GenericDataType
Default or unspecified value for the "dataType" attribute.
Definition: falagard/XMLHandler.h:111
const String S_parentIdentifier
void clearLinkTargets()
clear all link targets from this link definition.
Definition: PropertyLinkDefinition.h:106
static const String ParentIdentifier
String value representing a parent link identifier.
Definition: falagard/XMLHandler.h:115
static const String HelpStringAttribute
Attribute name that stores a help string.
Definition: falagard/XMLHandler.h:200
Class representing a property that links to another property defined on an attached child widget.
Definition: PropertyLinkDefinition.h:71
static const String TypeAttribute
Attribute name that stores a type string.
Definition: falagard/XMLHandler.h:173
const Window * getTargetWindow(const PropertyReceiver *receiver, const String &name) const
Return a pointer to the target window with the given name.
Definition: PropertyLinkDefinition.h:246
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
String d_dataType
Holds data type of this property.
Definition: Property.h:272
LinkTargetCollection d_targets
collection of targets for this PropertyLinkDefinition.
Definition: PropertyLinkDefinition.h:274
String d_name
String that stores the Property name.
Definition: Property.h:267
void addLinkTarget(const String &widget, const String &property)
add a new link target to property on widget (name).
Definition: PropertyLinkDefinition.h:99
static const String PropertyLinkDefinitionElement
Tag name for property link elements.
Definition: falagard/XMLHandler.h:151
iterator for vectors
Definition: IteratorBase.h:309
Window * getParent() const
return the parent of this Window.
Definition: Window.h:1115
void initialisePropertyReceiver(PropertyReceiver *receiver) const
function to allow initialisation of a PropertyReceiver.
Definition: PropertyLinkDefinition.h:127
Window * getChild(const String &name_path) const
return the attached child window that the given name path references.
Definition: Window.h:770
static const String PropertyAttribute
Attribute name that stores the name of a property.
Definition: falagard/XMLHandler.h:196
static const String PropertyLinkDefinitionHelpDefaultValue
Default value for the "type" attribute of PropertyLinkDefinition elements.
Definition: falagard/XMLHandler.h:108
bool empty(void) const
Returns true if the String is empty.
Definition: String.h:651
void writeDefinitionXMLElementType(XMLSerializer &xml_stream) const
Write out the text of the XML element type. Note that you should not write the opening '<' character,...
Definition: PropertyLinkDefinition.h:190
String class used within the GUI system.
Definition: String.h:83
An abstract class that defines the interface to access object properties by name.
Definition: Property.h:83
static const String WidgetAttribute
Attribute name that stores the name of a widget (suffix).
Definition: falagard/XMLHandler.h:184
static const String PropertyLinkTargetElement
Tag name for property link target elements.
Definition: falagard/XMLHandler.h:152
Dummy base class to ensure correct casting of receivers.
Definition: Property.h:68
static const String TargetPropertyAttribute
Attribute name that stores a name of a target property.
Definition: falagard/XMLHandler.h:193
Definition: FalagardPropertyBase.h:56