mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-08 17:55:00 -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
|
@ -21,26 +21,12 @@
|
|||
|
||||
#include "ui_rssi.hpp"
|
||||
|
||||
#include "event_m0.hpp"
|
||||
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace ui {
|
||||
|
||||
void RSSI::on_show() {
|
||||
EventDispatcher::message_map().register_handler(Message::ID::RSSIStatistics,
|
||||
[this](const Message* const p) {
|
||||
this->on_statistics_update(static_cast<const RSSIStatisticsMessage*>(p)->statistics);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void RSSI::on_hide() {
|
||||
EventDispatcher::message_map().unregister_handler(Message::ID::RSSIStatistics);
|
||||
}
|
||||
|
||||
void RSSI::paint(Painter& painter) {
|
||||
const auto r = screen_rect();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue