mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-14 01:15:38 -04:00
Wrap message handler registrations in class to subscribe/unsubscribe automatically.
This commit is contained in:
parent
e298e1ec5a
commit
7d4dd03418
18 changed files with 139 additions and 149 deletions
|
@ -23,6 +23,9 @@
|
|||
#define __UI_BASEBAND_STATS_VIEW_H__
|
||||
|
||||
#include "ui_widget.hpp"
|
||||
|
||||
#include "event_m0.hpp"
|
||||
|
||||
#include "message.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
@ -31,15 +34,19 @@ class BasebandStatsView : public View {
|
|||
public:
|
||||
BasebandStatsView();
|
||||
|
||||
void on_show() override;
|
||||
void on_hide() override;
|
||||
|
||||
private:
|
||||
Text text_stats {
|
||||
{ 0 * 8, 0, (4 * 4 + 3) * 8, 1 * 16 },
|
||||
"",
|
||||
};
|
||||
|
||||
MessageHandlerRegistration message_handler_stats {
|
||||
Message::ID::BasebandStatistics,
|
||||
[this](const Message* const p) {
|
||||
this->on_statistics_update(static_cast<const BasebandStatisticsMessage*>(p)->statistics);
|
||||
}
|
||||
};
|
||||
|
||||
void on_statistics_update(const BasebandStatistics& statistics);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue