aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/win
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-04-04 14:14:07 +0800
committercrupest <crupest@outlook.com>2019-04-04 14:14:07 +0800
commitdcd866074615ba357b62b6128f1c64d56ed4ad16 (patch)
tree86db346cfa104d173b4e9dd7449d51ec36f0b5b3 /include/cru/platform/win
parentd732b99cd1436144d4625382954eb4a1cf832a1f (diff)
downloadcru-dcd866074615ba357b62b6128f1c64d56ed4ad16.tar.gz
cru-dcd866074615ba357b62b6128f1c64d56ed4ad16.tar.bz2
cru-dcd866074615ba357b62b6128f1c64d56ed4ad16.zip
...
Diffstat (limited to 'include/cru/platform/win')
-rw-r--r--include/cru/platform/win/win_text_layout.hpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/cru/platform/win/win_text_layout.hpp b/include/cru/platform/win/win_text_layout.hpp
index 68961dd7..277bbcae 100644
--- a/include/cru/platform/win/win_text_layout.hpp
+++ b/include/cru/platform/win/win_text_layout.hpp
@@ -7,18 +7,34 @@
#include <memory>
namespace cru::platform::win {
+class GraphManager;
+
class WinTextLayout : public Object, public virtual TextLayout {
public:
- explicit WinTextLayout(std::shared_ptr<WinFontDescriptor> font);
+ explicit WinTextLayout(GraphManager* graph_manager,
+ std::shared_ptr<WinFontDescriptor> font, std::wstring text);
WinTextLayout(const WinTextLayout& other) = delete;
WinTextLayout(WinTextLayout&& other) = delete;
WinTextLayout& operator=(const WinTextLayout& other) = delete;
WinTextLayout& operator=(WinTextLayout&& other) = delete;
~WinTextLayout() override;
+ std::wstring GetText() override;
+ void SetText(std::wstring new_text) override;
+ void SetMaxWidth(float max_width) override;
+ void SetMaxHeight(float max_height) override;
+ ui::Rect GetTextBounds() override;
+ std::vector<ui::Rect> TextRangeRect(
+ const ui::TextRange& text_range) override;
+
IDWriteTextLayout* GetDWriteTextLayout() const { return text_layout_.Get(); }
private:
+ GraphManager* graph_manager_;
+ std::wstring text_;
+ std::shared_ptr<WinFontDescriptor> font_descriptor_;
+ float max_width_ = 0.0f;
+ float max_height_ = 0.0f;
Microsoft::WRL::ComPtr<IDWriteTextLayout> text_layout_;
};
} // namespace cru::platform::win