From 14e327c603e35f16a6052b99c58c03ea5ae3031a Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 15 Jan 2017 12:11:15 +0100 Subject: [PATCH] Sdk/TextAreaWidget: Add SetTextColor --- SDK/include/NDK/Widgets/TextAreaWidget.hpp | 4 +++- SDK/include/NDK/Widgets/TextAreaWidget.inl | 19 +++++++++++++++++++ SDK/src/NDK/Widgets/TextAreaWidget.cpp | 7 ------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/SDK/include/NDK/Widgets/TextAreaWidget.hpp b/SDK/include/NDK/Widgets/TextAreaWidget.hpp index 8236b1689..2b0774ec8 100644 --- a/SDK/include/NDK/Widgets/TextAreaWidget.hpp +++ b/SDK/include/NDK/Widgets/TextAreaWidget.hpp @@ -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); diff --git a/SDK/include/NDK/Widgets/TextAreaWidget.inl b/SDK/include/NDK/Widgets/TextAreaWidget.inl index d923e7223..711f8de8c 100644 --- a/SDK/include/NDK/Widgets/TextAreaWidget.inl +++ b/SDK/include/NDK/Widgets/TextAreaWidget.inl @@ -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); + } } diff --git a/SDK/src/NDK/Widgets/TextAreaWidget.cpp b/SDK/src/NDK/Widgets/TextAreaWidget.cpp index 0e0f82f57..0c9b7b3d5 100644 --- a/SDK/src/NDK/Widgets/TextAreaWidget.cpp +++ b/SDK/src/NDK/Widgets/TextAreaWidget.cpp @@ -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())