aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/conditions/CompoundConditonEditor.cpp
blob: 812c27dc43b38333755b01c0ef730321b917e72a (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
#include "CompoundConditionEditor.h"

namespace cru::theme_builder::components::conditions {
CompoundConditionEditorChild::CompoundConditionEditorChild(
    std::unique_ptr<ConditionEditor>&& condition_editor)
    : condition_editor_(std::move(condition_editor)) {
  container_.SetFlexDirection(ui::controls::FlexDirection::Horizontal);
  container_.AddChild(&remove_button_);

  remove_button_.SetChild(&remove_button_text_);
  remove_button_text_.SetText(u"-");

  container_.AddChild(condition_editor_->GetRootControl());

  remove_button_.ClickEvent()->AddSpyOnlyHandler(
      [this] { this->remove_event_.Raise(nullptr); });
}

CompoundConditionEditor::CompoundConditionEditor() {
  GetContainer()->AddChild(&children_container_);
  GetContainer()->AddChild(&add_child_button_);

  add_child_button_.SetChild(&add_child_button_text_);
  add_child_button_text_.SetText(u"+");
}

CompoundConditionEditor::~CompoundConditionEditor() {}

}  // namespace cru::theme_builder::components::conditions