summaryrefslogtreecommitdiff
path: root/libraries/pake/source/widgets/fixed-text.cpp
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-07-31 13:36:53 -0400
committerBenji Dial <benji@benjidial.net>2024-07-31 13:36:53 -0400
commitb1cf9e5dfbc8967bd7cb2a22ec1e5e521f4e0e6e (patch)
tree00837891f9b9bf232e540a6f9b3e16f2438865c3 /libraries/pake/source/widgets/fixed-text.cpp
parent86b343f17175ef3e1fad2197636f75770466aa7c (diff)
downloadhilbert-os-b1cf9e5dfbc8967bd7cb2a22ec1e5e521f4e0e6e.tar.gz
add clock
Diffstat (limited to 'libraries/pake/source/widgets/fixed-text.cpp')
-rw-r--r--libraries/pake/source/widgets/fixed-text.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/libraries/pake/source/widgets/fixed-text.cpp b/libraries/pake/source/widgets/fixed-text.cpp
index c3a9a10..69c4046 100644
--- a/libraries/pake/source/widgets/fixed-text.cpp
+++ b/libraries/pake/source/widgets/fixed-text.cpp
@@ -15,12 +15,18 @@ namespace pake::widgets {
daguerre::hilbert_color fg,
halign ha, valign va)
: font(font), bg(bg), fg(fg),
- text(std::move(text)), ha(ha), va(va) {}
+ text(std::move(text)),
+ ha(ha), va(va) {}
+
+ void fixed_text::set_text(std::string &&text) {
+ this->text = std::move(text);
+ text_changed = true;
+ }
void fixed_text::render(
dirtiable_image &onto, int x_off, int y_off, bool force) {
- if (force) {
+ if (force || text_changed) {
//TODO: check overflow
@@ -54,6 +60,8 @@ namespace pake::widgets {
*font, fg, x_off, y_off,
text.data(), draw_if_true);
+ text_changed = false;
+
}
}