From 0d8373287ccc01089f558a33d9150281fd63a8a8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 23 Oct 2021 14:31:48 +0200 Subject: LibGUI: Add GUI::KeyEvent::is_arrow_key() --- Userland/Libraries/LibGUI/Event.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Userland') diff --git a/Userland/Libraries/LibGUI/Event.h b/Userland/Libraries/LibGUI/Event.h index 8a2b732773..86c5011142 100644 --- a/Userland/Libraries/LibGUI/Event.h +++ b/Userland/Libraries/LibGUI/Event.h @@ -346,6 +346,19 @@ public: String to_string() const; + bool is_arrow_key() const + { + switch (m_key) { + case KeyCode::Key_Up: + case KeyCode::Key_Down: + case KeyCode::Key_Left: + case KeyCode::Key_Right: + return true; + default: + return false; + } + } + private: friend class WindowServerConnection; KeyCode m_key { KeyCode::Key_Invalid }; -- cgit v1.2.3