Skip to content
Snippets Groups Projects
Commit cb403160 authored by Jared Boone's avatar Jared Boone
Browse files

Really dumb list view columns structures.

parent cac9f02c
No related branches found
No related tags found
No related merge requests found
...@@ -218,13 +218,28 @@ void AISRecentEntry::update(const ais::Packet& packet) { ...@@ -218,13 +218,28 @@ void AISRecentEntry::update(const ais::Packet& packet) {
namespace ui { namespace ui {
static const std::array<std::pair<std::string, size_t>, 2> ais_columns { {
{ "MMSI", 9 },
{ "Name/Call", 20 },
} };
template<> template<>
void RecentEntriesView<AISRecentEntries>::draw_header( void RecentEntriesView<AISRecentEntries>::draw_header(
const Rect& target_rect, const Rect& target_rect,
Painter& painter, Painter& painter,
const Style& style const Style& style
) { ) {
painter.draw_string(target_rect.pos, style, " MMSI |Name/Call "); auto x = 0;
for(const auto& column : ais_columns) {
const auto width = column.second;
auto text = column.first;
if( width > text.length() ) {
text.append(width - text.length(), ' ');
}
painter.draw_string({ x, target_rect.pos.y }, style, text);
x += (width * 8) + 8;
}
} }
template<> template<>
......
...@@ -71,13 +71,29 @@ void ERTRecentEntry::update(const ert::Packet& packet) { ...@@ -71,13 +71,29 @@ void ERTRecentEntry::update(const ert::Packet& packet) {
namespace ui { namespace ui {
static const std::array<std::pair<std::string, size_t>, 3> ert_columns { {
{ "ID", 10 },
{ "Consumpt", 10 },
{ "Cnt", 3 },
} };
template<> template<>
void RecentEntriesView<ERTRecentEntries>::draw_header( void RecentEntriesView<ERTRecentEntries>::draw_header(
const Rect& target_rect, const Rect& target_rect,
Painter& painter, Painter& painter,
const Style& style const Style& style
) { ) {
painter.draw_string(target_rect.pos, style, " ID | Consumpt |Cnt "); auto x = 0;
for(const auto& column : ert_columns) {
const auto width = column.second;
auto text = column.first;
if( width > text.length() ) {
text.append(width - text.length(), ' ');
}
painter.draw_string({ x, target_rect.pos.y }, style, text);
x += (width * 8) + 8;
}
} }
template<> template<>
......
...@@ -165,13 +165,31 @@ void TPMSRecentEntry::update(const tpms::Reading& reading) { ...@@ -165,13 +165,31 @@ void TPMSRecentEntry::update(const tpms::Reading& reading) {
namespace ui { namespace ui {
static const std::array<std::pair<std::string, size_t>, 5> tpms_columns { {
{ "Tp", 2 },
{ "ID", 8 },
{ "kPa", 3 },
{ "C", 3 },
{ "Cnt", 3 },
} };
template<> template<>
void RecentEntriesView<TPMSRecentEntries>::draw_header( void RecentEntriesView<TPMSRecentEntries>::draw_header(
const Rect& target_rect, const Rect& target_rect,
Painter& painter, Painter& painter,
const Style& style const Style& style
) { ) {
painter.draw_string(target_rect.pos, style, "Tp| ID |kPa| C |Cnt "); auto x = 0;
for(const auto& column : tpms_columns) {
const auto width = column.second;
auto text = column.first;
if( width > text.length() ) {
text.append(width - text.length(), ' ');
}
painter.draw_string({ x, target_rect.pos.y }, style, text);
x += (width * 8) + 8;
}
} }
template<> template<>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment