improve button enum

This commit is contained in:
hippoz 2022-10-01 17:08:15 +03:00
parent a4e5d47690
commit 407a86de79
No known key found for this signature in database
GPG key ID: 7C52899193467641
2 changed files with 3 additions and 3 deletions

View file

@ -11,7 +11,7 @@ namespace Raven {
class Button : public Widget { class Button : public Widget {
public: public:
enum class ButtonType { enum ButtonType {
Flat, Flat,
Accent Accent
}; };

View file

@ -34,14 +34,14 @@ int main() {
container_widget_layout->set_margin(24.0); container_widget_layout->set_margin(24.0);
container_widget_layout->set_spacing(8.0); container_widget_layout->set_spacing(8.0);
auto new_button = top_bar->add<Raven::Button>("add", Raven::Button::ButtonType::Accent); auto new_button = top_bar->add<Raven::Button>("add", Raven::Button::Accent);
new_button->on_click = [&window, container_widget]() { new_button->on_click = [&window, container_widget]() {
window.queue_microtask([container_widget]() { window.queue_microtask([container_widget]() {
container_widget->add<Raven::Button>("hello"); container_widget->add<Raven::Button>("hello");
}); });
}; };
auto remove_button = top_bar->add<Raven::Button>("remove", Raven::Button::ButtonType::Flat); auto remove_button = top_bar->add<Raven::Button>("remove", Raven::Button::Flat);
remove_button->on_click = [container_widget]() { remove_button->on_click = [container_widget]() {
container_widget->clear_children(); container_widget->clear_children();
}; };