mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-06-28 12:39:50 +03:00
428a316bc1
It was only used to fetch resY, so I replaced that by taking the y-coordinate as an argument. That is also more consistent with the x-coordinate which was already an argument. The x-coordinate was changed to a signed int, since that is the norm for paint coordinates. It can be useful for drawing widgets that are partially off screen, for example during a (dis)appear animation. In InputDialog, the ButtonBox field was changed from a pointer to a plain data member. There was no need to dynamically allocate it.
35 lines
547 B
C++
35 lines
547 B
C++
#include "buttonbox.h"
|
|
|
|
#include "gmenu2x.h"
|
|
#include "iconbutton.h"
|
|
|
|
using std::unique_ptr;
|
|
using std::move;
|
|
|
|
void ButtonBox::add(unique_ptr<IconButton> button)
|
|
{
|
|
buttons.push_back(move(button));
|
|
}
|
|
|
|
void ButtonBox::clear()
|
|
{
|
|
buttons.clear();
|
|
}
|
|
|
|
void ButtonBox::paint(Surface& s, int x, int y)
|
|
{
|
|
for (auto& button : buttons) {
|
|
auto rect = button->getRect();
|
|
button->setPosition(x, y - rect.h);
|
|
button->paint(s);
|
|
x += button->getRect().w + 6;
|
|
}
|
|
}
|
|
|
|
void ButtonBox::handleTS()
|
|
{
|
|
for (auto& button : buttons) {
|
|
button->handleTS();
|
|
}
|
|
}
|