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)
59 const String& targetProperty,
const String& initialValue,
61 bool redrawOnWrite,
bool layoutOnWrite,
66 redrawOnWrite, layoutOnWrite,
67 fireEvent, eventNamespace)
71 if (!widgetName.
empty() || !targetProperty.
empty())
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 =
131 return Helper::fromString(FalagardPropertyBase<T>::d_initialValue);
135 return Helper::fromString(target_wnd->getProperty(i->second.empty() ?
136 TypedProperty<T>::d_name : i->second));
140 void setNative_impl(PropertyReceiver* receiver,
141 typename Helper::pass_type value)
143 updateLinkTargets(receiver, value);
146 FalagardPropertyBase<T>::setNative_impl(receiver, value);
150 void updateLinkTargets(PropertyReceiver* receiver,
151 typename Helper::pass_type value)
const
153 LinkTargetCollection::const_iterator i =
d_targets.begin();
161 const CEGUI::String& propertyName = i->second.empty() ? TypedProperty<T>::d_name : i->second;
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())
230 return static_cast<const Window*>(receiver);
234 return static_cast<const Window*
>(receiver)->getParent();
236 return static_cast<const Window*
>(receiver)->getChild(name);
244 return const_cast<Window*
>(
245 getTargetWindow(static_cast<const PropertyReceiver*>(receiver), name));
249 typedef std::pair<String,String> StringPair;
259 LinkTargetIterator getLinkTargetIterator()
const
261 return LinkTargetIterator(d_targets.begin(),d_targets.end());
267 #if defined (_MSC_VER)
268 # pragma warning(pop)
static const String GenericDataType
Default or unspecified value for the "dataType" attribute.
Definition: falagard/XMLHandler.h:89
static const String TargetPropertyAttribute
Attribute name that stores a name of a target property.
Definition: falagard/XMLHandler.h:172
static const String HelpStringAttribute
Attribute name that stores a help string.
Definition: falagard/XMLHandler.h:179
static const String TypeAttribute
Attribute name that stores a type string.
Definition: falagard/XMLHandler.h:152
XMLSerializer & openTag(const String &name)
Start a new tag in the xml document.
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
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:241
Class representing a property that links to another property defined on an attached child widget...
Definition: PropertyLinkDefinition.h:51
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:130
XMLSerializer & closeTag(void)
Close the current tag.
void clearLinkTargets()
clear all link targets from this link definition.
Definition: PropertyLinkDefinition.h:86
std::vector< StringPair CEGUI_VECTOR_ALLOC(StringPair)> LinkTargetCollection
type used for the collection of targets.
Definition: PropertyLinkDefinition.h:251
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:149
const String S_parentIdentifier
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:175
void initialisePropertyReceiver(PropertyReceiver *receiver) const
function to allow initialisation of a PropertyReceiver.
Definition: PropertyLinkDefinition.h:107
const Window * getTargetWindow(const PropertyReceiver *receiver, const String &name) const
Return a pointer to the target window with the given name.
Definition: PropertyLinkDefinition.h:226
static const String PropertyLinkDefinitionHelpDefaultValue
Default value for the "type" attribute of PropertyLinkDefinition elements.
Definition: falagard/XMLHandler.h:86
static const String WidgetAttribute
Attribute name that stores the name of a widget (suffix).
Definition: falagard/XMLHandler.h:163
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:79
LinkTargetCollection d_targets
collection of targets for this PropertyLinkDefinition.
Definition: PropertyLinkDefinition.h:254
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:170
static const String ParentIdentifier
String value representing a parent link identifier.
Definition: falagard/XMLHandler.h:93
static const String PropertyLinkTargetElement
Tag name for property link target elements.
Definition: falagard/XMLHandler.h:131
String class used within the GUI system.
Definition: String.h:62