From 65e288c40a593965b41378755f7111c56e123295 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 26 Feb 2022 19:46:37 +0800 Subject: ... --- include/cru/ui/ThemeResourceDictionary.h | 11 +++++++++-- include/cru/ui/controls/Container.h | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/cru/ui/ThemeResourceDictionary.h b/include/cru/ui/ThemeResourceDictionary.h index 26f7ec8d..a303b466 100644 --- a/include/cru/ui/ThemeResourceDictionary.h +++ b/include/cru/ui/ThemeResourceDictionary.h @@ -7,6 +7,7 @@ #include "style/StyleRuleSet.h" #include +#include #include #include @@ -25,9 +26,15 @@ class CRU_UI_API ThemeResourceDictionary : public Object { CRU_DEFINE_CLASS_LOG_TAG(u"ThemeResources"); public: - static std::unique_ptr FromFile(const String& file_path); + static std::unique_ptr FromFile( + const String& file_path); + static std::unique_ptr FromFile( + std::filesystem::path file_path) { + return FromFile(String::FromStdPath(file_path)); + } - explicit ThemeResourceDictionary(xml::XmlElementNode* xml_root, bool clone = true); + explicit ThemeResourceDictionary(xml::XmlElementNode* xml_root, + bool clone = true); CRU_DELETE_COPY(ThemeResourceDictionary) CRU_DELETE_MOVE(ThemeResourceDictionary) diff --git a/include/cru/ui/controls/Container.h b/include/cru/ui/controls/Container.h index 98958b3b..c8bf3f32 100644 --- a/include/cru/ui/controls/Container.h +++ b/include/cru/ui/controls/Container.h @@ -2,10 +2,12 @@ #include "SingleChildControl.h" #include "../render/BorderRenderObject.h" +#include "IBorderControl.h" namespace cru::ui::controls { class CRU_UI_API Container - : public SingleChildControl { + : public SingleChildControl, + public virtual IBorderControl { static constexpr StringView kControlType = u"Container"; public: @@ -16,6 +18,13 @@ class CRU_UI_API Container ~Container() override; public: + bool IsBorderEnabled() const { + return GetContainerRenderObject()->IsBorderEnabled(); + } + void SetBorderEnabled(bool enabled) { + GetContainerRenderObject()->SetBorderEnabled(enabled); + } + std::shared_ptr GetForegroundBrush() const { return GetContainerRenderObject()->GetForegroundBrush(); } @@ -32,6 +41,10 @@ class CRU_UI_API Container GetContainerRenderObject()->SetBackgroundBrush(brush); } + void ApplyBorderStyle(const style::ApplyBorderStyleInfo& style) override { + GetContainerRenderObject()->ApplyBorderStyle(style); + } + public: String GetControlType() const final { return kControlType.ToString(); } }; -- cgit v1.2.3