OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
Margins.h
Go to the documentation of this file.
1
5// ###########################################################################################################################################################################################################################################################################################################################
6
7#pragma once
8
9// OpenTwin header
10#include "OTCore/Serializable.h"
13
14namespace ot {
15
16 // #########################################################################################################################################################################################################
17
19 public:
20 Margins() : m_left(0), m_top(0), m_right(0), m_bottom(0) {};
21 Margins(int _left, int _top, int _right, int _bottom) : m_left(_left), m_top(_top), m_right(_right), m_bottom(_bottom) {};
22 Margins(const Margins& _other) : m_left(_other.m_left), m_top(_other.m_top), m_right(_other.m_right), m_bottom(_other.m_bottom) {};
23 virtual ~Margins() {};
24
25 Margins& operator = (const Margins& _other);
26
30 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
31
35 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
36
37 void setLeft(int _margin) { m_left = _margin; };
38 int left(void) const { return m_left; };
39
40 void setRight(int _margin) { m_right = _margin; };
41 int right(void) const { return m_right; };
42
43 void setTop(int _margin) { m_top = _margin; };
44 int top(void) const { return m_top; };
45
46 void setBottom(int _margin) { m_bottom = _margin; };
47 int bottom(void) const { return m_bottom; };
48
49 private:
50 int m_left;
51 int m_top;
52 int m_right;
53 int m_bottom;
54 };
55
56 // #########################################################################################################################################################################################################
57
59 public:
60 MarginsF() : m_left(0.f), m_top(0.f), m_right(0.f), m_bottom(0.f) {};
61 MarginsF(float _left, float _top, float _right, float _bottom) : m_left(_left), m_top(_top), m_right(_right), m_bottom(_bottom) {};
62 MarginsF(const MarginsF& _other) : m_left(_other.m_left), m_top(_other.m_top), m_right(_other.m_right), m_bottom(_other.m_bottom) {};
63 virtual ~MarginsF() {};
64
65 MarginsF& operator = (const MarginsF& _other);
66
70 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
71
75 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
76
77 void setLeft(float _margin) { m_left = _margin; };
78 float left(void) const { return m_left; };
79
80 void setRight(float _margin) { m_right = _margin; };
81 float right(void) const { return m_right; };
82
83 void setTop(float _margin) { m_top = _margin; };
84 float top(void) const { return m_top; };
85
86 void setBottom(float _margin) { m_bottom = _margin; };
87 float bottom(void) const { return m_bottom; };
88
89 private:
90 float m_left;
91 float m_top;
92 float m_right;
93 float m_bottom;
94 };
95
96 // #########################################################################################################################################################################################################
97
99 public:
100 MarginsD() : m_left(0.), m_top(0.), m_right(0.), m_bottom(0.) {};
101 MarginsD(double _left, double _top, double _right, double _bottom) : m_left(_left), m_top(_top), m_right(_right), m_bottom(_bottom) {};
102 MarginsD(const MarginsD& _other) : m_left(_other.m_left), m_top(_other.m_top), m_right(_other.m_right), m_bottom(_other.m_bottom) {};
103 virtual ~MarginsD() {};
104
105 MarginsD& operator = (const MarginsD& _other);
106
110 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
111
115 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
116
117 void setLeft(double _margin) { m_left = _margin; };
118 double left(void) const { return m_left; };
119
120 void setRight(double _margin) { m_right = _margin; };
121 double right(void) const { return m_right; };
122
123 void setTop(double _margin) { m_top = _margin; };
124 double top(void) const { return m_top; };
125
126 void setBottom(double _margin) { m_bottom = _margin; };
127 double bottom(void) const { return m_bottom; };
128
129 private:
130 double m_left;
131 double m_top;
132 double m_right;
133 double m_bottom;
134 };
135
136}
This file contains defines that may be used simplyfy class creation.
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition Margins.h:98
void setBottom(double _margin)
Definition Margins.h:126
double bottom(void) const
Definition Margins.h:127
double top(void) const
Definition Margins.h:124
MarginsD(double _left, double _top, double _right, double _bottom)
Definition Margins.h:101
MarginsD()
Definition Margins.h:100
double left(void) const
Definition Margins.h:118
void setTop(double _margin)
Definition Margins.h:123
MarginsD(const MarginsD &_other)
Definition Margins.h:102
void setLeft(double _margin)
Definition Margins.h:117
virtual ~MarginsD()
Definition Margins.h:103
double right(void) const
Definition Margins.h:121
void setRight(double _margin)
Definition Margins.h:120
Definition Margins.h:58
MarginsF(const MarginsF &_other)
Definition Margins.h:62
void setRight(float _margin)
Definition Margins.h:80
MarginsF(float _left, float _top, float _right, float _bottom)
Definition Margins.h:61
float top(void) const
Definition Margins.h:84
MarginsF()
Definition Margins.h:60
void setLeft(float _margin)
Definition Margins.h:77
float bottom(void) const
Definition Margins.h:87
void setTop(float _margin)
Definition Margins.h:83
float left(void) const
Definition Margins.h:78
float right(void) const
Definition Margins.h:81
virtual ~MarginsF()
Definition Margins.h:63
void setBottom(float _margin)
Definition Margins.h:86
Definition Margins.h:18
void setTop(int _margin)
Definition Margins.h:43
int right(void) const
Definition Margins.h:41
Margins(int _left, int _top, int _right, int _bottom)
Definition Margins.h:21
void setRight(int _margin)
Definition Margins.h:40
Margins()
Definition Margins.h:20
Margins(const Margins &_other)
Definition Margins.h:22
void setBottom(int _margin)
Definition Margins.h:46
int left(void) const
Definition Margins.h:38
int bottom(void) const
Definition Margins.h:47
void setLeft(int _margin)
Definition Margins.h:37
virtual ~Margins()
Definition Margins.h:23
int top(void) const
Definition Margins.h:44
The Serializable class is the default interface of serializable objects.
Definition Serializable.h:17
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