summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-13 13:20:25 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-13 13:21:49 +0200
commit06405e83d793eeb092c71e29d09fc85ec2d59d79 (patch)
treee4dcad6e798506fe83cf5e5795722a841a421772 /Applications
parent55d96715ff51c9076e28a7c3ffaa984f56949cf0 (diff)
downloadserenity-06405e83d793eeb092c71e29d09fc85ec2d59d79.zip
PaintBrush: Make ImageEditor forward keydown and keyup events to tool
Diffstat (limited to 'Applications')
-rw-r--r--Applications/PaintBrush/ImageEditor.cpp13
-rw-r--r--Applications/PaintBrush/ImageEditor.h2
2 files changed, 14 insertions, 1 deletions
diff --git a/Applications/PaintBrush/ImageEditor.cpp b/Applications/PaintBrush/ImageEditor.cpp
index 60718044f1..b283d73088 100644
--- a/Applications/PaintBrush/ImageEditor.cpp
+++ b/Applications/PaintBrush/ImageEditor.cpp
@@ -98,6 +98,18 @@ void ImageEditor::mouseup_event(GUI::MouseEvent& event)
m_active_tool->on_mouseup(*m_active_layer, layer_event, event);
}
+void ImageEditor::keydown_event(GUI::KeyEvent& event)
+{
+ if (m_active_tool)
+ m_active_tool->on_keydown(event);
+}
+
+void ImageEditor::keyup_event(GUI::KeyEvent& event)
+{
+ if (m_active_tool)
+ m_active_tool->on_keydown(event);
+}
+
void ImageEditor::set_active_layer(Layer* layer)
{
if (m_active_layer == layer)
@@ -162,5 +174,4 @@ void ImageEditor::set_secondary_color(Color color)
on_secondary_color_change(color);
}
-
}
diff --git a/Applications/PaintBrush/ImageEditor.h b/Applications/PaintBrush/ImageEditor.h
index 34617e48f4..aee01cbfd0 100644
--- a/Applications/PaintBrush/ImageEditor.h
+++ b/Applications/PaintBrush/ImageEditor.h
@@ -72,6 +72,8 @@ private:
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual void mousemove_event(GUI::MouseEvent&) override;
virtual void mouseup_event(GUI::MouseEvent&) override;
+ virtual void keydown_event(GUI::KeyEvent&) override;
+ virtual void keyup_event(GUI::KeyEvent&) override;
RefPtr<Image> m_image;
RefPtr<Layer> m_active_layer;