Loading...
Searching...
No Matches
ToggleSettings.h
Go to the documentation of this file.
1//
2// ToggleSettings.h
3//
4
5#ifndef MALENA_TOGGLESETTINGS_H
6#define MALENA_TOGGLESETTINGS_H
7
8#pragma once
9
12#include <string>
13#include <vector>
14#include <utility>
15
16namespace ml
17{
28 {
29 float animSpeed = 10.f;
30 std::vector<std::pair<std::string, std::string>> items;
31
32 // ── Assignment from parent levels ─────────────────────────────────────
33
35 {
36 static_cast<ControlSettings&>(*this) = c;
37 return *this;
38 }
39
41 {
42 static_cast<ControlSettings&>(*this) = g;
43 return *this;
44 }
45
46 // ── Getters / setters ─────────────────────────────────────────────────
47
48 [[nodiscard]] float getAnimSpeed() const { return animSpeed; }
49 void setAnimSpeed(float s) { animSpeed = s; }
50
51 [[nodiscard]] const std::vector<std::pair<std::string, std::string>>&
52 getItems() const { return items; }
53
54 void setItems(std::vector<std::pair<std::string, std::string>> i)
55 { items = std::move(i); }
56
57 void addItem(const std::string& label, const std::string& key)
58 { items.emplace_back(label, key); }
59
60 void clearItems() { items.clear(); }
61 };
62
63} // namespace ml
64
65#endif // MALENA_TOGGLESETTINGS_H
Definition Component.h:22
Settings trait for interactive UI controls — layout only.
Base settings trait for all visual components — geometry only.
Settings shared by all toggle variants — behaviour only.
ToggleSettings & operator=(const ControlSettings &c)
void setAnimSpeed(float s)
void setItems(std::vector< std::pair< std::string, std::string > > i)
ToggleSettings & operator=(const GraphicSettings &g)
void addItem(const std::string &label, const std::string &key)
const std::vector< std::pair< std::string, std::string > > & getItems() const
float getAnimSpeed() const
std::vector< std::pair< std::string, std::string > > items