Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
cell_bool.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
20#include <aurore/core/bind.hpp>
21#include <aurore/core/box.hpp>
24
25namespace aurore
26{
27
28class BooleanCell : public DetailCell
29{
30 public:
32
33 void init(std::string title, bool isOn, std::function<void(bool)> callback);
34
35 void setOn(bool on, bool animated = true);
36 bool isOn()
37 {
38 return state;
39 }
40
42 {
43 return &event;
44 }
45
46 static View* create();
47
48 private:
49 bool state = false;
50 float baseDetailTextSize;
51
52 Animatable scale = 1;
53 Event<bool> event;
54
55 void updateUI();
56 void scaleTick();
57
58 protected:
60 // "on" or "off", whether its detail is shown or not.
61 std::string getDefaultAccessibilityValue() override;
62};
63
64} // namespace aurore
Definition animation.hpp:42
Definition cell_bool.hpp:29
AccessibilityRole getDefaultAccessibilityRole() override
Definition cell_bool.hpp:59
std::string getDefaultAccessibilityValue() override
void init(std::string title, bool isOn, std::function< void(bool)> callback)
void setOn(bool on, bool animated=true)
bool isOn()
Definition cell_bool.hpp:36
static View * create()
Event< bool > * getEvent()
Definition cell_bool.hpp:41
Definition cell_detail.hpp:28
Definition event.hpp:41
Definition view.hpp:232
Definition actions.hpp:25
AccessibilityRole
Definition view_style.hpp:78