diff options
Diffstat (limited to 'src/theme_builder/components/properties/OptionalPropertyEditor.h')
-rw-r--r-- | src/theme_builder/components/properties/OptionalPropertyEditor.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/theme_builder/components/properties/OptionalPropertyEditor.h b/src/theme_builder/components/properties/OptionalPropertyEditor.h index 4467d4de..d7362d50 100644 --- a/src/theme_builder/components/properties/OptionalPropertyEditor.h +++ b/src/theme_builder/components/properties/OptionalPropertyEditor.h @@ -1,5 +1,5 @@ #pragma once -#include "cru/ui/components/Component.h" +#include "../Editor.h" #include "cru/ui/controls/CheckBox.h" #include "cru/ui/controls/FlexLayout.h" @@ -7,7 +7,7 @@ namespace cru::theme_builder::components::properties { template <typename TEditor> -class OptionalPropertyEditor : public ui::components::Component { +class OptionalPropertyEditor : public Editor { public: using PropertyType = typename TEditor::PropertyType; @@ -17,7 +17,7 @@ class OptionalPropertyEditor : public ui::components::Component { editor_.ChangeEvent()->AddHandler([this](std::nullptr_t) { if (IsEnabled()) { - change_event_.Raise(nullptr); + RaiseChangeEvent(); } }); } @@ -29,7 +29,7 @@ class OptionalPropertyEditor : public ui::components::Component { void SetEnabled(bool enabled, bool trigger_change = true) { check_box_.SetChecked(enabled); if (trigger_change) { - change_event_.Raise(nullptr); + RaiseChangeEvent(); } } @@ -42,7 +42,7 @@ class OptionalPropertyEditor : public ui::components::Component { if (value) { SetEnabled(true, false); editor_.SetValue(*value, false); - if (trigger_change) change_event_.Raise(nullptr); + if (trigger_change) RaiseChangeEvent(); } else { SetEnabled(false, trigger_change); } @@ -50,13 +50,9 @@ class OptionalPropertyEditor : public ui::components::Component { TEditor* GetEditor() { return &editor_; } - IEvent<std::nullptr_t>* ChangeEvent() { return &change_event_; } - private: ui::controls::FlexLayout container_; ui::controls::CheckBox check_box_; TEditor editor_; - - Event<std::nullptr_t> change_event_; }; } // namespace cru::theme_builder::components::properties |