1 #include <Interface/Menu/MenuItemCheckbox.hpp> 2 #include <Config/Globals.hpp> 3 #include <Flow/InputManager.hpp> 5 MenuItemCheckbox::MenuItemCheckbox(std::string label,
int id,
bool initial):
9 this->
type = MenuItem::CHECKBOX;
23 window->
print(((hilite)?
28 Globals::Theme::hilite_text:
29 Globals::Theme::text));
31 window->
print(
"ON", posx - 7, y, ((this->checked) ?
32 Globals::Theme::hilite_text:
33 Globals::Theme::text));
35 window->
print(
"|", posx - 5, y, Globals::Theme::text);
37 window->
print(
"OFF", posx - 4, y, ((this->checked) ?
38 Globals::Theme::text :
39 Globals::Theme::hilite_text));
41 window->
print(((hilite)?
46 Globals::Theme::hilite_text:
47 Globals::Theme::text));
51 if (InputManager::noKeyPressed())
54 if (InputManager::isPressed(
"left") ||
55 InputManager::isPressed(KEY_LEFT))
58 else if (InputManager::isPressed(
"right") ||
59 InputManager::isPressed(KEY_RIGHT))
62 else if (InputManager::isPressed(
' ') ||
63 InputManager::isPressed(
'\n') ||
64 InputManager::isPressed(KEY_ENTER))
67 void MenuItemCheckbox::check(
bool option)
69 this->checked = option;
71 void MenuItemCheckbox::toggle()
73 this->checked = !(this->checked);
75 bool MenuItemCheckbox::isChecked()
A segment of the terminal screen (2D char matrix).
void print(std::string str, int x, int y, ColorPair pair=0)
Shows text #str at #x #y on the window with color #pair.