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)
57 const String& targetProperty,
const String& initialValue,
59 bool redrawOnWrite,
bool layoutOnWrite,
64 redrawOnWrite, layoutOnWrite,
65 fireEvent, eventNamespace)
69 if (!widgetName.
empty() || !targetProperty.
empty())
79 d_targets.push_back(std::make_pair(widget,property));
92 bool isTargetProperty(
const String& widget,
const String& property)
const
94 LinkTargetCollection::const_iterator i =
d_targets.begin();
97 if (property == i->second && widget == i->first)
107 updateLinkTargets(receiver, Helper::fromString(this->
d_default));
119 typename Helper::safe_method_return_type
120 getNative_impl(
const PropertyReceiver* receiver)
const
122 const LinkTargetCollection::const_iterator i(
d_targets.begin());
124 const Window*
const target_wnd =
129 return Helper::fromString(TypedProperty<T>::d_default);
133 return Helper::fromString(target_wnd->getProperty(i->second.empty() ?
134 TypedProperty<T>::d_name : i->second));
138 void setNative_impl(PropertyReceiver* receiver,
139 typename Helper::pass_type value)
141 updateLinkTargets(receiver, value);
144 FalagardPropertyBase<T>::setNative_impl(receiver, value);
148 void updateLinkTargets(PropertyReceiver* receiver,
149 typename Helper::pass_type value)
const
151 LinkTargetCollection::const_iterator i =
d_targets.begin();
158 target_wnd->setProperty(i->second.empty() ?
159 TypedProperty<T>::d_name : i->second, Helper::toString(value));
167 writeFalagardXMLAttributes(xml_stream);
168 writeDefinitionXMLAdditionalAttributes(xml_stream);
172 void writeDefinitionXMLAdditionalAttributes(
XMLSerializer& xml_stream)
const
182 void writeFalagardXMLAttributes(XMLSerializer& xml_stream)
const
189 LinkTargetCollection::const_iterator i(
d_targets.begin());
194 if (!i->first.empty())
197 if (!i->second.empty())
207 if (!i->first.empty())
210 if (!i->second.empty())
224 return static_cast<const Window*>(receiver);
228 return static_cast<const Window*
>(receiver)->getParent();
230 return static_cast<const Window*
>(receiver)->getChild(name);
238 return const_cast<Window*
>(
239 getTargetWindow(static_cast<const PropertyReceiver*>(receiver), name));
243 typedef std::pair<String,String> StringPair;
261 #if defined (_MSC_VER)
262 # pragma warning(pop)
static const String GenericDataType
Default or unspecified value for the "dataType" attribute.
Definition: falagard/XMLHandler.h:84
static const String TargetPropertyAttribute
Attribute name that stores a name of a target property.
Definition: falagard/XMLHandler.h:167
static const String HelpStringAttribute
Attribute name that stores a help string.
Definition: falagard/XMLHandler.h:174
static const String TypeAttribute
Attribute name that stores a type string.
Definition: falagard/XMLHandler.h:147
XMLSerializer & openTag(const String &name)
Start a new tag in the xml document.
bool empty(void) const
Returns true if the String is empty.
Definition: String.h:633
iterator for vectors
Definition: IteratorBase.h:287
XMLSerializer & attribute(const String &name, const String &value)
After an opening tag you can populate attribute list with this function.
Window * getTargetWindow(PropertyReceiver *receiver, const String &name) const
Return a pointer to the target window with the given name.
Definition: PropertyLinkDefinition.h:235
Class representing a property that links to another property defined on an attached child widget...
Definition: PropertyLinkDefinition.h:49
Dummy base class to ensure correct casting of receivers.
Definition: Property.h:45
static const String PropertyLinkDefinitionElement
Tag name for property link elements.
Definition: falagard/XMLHandler.h:125
XMLSerializer & closeTag(void)
Close the current tag.
void clearLinkTargets()
clear all link targets from this link definition.
Definition: PropertyLinkDefinition.h:84
std::vector< StringPair CEGUI_VECTOR_ALLOC(StringPair)> LinkTargetCollection
type used for the collection of targets.
Definition: PropertyLinkDefinition.h:245
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:149
Helper class used to convert various data types to and from the format expected in Property strings...
Definition: ForwardRefs.h:84
static const String PropertyAttribute
Attribute name that stores the name of a property.
Definition: falagard/XMLHandler.h:170
String d_default
String that stores the Property default value string.
Definition: Property.h:246
void initialisePropertyReceiver(PropertyReceiver *receiver) const
function to allow initialisation of a PropertyReceiver.
Definition: PropertyLinkDefinition.h:105
const Window * getTargetWindow(const PropertyReceiver *receiver, const String &name) const
Return a pointer to the target window with the given name.
Definition: PropertyLinkDefinition.h:220
static const String PropertyLinkDefinitionHelpDefaultValue
Default value for the "type" attribute of PropertyLinkDefinition elements.
Definition: falagard/XMLHandler.h:81
static const String WidgetAttribute
Attribute name that stores the name of a widget (suffix).
Definition: falagard/XMLHandler.h:158
An abstract class that defines the interface to access object properties by name. ...
Definition: Property.h:60
Definition: FalagardPropertyBase.h:36
Class used to create XML Document.
Definition: XMLSerializer.h:85
void addLinkTarget(const String &widget, const String &property)
add a new link target to property on widget (name).
Definition: PropertyLinkDefinition.h:77
LinkTargetCollection d_targets
collection of targets for this PropertyLinkDefinition.
Definition: PropertyLinkDefinition.h:248
void writeDefinitionXMLElementType(XMLSerializer &xml_stream) const
Write out the text of the XML element type. Note that you should not write the opening '<' charact...
Definition: PropertyLinkDefinition.h:164
static const String ParentIdentifier
String value representing a parent link identifier.
Definition: falagard/XMLHandler.h:88
static const String PropertyLinkTargetElement
Tag name for property link target elements.
Definition: falagard/XMLHandler.h:126
String class used within the GUI system.
Definition: String.h:62