aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/properties/FontPropertyEditor.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-05-15 14:15:31 +0800
committercrupest <crupest@outlook.com>2022-05-15 14:15:31 +0800
commit34a64e6ffefaab007578932ddbab931a25f1d56e (patch)
tree541fdb8279e829a129df62288d09916bf23c9200 /src/theme_builder/components/properties/FontPropertyEditor.cpp
parent8ad2966933957ac5d6ff8dcd5e732736fd5e4dc6 (diff)
downloadcru-34a64e6ffefaab007578932ddbab931a25f1d56e.tar.gz
cru-34a64e6ffefaab007578932ddbab931a25f1d56e.tar.bz2
cru-34a64e6ffefaab007578932ddbab931a25f1d56e.zip
...
Diffstat (limited to 'src/theme_builder/components/properties/FontPropertyEditor.cpp')
-rw-r--r--src/theme_builder/components/properties/FontPropertyEditor.cpp60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/theme_builder/components/properties/FontPropertyEditor.cpp b/src/theme_builder/components/properties/FontPropertyEditor.cpp
deleted file mode 100644
index 927ada7d..00000000
--- a/src/theme_builder/components/properties/FontPropertyEditor.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "FontPropertyEditor.h"
-#include "cru/platform/graphics/Factory.h"
-#include "cru/platform/graphics/Font.h"
-#include "cru/platform/gui/UiApplication.h"
-#include "cru/ui/controls/FlexLayout.h"
-#include "cru/ui/render/FlexLayoutRenderObject.h"
-
-namespace cru::theme_builder::components::properties {
-using namespace cru::ui::controls;
-
-FontPropertyEditor::FontPropertyEditor() {
- main_container_.SetFlexDirection(FlexDirection::Horizontal);
- main_container_.AddChild(&label_);
- main_container_.AddChild(&right_container_);
-
- right_container_.SetFlexDirection(FlexDirection::Vertical);
- right_container_.AddChild(&font_family_container_);
- right_container_.AddChild(&font_size_container_);
-
- font_family_container_.SetFlexDirection(FlexDirection::Horizontal);
- font_family_container_.AddChild(&font_family_label_);
- font_family_container_.AddChild(&font_family_text_);
- font_family_label_.SetText(u"Font Family");
-
- font_size_container_.SetFlexDirection(FlexDirection::Horizontal);
- font_size_container_.AddChild(&font_size_label_);
- font_size_container_.AddChild(font_size_input_.GetRootControl());
- font_size_label_.SetText(u"Font Size");
- font_size_input_.SetMin(0.0f);
-
- font_family_text_.TextChangeEvent()->AddSpyOnlyHandler(
- [this] { RaiseChangeEvent(); });
-
- font_size_input_.ChangeEvent()->AddSpyOnlyHandler(
- [this] { RaiseChangeEvent(); });
-}
-
-FontPropertyEditor::~FontPropertyEditor() {}
-
-Control* FontPropertyEditor::GetRootControl() { return &main_container_; }
-
-std::shared_ptr<platform::graphics::IFont> FontPropertyEditor::GetValue()
- const {
- return platform::gui::IUiApplication::GetInstance()
- ->GetGraphicsFactory()
- ->CreateFont(font_family_text_.GetText(), font_size_input_.GetValue());
-}
-
-void FontPropertyEditor::SetValue(
- std::shared_ptr<platform::graphics::IFont> value, bool trigger_change) {
- SuppressNextChangeEvent();
- font_family_text_.SetText(value->GetFontName());
- SuppressNextChangeEvent();
- font_size_input_.SetValue(value->GetFontSize());
-
- if (trigger_change) {
- RaiseChangeEvent();
- }
-}
-} // namespace cru::theme_builder::components::properties