mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-05 05:04:27 -04:00
Add AIS detail view.
This commit is contained in:
parent
b1707298b7
commit
aa249cbad4
2 changed files with 87 additions and 0 deletions
|
@ -53,6 +53,11 @@ struct AISRecentEntry {
|
|||
size_t received_count;
|
||||
int8_t navigational_status;
|
||||
|
||||
AISRecentEntry(
|
||||
) : AISRecentEntry { 0 }
|
||||
{
|
||||
}
|
||||
|
||||
AISRecentEntry(
|
||||
const ais::MMSI& mmsi
|
||||
) : mmsi { mmsi },
|
||||
|
@ -113,11 +118,14 @@ namespace ui {
|
|||
|
||||
class AISRecentEntriesView : public View {
|
||||
public:
|
||||
std::function<void(const AISRecentEntry& entry)> on_select;
|
||||
|
||||
AISRecentEntriesView(AISRecentEntries& recent);
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
bool on_encoder(const EncoderEvent event) override;
|
||||
bool on_key(const ui::KeyEvent event) override;
|
||||
|
||||
private:
|
||||
AISRecentEntries& recent;
|
||||
|
@ -129,6 +137,25 @@ private:
|
|||
void advance(const int32_t amount);
|
||||
};
|
||||
|
||||
class AISRecentEntryDetailView : public View {
|
||||
public:
|
||||
std::function<void(void)> on_close;
|
||||
|
||||
AISRecentEntryDetailView();
|
||||
|
||||
void set_entry(const AISRecentEntry& new_entry);
|
||||
|
||||
void focus() override;
|
||||
|
||||
private:
|
||||
AISRecentEntry entry;
|
||||
|
||||
Button button_done {
|
||||
{ 72, 192, 96, 24 },
|
||||
"Done"
|
||||
};
|
||||
};
|
||||
|
||||
class AISAppView : public View {
|
||||
public:
|
||||
AISAppView();
|
||||
|
@ -145,8 +172,11 @@ private:
|
|||
AISLogger logger;
|
||||
|
||||
AISRecentEntriesView recent_entries_view { recent };
|
||||
AISRecentEntryDetailView recent_entry_detail_view;
|
||||
|
||||
void on_packet(const ais::Packet& packet);
|
||||
void on_show_list();
|
||||
void on_show_detail(const AISRecentEntry& entry);
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue