aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-24 22:14:37 +0800
committercrupest <crupest@outlook.com>2022-01-24 22:14:37 +0800
commit24e1dc8723aea1e46a3aa15794747f3fa52f8eca (patch)
tree0c879b38647307d25325eb8f9993a7f690fb46b2 /include
parent72402c09d45b696cd58a65b4a141a804e1cd9371 (diff)
downloadcru-24e1dc8723aea1e46a3aa15794747f3fa52f8eca.tar.gz
cru-24e1dc8723aea1e46a3aa15794747f3fa52f8eca.tar.bz2
cru-24e1dc8723aea1e46a3aa15794747f3fa52f8eca.zip
...
Diffstat (limited to 'include')
-rw-r--r--include/cru/common/io/FileStream.hpp8
-rw-r--r--include/cru/ui/UiManager.hpp7
-rw-r--r--include/cru/ui/mapper/style/ClickStateConditionMapper.hpp2
-rw-r--r--include/cru/ui/mapper/style/HoverConditionMapper.hpp26
-rw-r--r--include/cru/xml/XmlNode.hpp2
5 files changed, 41 insertions, 4 deletions
diff --git a/include/cru/common/io/FileStream.hpp b/include/cru/common/io/FileStream.hpp
new file mode 100644
index 00000000..da7849cd
--- /dev/null
+++ b/include/cru/common/io/FileStream.hpp
@@ -0,0 +1,8 @@
+#pragma once
+
+#ifdef CRU_PLATFORM_UNIX
+#include "UnixFileStream.hpp"
+namespace cru::io {
+using FileStream = UnixFileStream;
+}
+#endif
diff --git a/include/cru/ui/UiManager.hpp b/include/cru/ui/UiManager.hpp
index 4a2a7a77..d16adc4f 100644
--- a/include/cru/ui/UiManager.hpp
+++ b/include/cru/ui/UiManager.hpp
@@ -19,9 +19,8 @@ struct ThemeResources {
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;
+ std::shared_ptr<style::StyleRuleSet> button_style;
+ std::shared_ptr<style::StyleRuleSet> text_box_style;
style::StyleRuleSet menu_item_style;
};
@@ -42,6 +41,8 @@ class CRU_UI_API UiManager : public Object {
ThemeResources* GetThemeResources() { return &theme_resource_; }
+ void ReadResourcesFile(const String& file_path);
+
private:
ThemeResources theme_resource_;
};
diff --git a/include/cru/ui/mapper/style/ClickStateConditionMapper.hpp b/include/cru/ui/mapper/style/ClickStateConditionMapper.hpp
index 2fea5353..63577641 100644
--- a/include/cru/ui/mapper/style/ClickStateConditionMapper.hpp
+++ b/include/cru/ui/mapper/style/ClickStateConditionMapper.hpp
@@ -6,7 +6,7 @@
namespace cru::ui::mapper::style {
class CRU_UI_API ClickStateConditionMapper
: public BasicPtrMapper<ui::style::ClickStateCondition>,
- public IConditionMapper {
+ public virtual IConditionMapper {
public:
CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(ClickStateConditionMapper)
diff --git a/include/cru/ui/mapper/style/HoverConditionMapper.hpp b/include/cru/ui/mapper/style/HoverConditionMapper.hpp
new file mode 100644
index 00000000..bbd840f0
--- /dev/null
+++ b/include/cru/ui/mapper/style/HoverConditionMapper.hpp
@@ -0,0 +1,26 @@
+#pragma once
+#include "../Mapper.hpp"
+#include "IConditionMapper.hpp"
+#include "cru/ui/style/Condition.hpp"
+
+namespace cru::ui::mapper::style {
+class CRU_UI_API HoverConditionMapper
+ : public BasicPtrMapper<ui::style::HoverCondition>,
+ public virtual IConditionMapper {
+ public:
+ CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(HoverConditionMapper)
+
+ public:
+ bool SupportMapFromXml() override { return true; }
+ bool XmlElementIsOfThisType(xml::XmlElementNode* node) override;
+
+ ClonablePtr<ui::style::Condition> MapConditionFromXml(
+ xml::XmlElementNode* node) override {
+ return MapFromXml(node);
+ }
+
+ protected:
+ ClonablePtr<ui::style::HoverCondition> DoMapFromXml(
+ xml::XmlElementNode* node) override;
+};
+} // namespace cru::ui::mapper::style
diff --git a/include/cru/xml/XmlNode.hpp b/include/cru/xml/XmlNode.hpp
index c9e538c0..f308c9de 100644
--- a/include/cru/xml/XmlNode.hpp
+++ b/include/cru/xml/XmlNode.hpp
@@ -118,6 +118,8 @@ class CRU_XML_API XmlElementNode : public XmlNode {
void AddAttribute(String key, String value);
void AddChild(XmlNode* child);
+ XmlElementNode* GetFirstChildElement() const;
+
XmlNode* Clone() const override;
private: