-
Notifications
You must be signed in to change notification settings - Fork 0
/
AbstractModule.cpp
46 lines (36 loc) · 1 KB
/
AbstractModule.cpp
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
#include "AbstractModule.h"
AbstractModule::AbstractModule(std::string modName, Category modCategory) : name(modName), category(modCategory), i_toggle(false) {}
std::string AbstractModule::getName() {
return this->name;
}
bool AbstractModule::getToggle() {
return this->i_toggle;
}
void AbstractModule::setToggle(bool _New) {
if (_New == this->i_toggle) return;
this->i_toggle = _New;
this->onToggled();
}
void AbstractModule::enable() {
this->setToggle(true);
}
void AbstractModule::disable() {
this->setToggle(false);
}
Category AbstractModule::getCategory() {
return this->category;
}
void AbstractModule::toggle() {
this->i_toggle = !this->i_toggle;
this->onToggled();
}
void AbstractModule::onToggled() {
if (this->i_toggle) {
onEnabled();
NotificationManager::getInstance().makeNotification(this->getName() + std::string(" Enabled."), Type::SUCCESS);
}
else {
onDisabled();
NotificationManager::getInstance().makeNotification(this->getName() + std::string(" Disabled."), Type::SUCCESS);
}
}