mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-28 11:12:26 -04:00
RecentEntriesX: Move non-templated bits to .cpp.
This commit is contained in:
parent
722f9b6886
commit
2740761ed7
2 changed files with 42 additions and 28 deletions
|
@ -20,3 +20,42 @@
|
|||
*/
|
||||
|
||||
#include "recent_entries.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
||||
RecentEntriesColumns::RecentEntriesColumns(
|
||||
const std::initializer_list<RecentEntriesColumn> columns
|
||||
) : _columns { columns }
|
||||
{
|
||||
}
|
||||
|
||||
RecentEntriesHeader::RecentEntriesHeader(
|
||||
const RecentEntriesColumns& columns
|
||||
) : _columns { columns }
|
||||
{
|
||||
}
|
||||
|
||||
void RecentEntriesHeader::paint(Painter& painter) {
|
||||
const auto r = screen_rect();
|
||||
const auto& parent_style = style();
|
||||
|
||||
const Style style {
|
||||
.font = parent_style.font,
|
||||
.background = Color::blue(),
|
||||
.foreground = parent_style.foreground,
|
||||
};
|
||||
|
||||
auto p = r.pos;
|
||||
for(const auto& column : _columns) {
|
||||
const auto width = column.second;
|
||||
auto text = column.first;
|
||||
if( width > text.length() ) {
|
||||
text.append(width - text.length(), ' ');
|
||||
}
|
||||
|
||||
painter.draw_string(p, style, text);
|
||||
p += { static_cast<Coord>((width * 8) + 8), 0 };
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue