mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Add OptionsField event for on_focus.
TODO: So poorly named! Should be on_focus, but requires sweeping changes. Ugh.
This commit is contained in:
parent
fece0a5e1b
commit
be8c1307e2
@ -473,6 +473,12 @@ void OptionsField::paint(Painter& painter) {
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsField::on_focus() {
|
||||
if( on_show_options ) {
|
||||
on_show_options();
|
||||
}
|
||||
}
|
||||
|
||||
bool OptionsField::on_encoder(const EncoderEvent delta) {
|
||||
set_selected_index(selected_index() + delta);
|
||||
return true;
|
||||
|
@ -226,6 +226,7 @@ public:
|
||||
using options_t = std::vector<option_t>;
|
||||
|
||||
std::function<void(size_t, value_t)> on_change;
|
||||
std::function<void(void)> on_show_options;
|
||||
|
||||
OptionsField(Point parent_pos, size_t length, options_t options);
|
||||
|
||||
@ -236,6 +237,7 @@ public:
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
void on_focus() override;
|
||||
bool on_encoder(const EncoderEvent delta) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user