mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-10-21 03:10:16 +00:00
Wrap message handler registrations in class to subscribe/unsubscribe automatically.
This commit is contained in:
@@ -21,26 +21,12 @@
|
||||
|
||||
#include "ui_channel.hpp"
|
||||
|
||||
#include "event_m0.hpp"
|
||||
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace ui {
|
||||
|
||||
void Channel::on_show() {
|
||||
EventDispatcher::message_map().register_handler(Message::ID::ChannelStatistics,
|
||||
[this](const Message* const p) {
|
||||
this->on_statistics_update(static_cast<const ChannelStatisticsMessage*>(p)->statistics);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void Channel::on_hide() {
|
||||
EventDispatcher::message_map().unregister_handler(Message::ID::ChannelStatistics);
|
||||
}
|
||||
|
||||
void Channel::paint(Painter& painter) {
|
||||
const auto r = screen_rect();
|
||||
|
||||
|
Reference in New Issue
Block a user