SDK/TextAreaWidget: Add [Get|Set]TextFont

This commit is contained in:
Lynix 2019-07-07 00:23:49 +02:00
parent 55e3e05f0c
commit 8457cb4df7
4 changed files with 17 additions and 2 deletions

View File

@ -278,6 +278,7 @@ Nazara Development Kit:
- Console has been remade with widgets (allowing to scroll back history, select text, etc.)
- Added TextAreaWidget line wrap option
- TextAreaWidget will now shift the text to the left/right in order to keep the cursor visible
- Added TextAreaWidget::[Get|Set]TextFont
# 0.4:

View File

@ -52,6 +52,7 @@ namespace Ndk
inline std::size_t GetGlyphIndex(const Nz::Vector2ui& cursorPosition) const;
inline const Nz::String& GetText() const;
inline const Nz::Color& GetTextColor() const;
inline Nz::Font* GetTextFont() const;
inline const Nz::Color& GetTextOulineColor() const;
inline float GetTextOulineThickness() const;
@ -76,6 +77,7 @@ namespace Ndk
inline void SetSelection(Nz::Vector2ui fromPosition, Nz::Vector2ui toPosition);
inline void SetText(const Nz::String& text);
inline void SetTextColor(const Nz::Color& text);
inline void SetTextFont(Nz::FontRef font);
inline void SetTextOutlineColor(const Nz::Color& color);
inline void SetTextOutlineThickness(float thickness);

View File

@ -108,6 +108,11 @@ namespace Ndk
return m_drawer.GetColor();
}
inline Nz::Font* TextAreaWidget::GetTextFont() const
{
return m_drawer.GetFont();
}
inline const Nz::Color& TextAreaWidget::GetTextOulineColor() const
{
return m_drawer.GetOutlineColor();
@ -265,6 +270,13 @@ namespace Ndk
UpdateDisplayText();
}
inline void TextAreaWidget::SetTextFont(Nz::FontRef font)
{
m_drawer.SetFont(font);
UpdateDisplayText();
}
inline void TextAreaWidget::SetTextOutlineColor(const Nz::Color& color)
{
m_drawer.SetOutlineColor(color);

View File

@ -170,8 +170,8 @@ namespace Ndk
NazaraAssert(font && font->IsValid(), "Invalid font");
m_defaultFont = std::move(font);
//m_historyDrawer.SetFont(m_defaultFont);
//m_inputDrawer.SetFont(m_defaultFont);
m_history->SetTextFont(m_defaultFont);
m_input->SetTextFont(m_defaultFont);
Layout();
}