score
Home
Classes
Namespaces
Files
Loading...
Searching...
No Matches
LayoutSelection.hpp
1
#pragma once
2
#include <functional>
3
#include <vector>
4
5
namespace
score
6
{
9
struct
LayoutSelection
10
{
11
int
current{0};
12
std::vector<std::function<void(
int
)>> listeners;
13
15
void
listen
(std::function<
void
(
int
)> f)
16
{
17
f(current);
18
listeners.push_back(std::move(f));
19
}
20
21
void
select(
int
index)
22
{
23
if
(index == current)
24
return
;
25
current = index;
26
for
(
auto
& f : listeners)
27
f(index);
28
}
29
};
30
}
score
Base toolkit upon which the software is built.
Definition
Application.cpp:108
score::LayoutSelection
Definition
LayoutSelection.hpp:10
score::LayoutSelection::listen
void listen(std::function< void(int)> f)
Called immediately, then on change.
Definition
LayoutSelection.hpp:15