mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-10 02:35:17 -04:00
Really dumb list view columns structures.
This commit is contained in:
parent
cac9f02c48
commit
cb403160b3
3 changed files with 52 additions and 3 deletions
|
@ -165,13 +165,31 @@ void TPMSRecentEntry::update(const tpms::Reading& reading) {
|
|||
|
||||
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<>
|
||||
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 ");
|
||||
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<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue