Widgets/TextAreaWidget: Add a way to limit text length
This commit is contained in:
@@ -42,6 +42,7 @@ namespace Nz
|
||||
inline EchoMode GetEchoMode() const;
|
||||
inline std::size_t GetGlyphIndex() const;
|
||||
inline std::size_t GetGlyphIndex(const Vector2ui& cursorPosition) const;
|
||||
inline std::size_t GetMaximumTextLength() const;
|
||||
|
||||
Vector2ui GetHoveredGlyph(float x, float y) const;
|
||||
|
||||
@@ -61,6 +62,7 @@ namespace Nz
|
||||
inline void SetCursorPosition(std::size_t glyphIndex);
|
||||
inline void SetCursorPosition(Vector2ui cursorPosition);
|
||||
inline void SetEchoMode(EchoMode echoMode);
|
||||
virtual void SetMaximumTextLength(std::size_t maximumLength) = 0;
|
||||
inline void SetReadOnly(bool readOnly = true);
|
||||
inline void SetSelection(Vector2ui fromPosition, Vector2ui toPosition);
|
||||
|
||||
@@ -131,6 +133,7 @@ namespace Nz
|
||||
};
|
||||
|
||||
std::shared_ptr<TextSprite> m_textSprite;
|
||||
std::size_t m_maximumTextLength;
|
||||
std::vector<Cursor> m_cursors;
|
||||
CharacterFilter m_characterFilter;
|
||||
EchoMode m_echoMode;
|
||||
|
||||
@@ -87,6 +87,11 @@ namespace Nz
|
||||
return glyphIndex;
|
||||
}
|
||||
|
||||
inline std::size_t AbstractTextAreaWidget::GetMaximumTextLength() const
|
||||
{
|
||||
return m_maximumTextLength;
|
||||
}
|
||||
|
||||
inline bool AbstractTextAreaWidget::HasSelection() const
|
||||
{
|
||||
return m_cursorPositionBegin != m_cursorPositionEnd;
|
||||
@@ -257,3 +262,4 @@ namespace Nz
|
||||
}
|
||||
|
||||
#include <Nazara/Widgets/DebugOff.hpp>
|
||||
#include "AbstractTextAreaWidget.hpp"
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Nz
|
||||
inline void SetCharacterSize(unsigned int characterSize);
|
||||
inline void SetCharacterSpacingOffset(float offset);
|
||||
inline void SetLineSpacingOffset(float offset);
|
||||
void SetMaximumTextLength(std::size_t maximumLength) override;
|
||||
inline void SetTextColor(const Color& color);
|
||||
inline void SetTextFont(std::shared_ptr<Font> font);
|
||||
inline void SetTextOutlineColor(const Color& color);
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace Nz
|
||||
inline void SetCharacterSize(unsigned int characterSize);
|
||||
inline void SetCharacterSpacingOffset(float offset);
|
||||
inline void SetLineSpacingOffset(float offset);
|
||||
void SetMaximumTextLength(std::size_t maximumLength) override;
|
||||
inline void SetText(std::string text);
|
||||
inline void SetTextColor(const Color& text);
|
||||
inline void SetTextFont(std::shared_ptr<Font> font);
|
||||
|
||||
Reference in New Issue
Block a user