aboutsummaryrefslogtreecommitdiff
path: root/src/ThemeBuilder/components/properties/ThicknessPropertyEditor.h
blob: 106e0e9ef4a437a4d7e35adfd566fb20cac7db12 (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
#pragma once
#include "../Editor.h"
#include "../LabeledMixin.h"
#include "cru/ui/controls/FlexLayout.h"
#include "cru/ui/controls/TextBox.h"

namespace cru::theme_builder::components::properties {
class ThicknessPropertyEditor : public Editor, public LabeledMixin {
 public:
  using PropertyType = ui::Thickness;

  ThicknessPropertyEditor();
  ~ThicknessPropertyEditor() override;

  ui::controls::Control* GetRootControl() override { return &container_; }

  ui::Thickness GetValue() { return thickness_; }
  void SetValue(const ui::Thickness& thickness, bool trigger_change = true);

 private:
  ui::Thickness thickness_;

  ui::controls::FlexLayout container_;
  ui::controls::TextBox text_;
  bool is_text_valid_;
};
}  // namespace cru::theme_builder::components::properties