Root/src/buttonbox.cpp

Source at commit 73ceffa51d3450d2d20ce933e7fc6da187e09fc8 created 7 years 5 months ago.
By Maarten ter Huurne, Fix bug in section directory creation method
1#include "buttonbox.h"
2
3#include "gmenu2x.h"
4#include "iconbutton.h"
5
6using std::unique_ptr;
7using std::move;
8
9void ButtonBox::add(unique_ptr<IconButton> button)
10{
11    buttons.push_back(move(button));
12}
13
14void ButtonBox::clear()
15{
16    buttons.clear();
17}
18
19void ButtonBox::paint(Surface& s, int x, int y)
20{
21    for (auto& button : buttons) {
22        auto rect = button->getRect();
23        button->setPosition(x, y - rect.h);
24        button->paint(s);
25        x += button->getRect().w + 6;
26    }
27}
28

Archive Download this file



interactive