blob: e343727f53339a2b024db3015d31ffbc67181bcf (
plain)
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
|
#pragma once
#include "cru/ui/components/Component.h"
#include "cru/ui/controls/CheckBox.h"
#include "cru/ui/controls/FlexLayout.h"
namespace cru::theme_builder::components::properties {
template <typename TEditor>
class OptionalPropertyEditor : public ui::components::Component {
public:
OptionalPropertyEditor() {
container_.AddChild(&check_box_);
container_.AddChild(editor_->GetRootControl());
}
~OptionalPropertyEditor() override { container_.RemoveFromParent(); }
ui::controls::Control* GetRootControl() override { return &container_; }
bool IsEnabled() const { return check_box_.IsChecked(); }
void SetEnabled(bool enabled) { check_box_.SetChecked(enabled); }
TEditor* GetEditor() { return &editor_; }
private:
ui::controls::FlexLayout container_;
ui::controls::CheckBox check_box_;
TEditor editor_;
};
} // namespace cru::theme_builder::components::properties
|