OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
PropertyInt.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTGui/Property.h"
10
11namespace ot {
12
15 public:
16 PropertyInt(const PropertyInt* _other);
17 PropertyInt(const PropertyBase& _base);
18 PropertyInt(PropertyFlags _flags = PropertyFlags(NoFlags));
19 PropertyInt(int _value, PropertyFlags _flags = PropertyFlags(NoFlags));
20 PropertyInt(const std::string& _name, int _value, PropertyFlags _flags = PropertyFlags(NoFlags));
21 PropertyInt(const std::string& _name, int _value, int _min, int _max, PropertyFlags _flags = PropertyFlags(NoFlags));
22 virtual ~PropertyInt() {};
23
24 static std::string propertyTypeString(void) { return "Int"; };
25 virtual std::string getPropertyType(void) const override { return PropertyInt::propertyTypeString(); };
26
27 virtual Property* createCopy(void) const override;
28
29 void setValue(int _value) { m_value = _value; };
30 int getValue(void) const { return m_value; };
31
32 void setRange(int _min, int _max) { m_min = _min; m_max = _max; };
33
34 void setMin(int _value) { m_min = _value; };
35 int getMin(void) const { return m_min; };
36
37 void setMax(int _value) { m_max = _value; };
38 int getMax(void) const { return m_max; };
39
40 protected:
45 virtual void getPropertyData(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
46
50 virtual void setPropertyData(const ot::ConstJsonObject& _object) override;
51
52 private:
53 int m_value;
54 int m_min;
55 int m_max;
56 };
57
58}
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
The PropertyBase class is used to hold general Property information.
Definition PropertyBase.h:25
The Property class is used as a base class for all Properties that can be displayed and modified in t...
Definition Property.h:21
Definition PropertyInt.h:13
int getMin(void) const
Definition PropertyInt.h:35
void setMin(int _value)
Definition PropertyInt.h:34
int getMax(void) const
Definition PropertyInt.h:38
void setMax(int _value)
Definition PropertyInt.h:37
static std::string propertyTypeString(void)
Definition PropertyInt.h:24
void setRange(int _min, int _max)
Definition PropertyInt.h:32
virtual std::string getPropertyType(void) const override
Definition PropertyInt.h:25
void setValue(int _value)
Definition PropertyInt.h:29
int getValue(void) const
Definition PropertyInt.h:30
virtual ~PropertyInt()
Definition PropertyInt.h:22
Definition Connector.h:8
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30