OpenLexocad  27.0
PropertyColor.h
Go to the documentation of this file.
1 #pragma once
2 #include <Base/Color.h>
3 #include <Core/Property.h>
4 #include <Core/Variant.h>
5 #include <Core/core_defines2.h>
6 
7 namespace Core
8 {
10 {
12 
13 public:
14  PropertyColor(void);
15  virtual ~PropertyColor(void);
16 
17 
18  void setValue(const Base::Color& c);
19  void setValue(int r, int g, int b);
20  bool setValueFromVariant(const Core::Variant& value);
21 
23  virtual bool setKeyValue(const std::string& name, const Core::Variant& value);
25  virtual std::map<std::string, Core::Variant> getKeyValueMap() const;
26 
27  void copyValue(Core::Property* p);
28 
29  const Base::Color& getValue() const;
30  Core::Variant getVariant(void) const;
31 
32  virtual void save(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version);
33  virtual void restore(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version);
34  virtual bool isEqual(const Property*) const;
35 
36 protected:
38 };
39 
41 {
43 
44 public:
46  virtual ~PropertyColorList();
47 
48  void setValue(const std::vector<Base::MColor>& clist);
49  void setValue(const std::vector<Base::Color>& clist);
50  bool setValueFromVariant(const Core::Variant& value);
51  void copyValue(Core::Property* p);
52 
53  void addColor(const Base::MColor& c);
54  void setEmpty();
55  bool isEmpty() const;
56 
57  const std::vector<Base::MColor>& getValue() const;
58 
59  Core::Variant getVariant(void) const { return Core::Variant(_colorList); }
60 
61  virtual void save(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version);
62  virtual void restore(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version);
63  virtual bool isEqual(const Property*) const;
64 
65 protected:
66  std::vector<Base::MColor> _colorList;
67 };
68 
70 DECLARE_PROPERTY_FACTORY(PropertyColor_Factory, Core::PropertyColor);
71 DECLARE_PROPERTY_FACTORY(PropertyColorOpt_Factory, Core::PropertyColorOpt);
72 DECLARE_PROPERTY_FACTORY(PropertyColorList_Factory, Core::PropertyColorList);
73 
74 } // namespace Core
DECLARE_OPTIONAL_PROPERTY_HEADER(PropertyColorOpt, Core::PropertyColor)
#define CORE_EXPORT
Definition: core_defines2.h:10
Base::Color _cValue
Definition: PropertyColor.h:37
Definition: Color.h:47
Core::PropertyText name
Definition: CoreDocument.h:143
Definition: Persistance.h:20
Definition: PropertyColor.h:9
LX_CORE_EXPORT Version & version
Definition: Variant.h:90
Definition: AbstractXMLReader.h:10
Definition: Base.h:19
Definition: Writer.h:27
Core::Variant getVariant(void) const
Definition: PropertyColor.h:59
Definition: Color.h:23
Definition: PropertyColor.h:40
std::vector< Base::MColor > _colorList
Definition: PropertyColor.h:66
Definition: Property.h:81
TYPESYSTEM_HEADER()
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)