mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
add back correct highlight to list (#1114)
This commit is contained in:
parent
f2a7617b1b
commit
c66df8c807
@ -75,18 +75,22 @@ void FreqManUIList::paint(Painter& painter) {
|
||||
uint8_t nb_lines = 0;
|
||||
for (uint8_t it = current_index; it < freqlist_db.size(); it++) {
|
||||
uint8_t line_height = (int)nb_lines * char_height;
|
||||
if (line_height < (r.height() - char_height)) {
|
||||
if (line_height < (r.height() - char_height)) { // line is within the widget
|
||||
std::string description = freqman_item_string(freqlist_db[it], 30);
|
||||
// line is within the widget
|
||||
painter.draw_string(
|
||||
{0, r.location().y() + (int)nb_lines * char_height},
|
||||
*text_color, description);
|
||||
if (nb_lines == highlighted_index) {
|
||||
const Rect r_highlighted_freq{0, r.location().y() + (int)nb_lines * char_height, 240, char_height};
|
||||
painter.draw_rectangle(
|
||||
painter.fill_rectangle(
|
||||
r_highlighted_freq,
|
||||
Color::white());
|
||||
painter.draw_string(
|
||||
{0, r.location().y() + (int)nb_lines * char_height},
|
||||
style_highlight, description);
|
||||
} else {
|
||||
painter.draw_string(
|
||||
{0, r.location().y() + (int)nb_lines * char_height},
|
||||
*text_color, description);
|
||||
}
|
||||
|
||||
nb_lines++;
|
||||
} else {
|
||||
// rect is filled, we can break
|
||||
|
@ -66,6 +66,11 @@ class FreqManUIList : public Widget {
|
||||
.background = Color::black(),
|
||||
.foreground = Color::white(),
|
||||
};
|
||||
Style style_highlight{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::white(),
|
||||
.foreground = Color::black(),
|
||||
};
|
||||
Style style_yellow{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
|
Loading…
Reference in New Issue
Block a user