Allows for multi-byte pictograms in MenuToolbarButton

This commit is contained in:
Raphael Coeffic
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent ba7564c62a
commit c62208261e
2 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -28,10 +28,10 @@ void MenuToolbarButton::paint(BitmapBuffer * dc)
MENUS_TOOLBAR_BUTTON_WIDTH - 2 * MENUS_TOOLBAR_BUTTON_PADDING,
MENUS_TOOLBAR_BUTTON_WIDTH - 2 * MENUS_TOOLBAR_BUTTON_PADDING,
COLOR_THEME_FOCUS);
dc->drawSizedText(rect.w / 2, (rect.h - getFontHeight(FONT(STD))) / 2 + 1,
&picto, 1, CENTERED | COLOR_THEME_PRIMARY2);
dc->drawText(rect.w / 2, (rect.h - getFontHeight(FONT(STD))) / 2 + 1,
picto, CENTERED | COLOR_THEME_PRIMARY2);
} else {
dc->drawSizedText(rect.w / 2, (rect.h - getFontHeight(FONT(STD))) / 2 + 1,
&picto, 1, CENTERED | COLOR_THEME_PRIMARY1);
dc->drawText(rect.w / 2, (rect.h - getFontHeight(FONT(STD))) / 2 + 1,
picto, CENTERED | COLOR_THEME_PRIMARY1);
}
}
+3 -3
View File
@@ -27,7 +27,7 @@ int getFirstAvailable(int min, int max, std::function<bool(int)>isValueAvailable
class MenuToolbarButton: public Button {
public:
MenuToolbarButton(FormGroup * window, const rect_t & rect, char picto):
MenuToolbarButton(FormGroup * window, const rect_t & rect, const char* picto):
#if defined(HARDWARE_TOUCH)
Button(window, rect, nullptr),
#else
@@ -40,7 +40,7 @@ class MenuToolbarButton: public Button {
void paint(BitmapBuffer * dc) override;
protected:
char picto;
const char* picto;
};
template <class T>
@@ -112,7 +112,7 @@ class MenuToolbar: public FormGroup {
coord_t y = 0;
std::vector<MenuToolbarButton *> menuButtons;
void addButton(char picto, int16_t filtermin, int16_t filtermax)
void addButton(const char* picto, int16_t filtermin, int16_t filtermax)
{
int vmin = choice->vmin;
int vmax = choice->vmax;