[color] fix statistics view (now displays proper numbers)
This commit is contained in:
@@ -32,19 +32,19 @@ class DebugInfoNumber : public Window
|
|||||||
public:
|
public:
|
||||||
DebugInfoNumber(Window * parent, const rect_t & rect, std::function<T()> numberHandler, LcdFlags textFlags = 0, const char * prefix = nullptr, const char * suffix = nullptr):
|
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),
|
Window(parent, rect, 0, textFlags),
|
||||||
numberHandler(std::move(numberHandler)),
|
|
||||||
prefix(prefix),
|
prefix(prefix),
|
||||||
suffix(suffix)
|
suffix(suffix)
|
||||||
{
|
{
|
||||||
coord_t prefixSize = getTextWidth(prefix, 0, HEADER_COLOR | FONT(XS));
|
coord_t prefixSize = 0;
|
||||||
new StaticText(this, {0, 0, prefixSize, rect.h}, prefix, 0, HEADER_COLOR | FONT(XS));
|
if (prefix != nullptr) {
|
||||||
new DynamicNumber<uint32_t>(this, {prefixSize, 0, rect.w - prefixSize, rect.h}, [] {
|
prefixSize = getTextWidth(prefix, 0, HEADER_COLOR | FONT(XS));
|
||||||
return menusStack.available();
|
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:
|
protected:
|
||||||
std::function<T()> numberHandler;
|
|
||||||
const char * prefix;
|
const char * prefix;
|
||||||
const char * suffix;
|
const char * suffix;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user