mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-27 16:17:31 -04:00
"Labels" widget
This commit is contained in:
parent
0102a34286
commit
d12cd0d8af
11 changed files with 52 additions and 74 deletions
|
@ -352,27 +352,26 @@ void Text::paint(Painter& painter) {
|
|||
/* Labels ****************************************************************/
|
||||
|
||||
Labels::Labels(
|
||||
std::vector<Label> * labels
|
||||
std::initializer_list<Label> labels
|
||||
) : labels_ { labels }
|
||||
{
|
||||
}
|
||||
|
||||
void Labels::set_labels(std::vector<Label> * const labels) {
|
||||
void Labels::set_labels(std::initializer_list<Label> labels) {
|
||||
labels_ = labels;
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void Labels::paint(Painter& painter) {
|
||||
/*const auto rect = screen_rect();
|
||||
const auto s = style();
|
||||
|
||||
painter.fill_rectangle(rect, s.background);
|
||||
|
||||
painter.draw_string(
|
||||
rect.location(),
|
||||
s,
|
||||
text
|
||||
);*/
|
||||
for (auto &label : labels_) {
|
||||
painter.draw_string(
|
||||
label.pos + screen_pos(),
|
||||
style().font,
|
||||
label.color,
|
||||
style().background,
|
||||
label.text
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* BigFrequency **********************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue