-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgramBox.h
More file actions
51 lines (39 loc) · 1.42 KB
/
ProgramBox.h
File metadata and controls
51 lines (39 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef PROGRAMBOX_H
#define PROGRAMBOX_H
#include "Utils.h"
#include "Button.h"
#include <SFML/Graphics.hpp>
#include <vector>
#include <string>
class ProgramBox
{
private:
// The container with all the buttons (actions)
std::vector<Button*> m_actions;
// This rectangle is used to draw the program box
sf::RectangleShape m_rect;
// Program box name to draw
sf::Font m_font;
sf::Text m_text;
// Type of the prog (main, p1, p2)
Utils::TypeProg m_type_prog;
public:
ProgramBox(const sf::Vector2f &pos, const sf::Vector2f &size, const sf::Color &fill_color, const sf::Color &outline_color, const int &outline_size, const std::string &prog_name, const Utils::TypeProg &type_prog);
~ProgramBox();
// Actions (add / remove actions in the programbox)
void addAction(Button *button);
void addAction(Button *button, const unsigned int &row);
void deleteAction(const unsigned int &row);
void clearActions();
// Calculate the new position of a new action in the program box (-1;1) if there is no more place
sf::Vector2f calculateNewPosition() const;
// Returns true if the pos is in the programbox
bool overBox(const sf::Vector2i &pos) const;
/* GETTERS */
std::vector<Button *> getActions() const;
std::string getName() const;
Utils::TypeProg getType() const;
// Drawing method
void drawProgBox(sf::RenderWindow &window);
};
#endif // PROGRAM_H