Sdk/TextAreaWidget: Add SetTextColor

This commit is contained in:
Lynix 2017-01-15 12:11:15 +01:00
parent fd923ed58b
commit 14e327c603
3 changed files with 22 additions and 8 deletions

View File

@ -35,6 +35,7 @@ namespace Ndk
inline std::size_t GetCursorPosition() const;
inline std::size_t GetLineCount() const;
inline const Nz::String& GetText() const;
inline const Nz::Color& GetTextColor() const;
std::size_t GetHoveredGlyph(float x, float y) const;
@ -47,7 +48,8 @@ namespace Ndk
inline void SetCursorPosition(std::size_t cursorPosition);
inline void SetReadOnly(bool readOnly = true);
void SetText(const Nz::String& text);
inline void SetText(const Nz::String& text);
inline void SetTextColor(const Nz::Color& text);
void Write(const Nz::String& text);

View File

@ -35,6 +35,11 @@ namespace Ndk
return m_drawer.GetText();
}
inline const Nz::Color& TextAreaWidget::GetTextColor() const
{
return m_drawer.GetColor();
}
inline bool Ndk::TextAreaWidget::IsMultilineEnabled() const
{
return m_multiLineEnabled;
@ -72,4 +77,18 @@ namespace Ndk
m_cursorEntity->Enable(!m_readOnly);
}
inline void TextAreaWidget::SetText(const Nz::String& text)
{
m_drawer.SetText(text);
m_textSprite->Update(m_drawer);
}
inline void TextAreaWidget::SetTextColor(const Nz::Color& text)
{
m_drawer.SetColor(text);
m_textSprite->Update(m_drawer);
}
}

View File

@ -77,13 +77,6 @@ namespace Ndk
SetContentSize(Nz::Vector2f(m_textSprite->GetBoundingVolume().obb.localBox.GetLengths()));
}
void TextAreaWidget::SetText(const Nz::String& text)
{
m_drawer.SetText(text);
m_textSprite->Update(m_drawer);
}
void TextAreaWidget::Write(const Nz::String& text)
{
if (m_cursorPosition >= m_drawer.GetGlyphCount())