guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
divider.hpp
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#pragma once
23
24#include <utility/graphic/color.hpp>
25#include <utility/graphic/pose.hpp>
26
27#include "guillaume/ecs/component.hpp"
28
30{
58 class Divider: public ecs::Component
59 {
60 public:
67 enum class Variant { FullWidth, Inset, Middle };
68
70 static constexpr float HairlineThickness = 0.5f;
71
73 static constexpr float BoldThickness = 1.0f;
74
79 Divider(void) = default;
80
84 ~Divider(void) = default;
85
90 Variant getVariant(void) const;
91
99 Divider &setVariant(Variant variant);
100
105 float getLength(void) const;
106
116 Divider &setLength(float length);
117
122 float getThickness(void) const;
123
132 Divider &setThickness(float thickness);
133
138 float getInset(void) const;
139
148 Divider &setInset(float inset);
149
154 const utility::graphic::Color32Bit &getColor(void) const;
155
164 Divider &setColor(const utility::graphic::Color32Bit &color);
165
170 const utility::graphic::PoseF &getOriginPose(void) const;
171
181 Divider &setOriginPose(const utility::graphic::PoseF &pose);
182
187 const utility::graphic::PoseF &getAppliedPose(void) const;
188
198 Divider &setAppliedPose(const utility::graphic::PoseF &pose);
199
205 float getLeadingInset(void) const;
206
212 float getTrailingInset(void) const;
213
214 private:
215 Variant _variant { Variant::FullWidth };
216 float _length { 100.0f };
217 float _thickness { HairlineThickness };
218 float _inset { 16.0f };
219 utility::graphic::Color32Bit _color {};
220 utility::graphic::PoseF _originPose {};
221 utility::graphic::PoseF _appliedPose {};
222 };
223
224} // 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
static constexpr float BoldThickness
Thickness of a bold stroke, in dp.
Definition divider.hpp:73
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(void)=default
Default destructor.
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
static constexpr float HairlineThickness
Default stroke thickness, in dp.
Definition divider.hpp:70
Base class of every component: a piece of state attached to an entity, plus a "changed" flag.
Definition component.hpp:72
State. Every class here is plain data attached to an entity.