Loading...
Searching...
No Matches
LayoutSelection.hpp
1#pragma once
2#include <functional>
3#include <vector>
4
5namespace score
6{
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}
Base toolkit upon which the software is built.
Definition Application.cpp:108
Definition LayoutSelection.hpp:10
void listen(std::function< void(int)> f)
Called immediately, then on change.
Definition LayoutSelection.hpp:15