mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 03:06:15 +02:00
Changed icon lookup in GMenu2X::drawButton(Right)
Look up the icon with the "skin:" prefix to be consistent with how other lookups of the same icons are performed. Also don't perform repeated lookups.
This commit is contained in:
parent
8e885bc2c1
commit
45304052cd
@ -1031,11 +1031,13 @@ string GMenu2X::getDiskFree(const char *path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int GMenu2X::drawButton(Surface& s, const string &btn, const string &text, int x, int y) {
|
int GMenu2X::drawButton(Surface& s, const string &btn, const string &text, int x, int y) {
|
||||||
if (y<0) y = resY+y;
|
|
||||||
int w = 0;
|
int w = 0;
|
||||||
if (sc.skinRes("imgs/buttons/"+btn+".png") != NULL) {
|
auto icon = sc["skin:imgs/buttons/" + btn + ".png"];
|
||||||
sc["imgs/buttons/"+btn+".png"]->blit(s, x, y-7);
|
if (icon) {
|
||||||
w = sc["imgs/buttons/"+btn+".png"]->width() + 3;
|
if (y < 0) y = resY + y;
|
||||||
|
w = icon->width();
|
||||||
|
icon->blit(s, x, y - 7);
|
||||||
|
w += 3;
|
||||||
w += font->write(
|
w += font->write(
|
||||||
s, text, x + w, y, Font::HAlignLeft, Font::VAlignMiddle);
|
s, text, x + w, y, Font::HAlignLeft, Font::VAlignMiddle);
|
||||||
}
|
}
|
||||||
@ -1043,15 +1045,17 @@ int GMenu2X::drawButton(Surface& s, const string &btn, const string &text, int x
|
|||||||
}
|
}
|
||||||
|
|
||||||
int GMenu2X::drawButtonRight(Surface& s, const string &btn, const string &text, int x, int y) {
|
int GMenu2X::drawButtonRight(Surface& s, const string &btn, const string &text, int x, int y) {
|
||||||
if (y<0) y = resY+y;
|
int w = 0;
|
||||||
if (sc.skinRes("imgs/buttons/"+btn+".png") != NULL) {
|
auto icon = sc["skin:imgs/buttons/" + btn + ".png"];
|
||||||
x -= 16;
|
if (icon) {
|
||||||
sc["imgs/buttons/"+btn+".png"]->blit(s, x, y-7);
|
if (y < 0) y = resY + y;
|
||||||
x -= 3;
|
w = icon->width();
|
||||||
return x-6 - font->write(
|
icon->blit(s, x - w, y - 7);
|
||||||
s, text, x, y, Font::HAlignRight, Font::VAlignMiddle);
|
w += 3;
|
||||||
|
w += font->write(
|
||||||
|
s, text, x - w, y, Font::HAlignRight, Font::VAlignMiddle);
|
||||||
}
|
}
|
||||||
return x-6;
|
return x - (w + 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMenu2X::drawScrollBar(uint pageSize, uint totalSize, uint pagePos) {
|
void GMenu2X::drawScrollBar(uint pageSize, uint totalSize, uint pagePos) {
|
||||||
|
Loading…
Reference in New Issue
Block a user