mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-11 07:19:34 -05: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;
|
uint8_t nb_lines = 0;
|
||||||
for (uint8_t it = current_index; it < freqlist_db.size(); it++) {
|
for (uint8_t it = current_index; it < freqlist_db.size(); it++) {
|
||||||
uint8_t line_height = (int)nb_lines * char_height;
|
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);
|
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) {
|
if (nb_lines == highlighted_index) {
|
||||||
const Rect r_highlighted_freq{0, r.location().y() + (int)nb_lines * char_height, 240, char_height};
|
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,
|
r_highlighted_freq,
|
||||||
Color::white());
|
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++;
|
nb_lines++;
|
||||||
} else {
|
} else {
|
||||||
// rect is filled, we can break
|
// rect is filled, we can break
|
||||||
|
@ -66,6 +66,11 @@ class FreqManUIList : public Widget {
|
|||||||
.background = Color::black(),
|
.background = Color::black(),
|
||||||
.foreground = Color::white(),
|
.foreground = Color::white(),
|
||||||
};
|
};
|
||||||
|
Style style_highlight{
|
||||||
|
.font = font::fixed_8x16,
|
||||||
|
.background = Color::white(),
|
||||||
|
.foreground = Color::black(),
|
||||||
|
};
|
||||||
Style style_yellow{
|
Style style_yellow{
|
||||||
.font = font::fixed_8x16,
|
.font = font::fixed_8x16,
|
||||||
.background = Color::black(),
|
.background = Color::black(),
|
||||||
|
Loading…
Reference in New Issue
Block a user