guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
divider.cpp
1/*
2 Copyright (c) 2026 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#include "guillaume/components/divider.hpp"
24
26{
28 {
29 return _variant;
30 }
31
33 {
34 if (_variant == value) {
35 return *this;
36 }
37 _variant = value;
38 setHasChanged(true);
39 return *this;
40 }
41
42 float Divider::getLength(void) const
43 {
44 return _length;
45 }
46
48 {
49 if (_length == value) {
50 return *this;
51 }
52 _length = value;
53 setHasChanged(true);
54 return *this;
55 }
56
57 float Divider::getThickness(void) const
58 {
59 return _thickness;
60 }
61
63 {
64 if (_thickness == value) {
65 return *this;
66 }
67 _thickness = value;
68 setHasChanged(true);
69 return *this;
70 }
71
72 float Divider::getInset(void) const
73 {
74 return _inset;
75 }
76
78 {
79 if (_inset == value) {
80 return *this;
81 }
82 _inset = value;
83 setHasChanged(true);
84 return *this;
85 }
86
87 const utility::graphic::Color32Bit &Divider::getColor(void) const
88 {
89 return _color;
90 }
91
92 Divider &Divider::setColor(const utility::graphic::Color32Bit &value)
93 {
94 _color = value;
95 setHasChanged(true);
96 return *this;
97 }
98
99 const utility::graphic::PoseF &Divider::getOriginPose(void) const
100 {
101 return _originPose;
102 }
103
104 Divider &Divider::setOriginPose(const utility::graphic::PoseF &value)
105 {
106 if (_originPose == value) {
107 return *this;
108 }
109 _originPose = value;
110 setHasChanged(true);
111 return *this;
112 }
113
114 const utility::graphic::PoseF &Divider::getAppliedPose(void) const
115 {
116 return _appliedPose;
117 }
118
119 Divider &Divider::setAppliedPose(const utility::graphic::PoseF &value)
120 {
121 _appliedPose = value;
122 return *this;
123 }
124
125 float Divider::getLeadingInset(void) const
126 {
127 return _variant == Variant::FullWidth ? 0.0f : _inset;
128 }
129
131 {
132 return _variant == Variant::Middle ? _inset : 0.0f;
133 }
134} // namespace guillaume::components
Divider & setInset(float inset)
Set the inset applied to an inset end.
Definition divider.cpp:77
Variant
Which ends of the divider are inset.
Definition divider.hpp:67
float getLength(void) const
Get the total length, insets included.
Definition divider.cpp:42
const utility::graphic::PoseF & getOriginPose(void) const
Get the pose of the divider before the leading inset.
Definition divider.cpp:99
Divider & setVariant(Variant variant)
Choose which ends are inset.
Definition divider.cpp:32
Divider & setColor(const utility::graphic::Color32Bit &color)
Set the stroke color.
Definition divider.cpp:92
const utility::graphic::Color32Bit & getColor(void) const
Get the stroke color.
Definition divider.cpp:87
Divider & setOriginPose(const utility::graphic::PoseF &pose)
Set the pose of the divider before the leading inset.
Definition divider.cpp:104
Divider & setThickness(float thickness)
Set the stroke thickness.
Definition divider.cpp:62
float getInset(void) const
Get the inset applied to an inset end.
Definition divider.cpp:72
Divider(void)=default
Create the state of a full-width hairline divider, 100 dp long.
float getTrailingInset(void) const
Get the inset applied on the trailing (right) end for the current variant.
Definition divider.cpp:130
Divider & setAppliedPose(const utility::graphic::PoseF &pose)
Record the pose written to the Transform.
Definition divider.cpp:119
float getLeadingInset(void) const
Get the inset applied on the leading (left) end for the current variant.
Definition divider.cpp:125
const utility::graphic::PoseF & getAppliedPose(void) const
Get the pose systems::Divider last wrote to the Transform.
Definition divider.cpp:114
Variant getVariant(void) const
Get which ends are inset.
Definition divider.cpp:27
float getThickness(void) const
Get the stroke thickness.
Definition divider.cpp:57
Divider & setLength(float length)
Set the total length, insets included.
Definition divider.cpp:47
void setHasChanged(bool hasChanged)
Raise or lower the changed flag.
Definition component.cpp:32
State. Every class here is plain data attached to an entity.