OpenLexocad  28.0
PropertyProxy.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Core/Property.h>
4 
5 
6 namespace Core
7 {
8 /*@brief
9  * A PropertyProxy serves as a placeholder for another property (usually in another class).
10  * It is used to mimic the Properties update mechanism even if the class it is used in does
11  * not have a property of this king.
12  * P.e. it can be used in an Element to do as if it would have a PropertyShape. This way
13  * the updating of shapes can be more easily handled in App.Element.
14  */
15 
16 class LX_CORE_EXPORT PropertyProxy : public Core::Property
17 {
19 
20 public:
21  inline void setValue(bool b);
22  bool setValueFromVariant(const Core::Variant& value);
24 
25  bool getValue() const;
27 
28  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
30  virtual bool isEqual(const Property*) const;
31  virtual Core::Property* copy(void) const override;
32  virtual void paste(const Core::Property& from) override;
33 
34 protected:
35  bool _nValue = false;
36 };
37 
39 
40 } // namespace Core
Property.h
Core::PropertyProxy::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyProxy::getValue
bool getValue() const
Core::PropertyProxy::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value)
Base::PersistenceVersion
Definition: Persistence.h:13
Core::PropertyProxy::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core
Definition: Base.h:5
Core::Variant
Definition: Variant.h:78
Base::AbstractWriter
Definition: Writer.h:13
Core::PropertyProxy::getVariant
Core::Variant getVariant(void) const
Base::AbstractXMLReader
Definition: AbstractXMLReader.h:7
Core::PropertyProxy::copyValue
void copyValue(Core::Property *p)
Core::PropertyProxy::setValue
void setValue(bool b)
Core::PropertyProxy
Definition: PropertyProxy.h:17
Core::version
LX_CORE_EXPORT Version & version
Core::Property
Definition: Property.h:72
Core::PropertyProxy::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyProxy::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyProxy::isEqual
virtual bool isEqual(const Property *) const
compare properties
TYPESYSTEM_HEADER
#define TYPESYSTEM_HEADER()
define for subclassing Base::BaseClass
Definition: Base.h:12
Core::DECLARE_PROPERTY_FACTORY
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)