Loading...
Searching...
No Matches
SegmentSettings.h
Go to the documentation of this file.
1//
2// SegmentSettings.h
3//
4
5#ifndef MALENA_SEGMENTSETTINGS_H
6#define MALENA_SEGMENTSETTINGS_H
7
8#pragma once
9
13#include <string>
14
15namespace ml
16{
26 {
27 // ── Geometry ──────────────────────────────────────────────────────────
28 sf::Vector2f size = {200.f, 36.f};
29 float segRadius = 20.f;
30 float segPadding = 3.f;
31
32 // ── Labels ────────────────────────────────────────────────────────────
33 std::string offLabel = "Off";
34 std::string onLabel = "On";
35
36 // ── Assignment from parent levels ─────────────────────────────────────
37
39 {
40 static_cast<ToggleSettings&>(*this) = t;
41 return *this;
42 }
43
45 {
46 static_cast<ToggleSettings&>(*this) = c;
47 return *this;
48 }
49
51 {
52 static_cast<ToggleSettings&>(*this) = g;
53 return *this;
54 }
55
56 // ── Getters / setters ─────────────────────────────────────────────────
57
58 [[nodiscard]] sf::Vector2f getSize() const { return size; }
59 [[nodiscard]] float getSegRadius() const { return segRadius; }
60 [[nodiscard]] float getSegPadding() const { return segPadding; }
61 [[nodiscard]] std::string getOffLabel() const { return offLabel; }
62 [[nodiscard]] std::string getOnLabel() const { return onLabel; }
63
64 void setSize(const sf::Vector2f& s) { size = s; }
65 void setSegRadius(float r) { segRadius = r; }
66 void setSegPadding(float p) { segPadding = p; }
67 void setOffLabel(const std::string& s) { offLabel = s; }
68 void setOnLabel(const std::string& s) { onLabel = s; }
69 void setSegmentLabels(const std::string& off, const std::string& on) { offLabel = off; onLabel = on; }
70 };
71
72} // namespace ml
73
74#endif // MALENA_SEGMENTSETTINGS_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 SegmentToggle.
float getSegPadding() const
void setSegmentLabels(const std::string &off, const std::string &on)
void setOffLabel(const std::string &s)
void setSegRadius(float r)
void setSegPadding(float p)
SegmentSettings & operator=(const ToggleSettings &t)
void setSize(const sf::Vector2f &s)
float getSegRadius() const
SegmentSettings & operator=(const ControlSettings &c)
SegmentSettings & operator=(const GraphicSettings &g)
std::string getOffLabel() const
std::string getOnLabel() const
void setOnLabel(const std::string &s)
sf::Vector2f getSize() const
Settings shared by all toggle variants — behaviour only.