28 #ifndef _CEGUIFalPropertyLinkDefinition_h_
29 #define _CEGUIFalPropertyLinkDefinition_h_
31 #include "CEGUI/falagard/FalagardPropertyBase.h"
32 #include "CEGUI/IteratorBase.h"
35 #if defined (_MSC_VER)
36 # pragma warning(push)
37 # pragma warning(disable : 4251)
42 extern const String S_parentIdentifier;
58 const String& targetProperty,
const String& initialValue,
60 bool redrawOnWrite,
bool layoutOnWrite,
63 "Falagard property link definition - links a "
64 "property on this window to properties "
65 "defined on one or more child windows, or "
68 redrawOnWrite, layoutOnWrite,
69 fireEvent, eventNamespace)
73 if (!widgetName.
empty() || !targetProperty.
empty())
83 d_targets.push_back(std::make_pair(widget,property));
96 bool isTargetProperty(
const String& widget,
const String& property)
const
98 LinkTargetCollection::const_iterator i =
d_targets.begin();
101 if (property == i->second && widget == i->first)
111 updateLinkTargets(receiver, Helper::fromString(this->
d_default));
123 typename Helper::safe_method_return_type
124 getNative_impl(
const PropertyReceiver* receiver)
const
126 const LinkTargetCollection::const_iterator i(
d_targets.begin());
128 const Window*
const target_wnd =
133 return Helper::fromString(TypedProperty<T>::d_default);
137 return Helper::fromString(target_wnd->getProperty(i->second.empty() ?
138 TypedProperty<T>::d_name : i->second));
142 void setNative_impl(PropertyReceiver* receiver,
143 typename Helper::pass_type value)
145 updateLinkTargets(receiver, value);
148 FalagardPropertyBase<T>::setNative_impl(receiver, value);
152 void updateLinkTargets(PropertyReceiver* receiver,
153 typename Helper::pass_type value)
const
155 LinkTargetCollection::const_iterator i =
d_targets.begin();
162 target_wnd->setProperty(i->second.empty() ?
163 TypedProperty<T>::d_name : i->second, Helper::toString(value));
170 xml_stream.
openTag(
"PropertyLinkDefinition");
174 void writeFalagardXMLAttributes(
XMLSerializer& xml_stream)
const
183 LinkTargetCollection::const_iterator i(
d_targets.begin());
188 if (!i->first.empty())
189 xml_stream.
attribute(
"widget", i->first);
191 if (!i->second.empty())
192 xml_stream.
attribute(
"targetProperty", i->second);
199 xml_stream.
openTag(
"PropertyLinkTarget");
201 if (!i->first.empty())
202 xml_stream.
attribute(
"widget", i->first);
204 if (!i->second.empty())
205 xml_stream.
attribute(
"property", i->second);
218 return static_cast<const Window*>(receiver);
221 if (name== S_parentIdentifier)
222 return static_cast<const Window*
>(receiver)->getParent();
224 return static_cast<const Window*
>(receiver)->getChild(name);
232 return const_cast<Window*
>(
233 getTargetWindow(static_cast<const PropertyReceiver*>(receiver), name));
237 typedef std::pair<String,String> StringPair;
255 #if defined (_MSC_VER)
256 # pragma warning(pop)