[color] fix statistics view (now displays proper numbers)

This commit is contained in:
Raphael Coeffic
2021-07-22 09:00:26 +02:00
parent d3c16a89c4
commit c832a74114
+7 -7
View File
@@ -32,19 +32,19 @@ class DebugInfoNumber : public Window
public:
DebugInfoNumber(Window * parent, const rect_t & rect, std::function<T()> numberHandler, LcdFlags textFlags = 0, const char * prefix = nullptr, const char * suffix = nullptr):
Window(parent, rect, 0, textFlags),
numberHandler(std::move(numberHandler)),
prefix(prefix),
suffix(suffix)
{
coord_t prefixSize = getTextWidth(prefix, 0, HEADER_COLOR | FONT(XS));
new StaticText(this, {0, 0, prefixSize, rect.h}, prefix, 0, HEADER_COLOR | FONT(XS));
new DynamicNumber<uint32_t>(this, {prefixSize, 0, rect.w - prefixSize, rect.h}, [] {
return menusStack.available();
});
coord_t prefixSize = 0;
if (prefix != nullptr) {
prefixSize = getTextWidth(prefix, 0, HEADER_COLOR | FONT(XS));
new StaticText(this, {0, 0, prefixSize, rect.h}, prefix, 0, HEADER_COLOR | FONT(XS));
}
new DynamicNumber<uint32_t>(this, {prefixSize, 0, rect.w - prefixSize, rect.h},
numberHandler);
}
protected:
std::function<T()> numberHandler;
const char * prefix;
const char * suffix;
};