aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui')
-rw-r--r--include/cru/ui/ThemeManager.hpp2
-rw-r--r--include/cru/ui/UiManager.hpp44
-rw-r--r--include/cru/ui/mapper/FontMapper.hpp19
3 files changed, 21 insertions, 44 deletions
diff --git a/include/cru/ui/ThemeManager.hpp b/include/cru/ui/ThemeManager.hpp
index 7d52fa48..be9daa47 100644
--- a/include/cru/ui/ThemeManager.hpp
+++ b/include/cru/ui/ThemeManager.hpp
@@ -56,6 +56,8 @@ class CRU_UI_API ThemeManager : public Object {
std::shared_ptr<platform::graphics::IBrush> GetResourceBrush(
const String& key);
+ std::shared_ptr<platform::graphics::IFont> GetResourceFont(const String& key);
+
std::shared_ptr<style::StyleRuleSet> GetResourceStyleRuleSet(
const String& key);
diff --git a/include/cru/ui/UiManager.hpp b/include/cru/ui/UiManager.hpp
deleted file mode 100644
index 9ac7f416..00000000
--- a/include/cru/ui/UiManager.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#pragma once
-#include "Base.hpp"
-
-#include "controls/Base.hpp"
-#include "cru/platform/graphics/Brush.hpp"
-#include "cru/ui/helper/ClickDetector.hpp"
-#include "style/StyleRuleSet.hpp"
-
-#include <gsl/pointers>
-#include <memory>
-#include <string>
-#include <unordered_map>
-
-namespace cru::ui {
-struct ThemeResources {
- String default_font_family;
- std::shared_ptr<platform::graphics::IFont> default_font;
- 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;
-};
-
-class CRU_UI_API UiManager : public Object {
- public:
- static UiManager* GetInstance();
-
- private:
- UiManager();
-
- public:
- UiManager(const UiManager& other) = delete;
- UiManager(UiManager&& other) = delete;
- UiManager& operator=(const UiManager& other) = delete;
- UiManager& operator=(UiManager&& other) = delete;
- ~UiManager() override;
-
- ThemeResources* GetThemeResources() { return &theme_resource_; }
-
- void ReadResourcesFile(const String& file_path);
-
- private:
- ThemeResources theme_resource_;
-};
-} // namespace cru::ui
diff --git a/include/cru/ui/mapper/FontMapper.hpp b/include/cru/ui/mapper/FontMapper.hpp
new file mode 100644
index 00000000..ad8c43b5
--- /dev/null
+++ b/include/cru/ui/mapper/FontMapper.hpp
@@ -0,0 +1,19 @@
+#pragma once
+#include "Mapper.hpp"
+#include "cru/common/Base.hpp"
+#include "cru/platform/graphics/Font.hpp"
+
+namespace cru::ui::mapper {
+class FontMapper : public BasicRefMapper<platform::graphics::IFont> {
+ public:
+ CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(FontMapper)
+
+ public:
+ bool SupportMapFromXml() override { return true; }
+ bool XmlElementIsOfThisType(xml::XmlElementNode* node) override;
+
+ protected:
+ std::shared_ptr<platform::graphics::IFont> DoMapFromXml(
+ xml::XmlElementNode* node) override;
+};
+} // namespace cru::ui::mapper