aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/cru/platform/Color.hpp11
-rw-r--r--include/cru/ui/ThemeManager.hpp17
-rw-r--r--include/cru/ui/UiManager.hpp2
-rw-r--r--include/cru/ui/controls/RootControl.hpp3
4 files changed, 19 insertions, 14 deletions
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 <boost/functional/hash.hpp>
-
#include <cstdint>
#include <optional>
#include <string_view>
@@ -243,10 +242,10 @@ template <>
struct std::hash<cru::platform::Color> {
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 <boost/property_tree/ptree.hpp>
-#include <cstddef>
-#include <memory>
-#include <stdexcept>
-#include <string_view>
#include <unordered_map>
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<std::nullptr_t> theme_resource_change_event_;
- boost::property_tree::ptree theme_tree_;
+ std::unordered_map<String, String> theme_resource_map_;
std::unordered_map<String, std::shared_ptr<platform::graphics::IBrush>>
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<platform::graphics::IBrush> text_brush;
std::shared_ptr<platform::graphics::IBrush> text_selection_brush;
std::shared_ptr<platform::graphics::IBrush> 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);