Allows for multi-byte pictograms in MenuToolbarButton
This commit is contained in:
committed by
Raphael Coeffic
parent
ba7564c62a
commit
c62208261e
+4
-4
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user