-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathButton.cpp
More file actions
49 lines (43 loc) · 993 Bytes
/
Button.cpp
File metadata and controls
49 lines (43 loc) · 993 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
46
47
48
49
#include "Button.h"
#include <iostream>
#include "Menu.h"
Button::Button(std::string text, int status)
{
this->text = text;
this->status = status;
}
void Button::Print()
{
std::cout << this->text;
if (status != -1) {
std::cout << " [";
if (status == 0)
std::cout << ansi::foreground_red << "OFF";
else if (status == 1) {
std::cout << ansi::foreground_yellow << "LOADING";
}
else if (status == 2)
std::cout << ansi::foreground_green << "ON";
std::cout << ansi::reset << "]";
}
std::cout << std::endl;
}
void Button::UpdateStatus()
{
if (this->status == 2)
this->status = 0;
else if (this->status == 0) {
this->status = 1;
}
else if (this->status == 1)
this->status = 2;
}
void Button::UpdateStatus(int status)
{
this->status = status;
}
void Button::UpdateStatus(bool status)
{
int iStatus = status ? 2 : 0;
this->status = iStatus;
}