summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-23 14:31:48 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-23 16:10:44 +0200
commit0d8373287ccc01089f558a33d9150281fd63a8a8 (patch)
treec168dea03b5b1f112e8e3c29236e9748bd450ec4 /Userland
parentd91732f959d5b70feafefad7a20689775ae47631 (diff)
downloadserenity-0d8373287ccc01089f558a33d9150281fd63a8a8.zip
LibGUI: Add GUI::KeyEvent::is_arrow_key()
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/Event.h13
1 files changed, 13 insertions, 0 deletions
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 };