Loading...
Searching...
No Matches
PillSettings.h
Go to the documentation of this file.
1//
2// PillSettings.h
3//
4
5#ifndef MALENA_PILLSETTINGS_H
6#define MALENA_PILLSETTINGS_H
7
8#pragma once
9
13#include <string>
14
15namespace ml
16{
28 {
29 // ── Geometry ──────────────────────────────────────────────────────────
30 sf::Vector2f trackSize = {44.f, 24.f};
31 float thumbMargin = 2.f;
32 float labelOffset = 8.f;
33
34 // ── Labels ────────────────────────────────────────────────────────────
35 std::string pillOffLabel;
36 std::string pillOnLabel;
37 std::string leftLabel;
38 std::string rightLabel;
39
40 // ── Assignment from parent levels ─────────────────────────────────────
41
43 {
44 static_cast<ToggleSettings&>(*this) = t;
45 return *this;
46 }
47
49 {
50 static_cast<ToggleSettings&>(*this) = c;
51 return *this;
52 }
53
55 {
56 static_cast<ToggleSettings&>(*this) = g;
57 return *this;
58 }
59
60 // ── Getters / setters ─────────────────────────────────────────────────
61
62 [[nodiscard]] sf::Vector2f getTrackSize() const { return trackSize; }
63 [[nodiscard]] float getThumbMargin() const { return thumbMargin; }
64 [[nodiscard]] float getLabelOffset() const { return labelOffset; }
65 [[nodiscard]] std::string getPillOffLabel() const { return pillOffLabel; }
66 [[nodiscard]] std::string getPillOnLabel() const { return pillOnLabel; }
67 [[nodiscard]] std::string getLeftLabel() const { return leftLabel; }
68 [[nodiscard]] std::string getRightLabel() const { return rightLabel; }
69
70 void setTrackSize(const sf::Vector2f& s) { trackSize = s; }
71 void setThumbMargin(float m) { thumbMargin = m; }
72 void setLabelOffset(float o) { labelOffset = o; }
73 void setPillOffLabel(const std::string& s) { pillOffLabel = s; }
74 void setPillOnLabel(const std::string& s) { pillOnLabel = s; }
75 void setPillLabels(const std::string& off,
76 const std::string& on) { pillOffLabel = off; pillOnLabel = on; }
77 void setLeftLabel(const std::string& s) { leftLabel = s; }
78 void setRightLabel(const std::string& s) { rightLabel = s; }
79 };
80
81} // namespace ml
82
83#endif // MALENA_PILLSETTINGS_H
Definition Component.h:22
Vector2< float > Vector2f
Settings trait for interactive UI controls — layout only.
Base settings trait for all visual components — geometry only.
Layout and behaviour settings for PillToggle.
sf::Vector2f getTrackSize() const
std::string pillOnLabel
float getLabelOffset() const
void setTrackSize(const sf::Vector2f &s)
void setPillOffLabel(const std::string &s)
std::string pillOffLabel
void setLabelOffset(float o)
sf::Vector2f trackSize
float getThumbMargin() const
PillSettings & operator=(const GraphicSettings &g)
std::string getPillOnLabel() const
std::string getLeftLabel() const
std::string getPillOffLabel() const
std::string leftLabel
std::string getRightLabel() const
void setPillLabels(const std::string &off, const std::string &on)
void setLeftLabel(const std::string &s)
PillSettings & operator=(const ToggleSettings &t)
void setRightLabel(const std::string &s)
std::string rightLabel
void setThumbMargin(float m)
void setPillOnLabel(const std::string &s)
PillSettings & operator=(const ControlSettings &c)
Settings shared by all toggle variants — behaviour only.