Wrap message handler registrations in class to subscribe/unsubscribe automatically.

This commit is contained in:
Jared Boone 2016-05-11 22:53:09 -07:00
parent e298e1ec5a
commit 7d4dd03418
18 changed files with 139 additions and 149 deletions

View file

@ -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();