Sdk/TextAreaWidget: Fix cursor showing up on readonly text area
This commit is contained in:
parent
d98b7a8f4f
commit
3cff3fbadc
|
|
@ -170,8 +170,7 @@ namespace Ndk
|
||||||
inline void TextAreaWidget::SetReadOnly(bool readOnly)
|
inline void TextAreaWidget::SetReadOnly(bool readOnly)
|
||||||
{
|
{
|
||||||
m_readOnly = readOnly;
|
m_readOnly = readOnly;
|
||||||
|
m_cursorEntity->Enable(!m_readOnly && HasFocus());
|
||||||
m_cursorEntity->Enable(!m_readOnly);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void TextAreaWidget::SetText(const Nz::String& text)
|
inline void TextAreaWidget::SetText(const Nz::String& text)
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,8 @@ namespace Ndk
|
||||||
|
|
||||||
void TextAreaWidget::OnFocusReceived()
|
void TextAreaWidget::OnFocusReceived()
|
||||||
{
|
{
|
||||||
m_cursorEntity->Enable(true);
|
if (!m_readOnly)
|
||||||
|
m_cursorEntity->Enable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextAreaWidget::OnKeyPressed(const Nz::WindowEvent::KeyEvent& key)
|
void TextAreaWidget::OnKeyPressed(const Nz::WindowEvent::KeyEvent& key)
|
||||||
|
|
@ -289,6 +290,9 @@ namespace Ndk
|
||||||
|
|
||||||
void TextAreaWidget::RefreshCursor()
|
void TextAreaWidget::RefreshCursor()
|
||||||
{
|
{
|
||||||
|
if (m_readOnly)
|
||||||
|
return;
|
||||||
|
|
||||||
const auto& lineInfo = m_drawer.GetLine(m_cursorPosition.y);
|
const auto& lineInfo = m_drawer.GetLine(m_cursorPosition.y);
|
||||||
std::size_t cursorGlyph = GetGlyphIndex(m_cursorPosition);
|
std::size_t cursorGlyph = GetGlyphIndex(m_cursorPosition);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue