mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Add simple column headers to recents list views.
This commit is contained in:
parent
bd829d7d85
commit
cac9f02c48
@ -218,6 +218,15 @@ void AISRecentEntry::update(const ais::Packet& packet) {
|
|||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void RecentEntriesView<AISRecentEntries>::draw_header(
|
||||||
|
const Rect& target_rect,
|
||||||
|
Painter& painter,
|
||||||
|
const Style& style
|
||||||
|
) {
|
||||||
|
painter.draw_string(target_rect.pos, style, " MMSI |Name/Call ");
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void RecentEntriesView<AISRecentEntries>::draw(
|
void RecentEntriesView<AISRecentEntries>::draw(
|
||||||
const Entry& entry,
|
const Entry& entry,
|
||||||
|
@ -71,6 +71,15 @@ void ERTRecentEntry::update(const ert::Packet& packet) {
|
|||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void RecentEntriesView<ERTRecentEntries>::draw_header(
|
||||||
|
const Rect& target_rect,
|
||||||
|
Painter& painter,
|
||||||
|
const Style& style
|
||||||
|
) {
|
||||||
|
painter.draw_string(target_rect.pos, style, " ID | Consumpt |Cnt ");
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void RecentEntriesView<ERTRecentEntries>::draw(
|
void RecentEntriesView<ERTRecentEntries>::draw(
|
||||||
const Entry& entry,
|
const Entry& entry,
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#define __RECENT_ENTRIES_H__
|
#define __RECENT_ENTRIES_H__
|
||||||
|
|
||||||
#include "ui_widget.hpp"
|
#include "ui_widget.hpp"
|
||||||
|
#include "ui_font_fixed_8x16.hpp"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -138,6 +139,15 @@ public:
|
|||||||
Rect target_rect { r.pos, { r.width(), s.font.line_height() }};
|
Rect target_rect { r.pos, { r.width(), s.font.line_height() }};
|
||||||
const size_t visible_item_count = r.height() / s.font.line_height();
|
const size_t visible_item_count = r.height() / s.font.line_height();
|
||||||
|
|
||||||
|
const Style style_header {
|
||||||
|
.font = font::fixed_8x16,
|
||||||
|
.background = Color::blue(),
|
||||||
|
.foreground = Color::white(),
|
||||||
|
};
|
||||||
|
|
||||||
|
draw_header(target_rect, painter, style_header);
|
||||||
|
target_rect.pos.y += target_rect.height();
|
||||||
|
|
||||||
auto selected = recent.find(selected_key);
|
auto selected = recent.find(selected_key);
|
||||||
if( selected == std::end(recent) ) {
|
if( selected == std::end(recent) ) {
|
||||||
selected = std::begin(recent);
|
selected = std::begin(recent);
|
||||||
@ -208,6 +218,12 @@ private:
|
|||||||
set_dirty();
|
set_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw_header(
|
||||||
|
const Rect& target_rect,
|
||||||
|
Painter& painter,
|
||||||
|
const Style& style
|
||||||
|
);
|
||||||
|
|
||||||
void draw(
|
void draw(
|
||||||
const Entry& entry,
|
const Entry& entry,
|
||||||
const Rect& target_rect,
|
const Rect& target_rect,
|
||||||
|
@ -165,6 +165,15 @@ void TPMSRecentEntry::update(const tpms::Reading& reading) {
|
|||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void RecentEntriesView<TPMSRecentEntries>::draw_header(
|
||||||
|
const Rect& target_rect,
|
||||||
|
Painter& painter,
|
||||||
|
const Style& style
|
||||||
|
) {
|
||||||
|
painter.draw_string(target_rect.pos, style, "Tp| ID |kPa| C |Cnt ");
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void RecentEntriesView<TPMSRecentEntries>::draw(
|
void RecentEntriesView<TPMSRecentEntries>::draw(
|
||||||
const Entry& entry,
|
const Entry& entry,
|
||||||
|
Loading…
Reference in New Issue
Block a user