summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint/Tool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Applications/PixelPaint/Tool.cpp')
-rw-r--r--Userland/Applications/PixelPaint/Tool.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/Userland/Applications/PixelPaint/Tool.cpp b/Userland/Applications/PixelPaint/Tool.cpp
index 82b3b37424..0d747807b0 100644
--- a/Userland/Applications/PixelPaint/Tool.cpp
+++ b/Userland/Applications/PixelPaint/Tool.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2021, Mustafa Quraish <mustafa@cs.toronto.edu>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -28,4 +29,28 @@ void Tool::set_action(GUI::Action* action)
m_action = action;
}
+void Tool::on_keydown(GUI::KeyEvent& event)
+{
+ switch (event.key()) {
+ case KeyCode::Key_LeftBracket:
+ if (m_primary_slider)
+ m_primary_slider->set_value(m_primary_slider->value() - 1);
+ break;
+ case KeyCode::Key_RightBracket:
+ if (m_primary_slider)
+ m_primary_slider->set_value(m_primary_slider->value() + 1);
+ break;
+ case KeyCode::Key_LeftBrace:
+ if (m_secondary_slider)
+ m_secondary_slider->set_value(m_secondary_slider->value() - 1);
+ break;
+ case KeyCode::Key_RightBrace:
+ if (m_secondary_slider)
+ m_secondary_slider->set_value(m_secondary_slider->value() + 1);
+ break;
+ default:
+ break;
+ }
+}
+
}