diff --git a/src/buttonbox.cpp b/src/buttonbox.cpp index 4a1265e..e102aba 100644 --- a/src/buttonbox.cpp +++ b/src/buttonbox.cpp @@ -22,10 +22,14 @@ void ButtonBox::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) { - posX = gmenu2x->drawButton(s, button, posX); + auto rect = button->getRect(); + button->setPosition(x, y - rect.h); + button->paint(s); + x += button->getRect().w + 6; } } diff --git a/src/buttonbox.h b/src/buttonbox.h index caa918f..47929e8 100644 --- a/src/buttonbox.h +++ b/src/buttonbox.h @@ -16,7 +16,7 @@ public: void add(IconButton *button); void clear(); - void paint(Surface& s, unsigned int posX); + void paint(Surface& s, unsigned int x); void handleTS(); private: diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 7388e3a..ad3e415 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -1030,13 +1030,6 @@ string GMenu2X::getDiskFree(const char *path) { 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) { if (y<0) y = resY+y; int w = 0; diff --git a/src/gmenu2x.h b/src/gmenu2x.h index 4ffffd6..ad7d07f 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -205,7 +205,6 @@ public: void renameSection(); 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 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);