aboutsummaryrefslogtreecommitdiff
path: root/src/ui/ui_manager.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-05-24 01:40:02 +0800
committercrupest <crupest@outlook.com>2020-05-24 01:40:02 +0800
commitd86a71f79afe0e4dac768f61d6bff690567aca5b (patch)
tree4957e9a64c77680deb07201fbd879bf036616dae /src/ui/ui_manager.cpp
parentf3a8fd608a9776ef0a5f547da918a32cf6074060 (diff)
downloadcru-d86a71f79afe0e4dac768f61d6bff690567aca5b.tar.gz
cru-d86a71f79afe0e4dac768f61d6bff690567aca5b.tar.bz2
cru-d86a71f79afe0e4dac768f61d6bff690567aca5b.zip
...
Diffstat (limited to 'src/ui/ui_manager.cpp')
-rw-r--r--src/ui/ui_manager.cpp81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/ui/ui_manager.cpp b/src/ui/ui_manager.cpp
deleted file mode 100644
index 905d29ad..00000000
--- a/src/ui/ui_manager.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#include "cru/ui/ui_manager.hpp"
-
-#include "cru/platform/graph/brush.hpp"
-#include "cru/platform/graph/factory.hpp"
-#include "cru/platform/graph/font.hpp"
-#include "cru/platform/native/ui_application.hpp"
-#include "helper.hpp"
-
-namespace cru::ui {
-using namespace cru::platform::graph;
-
-namespace {
-std::unique_ptr<ISolidColorBrush> CreateSolidColorBrush(IGraphFactory* factory,
- const Color& color) {
- auto brush = factory->CreateSolidColorBrush();
- brush->SetColor(color);
- return brush;
-}
-} // namespace
-
-UiManager* UiManager::GetInstance() {
- static UiManager* instance = new UiManager();
- GetUiApplication()->AddOnQuitHandler([] {
- delete instance;
- instance = nullptr;
- });
- return instance;
-}
-
-UiManager::UiManager() {
- const auto factory = GetGraphFactory();
-
- theme_resource_.default_font = factory->CreateFont("等线", 24.0f);
-
- const auto black_brush = std::shared_ptr<platform::graph::ISolidColorBrush>(
- CreateSolidColorBrush(factory, colors::black));
- theme_resource_.text_brush = black_brush;
- theme_resource_.text_selection_brush =
- CreateSolidColorBrush(factory, colors::skyblue);
- theme_resource_.caret_brush = black_brush;
-
- theme_resource_.button_style.normal.border_brush =
- CreateSolidColorBrush(factory, Color::FromHex(0x00bfff));
- theme_resource_.button_style.hover.border_brush =
- CreateSolidColorBrush(factory, Color::FromHex(0x47d1ff));
- theme_resource_.button_style.press.border_brush =
- CreateSolidColorBrush(factory, Color::FromHex(0x91e4ff));
- theme_resource_.button_style.press_cancel.border_brush =
- CreateSolidColorBrush(factory, Color::FromHex(0x91e4ff));
-
- theme_resource_.button_style.normal.border_thickness =
- theme_resource_.button_style.hover.border_thickness =
- theme_resource_.button_style.press.border_thickness =
- theme_resource_.button_style.press_cancel.border_thickness =
- Thickness(3);
-
- theme_resource_.button_style.normal.border_radius =
- theme_resource_.button_style.hover.border_radius =
- theme_resource_.button_style.press.border_radius =
- theme_resource_.button_style.press_cancel.border_radius =
- CornerRadius({5, 5});
-
- theme_resource_.text_box_border_style.normal.border_brush =
- CreateSolidColorBrush(factory, Color::FromHex(0xced4da));
- theme_resource_.text_box_border_style.normal.border_radius = CornerRadius(5);
- theme_resource_.text_box_border_style.normal.border_thickness = Thickness(1);
-
- theme_resource_.text_box_border_style.hover =
- theme_resource_.text_box_border_style.normal;
-
- theme_resource_.text_box_border_style.normal.border_brush =
- CreateSolidColorBrush(factory, Color::FromHex(0x495057));
- theme_resource_.text_box_border_style.normal.border_radius = CornerRadius(5);
- theme_resource_.text_box_border_style.normal.border_thickness = Thickness(1);
-
- theme_resource_.text_box_border_style.focus_hover =
- theme_resource_.text_box_border_style.focus;
-}
-
-UiManager::~UiManager() = default;
-} // namespace cru::ui