Sdk/Console: Add ClearFocus/SetFocus methods

Theses should be virtuals
This commit is contained in:
Jérôme Leclercq 2018-04-12 13:42:36 +02:00
parent 6fb44796a0
commit 26f0a9fec9
2 changed files with 23 additions and 4 deletions

View File

@ -42,6 +42,7 @@ namespace Ndk
void AddLine(const Nz::String& text, const Nz::Color& color = Nz::Color::White);
void Clear();
void ClearFocus();
inline unsigned int GetCharacterSize() const;
inline const TextAreaWidget* GetHistory() const;
@ -51,6 +52,7 @@ namespace Ndk
void ResizeToContent() override;
void SetCharacterSize(unsigned int size);
void SetFocus();
void SetTextFont(Nz::FontRef font);
Console& operator=(const Console& console) = delete;

View File

@ -103,7 +103,6 @@ namespace Ndk
* \param text New line of text
* \param color Color for the text
*/
void Console::AddLine(const Nz::String& text, const Nz::Color& color)
{
m_historyLines.emplace_back(Line{ color, text });
@ -112,8 +111,9 @@ namespace Ndk
/*!
* \brief Clears the console
*
* Clears the console history and input
*/
void Console::Clear()
{
m_historyLines.clear();
@ -121,6 +121,16 @@ namespace Ndk
m_input->SetText(s_inputPrefix);
}
/*!
* \brief Clears the console focus
*
* Clear console input widget focus (if owned)
*/
void Console::ClearFocus()
{
m_input->ClearFocus();
}
void Console::ResizeToContent()
{
}
@ -130,7 +140,6 @@ namespace Ndk
*
* \param size Size of the font
*/
void Console::SetCharacterSize(unsigned int size)
{
m_characterSize = size;
@ -141,6 +150,15 @@ namespace Ndk
Layout();
}
/*!
* \brief Give the console input focus
*
*/
void Console::SetFocus()
{
m_input->SetFocus();
}
/*!
* \brief Sets the text font
*
@ -148,7 +166,6 @@ namespace Ndk
*
* \remark Produces a NazaraAssert if font is invalid or null
*/
void Console::SetTextFont(Nz::FontRef font)
{
NazaraAssert(font && font->IsValid(), "Invalid font");