aboutsummaryrefslogtreecommitdiff
path: root/include/cru/win/graphics/direct/TextLayout.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/win/graphics/direct/TextLayout.hpp')
-rw-r--r--include/cru/win/graphics/direct/TextLayout.hpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/include/cru/win/graphics/direct/TextLayout.hpp b/include/cru/win/graphics/direct/TextLayout.hpp
index aa040278..1ac56a9d 100644
--- a/include/cru/win/graphics/direct/TextLayout.hpp
+++ b/include/cru/win/graphics/direct/TextLayout.hpp
@@ -10,12 +10,12 @@
namespace cru::platform::graphics::win::direct {
class DWriteFont;
-class DWriteTextLayout : public DirectGraphResource,
+class DWriteTextLayout : public DirectGraphicsResource,
public virtual ITextLayout,
public virtual IComResource<IDWriteTextLayout> {
public:
- DWriteTextLayout(DirectGraphFactory* factory, std::shared_ptr<IFont> font,
- std::u16string text);
+ DWriteTextLayout(DirectGraphicsFactory* factory, std::shared_ptr<IFont> font,
+ String text);
CRU_DELETE_COPY(DWriteTextLayout)
CRU_DELETE_MOVE(DWriteTextLayout)
@@ -28,9 +28,8 @@ class DWriteTextLayout : public DirectGraphResource,
}
public:
- std::u16string GetText() override;
- std::u16string_view GetTextView() override;
- void SetText(std::u16string new_text) override;
+ String GetText() override;
+ void SetText(String new_text) override;
std::shared_ptr<IFont> GetFont() override;
void SetFont(std::shared_ptr<IFont> font) override;
@@ -38,15 +37,22 @@ class DWriteTextLayout : public DirectGraphResource,
void SetMaxWidth(float max_width) override;
void SetMaxHeight(float max_height) override;
+ bool IsEditMode() override;
+ void SetEditMode(bool enable) override;
+
+ Index GetLineIndexFromCharIndex(Index char_index) override;
+ float GetLineHeight(Index line_index) override;
+ Index GetLineCount() override;
+
Rect GetTextBounds(bool includingTrailingSpace = false) override;
// Return empty vector if text_range.count is 0. Text range could be in
// reverse direction, it should be normalized first in implementation.
std::vector<Rect> TextRangeRect(const TextRange& text_range) override;
- Point TextSinglePoint(Index position, bool trailing) override;
+ Rect TextSinglePoint(Index position, bool trailing) override;
TextHitTestResult HitTest(const Point& point) override;
private:
- std::u16string text_;
+ String text_;
std::shared_ptr<DWriteFont> font_;
float max_width_ = std::numeric_limits<float>::max();
float max_height_ = std::numeric_limits<float>::max();