diff options
author | crupest <crupest@outlook.com> | 2019-06-27 00:18:48 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-06-27 00:18:48 +0800 |
commit | baa7cf141b8121473edceae16c1a20a6d47bd202 (patch) | |
tree | 9349633a9d0bc286fe29f480bd70e4c2ad1f3075 /include/cru/platform/graph/text_layout.hpp | |
parent | f404a3b2eb7bb9865d0c6f938538899996a53d8c (diff) | |
download | cru-baa7cf141b8121473edceae16c1a20a6d47bd202.tar.gz cru-baa7cf141b8121473edceae16c1a20a6d47bd202.tar.bz2 cru-baa7cf141b8121473edceae16c1a20a6d47bd202.zip |
......
Diffstat (limited to 'include/cru/platform/graph/text_layout.hpp')
-rw-r--r-- | include/cru/platform/graph/text_layout.hpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/include/cru/platform/graph/text_layout.hpp b/include/cru/platform/graph/text_layout.hpp index 894c1408..56943098 100644 --- a/include/cru/platform/graph/text_layout.hpp +++ b/include/cru/platform/graph/text_layout.hpp @@ -1,24 +1,38 @@ #pragma once -#include "cru/common/base.hpp" - -#include "cru/common/ui_base.hpp" +#include "../graphic_base.hpp" +#include "../native_resource.hpp" #include <memory> #include <string> #include <vector> namespace cru::platform::graph { -struct IFontDescriptor; +class Font; + +class TextLayout : public NativeResource { + protected: + TextLayout() = default; + + public: + TextLayout(const TextLayout& other) = delete; + TextLayout& operator=(const TextLayout& other) = delete; + + TextLayout(TextLayout&& other) = delete; + TextLayout& operator=(TextLayout&& other) = delete; -struct ITextLayout : virtual Interface { + ~TextLayout() override = default; + + public: virtual std::wstring GetText() = 0; virtual void SetText(std::wstring new_text) = 0; - virtual std::shared_ptr<IFontDescriptor> GetFont() = 0; - virtual void SetFont(std::shared_ptr<IFontDescriptor> font) = 0; + + virtual std::shared_ptr<Font> GetFont() = 0; + virtual void SetFont(std::shared_ptr<Font> font) = 0; + virtual void SetMaxWidth(float max_width) = 0; virtual void SetMaxHeight(float max_height) = 0; - virtual ui::Rect GetTextBounds() = 0; - virtual std::vector<ui::Rect> TextRangeRect( - const ui::TextRange& text_range) = 0; + + virtual Rect GetTextBounds() = 0; + virtual std::vector<Rect> TextRangeRect(const TextRange& text_range) = 0; }; -} // namespace cru::platform +} // namespace cru::platform::graph |