10 std::size_t rows, std::span<const std::string_view> iconNames)
11 : _screens(screens, std::string(screen)),
13 _subtitle(std::format(
"{}_subtitle", screen)),
14 _close(std::format(
"{}_close", screen)),
15 _empty(std::format(
"{}_empty", screen)),
16 _prompt(std::format(
"{}_prompt", screen)),
17 _cancel(std::format(
"{}_cancel", screen)),
18 _back(std::format(
"{}_back", screen)),
19 _page(std::format(
"{}_page", screen)),
20 _pagePrevious(std::format(
"{}_page_previous", screen)),
21 _pageNext(std::format(
"{}_page_next", screen)),
24 for (std::size_t index = 0; index < tabs; ++index)
26 _tabs.push_back(TabIds{
27 .Id = std::format(
"{}_tab{}", screen, index),
28 .Icon = std::format(
"{}_tab{}_icon", screen, index),
29 .LabelVar = std::format(
"tab{}", index),
33 for (std::size_t index = 0; index < rows; ++index)
35 _rows.push_back(RowIds{
36 .Id = std::format(
"{}_row{}", screen, index),
37 .Button = std::format(
"{}_row{}_button", screen, index),
38 .Decrease = std::format(
"{}_row{}_decrease", screen, index),
39 .Increase = std::format(
"{}_row{}_increase", screen, index),
40 .LabelVar = std::format(
"row{}_label", index),
41 .HintVar = std::format(
"row{}_hint", index),
42 .ValueVar = std::format(
"row{}_value", index),
85 const TabIds& ids = _tabs[
static_cast<std::size_t
>(index)];
86 Screen& screen = _screens.For(slot);
94 screen.SetText(slot, ids.LabelVar, tab->
Label);
95 screen.SetClass(slot, ids.Id,
"tab--selected", tab->
Selected);
97 screen.SetModifier(slot, ids.Icon,
"icon-set", _iconNames, tab->
Icon);
102 const RowIds& ids = _rows[
static_cast<std::size_t
>(index)];
103 Screen& screen = _screens.For(slot);
112 screen.SetText(slot, ids.LabelVar, row->
Label);
113 screen.SetText(slot, ids.ValueVar, row->
Value);
114 screen.SetClass(slot, ids.Id,
"row--value", !row->
Value.empty());
115 screen.SetClass(slot, ids.Id,
"row--disabled", !row->
Enabled);
116 screen.SetClass(slot, ids.Id,
"row--on", row->
State.value_or(
false));
117 screen.SetClass(slot, ids.Id,
"row--toggle", toggle);
120 screen.SetClass(slot, ids.Id,
"row--static", !row->
Selectable);
121 screen.SetClass(slot, ids.Id,
"row--steppers", row->
Steppable && row->
Enabled && !toggle);
122 screen.SetClass(slot, ids.Id,
"row--pending", row->
Pending);
125 screen.SetText(slot, ids.HintVar, pendingHint);