Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
cell_input.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
29class InputCell : public DetailCell
30{
31 public:
33
34 void init(std::string title, std::string value, Event<std::string>::Callback callback = [](std::string text) {}, std::string placeholder = "", std::string hint = "", int maxInputLength = 32, int kbdDisableBitmask = 0);
35
36 void setValue(std::string value);
37 std::string getValue()
38 {
39 return value;
40 }
41
42 void setPlaceholder(std::string placeholder);
43
48 void setSecure(bool secure);
49 std::string getPlaceholder()
50 {
51 return placeholder;
52 }
53
54 void setHint(std::string hint)
55 {
56 this->hint = hint;
57 }
58
59 std::string getHint()
60 {
61 return hint;
62 }
63
65 {
66 return &event;
67 }
68
69 static View* create();
70
71 private:
72 bool secure = false;
73 std::string value;
74 std::string hint;
75 std::string placeholder;
76 int maxInputLength;
77 int kbdDisableBitmask;
78
80 void updateUI();
81
82 protected:
84};
85
87{
88 public:
90
91 void init(std::string title, long value, Event<long>::Callback callback, std::string hint = "", int maxInputLength = 18, int kbdDisableBitmask = 0);
92
93 void setValue(long value);
94 long getValue()
95 {
96 return value;
97 }
98
99 void setHint(std::string hint)
100 {
101 this->hint = hint;
102 }
103
104 std::string getHint()
105 {
106 return hint;
107 }
108
110 {
111 return &event;
112 }
113
114 static View* create();
115
116 private:
117 long value;
118 std::string hint;
119 int maxInputLength;
120 int kbdDisableBitmask;
121
122 Event<long> event;
123 void updateUI();
124
125 protected:
127};
128
129} // namespace aurore
Definition cell_detail.hpp:28
Definition event.hpp:41
std::function< void(Ts...)> Callback
Definition event.hpp:43
Definition cell_input.hpp:30
std::string getValue()
Definition cell_input.hpp:37
void setPlaceholder(std::string placeholder)
static View * create()
Event< std::string > * getEvent()
Definition cell_input.hpp:64
void setValue(std::string value)
AccessibilityRole getDefaultAccessibilityRole() override
Definition cell_input.hpp:83
std::string getHint()
Definition cell_input.hpp:59
std::string getPlaceholder()
Definition cell_input.hpp:49
void setHint(std::string hint)
Definition cell_input.hpp:54
void setSecure(bool secure)
void init(std::string title, std::string value, Event< std::string >::Callback callback=[](std::string text) {}, std::string placeholder="", std::string hint="", int maxInputLength=32, int kbdDisableBitmask=0)
Definition cell_input.hpp:87
static View * create()
void setValue(long value)
Event< long > * getEvent()
Definition cell_input.hpp:109
long getValue()
Definition cell_input.hpp:94
void setHint(std::string hint)
Definition cell_input.hpp:99
void init(std::string title, long value, Event< long >::Callback callback, std::string hint="", int maxInputLength=18, int kbdDisableBitmask=0)
AccessibilityRole getDefaultAccessibilityRole() override
Definition cell_input.hpp:126
std::string getHint()
Definition cell_input.hpp:104
Definition view.hpp:232
Definition actions.hpp:25
AccessibilityRole
Definition view_style.hpp:78
Definition text.hpp:13