cleanup & formatting

This commit is contained in:
Raphael Coeffic
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent fd0881f19e
commit 40233604ce
+14 -16
View File
@@ -130,27 +130,25 @@ class StaticBitmap: public Window
bool scale = false; bool scale = false;
}; };
class DynamicText: public StaticText class DynamicText : public StaticText
{ {
public: public:
DynamicText(Window * parent, const rect_t & rect, std::function<std::string()> textHandler, LcdFlags textFlags = 0): DynamicText(Window *parent, const rect_t &rect,
std::function<std::string()> textHandler,
LcdFlags textFlags = 0) :
StaticText(parent, rect, "", 0, textFlags), StaticText(parent, rect, "", 0, textFlags),
textHandler(std::move(textHandler)) textHandler(std::move(textHandler))
{ {
} }
void checkEvents() override void checkEvents() override
{ {
StaticText::checkEvents(); StaticText::checkEvents();
std::string newText = textHandler(); setText(textHandler());
if (newText != text) { }
setText(newText);
invalidate();
}
}
protected: protected:
std::function<std::string()> textHandler; std::function<std::string()> textHandler;
}; };
template <class T> template <class T>