Track when AISView has focus.

This commit is contained in:
Jared Boone 2015-12-05 14:23:53 -08:00
parent 1c191bcd4f
commit 27684069c5
2 changed files with 19 additions and 0 deletions

View File

@ -405,6 +405,16 @@ void AISView::on_packet(const baseband::ais::Packet& packet) {
set_dirty();
}
void AISView::on_focus() {
has_focus = true;
set_dirty();
}
void AISView::on_blur() {
has_focus = false;
set_dirty();
}
void AISView::paint(Painter& painter) {
const auto r = screen_rect();
const auto& s = style();

View File

@ -118,14 +118,23 @@ namespace ui {
class AISView : public View {
public:
AISView() {
flags.focusable = true;
}
void on_show() override;
void on_hide() override;
void paint(Painter& painter) override;
void on_focus() override;
void on_blur() override;
private:
AISModel model;
bool has_focus = false;
struct Position {
rtc::RTC timestamp { };
baseband::ais::Latitude latitude { 0 };