Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
cell_selector.hpp
Go to the documentation of this file.
1/*
2 Copyright 2021 XITRIX
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#pragma once
18
19#include <string>
21#include <aurore/core/bind.hpp>
22#include <aurore/core/box.hpp>
25
26namespace aurore
27{
28
30{
31 public:
33
34 void init(std::string title, std::vector<std::string> data, int selected, Event<int>::Callback callback, Event<int>::Callback dismissCb = [](int) {});
35
36 void setData(std::vector<std::string> data)
37 {
38 this->data = data;
39 }
40
41 void setSelection(int selection, bool silent = false);
43 {
44 return selection;
45 }
46
48 {
49 return &event;
50 }
51
52 static View* create();
53
54 protected:
56 std::vector<std::string> data;
57
60 void updateUI();
61};
62
63} // namespace aurore
Definition cell_detail.hpp:28
Definition event.hpp:41
std::function< void(Ts...)> Callback
Definition event.hpp:43
Definition cell_selector.hpp:30
void setSelection(int selection, bool silent=false)
std::vector< std::string > data
Definition cell_selector.hpp:56
Event< int >::Callback dismissCb
Definition cell_selector.hpp:59
int selection
Definition cell_selector.hpp:55
int getSelection()
Definition cell_selector.hpp:42
static View * create()
void setData(std::vector< std::string > data)
Definition cell_selector.hpp:36
Event< int > * getEvent()
Definition cell_selector.hpp:47
Event< int > event
Definition cell_selector.hpp:58
void init(std::string title, std::vector< std::string > data, int selected, Event< int >::Callback callback, Event< int >::Callback dismissCb=[](int) {})
Definition view.hpp:232
Definition actions.hpp:25