Sdk/TextAreaWidget: Show cursor as long as focus is active
This commit is contained in:
parent
f136530a74
commit
0487b282d7
|
|
@ -23,6 +23,7 @@ Nazara Development Kit:
|
|||
- Fixed minor issues relative to TextAreaWidget cursor handling
|
||||
- ⚠️ Renamed BaseWidget::GrabKeyboard method to SetFocus
|
||||
- Added BaseWidget::ClearFocus method and OnFocus[Lost|Received] virtual methods
|
||||
- TextAreaWidget will now show a cursor as long as it has focus
|
||||
|
||||
# 0.4:
|
||||
|
||||
|
|
|
|||
|
|
@ -73,12 +73,12 @@ namespace Ndk
|
|||
private:
|
||||
void Layout() override;
|
||||
|
||||
void OnFocusLost() override;
|
||||
void OnFocusReceived() override;
|
||||
void OnKeyPressed(const Nz::WindowEvent::KeyEvent& key) override;
|
||||
void OnKeyReleased(const Nz::WindowEvent::KeyEvent& key) override;
|
||||
void OnMouseEnter() override;
|
||||
void OnMouseButtonPress(int /*x*/, int /*y*/, Nz::Mouse::Button button) override;
|
||||
void OnMouseMoved(int x, int y, int deltaX, int deltaY) override;
|
||||
void OnMouseExit() override;
|
||||
void OnTextEntered(char32_t character, bool repeated) override;
|
||||
|
||||
void RefreshCursor();
|
||||
|
|
|
|||
|
|
@ -134,6 +134,16 @@ namespace Ndk
|
|||
RefreshCursor();
|
||||
}
|
||||
|
||||
void TextAreaWidget::OnFocusLost()
|
||||
{
|
||||
m_cursorEntity->Enable(false);
|
||||
}
|
||||
|
||||
void TextAreaWidget::OnFocusReceived()
|
||||
{
|
||||
m_cursorEntity->Enable(true);
|
||||
}
|
||||
|
||||
void TextAreaWidget::OnKeyPressed(const Nz::WindowEvent::KeyEvent& key)
|
||||
{
|
||||
switch (key.code)
|
||||
|
|
@ -214,16 +224,11 @@ namespace Ndk
|
|||
{
|
||||
}
|
||||
|
||||
void TextAreaWidget::OnMouseEnter()
|
||||
{
|
||||
m_cursorEntity->Enable(true);
|
||||
}
|
||||
|
||||
void TextAreaWidget::OnMouseButtonPress(int x, int y, Nz::Mouse::Button button)
|
||||
{
|
||||
if (button == Nz::Mouse::Left)
|
||||
{
|
||||
GrabKeyboard();
|
||||
SetFocus();
|
||||
|
||||
SetCursorPosition(GetHoveredGlyph(float(x), float(y)));
|
||||
}
|
||||
|
|
@ -231,11 +236,10 @@ namespace Ndk
|
|||
|
||||
void TextAreaWidget::OnMouseMoved(int x, int y, int /*deltaX*/, int /*deltaY*/)
|
||||
{
|
||||
}
|
||||
if (m_isMouseButtonDown)
|
||||
{
|
||||
|
||||
void TextAreaWidget::OnMouseExit()
|
||||
{
|
||||
m_cursorEntity->Enable(false);
|
||||
}
|
||||
}
|
||||
|
||||
void TextAreaWidget::OnTextEntered(char32_t character, bool /*repeated*/)
|
||||
|
|
|
|||
Loading…
Reference in New Issue