Rework TextDrawer interface
This commit is contained in:
@@ -64,9 +64,9 @@ namespace Nz
|
||||
inline void SetReadOnly(bool readOnly = true);
|
||||
inline void SetSelection(Vector2ui fromPosition, Vector2ui toPosition);
|
||||
|
||||
inline void Write(const std::string& text);
|
||||
inline void Write(const std::string& text, const Vector2ui& glyphPosition);
|
||||
virtual void Write(const std::string& text, std::size_t glyphPosition) = 0;
|
||||
inline void Write(std::string_view text);
|
||||
inline void Write(std::string_view text, const Vector2ui& glyphPosition);
|
||||
virtual void Write(std::string_view text, std::size_t glyphPosition) = 0;
|
||||
|
||||
AbstractTextAreaWidget& operator=(const AbstractTextAreaWidget&) = delete;
|
||||
AbstractTextAreaWidget& operator=(AbstractTextAreaWidget&&) = delete;
|
||||
|
||||
@@ -231,12 +231,12 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
inline void AbstractTextAreaWidget::Write(const std::string& text)
|
||||
inline void AbstractTextAreaWidget::Write(std::string_view text)
|
||||
{
|
||||
Write(text, GetGlyphIndex(m_cursorPositionBegin));
|
||||
}
|
||||
|
||||
inline void AbstractTextAreaWidget::Write(const std::string& text, const Vector2ui& glyphPosition)
|
||||
inline void AbstractTextAreaWidget::Write(std::string_view text, const Vector2ui& glyphPosition)
|
||||
{
|
||||
Write(text, GetGlyphIndex(glyphPosition));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Nz
|
||||
RichTextAreaWidget(RichTextAreaWidget&&) = delete;
|
||||
~RichTextAreaWidget() = default;
|
||||
|
||||
void AppendText(const std::string& text);
|
||||
void AppendText(std::string_view text);
|
||||
|
||||
void Clear() override;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Nz
|
||||
inline void SetTextOutlineThickness(float thickness);
|
||||
inline void SetTextStyle(TextStyleFlags style);
|
||||
|
||||
void Write(const std::string& text, std::size_t glyphPosition) override;
|
||||
void Write(std::string_view text, std::size_t glyphPosition) override;
|
||||
|
||||
RichTextAreaWidget& operator=(const RichTextAreaWidget&) = delete;
|
||||
RichTextAreaWidget& operator=(RichTextAreaWidget&&) = delete;
|
||||
|
||||
@@ -8,82 +8,82 @@ namespace Nz
|
||||
{
|
||||
inline unsigned int RichTextAreaWidget::GetCharacterSize() const
|
||||
{
|
||||
return m_drawer.GetDefaultCharacterSize();
|
||||
return m_drawer.GetCharacterSize();
|
||||
}
|
||||
|
||||
inline float RichTextAreaWidget::GetCharacterSpacingOffset() const
|
||||
{
|
||||
return m_drawer.GetDefaultCharacterSpacingOffset();
|
||||
return m_drawer.GetCharacterSpacingOffset();
|
||||
}
|
||||
|
||||
inline float RichTextAreaWidget::GetLineSpacingOffset() const
|
||||
{
|
||||
return m_drawer.GetDefaultLineSpacingOffset();
|
||||
return m_drawer.GetLineSpacingOffset();
|
||||
}
|
||||
|
||||
inline const Color& RichTextAreaWidget::GetTextColor() const
|
||||
{
|
||||
return m_drawer.GetDefaultColor();
|
||||
return m_drawer.GetTextColor();
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<Font>& RichTextAreaWidget::GetTextFont() const
|
||||
{
|
||||
return m_drawer.GetDefaultFont();
|
||||
return m_drawer.GetTextFont();
|
||||
}
|
||||
|
||||
inline const Color& RichTextAreaWidget::GetTextOutlineColor() const
|
||||
{
|
||||
return m_drawer.GetDefaultOutlineColor();
|
||||
return m_drawer.GetTextOutlineColor();
|
||||
}
|
||||
|
||||
inline float RichTextAreaWidget::GetTextOutlineThickness() const
|
||||
{
|
||||
return m_drawer.GetDefaultOutlineThickness();
|
||||
return m_drawer.GetTextOutlineThickness();
|
||||
}
|
||||
|
||||
inline TextStyleFlags RichTextAreaWidget::GetTextStyle() const
|
||||
{
|
||||
return m_drawer.GetDefaultStyle();
|
||||
return m_drawer.GetTextStyle();
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetCharacterSize(unsigned int characterSize)
|
||||
{
|
||||
m_drawer.SetDefaultCharacterSize(characterSize);
|
||||
m_drawer.SetCharacterSize(characterSize);
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetCharacterSpacingOffset(float offset)
|
||||
{
|
||||
m_drawer.SetDefaultCharacterSpacingOffset(offset);
|
||||
m_drawer.SetCharacterSpacingOffset(offset);
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetLineSpacingOffset(float offset)
|
||||
{
|
||||
m_drawer.SetDefaultLineSpacingOffset(offset);
|
||||
m_drawer.SetLineSpacingOffset(offset);
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetTextColor(const Color& color)
|
||||
{
|
||||
m_drawer.SetDefaultColor(color);
|
||||
m_drawer.SetTextColor(color);
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetTextFont(std::shared_ptr<Font> font)
|
||||
{
|
||||
m_drawer.SetDefaultFont(std::move(font));
|
||||
m_drawer.SetTextFont(std::move(font));
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetTextOutlineColor(const Color& color)
|
||||
{
|
||||
m_drawer.SetDefaultOutlineColor(color);
|
||||
m_drawer.SetTextOutlineColor(color);
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetTextOutlineThickness(float thickness)
|
||||
{
|
||||
m_drawer.SetDefaultOutlineThickness(thickness);
|
||||
m_drawer.SetTextOutlineThickness(thickness);
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetTextStyle(TextStyleFlags style)
|
||||
{
|
||||
m_drawer.SetDefaultStyle(style);
|
||||
m_drawer.SetTextStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Nz
|
||||
TextAreaWidget(TextAreaWidget&&) = delete;
|
||||
~TextAreaWidget() = default;
|
||||
|
||||
void AppendText(const std::string& text);
|
||||
void AppendText(std::string_view text);
|
||||
|
||||
void Clear() override;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Nz
|
||||
inline void SetTextStyle(TextStyleFlags style);
|
||||
|
||||
using AbstractTextAreaWidget::Write;
|
||||
void Write(const std::string& text, std::size_t glyphPosition) override;
|
||||
void Write(std::string_view text, std::size_t glyphPosition) override;
|
||||
|
||||
TextAreaWidget& operator=(const TextAreaWidget&) = delete;
|
||||
TextAreaWidget& operator=(TextAreaWidget&&) = delete;
|
||||
|
||||
@@ -33,27 +33,27 @@ namespace Nz
|
||||
|
||||
inline const Color& TextAreaWidget::GetTextColor() const
|
||||
{
|
||||
return m_drawer.GetColor();
|
||||
return m_drawer.GetTextColor();
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<Font>& TextAreaWidget::GetTextFont() const
|
||||
{
|
||||
return m_drawer.GetFont();
|
||||
return m_drawer.GetTextFont();
|
||||
}
|
||||
|
||||
inline const Color& TextAreaWidget::GetTextOulineColor() const
|
||||
{
|
||||
return m_drawer.GetOutlineColor();
|
||||
return m_drawer.GetTextOutlineColor();
|
||||
}
|
||||
|
||||
inline float TextAreaWidget::GetTextOulineThickness() const
|
||||
{
|
||||
return m_drawer.GetOutlineThickness();
|
||||
return m_drawer.GetTextOutlineThickness();
|
||||
}
|
||||
|
||||
inline TextStyleFlags TextAreaWidget::GetTextStyle() const
|
||||
{
|
||||
return m_drawer.GetStyle();
|
||||
return m_drawer.GetTextStyle();
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetCharacterSize(unsigned int characterSize)
|
||||
@@ -89,35 +89,35 @@ namespace Nz
|
||||
|
||||
inline void TextAreaWidget::SetTextColor(const Color& text)
|
||||
{
|
||||
m_drawer.SetColor(text);
|
||||
m_drawer.SetTextColor(text);
|
||||
|
||||
UpdateDisplayText();
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetTextFont(std::shared_ptr<Font> font)
|
||||
{
|
||||
m_drawer.SetFont(std::move(font));
|
||||
m_drawer.SetTextFont(std::move(font));
|
||||
|
||||
UpdateDisplayText();
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetTextOutlineColor(const Color& color)
|
||||
{
|
||||
m_drawer.SetOutlineColor(color);
|
||||
m_drawer.SetTextOutlineColor(color);
|
||||
|
||||
UpdateDisplayText();
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetTextOutlineThickness(float thickness)
|
||||
{
|
||||
m_drawer.SetOutlineThickness(thickness);
|
||||
m_drawer.SetTextOutlineThickness(thickness);
|
||||
|
||||
UpdateDisplayText();
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetTextStyle(TextStyleFlags style)
|
||||
{
|
||||
m_drawer.SetStyle(style);
|
||||
m_drawer.SetTextStyle(style);
|
||||
|
||||
UpdateDisplayText();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user