mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
Add TextBox::onReturnPressed.
This commit is contained in:
@@ -56,7 +56,7 @@ void TextBox::paintEvent(PaintEvent&)
|
||||
painter.drawBitmap({x, y}, *bitmap, Color::Black);
|
||||
}
|
||||
|
||||
if (m_cursorBlinkState) {
|
||||
if (isFocused() && m_cursorBlinkState) {
|
||||
unsigned visibleCursorPosition = m_cursorPosition - firstVisibleChar;
|
||||
Rect cursorRect(innerRect.x() + visibleCursorPosition * font.glyphWidth(), innerRect.y(), 1, innerRect.height());
|
||||
painter.fillRect(cursorRect, foregroundColor());
|
||||
@@ -107,6 +107,10 @@ void TextBox::keyDownEvent(KeyEvent& event)
|
||||
return;
|
||||
case KeyboardKey::Backspace:
|
||||
return handleBackspace();
|
||||
case KeyboardKey::Return:
|
||||
if (onReturnPressed)
|
||||
onReturnPressed(*this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.text().isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user