2013-08-12 23:17:26 +03:00
|
|
|
#include "buttonbox.h"
|
2010-05-03 23:21:36 +03:00
|
|
|
|
|
|
|
#include "gmenu2x.h"
|
2013-08-12 23:17:26 +03:00
|
|
|
#include "iconbutton.h"
|
2010-05-03 23:21:36 +03:00
|
|
|
|
|
|
|
ButtonBox::ButtonBox(GMenu2X *gmenu2x) : gmenu2x(gmenu2x)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ButtonBox::~ButtonBox()
|
|
|
|
{
|
2011-09-15 21:12:02 +03:00
|
|
|
clear();
|
2010-05-03 23:21:36 +03:00
|
|
|
}
|
|
|
|
|
2013-08-12 23:17:26 +03:00
|
|
|
void ButtonBox::add(IconButton *button)
|
2010-05-03 23:21:36 +03:00
|
|
|
{
|
|
|
|
buttons.push_back(button);
|
|
|
|
}
|
|
|
|
|
2011-09-15 21:12:02 +03:00
|
|
|
void ButtonBox::clear()
|
|
|
|
{
|
|
|
|
buttons.clear();
|
|
|
|
}
|
|
|
|
|
2014-08-15 18:27:09 +03:00
|
|
|
void ButtonBox::paint(Surface& s, unsigned int x)
|
2010-05-03 23:21:36 +03:00
|
|
|
{
|
2014-08-15 18:27:09 +03:00
|
|
|
const int y = gmenu2x->resY - 1;
|
2014-08-10 05:26:59 +03:00
|
|
|
for (auto button : buttons) {
|
2014-08-15 18:27:09 +03:00
|
|
|
auto rect = button->getRect();
|
|
|
|
button->setPosition(x, y - rect.h);
|
|
|
|
button->paint(s);
|
|
|
|
x += button->getRect().w + 6;
|
2014-08-10 05:26:59 +03:00
|
|
|
}
|
2010-05-03 23:21:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ButtonBox::handleTS()
|
|
|
|
{
|
2014-08-10 05:26:59 +03:00
|
|
|
for (auto button : buttons) {
|
2013-08-12 23:17:26 +03:00
|
|
|
button->handleTS();
|
2014-08-10 05:26:59 +03:00
|
|
|
}
|
2010-05-03 23:21:36 +03:00
|
|
|
}
|