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
|
|
|
|
2014-08-16 00:52:48 +03:00
|
|
|
using std::unique_ptr;
|
|
|
|
using std::move;
|
2010-05-03 23:21:36 +03:00
|
|
|
|
2014-08-16 00:52:48 +03:00
|
|
|
void ButtonBox::add(unique_ptr<IconButton> button)
|
2010-05-03 23:21:36 +03:00
|
|
|
{
|
2014-08-16 00:52:48 +03:00
|
|
|
buttons.push_back(move(button));
|
2010-05-03 23:21:36 +03:00
|
|
|
}
|
|
|
|
|
2011-09-15 21:12:02 +03:00
|
|
|
void ButtonBox::clear()
|
|
|
|
{
|
|
|
|
buttons.clear();
|
|
|
|
}
|
|
|
|
|
2014-08-16 06:47:48 +03:00
|
|
|
void ButtonBox::paint(Surface& s, int x, int y)
|
2010-05-03 23:21:36 +03:00
|
|
|
{
|
2014-08-16 00:52:48 +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-16 00:52:48 +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
|
|
|
}
|