TextAreaWidget: Make Tab writable (#175)
* TextAreaWidget: Make Tab writable * Implement Tab ena/disabling, disable it by default * Log change * Rename Tab Enabling function * Add useful Write/Delete functions * Finished! * whoops * Fix everything * whoops * I don't know why but it works * whoops * I'M PUSHING.
This commit is contained in:
@@ -32,8 +32,12 @@ namespace Ndk
|
||||
|
||||
//virtual TextAreaWidget* Clone() const = 0;
|
||||
|
||||
inline void EnableMultiline(bool enable = true);
|
||||
|
||||
inline void EnableMultiline(bool enable = true);
|
||||
inline void EnableTabWriting(bool enable = true);
|
||||
|
||||
inline void Erase(std::size_t glyphPosition);
|
||||
void Erase(std::size_t firstGlyph, std::size_t lastGlyph);
|
||||
void EraseSelection();
|
||||
|
||||
inline CharacterFilter GetCharacterFilter() const;
|
||||
@@ -52,6 +56,7 @@ namespace Ndk
|
||||
|
||||
inline bool IsMultilineEnabled() const;
|
||||
inline bool IsReadOnly() const;
|
||||
inline bool IsTabWritingEnabled() const;
|
||||
|
||||
inline void MoveCursor(int offset);
|
||||
inline void MoveCursor(const Nz::Vector2i& offset);
|
||||
@@ -68,7 +73,9 @@ namespace Ndk
|
||||
inline void SetText(const Nz::String& text);
|
||||
inline void SetTextColor(const Nz::Color& text);
|
||||
|
||||
void Write(const Nz::String& text);
|
||||
inline void Write(const Nz::String& text);
|
||||
inline void Write(const Nz::String& text, const Nz::Vector2ui& glyphPosition);
|
||||
void Write(const Nz::String& text, std::size_t glyphPosition);
|
||||
|
||||
TextAreaWidget& operator=(const TextAreaWidget&) = delete;
|
||||
TextAreaWidget& operator=(TextAreaWidget&&) = default;
|
||||
@@ -115,6 +122,7 @@ namespace Ndk
|
||||
bool m_isMouseButtonDown;
|
||||
bool m_multiLineEnabled;
|
||||
bool m_readOnly;
|
||||
bool m_tabEnabled; // writes (Shift+)Tab character if set to true
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,16 @@ namespace Ndk
|
||||
m_multiLineEnabled = enable;
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::EnableTabWriting(bool enable)
|
||||
{
|
||||
m_tabEnabled = enable;
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::Erase(std::size_t glyphPosition)
|
||||
{
|
||||
Erase(glyphPosition, glyphPosition + 1U);
|
||||
}
|
||||
|
||||
inline TextAreaWidget::CharacterFilter TextAreaWidget::GetCharacterFilter() const
|
||||
{
|
||||
return m_characterFilter;
|
||||
@@ -102,6 +112,11 @@ namespace Ndk
|
||||
return m_multiLineEnabled;
|
||||
}
|
||||
|
||||
inline bool TextAreaWidget::IsTabWritingEnabled() const
|
||||
{
|
||||
return m_tabEnabled;
|
||||
}
|
||||
|
||||
inline bool TextAreaWidget::IsReadOnly() const
|
||||
{
|
||||
return m_readOnly;
|
||||
@@ -233,4 +248,14 @@ namespace Ndk
|
||||
|
||||
m_textSprite->Update(m_drawer);
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::Write(const Nz::String& text)
|
||||
{
|
||||
Write(text, GetGlyphIndex(m_cursorPositionBegin));
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::Write(const Nz::String& text, const Nz::Vector2ui& glyphPosition)
|
||||
{
|
||||
Write(text, GetGlyphIndex(glyphPosition));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user