23 #ifndef __SELECTGROUP__ 24 #define __SELECTGROUP__ 27 #include <Eigen/Dense> 44 vector < Tucano::GUI::SelectButton* >
buttons;
71 buttons.push_back(el);
103 for (
unsigned int i = 1; i < buttons.size(); ++i)
105 if (buttons[i]->selected)
107 buttons[i]->clicked();
110 if (!buttons[0]->selected)
111 buttons[0]->clicked();
124 for (
unsigned int i = 0; i < buttons.size(); ++i)
126 if (buttons[i]->
isVisible() && buttons[i]->isInside(x, y))
132 buttons[i]->clicked();
147 for (
unsigned int i = 0; i < buttons.size(); ++i)
149 buttons[i]->render(camera_2d, shader);
Eigen::Vector2i dimensions
Dimensions in pixels.
Definition: element.hpp:66
Eigen::Vector2i position
Position of top-left corner in pixels.
Definition: element.hpp:69
Base class for all GUI elements (buttons, sliders ...)
Definition: element.hpp:52
bool isVisible(void)
Return whether element is visible or not.
Definition: element.hpp:359
Definition: bufferobject.hpp:34
A Shader object represents one GLSL program.
Definition: shader.hpp:45
vector< Tucano::GUI::SelectButton * > buttons
Vector containing select buttons inside box.
Definition: selectgroup.hpp:44
The gui select group is a placeholder for many selection buttons, so only one can be active at a time...
Definition: selectgroup.hpp:39
int selected
ID of currently selected button, -1 if no button is selected.
Definition: selectgroup.hpp:47
void add(SelectButton *el)
Adds an element to the gui The dimensions of the select group adjusts to fit all included select butt...
Definition: selectgroup.hpp:69
Definition: element.hpp:44
Eigen::Vector2i end_position
Definition: selectgroup.hpp:50
int getType(void)
Returns this element type, SELECTGROUP.
Definition: selectgroup.hpp:90
void render(Tucano::Camera &camera_2d, Shader &shader)
Renders all elements inside group.
Definition: selectgroup.hpp:145
SelectGroup(void)
Default constructor.
Definition: selectgroup.hpp:57
int element_type
Type of element.
Definition: element.hpp:57
Defines an abstract camera with a projection and view matrices.
Definition: camera.hpp:37
void resetSelection(void)
Select first element of group and makes sure all others are unselected.
Definition: selectgroup.hpp:98
bool checkClicked(int x, int y)
Check if any element inside select group was clicked.
Definition: selectgroup.hpp:122