mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
test sim
Add led
This commit is contained in:
@@ -7,13 +7,15 @@ m_button("button", "Off", Color(Color::White), Color(Color::Red), [this](std::st
|
|||||||
m_combobox("combobox", "Combobox", Color(Color::White), Color(Color::Black), {"Option 1", "Option 2", "Option 3"}, 0, [](std::string id, std::string selected) { spdlog::info("Combobox {} selected {}", id, selected); }),
|
m_combobox("combobox", "Combobox", Color(Color::White), Color(Color::Black), {"Option 1", "Option 2", "Option 3"}, 0, [](std::string id, std::string selected) { spdlog::info("Combobox {} selected {}", id, selected); }),
|
||||||
m_label("label", "Label", Color(Color::White), Color(Color::Black)),
|
m_label("label", "Label", Color(Color::White), Color(Color::Black)),
|
||||||
m_checkbox("checkbox", "Checkbox", Color(Color::White), Color(Color::Black), {"Option 1", "Option 2", "Option 3"}, [](std::string id, std::vector<std::string> selected) { spdlog::info("Checkbox {} selected {}", id, (selected.size() > 0 ? selected[0] : "")); }),
|
m_checkbox("checkbox", "Checkbox", Color(Color::White), Color(Color::Black), {"Option 1", "Option 2", "Option 3"}, [](std::string id, std::vector<std::string> selected) { spdlog::info("Checkbox {} selected {}", id, (selected.size() > 0 ? selected[0] : "")); }),
|
||||||
m_slider("slider", "Slider", Color(Color::White), Color(Color::Black), 0, 100, 50, [](std::string id, double value) { spdlog::info("Slider {} changed to {}", id, value); })
|
m_slider("slider", "Slider", Color(Color::White), Color(Color::Black), 0, 100, 50, [](std::string id, double value) { spdlog::info("Slider {} changed to {}", id, value); }),
|
||||||
|
m_led("led", "Led", Color(Color::White), Color(Color::Black), Color(Color::Red))
|
||||||
{
|
{
|
||||||
this->add_UI_item(&this->m_button);
|
this->add_UI_item(&this->m_button);
|
||||||
this->add_UI_item(&this->m_combobox);
|
this->add_UI_item(&this->m_combobox);
|
||||||
this->add_UI_item(&this->m_label);
|
this->add_UI_item(&this->m_label);
|
||||||
this->add_UI_item(&this->m_checkbox);
|
this->add_UI_item(&this->m_checkbox);
|
||||||
this->add_UI_item(&this->m_slider);
|
this->add_UI_item(&this->m_slider);
|
||||||
|
this->add_UI_item(&this->m_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test_Sim::timer()
|
void Test_Sim::timer()
|
||||||
@@ -34,6 +36,8 @@ void Test_Sim::button_clicked(std::string id)
|
|||||||
bool state = this->m_button.bg_color() == Color(Color::Red) ? true : false;
|
bool state = this->m_button.bg_color() == Color(Color::Red) ? true : false;
|
||||||
this->m_button.set_bg_color(state ? Color(Color::Green) : Color(Color::Red));
|
this->m_button.set_bg_color(state ? Color(Color::Green) : Color(Color::Red));
|
||||||
this->m_button.set_text(state ? "On" : "Off");
|
this->m_button.set_text(state ? "On" : "Off");
|
||||||
|
|
||||||
|
this->m_led.set_led_color(state ? Color(Color::Green) : Color(Color::Red));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ class Test_Sim : public Simulator_base {
|
|||||||
UI_label m_label;
|
UI_label m_label;
|
||||||
UI_checkbox m_checkbox;
|
UI_checkbox m_checkbox;
|
||||||
UI_slider m_slider;
|
UI_slider m_slider;
|
||||||
|
UI_led m_led;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user