From ff6cb3b468a0d4caf87c2291818d24e0a6d12b39 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 30 Nov 2021 15:26:16 +0800 Subject: ... --- include/cru/platform/Color.hpp | 11 +++++------ include/cru/ui/ThemeManager.hpp | 17 +++++++++-------- include/cru/ui/UiManager.hpp | 2 ++ include/cru/ui/controls/RootControl.hpp | 3 +++ 4 files changed, 19 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/cru/platform/Color.hpp b/include/cru/platform/Color.hpp index f60ab692..94c6c485 100644 --- a/include/cru/platform/Color.hpp +++ b/include/cru/platform/Color.hpp @@ -1,10 +1,9 @@ #pragma once +#include "cru/common/Base.hpp" #include "cru/platform/Base.hpp" #include "cru/common/String.hpp" -#include - #include #include #include @@ -243,10 +242,10 @@ template <> struct std::hash { std::size_t operator()(const cru::platform::Color& color) const { std::size_t seed = 0; - boost::hash_combine(seed, color.red); - boost::hash_combine(seed, color.green); - boost::hash_combine(seed, color.blue); - boost::hash_combine(seed, color.alpha); + cru::hash_combine(seed, color.red); + cru::hash_combine(seed, color.green); + cru::hash_combine(seed, color.blue); + cru::hash_combine(seed, color.alpha); return seed; } }; diff --git a/include/cru/ui/ThemeManager.hpp b/include/cru/ui/ThemeManager.hpp index 9908658c..45cd810c 100644 --- a/include/cru/ui/ThemeManager.hpp +++ b/include/cru/ui/ThemeManager.hpp @@ -2,19 +2,20 @@ #include "Base.hpp" #include "cru/common/Base.hpp" #include "cru/common/Event.hpp" +#include "cru/common/Exception.hpp" #include "cru/platform/graphics/Brush.hpp" -#include -#include -#include -#include -#include #include namespace cru::ui { -class BadThemeResourceException : public std::runtime_error { +class ThemeResourceKeyNotExistException : public Exception { public: - using std::runtime_error::runtime_error; + using Exception::Exception; +}; + +class BadThemeResourceException : public Exception { + public: + using Exception::Exception; }; class ThemeManager : public Object { @@ -42,7 +43,7 @@ class ThemeManager : public Object { private: Event theme_resource_change_event_; - boost::property_tree::ptree theme_tree_; + std::unordered_map theme_resource_map_; std::unordered_map> brushes_; }; diff --git a/include/cru/ui/UiManager.hpp b/include/cru/ui/UiManager.hpp index 6b1083b2..e617dea8 100644 --- a/include/cru/ui/UiManager.hpp +++ b/include/cru/ui/UiManager.hpp @@ -18,7 +18,9 @@ struct ThemeResources { std::shared_ptr text_brush; std::shared_ptr text_selection_brush; std::shared_ptr caret_brush; + style::StyleRuleSet button_style; + style::StyleRuleSet text_box_style; style::StyleRuleSet menu_item_style; diff --git a/include/cru/ui/controls/RootControl.hpp b/include/cru/ui/controls/RootControl.hpp index 823b9f03..c3f3da9f 100644 --- a/include/cru/ui/controls/RootControl.hpp +++ b/include/cru/ui/controls/RootControl.hpp @@ -4,6 +4,7 @@ #include "cru/common/Base.hpp" #include "cru/common/Event.hpp" #include "cru/platform/gui/Base.hpp" +#include "cru/platform/gui/Window.hpp" #include "cru/ui/Base.hpp" #include "cru/ui/host/WindowHost.hpp" @@ -20,6 +21,8 @@ class RootControl : public LayoutControl { public: render::RenderObject* GetRenderObject() const override; + platform::gui::INativeWindow* GetNativeWindow(); + protected: void SetGainFocusOnCreateAndDestroyWhenLoseFocus(bool value); -- cgit v1.2.3