1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-09-28 21:09:47 +03:00

Removed GMenu2X::drawButton variant

This was only called form ButtonBox, so I moved the code there.

I still think a paint method shouldn't be repositioning widgets, but
that's something for a later cleanup.
This commit is contained in:
Maarten ter Huurne 2014-08-15 17:27:09 +02:00
parent faf0287cf5
commit 8e885bc2c1
4 changed files with 7 additions and 11 deletions

View File

@ -22,10 +22,14 @@ void ButtonBox::clear()
buttons.clear(); buttons.clear();
} }
void ButtonBox::paint(Surface& s, unsigned int posX) void ButtonBox::paint(Surface& s, unsigned int x)
{ {
const int y = gmenu2x->resY - 1;
for (auto button : buttons) { for (auto button : buttons) {
posX = gmenu2x->drawButton(s, button, posX); auto rect = button->getRect();
button->setPosition(x, y - rect.h);
button->paint(s);
x += button->getRect().w + 6;
} }
} }

View File

@ -16,7 +16,7 @@ public:
void add(IconButton *button); void add(IconButton *button);
void clear(); void clear();
void paint(Surface& s, unsigned int posX); void paint(Surface& s, unsigned int x);
void handleTS(); void handleTS();
private: private:

View File

@ -1030,13 +1030,6 @@ string GMenu2X::getDiskFree(const char *path) {
return df; return df;
} }
int GMenu2X::drawButton(Surface& s, IconButton *btn, int x, int y) {
if (y<0) y = resY+y;
btn->setPosition(x, y-7);
btn->paint(s);
return x+btn->getRect().w+6;
}
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; if (y<0) y = resY+y;
int w = 0; int w = 0;

View File

@ -205,7 +205,6 @@ public:
void renameSection(); void renameSection();
void deleteSection(); void deleteSection();
int drawButton(Surface& s, IconButton *btn, int x=5, int y=-10);
int drawButton(Surface& s, const std::string &btn, const std::string &text, int x=5, int y=-10); int drawButton(Surface& s, const std::string &btn, const std::string &text, int x=5, int y=-10);
int drawButtonRight(Surface& s, const std::string &btn, const std::string &text, int x=5, int y=-10); int drawButtonRight(Surface& s, const std::string &btn, const std::string &text, int x=5, int y=-10);
void drawScrollBar(uint pageSize, uint totalSize, uint pagePos); void drawScrollBar(uint pageSize, uint totalSize, uint pagePos);