rename Widget::visible to Widget::drawn (#3066)

* rename Widget::visible to Widget::drawn

* Update firmware/standalone/common/ui/ui_widget.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update firmware/standalone/common/ui/ui_widget.hpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix fm_radio usage of drawn()

---------

Co-authored-by: gullradriel <3157857+gullradriel@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
E.T.
2026-03-04 21:30:43 +01:00
committed by GitHub
parent 60ce89021a
commit 2b7302e659
11 changed files with 48 additions and 48 deletions
+11 -11
View File
@@ -91,9 +91,9 @@ void Widget::set_parent(Widget* const widget) {
}
if (parent_ && !widget) {
// We have a parent, but are losing it. Update visible status.
// We have a parent, but are losing it. Update drawn status.
dirty_overlapping_children_in_rect(screen_rect());
visible(false);
drawn(false);
}
if (widget == nullptr)
@@ -209,9 +209,9 @@ const Style& Widget::style() const {
return style_ ? *style_ : parent()->style();
}
void Widget::visible(bool v) {
if (v != flags.visible) {
flags.visible = v;
void Widget::drawn(bool v) {
if (v != flags.drawn) {
flags.drawn = v;
/* TODO: This on_show/on_hide implementation seems inelegant.
* But I need *some* way to take/configure resources when
@@ -224,9 +224,9 @@ void Widget::visible(bool v) {
} else {
on_hide();
// Set all children invisible too.
// Set all children not drawn too.
for (const auto child : children()) {
child->visible(false);
child->drawn(false);
}
}
}
@@ -694,7 +694,7 @@ void Console::clear(bool clear_buffer = false) {
if (clear_buffer)
buffer.clear();
if (!hidden() && visible()) {
if (!hidden() && drawn()) {
display.fill_rectangle(
screen_rect(),
Theme::getInstance()->bg_darkest->background);
@@ -706,7 +706,7 @@ void Console::clear(bool clear_buffer = false) {
void Console::write(std::string message) {
bool escape = false;
if (!hidden() && visible()) {
if (!hidden() && drawn()) {
const Style& s = style();
const Font& font = s.font;
auto rect = screen_rect();
@@ -797,7 +797,7 @@ void Console::on_hide() {
}
void Console::crlf() {
if (hidden() || !visible()) return;
if (hidden() || !drawn()) return;
const auto& s = style();
auto sr = screen_rect();
@@ -3232,7 +3232,7 @@ void GraphEq::update_audio_spectrum(const AudioSpectrum& spectrum) {
}
void GraphEq::paint(Painter& painter) {
if (!visible()) return;
if (!drawn()) return;
if (!is_calculated) { // calc positions first
calculate_params();
is_calculated = true;