mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-21 13:24:30 -04:00
Remove expensive path.string() calls, UI changes
This commit is contained in:
parent
06643df6a5
commit
bf4ed416bd
8 changed files with 254 additions and 147 deletions
|
@ -29,9 +29,25 @@ using namespace portapack;
|
|||
|
||||
namespace ui {
|
||||
|
||||
void text_prompt(NavigationView& nav, std::string& str, const size_t max_length, const std::function<void(std::string&)> on_done) {
|
||||
void text_prompt(
|
||||
NavigationView& nav,
|
||||
std::string& str,
|
||||
const size_t max_length,
|
||||
const std::function<void(std::string&)> on_done
|
||||
) {
|
||||
text_prompt(nav, str, str.length(), max_length, on_done);
|
||||
}
|
||||
|
||||
void text_prompt(
|
||||
NavigationView& nav,
|
||||
std::string& str,
|
||||
uint32_t cursor_pos,
|
||||
const size_t max_length,
|
||||
const std::function<void(std::string&)> on_done
|
||||
) {
|
||||
//if (persistent_memory::ui_config_textentry() == 0) {
|
||||
auto te_view = nav.push<AlphanumView>(str, max_length);
|
||||
te_view->set_cursor(cursor_pos);
|
||||
te_view->on_changed = [on_done](std::string& value) {
|
||||
if (on_done)
|
||||
on_done(value);
|
||||
|
@ -211,6 +227,10 @@ void TextEntryView::char_add(const char c) {
|
|||
text_input.char_add(c);
|
||||
}
|
||||
|
||||
void TextEntryView::set_cursor(uint32_t pos) {
|
||||
text_input.set_cursor(pos);
|
||||
}
|
||||
|
||||
void TextEntryView::focus() {
|
||||
text_input.focus();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue