Menu like structure with clickable buttons. Member of GUI classes Graphic group.
More...
#include <Menu.h>
|
cv::Mat | img |
| Image matrix of the menu.
|
|
vector< Button > | buttons |
| Vector holding all buttons.
|
|
Menu like structure with clickable buttons. Member of GUI classes Graphic group.
◆ Menu()
Menu::Menu |
( |
cv::Size |
size | ) |
|
Constructor.
- Parameters
-
size | Height and width of the menu |
18 img = Mat::zeros(size, CV_8UC3);
19 rectangle(
img, Point(0, 0), size, Scalar(182, 182, 182), -1);
◆ addButton()
void Menu::addButton |
( |
cv::Point |
startPoint, |
|
|
int |
height, |
|
|
cv::String |
text |
|
) |
| |
Adds a button to the menu.
calls the Button constructor and pushes it to the button vector
- Parameters
-
startPoint | X and Y coordinate of the topleft corner in pixels |
height | Height of the button in pixels |
text | Button text |
◆ draw()
Draws all buttons to the image.
uses a iterating for loop.
- Returns
- the image matrix
29 vector<Button>::iterator it;
◆ checkClicks()
void Menu::checkClicks |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Checks if a mouse-click event happened inside on of the menubuttons.
- Parameters
-
x | X-part of the mouse event Coordinate |
y | Y-part of the mouse event Coordinate |
40 vector<Button>::iterator it;
◆ getButtons()
vector< Button > * Menu::getButtons |
( |
| ) |
|
Gets the buttons.
- Returns
- Pointer to the vector holding all menu buttons.