-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckBox.cpp
More file actions
45 lines (39 loc) · 834 Bytes
/
CheckBox.cpp
File metadata and controls
45 lines (39 loc) · 834 Bytes
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
#include "CheckBox.h"
void CheckBox::setState(bool state)
{
if (this->state != state) {
if (state) {
this->setTexture(&this->checked);
}
else {
this->setTexture(&this->unchecked);
}
this->state = state;
}
}
void CheckBox::swtitchState()
{
this->state = !this->state;
if (state) {
this->setTexture(&this->checked);
}
else {
this->setTexture(&this->unchecked);
}
}
CheckBox::CheckBox(short int length, Vector2f position, Texture& unchecked, Texture& checked)
:checked(checked)
,unchecked(unchecked)
,RectangleShape(Vector2f(length, length))
{
checked.setSmooth(true);
unchecked.setSmooth(true);
this->checked.setSmooth(true);
this->unchecked.setSmooth(true);
this->setTexture(&this->unchecked);
setPosition(position);
}
CheckBox::CheckBox()
{
this->setTexture(&this->unchecked);
}