mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-10 07:30:08 -04:00
Send ASCII chars from USB serial to selected widget (#1708)
* Initial commit for keyboard emulation * Added on_keyboard to some widgets * TextEdit partly * Multi key send at once * Frequency control support * Fix encoder emulation * Add keyboard to geomap * More widgets
This commit is contained in:
parent
1b5125b0a8
commit
8761b9d7e0
15 changed files with 232 additions and 5 deletions
|
@ -101,6 +101,7 @@ class Widget {
|
|||
virtual bool on_key(const KeyEvent event);
|
||||
virtual bool on_encoder(const EncoderEvent event);
|
||||
virtual bool on_touch(const TouchEvent event);
|
||||
virtual bool on_keyboard(const KeyboardEvent event);
|
||||
virtual const std::vector<Widget*>& children() const;
|
||||
|
||||
virtual Context& context() const;
|
||||
|
@ -382,6 +383,7 @@ class Checkbox : public Widget {
|
|||
void paint(Painter& painter) override;
|
||||
|
||||
bool on_key(const KeyEvent key) override;
|
||||
bool on_keyboard(const KeyboardEvent key) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
|
||||
private:
|
||||
|
@ -418,6 +420,7 @@ class Button : public Widget {
|
|||
void on_focus() override;
|
||||
bool on_key(const KeyEvent key) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
bool on_keyboard(const KeyboardEvent event) override;
|
||||
|
||||
private:
|
||||
std::string text_;
|
||||
|
@ -456,6 +459,7 @@ class ButtonWithEncoder : public Widget {
|
|||
bool on_key(const KeyEvent key) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
bool on_encoder(const EncoderEvent delta) override;
|
||||
bool on_keyboard(const KeyboardEvent event) override;
|
||||
|
||||
private:
|
||||
std::string text_;
|
||||
|
@ -490,6 +494,7 @@ class NewButton : public Widget {
|
|||
void on_focus() override;
|
||||
bool on_key(const KeyEvent key) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
bool on_keyboard(const KeyboardEvent event) override;
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
|
@ -544,6 +549,7 @@ class ImageButton : public Image {
|
|||
|
||||
bool on_key(const KeyEvent key) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
bool on_keyboard(const KeyboardEvent event) override;
|
||||
};
|
||||
|
||||
/* A button that toggles between two images when set. */
|
||||
|
@ -621,6 +627,7 @@ class ImageOptionsField : public Widget {
|
|||
void on_focus() override;
|
||||
bool on_encoder(const EncoderEvent delta) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
bool on_keyboard(const KeyboardEvent event) override;
|
||||
|
||||
private:
|
||||
options_t options;
|
||||
|
@ -658,6 +665,7 @@ class OptionsField : public Widget {
|
|||
void on_focus() override;
|
||||
bool on_encoder(const EncoderEvent delta) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
bool on_keyboard(const KeyboardEvent event) override;
|
||||
|
||||
private:
|
||||
const size_t length_;
|
||||
|
@ -702,6 +710,7 @@ class TextEdit : public Widget {
|
|||
bool on_key(const KeyEvent key) override;
|
||||
bool on_encoder(const EncoderEvent delta) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
bool on_keyboard(const KeyboardEvent event) override;
|
||||
|
||||
void on_focus() override;
|
||||
void on_blur() override;
|
||||
|
@ -763,6 +772,7 @@ class NumberField : public Widget {
|
|||
bool on_key(const KeyEvent key) override;
|
||||
bool on_encoder(const EncoderEvent delta) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
bool on_keyboard(const KeyboardEvent event) override;
|
||||
|
||||
private:
|
||||
range_t range;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue