Sdk/TextAreaWidget: Fix GetGlyphIndex not being const + add overload returning current glyph index
This commit is contained in:
parent
583cfb5f71
commit
917c41f90e
|
|
@ -34,7 +34,8 @@ namespace Ndk
|
|||
inline const Nz::Vector2ui& GetCursorPosition() const;
|
||||
inline const Nz::String& GetDisplayText() const;
|
||||
inline EchoMode GetEchoMode() const;
|
||||
inline std::size_t GetGlyphIndex(const Nz::Vector2ui& cursorPosition);
|
||||
inline std::size_t GetGlyphIndex() const;
|
||||
inline std::size_t GetGlyphIndex(const Nz::Vector2ui& cursorPosition) const;
|
||||
inline const Nz::String& GetText() const;
|
||||
inline const Nz::Color& GetTextColor() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,17 @@ namespace Ndk
|
|||
return m_drawer.GetText();
|
||||
}
|
||||
|
||||
inline std::size_t TextAreaWidget::GetGlyphIndex(const Nz::Vector2ui& cursorPosition)
|
||||
inline EchoMode TextAreaWidget::GetEchoMode() const
|
||||
{
|
||||
return m_echoMode;
|
||||
}
|
||||
|
||||
inline std::size_t TextAreaWidget::GetGlyphIndex() const
|
||||
{
|
||||
return GetGlyphIndex(m_cursorPosition);
|
||||
}
|
||||
|
||||
inline std::size_t TextAreaWidget::GetGlyphIndex(const Nz::Vector2ui& cursorPosition) const
|
||||
{
|
||||
std::size_t glyphIndex = m_drawer.GetLine(cursorPosition.y).glyphIndex + cursorPosition.x;
|
||||
if (m_drawer.GetLineCount() > cursorPosition.y + 1)
|
||||
|
|
@ -48,11 +58,6 @@ namespace Ndk
|
|||
return glyphIndex;
|
||||
}
|
||||
|
||||
inline EchoMode TextAreaWidget::GetEchoMode() const
|
||||
{
|
||||
return m_echoMode;
|
||||
}
|
||||
|
||||
inline const Nz::String& TextAreaWidget::GetText() const
|
||||
{
|
||||
return m_text;
|
||||
|
|
|
|||
Loading…
Reference in New Issue