Ndk/TextAreaWidget: Add possibility to write only one specific character category (#174)
* Ndk/TextAreaWidget: Add possibility to write only one specific character category * Add support for multiple categories * Use a predicate instead of an enum * Log change * String::FindLast/FindWord: Fix bug where index wouldn't be used (#177) * String::FindLast/FindWord: Fix bug where index wouldn't be used * Log change * Update Physics2D Component and Body (#178) * Update * Add: [Get/Set]AngularDaming for standardization * Fix: Name error * Add: [Get/Set][AngularDamping/MomentOfInertia] in PhysicsComponent2D * Forgot in last commit * Add: param coordSys in [PhysicsComponent2D/RigidBody2D]::SetMassCenter * Add: Some forgotten inline * Fix little error * Fix: Indentation before case * Move and Change GetCenterOfGravity * Physics2D: Add Arbiter2D * Fix deprecation warning * Fix units tests :derp: * Fixies
This commit is contained in:
@@ -12,12 +12,15 @@
|
||||
#include <NDK/BaseWidget.hpp>
|
||||
#include <NDK/Widgets/Enums.hpp>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class NDK_API TextAreaWidget : public BaseWidget
|
||||
{
|
||||
public:
|
||||
using CharacterFilter = std::function<bool(char32_t)>;
|
||||
|
||||
TextAreaWidget(BaseWidget* parent);
|
||||
TextAreaWidget(const TextAreaWidget&) = delete;
|
||||
TextAreaWidget(TextAreaWidget&&) = default;
|
||||
@@ -33,6 +36,7 @@ namespace Ndk
|
||||
|
||||
void EraseSelection();
|
||||
|
||||
inline CharacterFilter GetCharacterFilter() const;
|
||||
inline unsigned int GetCharacterSize() const;
|
||||
inline const Nz::Vector2ui& GetCursorPosition() const;
|
||||
inline Nz::Vector2ui GetCursorPosition(std::size_t glyphIndex) const;
|
||||
@@ -54,6 +58,7 @@ namespace Ndk
|
||||
|
||||
void ResizeToContent() override;
|
||||
|
||||
inline void SetCharacterFilter(CharacterFilter filter);
|
||||
inline void SetCharacterSize(unsigned int characterSize);
|
||||
inline void SetCursorPosition(std::size_t glyphIndex);
|
||||
inline void SetCursorPosition(Nz::Vector2ui cursorPosition);
|
||||
@@ -96,6 +101,7 @@ namespace Ndk
|
||||
void RefreshCursor();
|
||||
void UpdateDisplayText();
|
||||
|
||||
std::function<bool(char32_t)> m_characterFilter;
|
||||
EchoMode m_echoMode;
|
||||
EntityHandle m_cursorEntity;
|
||||
EntityHandle m_textEntity;
|
||||
|
||||
@@ -23,6 +23,11 @@ namespace Ndk
|
||||
m_multiLineEnabled = enable;
|
||||
}
|
||||
|
||||
inline TextAreaWidget::CharacterFilter TextAreaWidget::GetCharacterFilter() const
|
||||
{
|
||||
return m_characterFilter;
|
||||
}
|
||||
|
||||
inline unsigned int TextAreaWidget::GetCharacterSize() const
|
||||
{
|
||||
return m_drawer.GetCharacterSize();
|
||||
@@ -140,6 +145,11 @@ namespace Ndk
|
||||
SetCursorPosition(cursorPosition);
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetCharacterFilter(CharacterFilter filter)
|
||||
{
|
||||
m_characterFilter = filter;
|
||||
}
|
||||
|
||||
inline void TextAreaWidget::SetCharacterSize(unsigned int characterSize)
|
||||
{
|
||||
m_drawer.SetCharacterSize(characterSize);
|
||||
|
||||
Reference in New Issue
Block a user