aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/stylers/CompoundStylerEditor.h
blob: 57150e83488c86d220d04c80f791dc099be4e80d (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
29
30
#pragma once
#include "StylerEditor.h"
#include "cru/common/ClonablePtr.h"
#include "cru/ui/DeleteLater.h"
#include "cru/ui/components/PopupButton.h"
#include "cru/ui/controls/FlexLayout.h"
#include "cru/ui/style/Styler.h"

namespace cru::theme_builder::components::stylers {
class CompoundStylerEditor : public StylerEditor {
 public:
  CompoundStylerEditor();
  ~CompoundStylerEditor() override;

 public:
  ClonablePtr<ui::style::CompoundStyler> GetValue();
  void SetValue(ui::style::CompoundStyler* styler, bool trigger_change = true);
  void SetValue(const ClonablePtr<ui::style::CompoundStyler>& styler,
                bool trigger_change = true) {
    SetValue(styler.get(), trigger_change);
  }

  ClonablePtr<ui::style::Styler> GetStyler() override { return GetValue(); }

 private:
  ui::controls::FlexLayout children_container_;
  std::vector<ui::DeleteLaterPtr<StylerEditor>> children_;
  ui::components::PopupMenuIconButton add_child_button_;
};
}  // namespace cru::theme_builder::components::stylers