mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-06 05:34:50 -04:00
make the ptext_prompt func can define which keyboard to enter (#2608)
* _ * format * use define
This commit is contained in:
parent
4162820409
commit
1377516dce
25 changed files with 50 additions and 19 deletions
|
@ -203,6 +203,7 @@ BleRecentEntryDetailView::BleRecentEntryDetailView(NavigationView& nav, const Bl
|
||||||
nav,
|
nav,
|
||||||
packetFileBuffer,
|
packetFileBuffer,
|
||||||
64,
|
64,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this, packetToSave](std::string& buffer) {
|
[this, packetToSave](std::string& buffer) {
|
||||||
on_save_file(buffer, packetToSave);
|
on_save_file(buffer, packetToSave);
|
||||||
});
|
});
|
||||||
|
@ -471,6 +472,7 @@ BLERxView::BLERxView(NavigationView& nav)
|
||||||
nav_,
|
nav_,
|
||||||
filterBuffer,
|
filterBuffer,
|
||||||
64,
|
64,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& buffer) {
|
[this](std::string& buffer) {
|
||||||
on_filter_change(buffer);
|
on_filter_change(buffer);
|
||||||
});
|
});
|
||||||
|
@ -493,6 +495,7 @@ BLERxView::BLERxView(NavigationView& nav)
|
||||||
nav,
|
nav,
|
||||||
listFileBuffer,
|
listFileBuffer,
|
||||||
64,
|
64,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& buffer) {
|
[this](std::string& buffer) {
|
||||||
on_save_file(buffer);
|
on_save_file(buffer);
|
||||||
});
|
});
|
||||||
|
|
|
@ -399,6 +399,7 @@ BLETxView::BLETxView(NavigationView& nav)
|
||||||
nav,
|
nav,
|
||||||
packetFileBuffer,
|
packetFileBuffer,
|
||||||
64,
|
64,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& buffer) {
|
[this](std::string& buffer) {
|
||||||
on_save_file(buffer);
|
on_save_file(buffer);
|
||||||
});
|
});
|
||||||
|
|
|
@ -94,6 +94,7 @@ APRSTXView::APRSTXView(NavigationView& nav) {
|
||||||
nav,
|
nav,
|
||||||
payload,
|
payload,
|
||||||
30,
|
30,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& s) {
|
[this](std::string& s) {
|
||||||
text_payload.set(s);
|
text_payload.set(s);
|
||||||
});
|
});
|
||||||
|
|
|
@ -499,7 +499,7 @@ FileSaveView::FileSaveView(
|
||||||
|
|
||||||
button_edit_path.on_select = [this](Button&) {
|
button_edit_path.on_select = [this](Button&) {
|
||||||
buffer_ = path_.string();
|
buffer_ = path_.string();
|
||||||
text_prompt(nav_, buffer_, max_filename_length,
|
text_prompt(nav_, buffer_, max_filename_length,ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string&) {
|
[this](std::string&) {
|
||||||
path_ = buffer_;
|
path_ = buffer_;
|
||||||
refresh_widgets();
|
refresh_widgets();
|
||||||
|
@ -508,7 +508,7 @@ FileSaveView::FileSaveView(
|
||||||
|
|
||||||
button_edit_name.on_select = [this](Button&) {
|
button_edit_name.on_select = [this](Button&) {
|
||||||
buffer_ = file_.string();
|
buffer_ = file_.string();
|
||||||
text_prompt(nav_, buffer_, max_filename_length,
|
text_prompt(nav_, buffer_, max_filename_length,ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string&) {
|
[this](std::string&) {
|
||||||
file_ = buffer_;
|
file_ = buffer_;
|
||||||
refresh_widgets();
|
refresh_widgets();
|
||||||
|
@ -566,7 +566,7 @@ void FileManagerView::on_rename(std::string_view hint) {
|
||||||
cursor_pos = pos;
|
cursor_pos = pos;
|
||||||
|
|
||||||
text_prompt(
|
text_prompt(
|
||||||
nav_, name_buffer, cursor_pos, max_filename_length,
|
nav_, name_buffer, cursor_pos, max_filename_length, ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& renamed) {
|
[this](std::string& renamed) {
|
||||||
auto renamed_path = fs::path{renamed};
|
auto renamed_path = fs::path{renamed};
|
||||||
rename_file(get_selected_full_path(), current_path / renamed_path);
|
rename_file(get_selected_full_path(), current_path / renamed_path);
|
||||||
|
@ -640,7 +640,7 @@ void FileManagerView::on_clean() {
|
||||||
|
|
||||||
void FileManagerView::on_new_dir() {
|
void FileManagerView::on_new_dir() {
|
||||||
name_buffer = "";
|
name_buffer = "";
|
||||||
text_prompt(nav_, name_buffer, max_filename_length, [this](std::string& dir_name) {
|
text_prompt(nav_, name_buffer, max_filename_length, ENTER_KEYBOARD_MODE_ALPHA, [this](std::string& dir_name) {
|
||||||
make_new_directory(current_path / dir_name);
|
make_new_directory(current_path / dir_name);
|
||||||
reload_current(true);
|
reload_current(true);
|
||||||
});
|
});
|
||||||
|
@ -671,7 +671,7 @@ void FileManagerView::on_paste() {
|
||||||
|
|
||||||
void FileManagerView::on_new_file() {
|
void FileManagerView::on_new_file() {
|
||||||
name_buffer = "";
|
name_buffer = "";
|
||||||
text_prompt(nav_, name_buffer, max_filename_length, [this](std::string& file_name) {
|
text_prompt(nav_, name_buffer, max_filename_length, ENTER_KEYBOARD_MODE_ALPHA, [this](std::string& file_name) {
|
||||||
make_new_file(current_path / file_name);
|
make_new_file(current_path / file_name);
|
||||||
reload_current(true);
|
reload_current(true);
|
||||||
});
|
});
|
||||||
|
|
|
@ -240,7 +240,7 @@ void FrequencyManagerView::on_edit_freq() {
|
||||||
|
|
||||||
void FrequencyManagerView::on_edit_desc() {
|
void FrequencyManagerView::on_edit_desc() {
|
||||||
temp_buffer_ = current_entry().description;
|
temp_buffer_ = current_entry().description;
|
||||||
text_prompt(nav_, temp_buffer_, freqman_max_desc_size, [this](std::string& new_desc) {
|
text_prompt(nav_, temp_buffer_, freqman_max_desc_size, ENTER_KEYBOARD_MODE_ALPHA, [this](std::string& new_desc) {
|
||||||
auto entry = current_entry();
|
auto entry = current_entry();
|
||||||
entry.description = std::move(new_desc);
|
entry.description = std::move(new_desc);
|
||||||
db_.replace_entry(current_index(), entry);
|
db_.replace_entry(current_index(), entry);
|
||||||
|
@ -250,7 +250,7 @@ void FrequencyManagerView::on_edit_desc() {
|
||||||
|
|
||||||
void FrequencyManagerView::on_add_category() {
|
void FrequencyManagerView::on_add_category() {
|
||||||
temp_buffer_.clear();
|
temp_buffer_.clear();
|
||||||
text_prompt(nav_, temp_buffer_, 20, [this](std::string& new_name) {
|
text_prompt(nav_, temp_buffer_, 20, ENTER_KEYBOARD_MODE_ALPHA, [this](std::string& new_name) {
|
||||||
if (!new_name.empty()) {
|
if (!new_name.empty()) {
|
||||||
create_freqman_file(new_name);
|
create_freqman_file(new_name);
|
||||||
refresh_categories();
|
refresh_categories();
|
||||||
|
|
|
@ -153,7 +153,7 @@ void POCSAGTXView::paint(Painter&) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void POCSAGTXView::on_set_text(NavigationView& nav) {
|
void POCSAGTXView::on_set_text(NavigationView& nav) {
|
||||||
text_prompt(nav, buffer, MAX_POCSAG_LENGTH);
|
text_prompt(nav, buffer, MAX_POCSAG_LENGTH, ENTER_KEYBOARD_MODE_ALPHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
POCSAGTXView::POCSAGTXView(
|
POCSAGTXView::POCSAGTXView(
|
||||||
|
|
|
@ -65,6 +65,7 @@ RDSPSNView::RDSPSNView(
|
||||||
nav,
|
nav,
|
||||||
PSN,
|
PSN,
|
||||||
8,
|
8,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& s) {
|
[this](std::string& s) {
|
||||||
text_psn.set(s);
|
text_psn.set(s);
|
||||||
});
|
});
|
||||||
|
@ -86,6 +87,7 @@ RDSRadioTextView::RDSRadioTextView(
|
||||||
nav,
|
nav,
|
||||||
radiotext,
|
radiotext,
|
||||||
28,
|
28,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& s) {
|
[this](std::string& s) {
|
||||||
text_radiotext.set(s);
|
text_radiotext.set(s);
|
||||||
});
|
});
|
||||||
|
|
|
@ -82,7 +82,7 @@ ReconSetupViewMain::ReconSetupViewMain(NavigationView& nav, Rect parent_rect, st
|
||||||
};
|
};
|
||||||
|
|
||||||
button_choose_output_name.on_select = [this, &nav](Button&) {
|
button_choose_output_name.on_select = [this, &nav](Button&) {
|
||||||
text_prompt(nav, _output_file, 28, [this](std::string& buffer) {
|
text_prompt(nav, _output_file, 28, ENTER_KEYBOARD_MODE_ALPHA, [this](std::string& buffer) {
|
||||||
_output_file = buffer;
|
_output_file = buffer;
|
||||||
button_choose_output_name.set_text(_output_file);
|
button_choose_output_name.set_text(_output_file);
|
||||||
});
|
});
|
||||||
|
|
|
@ -617,6 +617,7 @@ void TextEditorView::show_edit_line() {
|
||||||
edit_line_buffer_,
|
edit_line_buffer_,
|
||||||
viewer.col(),
|
viewer.col(),
|
||||||
max_edit_length,
|
max_edit_length,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& buffer) {
|
[this](std::string& buffer) {
|
||||||
auto range = file_->line_range(viewer.line());
|
auto range = file_->line_range(viewer.line());
|
||||||
if (!range)
|
if (!range)
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "ui.hpp"
|
#include "ui.hpp"
|
||||||
#include "ui_navigation.hpp"
|
#include "ui_navigation.hpp"
|
||||||
#include "ui_widget.hpp"
|
#include "ui_widget.hpp"
|
||||||
|
#include "ui_textentry.hpp"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ void bind(TextField& field, T& value, NavigationView& nav, Fn fn = Fn{}) {
|
||||||
// Capture a new string and make the lambda mutable so it can be modified.
|
// Capture a new string and make the lambda mutable so it can be modified.
|
||||||
field.on_select = [&nav, buf = std::string{}](TextField& tf) mutable {
|
field.on_select = [&nav, buf = std::string{}](TextField& tf) mutable {
|
||||||
buf = tf.get_text();
|
buf = tf.get_text();
|
||||||
text_prompt(nav, buf, /*max_length*/ 255,
|
text_prompt(nav, buf, /*max_length*/ 255, ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[&tf](std::string& str) {
|
[&tf](std::string& str) {
|
||||||
tf.set_text(str);
|
tf.set_text(str);
|
||||||
});
|
});
|
||||||
|
|
|
@ -131,6 +131,7 @@ ADSBCallsignView::ADSBCallsignView(
|
||||||
nav,
|
nav,
|
||||||
callsign,
|
callsign,
|
||||||
8,
|
8,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& s) {
|
[this](std::string& s) {
|
||||||
button_callsign.set_text(s);
|
button_callsign.set_text(s);
|
||||||
});
|
});
|
||||||
|
|
|
@ -227,6 +227,7 @@ void HopperView::save_list() {
|
||||||
nav_,
|
nav_,
|
||||||
filename_buffer,
|
filename_buffer,
|
||||||
64,
|
64,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& value) {
|
[this](std::string& value) {
|
||||||
auto path = hopper_dir / (value + ".PHOP");
|
auto path = hopper_dir / (value + ".PHOP");
|
||||||
|
|
||||||
|
|
2
firmware/application/external/lcr/ui_lcr.cpp
vendored
2
firmware/application/external/lcr/ui_lcr.cpp
vendored
|
@ -189,6 +189,7 @@ void LCRView::on_button_set_am(NavigationView& nav, int16_t button_id) {
|
||||||
nav,
|
nav,
|
||||||
litteral[button_id],
|
litteral[button_id],
|
||||||
7,
|
7,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this, button_id](std::string& buffer) {
|
[this, button_id](std::string& buffer) {
|
||||||
texts[button_id].set(buffer);
|
texts[button_id].set(buffer);
|
||||||
});
|
});
|
||||||
|
@ -257,6 +258,7 @@ LCRView::LCRView(NavigationView& nav) {
|
||||||
nav,
|
nav,
|
||||||
rgsb,
|
rgsb,
|
||||||
4,
|
4,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& buffer) {
|
[this](std::string& buffer) {
|
||||||
button_set_rgsb.set_text(buffer);
|
button_set_rgsb.set_text(buffer);
|
||||||
});
|
});
|
||||||
|
|
|
@ -311,6 +311,7 @@ LGEView::LGEView(NavigationView& nav) {
|
||||||
nav,
|
nav,
|
||||||
nickname,
|
nickname,
|
||||||
15,
|
15,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& buffer) {
|
[this](std::string& buffer) {
|
||||||
button_text.set_text(buffer);
|
button_text.set_text(buffer);
|
||||||
});
|
});
|
||||||
|
|
|
@ -212,6 +212,7 @@ MetronomeTapTempoView::MetronomeTapTempoView(NavigationView& nav, uint16_t bpm)
|
||||||
nav_,
|
nav_,
|
||||||
input_buffer,
|
input_buffer,
|
||||||
3,
|
3,
|
||||||
|
ENTER_KEYBOARD_MODE_DIGITS,
|
||||||
[this](std::string& buffer) {
|
[this](std::string& buffer) {
|
||||||
if (buffer.empty()) {
|
if (buffer.empty()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -99,7 +99,7 @@ static msg_t loopthread_fn(void* arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MorseView::on_set_text(NavigationView& nav) {
|
void MorseView::on_set_text(NavigationView& nav) {
|
||||||
text_prompt(nav, buffer, 28);
|
text_prompt(nav, buffer, 28, ENTER_KEYBOARD_MODE_ALPHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MorseView::focus() {
|
void MorseView::focus() {
|
||||||
|
|
|
@ -210,6 +210,7 @@ OOKEditorAppView::OOKEditorAppView(NavigationView& nav)
|
||||||
nav,
|
nav,
|
||||||
outputFileBuffer,
|
outputFileBuffer,
|
||||||
64,
|
64,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[this](std::string& buffer) {
|
[this](std::string& buffer) {
|
||||||
on_save_file(buffer);
|
on_save_file(buffer);
|
||||||
});
|
});
|
||||||
|
@ -263,6 +264,7 @@ OOKEditorAppView::OOKEditorAppView(NavigationView& nav)
|
||||||
nav,
|
nav,
|
||||||
ook_data.payload,
|
ook_data.payload,
|
||||||
100,
|
100,
|
||||||
|
ENTER_KEYBOARD_MODE_DIGITS,
|
||||||
[this](std::string& s) {
|
[this](std::string& s) {
|
||||||
text_payload.set(s);
|
text_payload.set(s);
|
||||||
draw_waveform();
|
draw_waveform();
|
||||||
|
|
|
@ -83,6 +83,7 @@ OOKBruteView::OOKBruteView(NavigationView& nav)
|
||||||
nav_,
|
nav_,
|
||||||
text_input_buffer,
|
text_input_buffer,
|
||||||
8, // currently longest is princeton
|
8, // currently longest is princeton
|
||||||
|
ENTER_KEYBOARD_MODE_DIGITS,
|
||||||
[this](std::string& buffer) {
|
[this](std::string& buffer) {
|
||||||
field_start.set_value(atoi(buffer.c_str()));
|
field_start.set_value(atoi(buffer.c_str()));
|
||||||
validate_start_stop();
|
validate_start_stop();
|
||||||
|
@ -100,6 +101,7 @@ OOKBruteView::OOKBruteView(NavigationView& nav)
|
||||||
nav_,
|
nav_,
|
||||||
text_input_buffer,
|
text_input_buffer,
|
||||||
8, // currently longest is princeton
|
8, // currently longest is princeton
|
||||||
|
ENTER_KEYBOARD_MODE_DIGITS,
|
||||||
[this](std::string& buffer) {
|
[this](std::string& buffer) {
|
||||||
field_stop.set_value(atoi(buffer.c_str()));
|
field_stop.set_value(atoi(buffer.c_str()));
|
||||||
validate_start_stop();
|
validate_start_stop();
|
||||||
|
|
|
@ -122,6 +122,7 @@ bool PlaylistEditorView::on_create_ppl() {
|
||||||
nav_,
|
nav_,
|
||||||
current_ppl_name_buffer,
|
current_ppl_name_buffer,
|
||||||
100,
|
100,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[&](std::string& s) {
|
[&](std::string& s) {
|
||||||
current_ppl_name_buffer = s;
|
current_ppl_name_buffer = s;
|
||||||
|
|
||||||
|
@ -307,6 +308,7 @@ PlaylistItemEditView::PlaylistItemEditView(
|
||||||
nav_,
|
nav_,
|
||||||
delay_str,
|
delay_str,
|
||||||
100,
|
100,
|
||||||
|
ENTER_KEYBOARD_MODE_ALPHA,
|
||||||
[&](std::string& s) {
|
[&](std::string& s) {
|
||||||
delay_ = atoi(s.c_str());
|
delay_ = atoi(s.c_str());
|
||||||
field_delay.set_value(delay_);
|
field_delay.set_value(delay_);
|
||||||
|
|
|
@ -330,7 +330,7 @@ RemoteAppView::RemoteAppView(
|
||||||
|
|
||||||
field_title.on_select = [this, &nav](TextField&) {
|
field_title.on_select = [this, &nav](TextField&) {
|
||||||
temp_buffer_ = model_.name;
|
temp_buffer_ = model_.name;
|
||||||
text_prompt(nav_, temp_buffer_, text_edit_max, [this](std::string& new_name) {
|
text_prompt(nav_, temp_buffer_, text_edit_max, ENTER_KEYBOARD_MODE_ALPHA, [this](std::string& new_name) {
|
||||||
model_.name = new_name;
|
model_.name = new_name;
|
||||||
refresh_ui();
|
refresh_ui();
|
||||||
set_needs_save();
|
set_needs_save();
|
||||||
|
@ -339,7 +339,7 @@ RemoteAppView::RemoteAppView(
|
||||||
|
|
||||||
field_filename.on_select = [this, &nav](TextField&) {
|
field_filename.on_select = [this, &nav](TextField&) {
|
||||||
temp_buffer_ = remote_path_.stem().string();
|
temp_buffer_ = remote_path_.stem().string();
|
||||||
text_prompt(nav_, temp_buffer_, text_edit_max, [this](std::string& new_name) {
|
text_prompt(nav_, temp_buffer_, text_edit_max, ENTER_KEYBOARD_MODE_ALPHA, [this](std::string& new_name) {
|
||||||
rename_remote(new_name);
|
rename_remote(new_name);
|
||||||
refresh_ui();
|
refresh_ui();
|
||||||
});
|
});
|
||||||
|
|
|
@ -56,7 +56,7 @@ SpectrumInputTextView::~SpectrumInputTextView() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpectrumInputTextView::on_set_text(NavigationView& nav) {
|
void SpectrumInputTextView::on_set_text(NavigationView& nav) {
|
||||||
text_prompt(nav, buffer, 300);
|
text_prompt(nav, buffer, 300, ENTER_KEYBOARD_MODE_DIGITS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpectrumInputTextView::focus() {
|
void SpectrumInputTextView::focus() {
|
||||||
|
|
|
@ -32,7 +32,8 @@ namespace ui {
|
||||||
AlphanumView::AlphanumView(
|
AlphanumView::AlphanumView(
|
||||||
NavigationView& nav,
|
NavigationView& nav,
|
||||||
std::string& str,
|
std::string& str,
|
||||||
size_t max_length)
|
size_t max_length,
|
||||||
|
uint8_t enter_mode)
|
||||||
: TextEntryView(nav, str, max_length) {
|
: TextEntryView(nav, str, max_length) {
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ AlphanumView::AlphanumView(
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_mode(mode);
|
set_mode(enter_mode);
|
||||||
|
|
||||||
button_mode.on_select = [this](Button&) {
|
button_mode.on_select = [this](Button&) {
|
||||||
set_mode(mode + 1);
|
set_mode(mode + 1);
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace ui {
|
||||||
|
|
||||||
class AlphanumView : public TextEntryView {
|
class AlphanumView : public TextEntryView {
|
||||||
public:
|
public:
|
||||||
AlphanumView(NavigationView& nav, std::string& str, size_t max_length);
|
AlphanumView(NavigationView& nav, std::string& str, size_t max_length, uint8_t enter_mode);
|
||||||
|
|
||||||
AlphanumView(const AlphanumView&) = delete;
|
AlphanumView(const AlphanumView&) = delete;
|
||||||
AlphanumView(AlphanumView&&) = delete;
|
AlphanumView(AlphanumView&&) = delete;
|
||||||
|
|
|
@ -31,8 +31,9 @@ void text_prompt(
|
||||||
NavigationView& nav,
|
NavigationView& nav,
|
||||||
std::string& str,
|
std::string& str,
|
||||||
size_t max_length,
|
size_t max_length,
|
||||||
|
uint8_t mode,
|
||||||
std::function<void(std::string&)> on_done) {
|
std::function<void(std::string&)> on_done) {
|
||||||
text_prompt(nav, str, str.length(), max_length, on_done);
|
text_prompt(nav, str, str.length(), max_length, mode, on_done);
|
||||||
}
|
}
|
||||||
|
|
||||||
void text_prompt(
|
void text_prompt(
|
||||||
|
@ -40,8 +41,9 @@ void text_prompt(
|
||||||
std::string& str,
|
std::string& str,
|
||||||
uint32_t cursor_pos,
|
uint32_t cursor_pos,
|
||||||
size_t max_length,
|
size_t max_length,
|
||||||
|
uint8_t mode,
|
||||||
std::function<void(std::string&)> on_done) {
|
std::function<void(std::string&)> on_done) {
|
||||||
auto te_view = nav.push<AlphanumView>(str, max_length);
|
auto te_view = nav.push<AlphanumView>(str, max_length, mode);
|
||||||
te_view->set_cursor(cursor_pos);
|
te_view->set_cursor(cursor_pos);
|
||||||
te_view->on_changed = [on_done](std::string& value) {
|
te_view->on_changed = [on_done](std::string& value) {
|
||||||
if (on_done)
|
if (on_done)
|
||||||
|
|
|
@ -26,6 +26,11 @@
|
||||||
#include "ui.hpp"
|
#include "ui.hpp"
|
||||||
#include "ui_navigation.hpp"
|
#include "ui_navigation.hpp"
|
||||||
|
|
||||||
|
#define ENTER_KEYBOARD_MODE_ALPHA 0
|
||||||
|
#define ENTER_KEYBOARD_MODE_DIGITS 1
|
||||||
|
#define ENTER_KEYBOARD_MODE_SYMBOLS 2
|
||||||
|
#define ENTER_KEYBOARD_MODE_HEX 3
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class TextEntryView : public View {
|
class TextEntryView : public View {
|
||||||
|
@ -62,6 +67,7 @@ void text_prompt(
|
||||||
NavigationView& nav,
|
NavigationView& nav,
|
||||||
std::string& str,
|
std::string& str,
|
||||||
size_t max_length,
|
size_t max_length,
|
||||||
|
uint8_t mode,
|
||||||
std::function<void(std::string&)> on_done = nullptr);
|
std::function<void(std::string&)> on_done = nullptr);
|
||||||
|
|
||||||
void text_prompt(
|
void text_prompt(
|
||||||
|
@ -69,6 +75,7 @@ void text_prompt(
|
||||||
std::string& str,
|
std::string& str,
|
||||||
uint32_t cursor_pos,
|
uint32_t cursor_pos,
|
||||||
size_t max_length,
|
size_t max_length,
|
||||||
|
uint8_t mode, // enter mode: 123 abc etc
|
||||||
std::function<void(std::string&)> on_done = nullptr);
|
std::function<void(std::string&)> on_done = nullptr);
|
||||||
|
|
||||||
} /* namespace ui */
|
} /* namespace ui */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue