Merge remote-tracking branch 'upstream/master'

Base class for text entry
This commit is contained in:
furrtek
2017-06-21 03:25:27 +01:00
131 changed files with 19385 additions and 5412 deletions
+35 -3
View File
@@ -25,12 +25,44 @@
#include "ui.hpp"
#include "ui_navigation.hpp"
#include "ui_handwrite.hpp"
#include "ui_alphanum.hpp"
namespace ui {
void text_entry(NavigationView& nav, std::string * str, size_t max_length, const std::function<void(std::string*)> on_done = nullptr);
class TextEntryView : public View {
public:
std::function<void(std::string*)> on_changed { };
void focus() override;
std::string title() const override { return "Text entry"; };
protected:
TextEntryView(NavigationView& nav, std::string * str, size_t max_length);
TextEntryView(const TextEntryView&) = delete;
TextEntryView(TextEntryView&&) = delete;
TextEntryView& operator=(const TextEntryView&) = delete;
TextEntryView& operator=(TextEntryView&&) = delete;
void char_add(const char c);
void char_delete();
void draw_cursor();
void update_text();
std::string * _str;
size_t _max_length;
uint32_t _cursor_pos { 0 };
Text text_input {
{ 0, 0, 240, 16 }
};
Button button_ok {
{ 10 * 8, 33 * 8, 9 * 8, 32 },
"OK"
};
};
void text_prompt(NavigationView& nav, std::string * str, size_t max_length, const std::function<void(std::string*)> on_done = nullptr);
} /* namespace ui */