aboutsummaryrefslogtreecommitdiff
path: root/include/cru
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru')
-rw-r--r--include/cru/common/Bitmask.hpp2
-rw-r--r--include/cru/platform/GraphBase.hpp2
-rw-r--r--include/cru/platform/graph/TextLayout.hpp1
-rw-r--r--include/cru/platform/native/Keyboard.hpp10
-rw-r--r--include/cru/ui/render/TextRenderObject.hpp1
-rw-r--r--include/cru/win/graph/direct/TextLayout.hpp1
6 files changed, 11 insertions, 6 deletions
diff --git a/include/cru/common/Bitmask.hpp b/include/cru/common/Bitmask.hpp
index ddfdc86b..c1b6443a 100644
--- a/include/cru/common/Bitmask.hpp
+++ b/include/cru/common/Bitmask.hpp
@@ -35,7 +35,7 @@ struct Bitmask final {
bool operator!=(Bitmask rhs) const { return this->value != rhs.value; }
explicit operator TUnderlying() const { return value; }
- explicit operator bool() const { return value != 0; }
+ operator bool() const { return value != 0; }
TUnderlying value;
};
diff --git a/include/cru/platform/GraphBase.hpp b/include/cru/platform/GraphBase.hpp
index e476e3cd..9f3f8393 100644
--- a/include/cru/platform/GraphBase.hpp
+++ b/include/cru/platform/GraphBase.hpp
@@ -258,6 +258,8 @@ struct TextRange final {
gsl::index GetStart() const { return position; }
gsl::index GetEnd() const { return position + count; }
+ void SetEnd(gsl::index new_end) { count = new_end - position; }
+
TextRange Normalize() const {
auto result = *this;
if (result.count < 0) {
diff --git a/include/cru/platform/graph/TextLayout.hpp b/include/cru/platform/graph/TextLayout.hpp
index 7dd20987..a101983f 100644
--- a/include/cru/platform/graph/TextLayout.hpp
+++ b/include/cru/platform/graph/TextLayout.hpp
@@ -7,6 +7,7 @@
namespace cru::platform::graph {
struct ITextLayout : virtual IGraphResource {
virtual std::u16string GetText() = 0;
+ virtual std::u16string_view GetTextView() = 0;
virtual void SetText(std::u16string new_text) = 0;
virtual std::shared_ptr<IFont> GetFont() = 0;
diff --git a/include/cru/platform/native/Keyboard.hpp b/include/cru/platform/native/Keyboard.hpp
index 26a1409d..83c61bcc 100644
--- a/include/cru/platform/native/Keyboard.hpp
+++ b/include/cru/platform/native/Keyboard.hpp
@@ -112,9 +112,9 @@ struct TagKeyModifier {};
using KeyModifier = Bitmask<details::TagKeyModifier>;
-namespace key_modifiers {
-constexpr KeyModifier shift{0b1};
-constexpr KeyModifier ctrl{0b10};
-constexpr KeyModifier alt{0b100};
-} // namespace key_modifiers
+struct KeyModifiers {
+ static constexpr KeyModifier shift{0b1};
+ static constexpr KeyModifier ctrl{0b10};
+ static constexpr KeyModifier alt{0b100};
+};
} // namespace cru::platform::native
diff --git a/include/cru/ui/render/TextRenderObject.hpp b/include/cru/ui/render/TextRenderObject.hpp
index 0b276415..3be42bbb 100644
--- a/include/cru/ui/render/TextRenderObject.hpp
+++ b/include/cru/ui/render/TextRenderObject.hpp
@@ -35,6 +35,7 @@ class TextRenderObject : public RenderObject {
~TextRenderObject() override;
std::u16string GetText() const;
+ std::u16string_view GetTextView() const;
void SetText(std::u16string new_text);
std::shared_ptr<platform::graph::IBrush> GetBrush() const { return brush_; }
diff --git a/include/cru/win/graph/direct/TextLayout.hpp b/include/cru/win/graph/direct/TextLayout.hpp
index c53cf655..016009ab 100644
--- a/include/cru/win/graph/direct/TextLayout.hpp
+++ b/include/cru/win/graph/direct/TextLayout.hpp
@@ -29,6 +29,7 @@ class DWriteTextLayout : public DirectGraphResource,
public:
std::u16string GetText() override;
+ std::u16string_view GetTextView() override;
void SetText(std::u16string new_text) override;
std::shared_ptr<IFont> GetFont() override;