mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-25 05:47:44 +00:00
Added Soundboard
file.cpp: scan_root_files proc_audiotx.cpp: bandwidth setting ui_widget.cpp: button on_focus
This commit is contained in:
@@ -434,13 +434,13 @@ ProgressBar::ProgressBar(
|
||||
{
|
||||
}
|
||||
|
||||
void ProgressBar::set_max(const uint16_t max) {
|
||||
void ProgressBar::set_max(const uint32_t max) {
|
||||
_value = 0;
|
||||
_max = max;
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void ProgressBar::set_value(const uint16_t value) {
|
||||
void ProgressBar::set_value(const uint32_t value) {
|
||||
if (value > _max)
|
||||
_value = _max;
|
||||
else
|
||||
@@ -689,6 +689,11 @@ void Button::paint(Painter& painter) {
|
||||
);
|
||||
}
|
||||
|
||||
void Button::on_focus() {
|
||||
if( on_highlight )
|
||||
on_highlight(*this);
|
||||
}
|
||||
|
||||
bool Button::on_key(const KeyEvent key) {
|
||||
if( key == KeyEvent::Select ) {
|
||||
if( on_select ) {
|
||||
|
@@ -220,14 +220,14 @@ class ProgressBar : public Widget {
|
||||
public:
|
||||
ProgressBar(Rect parent_rect);
|
||||
|
||||
void set_max(const uint16_t max);
|
||||
void set_value(const uint16_t value);
|
||||
void set_max(const uint32_t max);
|
||||
void set_value(const uint32_t value);
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
private:
|
||||
uint16_t _value = 0;
|
||||
uint16_t _max = 100;
|
||||
uint32_t _value = 0;
|
||||
uint32_t _max = 100;
|
||||
};
|
||||
|
||||
class Console : public Widget {
|
||||
@@ -282,6 +282,7 @@ class Button : public Widget {
|
||||
public:
|
||||
std::function<void(Button&)> on_select;
|
||||
std::function<void(Button&,KeyEvent)> on_dir;
|
||||
std::function<void(Button&)> on_highlight;
|
||||
|
||||
Button(Rect parent_rect, std::string text);
|
||||
|
||||
@@ -295,6 +296,7 @@ public:
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
void on_focus() override;
|
||||
bool on_key(const KeyEvent key) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
|
||||
|
Reference in New Issue
Block a user