SDK/(Rich)TextAreaWidget: Add character and line spacing offsets
This commit is contained in:
@@ -27,6 +27,8 @@ namespace Ndk
|
||||
void Erase(std::size_t firstGlyph, std::size_t lastGlyph) override;
|
||||
|
||||
inline unsigned int GetCharacterSize() const;
|
||||
inline float GetCharacterSpacingOffset() const;
|
||||
inline float GetLineSpacingOffset() const;
|
||||
inline const Nz::Color& GetTextColor() const;
|
||||
inline Nz::Font* GetTextFont() const;
|
||||
inline const Nz::Color& GetTextOutlineColor() const;
|
||||
@@ -34,6 +36,8 @@ namespace Ndk
|
||||
inline Nz::TextStyleFlags GetTextStyle() const;
|
||||
|
||||
inline void SetCharacterSize(unsigned int characterSize);
|
||||
inline void SetCharacterSpacingOffset(float offset);
|
||||
inline void SetLineSpacingOffset(float offset);
|
||||
inline void SetTextColor(const Nz::Color& color);
|
||||
inline void SetTextFont(Nz::FontRef font);
|
||||
inline void SetTextOutlineColor(const Nz::Color& color);
|
||||
@@ -53,7 +57,7 @@ namespace Ndk
|
||||
void HandleSelectionIndentation(bool add) override;
|
||||
void HandleWordCursorMove(bool left) override;
|
||||
|
||||
void UpdateDisplayText();
|
||||
void UpdateDisplayText() override;
|
||||
|
||||
Nz::RichTextDrawer m_drawer;
|
||||
};
|
||||
|
||||
@@ -11,6 +11,16 @@ namespace Ndk
|
||||
return m_drawer.GetDefaultCharacterSize();
|
||||
}
|
||||
|
||||
inline float RichTextAreaWidget::GetCharacterSpacingOffset() const
|
||||
{
|
||||
return m_drawer.GetDefaultCharacterSpacingOffset();
|
||||
}
|
||||
|
||||
inline float RichTextAreaWidget::GetLineSpacingOffset() const
|
||||
{
|
||||
return m_drawer.GetDefaultLineSpacingOffset();
|
||||
}
|
||||
|
||||
inline const Nz::Color& RichTextAreaWidget::GetTextColor() const
|
||||
{
|
||||
return m_drawer.GetDefaultColor();
|
||||
@@ -41,6 +51,16 @@ namespace Ndk
|
||||
m_drawer.SetDefaultCharacterSize(characterSize);
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetCharacterSpacingOffset(float offset)
|
||||
{
|
||||
m_drawer.SetDefaultCharacterSpacingOffset(offset);
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetLineSpacingOffset(float offset)
|
||||
{
|
||||
m_drawer.SetDefaultLineSpacingOffset(offset);
|
||||
}
|
||||
|
||||
inline void RichTextAreaWidget::SetTextColor(const Nz::Color& color)
|
||||
{
|
||||
m_drawer.SetDefaultColor(color);
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace Ndk
|
||||
|
||||
inline unsigned int GetCharacterSize() const;
|
||||
inline const Nz::String& GetDisplayText() const;
|
||||
inline float GetCharacterSpacingOffset() const;
|
||||
inline float GetLineSpacingOffset() const;
|
||||
inline const Nz::String& GetText() const;
|
||||
inline const Nz::Color& GetTextColor() const;
|
||||
inline Nz::Font* GetTextFont() const;
|
||||
@@ -36,7 +38,9 @@ namespace Ndk
|
||||
inline float GetTextOulineThickness() const;
|
||||
inline Nz::TextStyleFlags GetTextStyle() const;
|
||||
|
||||
void SetCharacterSize(unsigned int characterSize);
|
||||
inline void SetCharacterSize(unsigned int characterSize);
|
||||
inline void SetCharacterSpacingOffset(float offset);
|
||||
inline void SetLineSpacingOffset(float offset);
|
||||
inline void SetText(const Nz::String& text);
|
||||
inline void SetTextColor(const Nz::Color& text);
|
||||
inline void SetTextFont(Nz::FontRef font);
|
||||
@@ -61,6 +65,7 @@ namespace Ndk
|
||||
void HandleWordCursorMove(bool left) override;
|
||||
|
||||
void UpdateDisplayText() override;
|
||||
void UpdateMinimumSize();
|
||||
|
||||
Nz::SimpleTextDrawer m_drawer;
|
||||
Nz::String m_text;
|
||||
|
||||
@@ -16,6 +16,16 @@ namespace Ndk
|
||||
return m_drawer.GetText();
|
||||
}
|
||||
|
||||
inline float TextAreaWidget::GetCharacterSpacingOffset() const
|
||||
{
|
||||
return m_drawer.GetCharacterSpacingOffset();
|
||||
}
|
||||
|
||||
inline float TextAreaWidget::GetLineSpacingOffset() const
|
||||
{
|
||||
return m_drawer.GetLineSpacingOffset();
|
||||
}
|
||||
|
||||
inline const Nz::String& TextAreaWidget::GetText() const
|
||||
{
|
||||
return m_text;
|
||||
@@ -46,6 +56,29 @@ namespace Ndk
|
||||
return m_drawer.GetStyle();
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetCharacterSize(unsigned int characterSize)
|
||||
{
|
||||
m_drawer.SetCharacterSize(characterSize);
|
||||
|
||||
UpdateMinimumSize();
|
||||
UpdateDisplayText();
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetCharacterSpacingOffset(float offset)
|
||||
{
|
||||
m_drawer.SetCharacterSpacingOffset(offset);
|
||||
|
||||
UpdateMinimumSize();
|
||||
UpdateDisplayText();
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetLineSpacingOffset(float offset)
|
||||
{
|
||||
m_drawer.SetLineSpacingOffset(offset);
|
||||
|
||||
UpdateDisplayText();
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetText(const Nz::String& text)
|
||||
{
|
||||
m_text = text;
|
||||
|
||||
Reference in New Issue
Block a user