aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/stylers/MarginStylerEditor.cpp
blob: d7d89acbc6335dfe90e8f2bc0edec286a0b85066 (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
#include "MarginStylerEditor.h"
#include "cru/ui/style/Styler.h"

namespace cru::theme_builder::components::stylers {
MarginStylerEditor::MarginStylerEditor() {
  SetLabel(u"Margin Styler");
  GetContainer()->AddChild(thickness_editor_.GetRootControl());

  thickness_editor_.SetLabel(u"Thickness");

  ConnectChangeEvent(thickness_editor_);
}

MarginStylerEditor::~MarginStylerEditor() {}

ClonablePtr<ui::style::MarginStyler> MarginStylerEditor::GetValue() {
  return ui::style::MarginStyler::Create(thickness_editor_.GetValue());
}

void MarginStylerEditor::SetValue(ui::style::MarginStyler* styler,
                                  bool trigger_change) {
  thickness_editor_.SetValue(styler->GetMargin(), false);

  if (trigger_change) {
    RaiseChangeEvent();
  }
}
}  // namespace cru::theme_builder::components::stylers