mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
LibGUI: Start bringing up GTextBox in the standalone world.
This commit is contained in:
parent
57fb027216
commit
d72575d196
Notes:
sideshowbarker
2024-07-19 15:56:23 +09:00
Author: https://github.com/awesomekling
Commit: d72575d196
10 changed files with 165 additions and 121 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <SharedGraphics/CharacterBitmap.h>
|
||||
#include <SharedGraphics/Font.h>
|
||||
#include <SharedGraphics/Painter.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
|
||||
GTextBox::GTextBox(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
|
@ -91,21 +92,21 @@ void GTextBox::handle_backspace()
|
|||
void GTextBox::keydown_event(GKeyEvent& event)
|
||||
{
|
||||
switch (event.key()) {
|
||||
case GKeyboardKey::LeftArrow:
|
||||
case KeyCode::Key_Left:
|
||||
if (m_cursorPosition)
|
||||
--m_cursorPosition;
|
||||
m_cursorBlinkState = true;
|
||||
update();
|
||||
return;
|
||||
case GKeyboardKey::RightArrow:
|
||||
case KeyCode::Key_Right:
|
||||
if (m_cursorPosition < m_text.length())
|
||||
++m_cursorPosition;
|
||||
m_cursorBlinkState = true;
|
||||
update();
|
||||
return;
|
||||
case GKeyboardKey::Backspace:
|
||||
case KeyCode::Key_Backspace:
|
||||
return handle_backspace();
|
||||
case GKeyboardKey::Return:
|
||||
case KeyCode::Key_Return:
|
||||
if (onReturnPressed)
|
||||
onReturnPressed(*this);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue