PaintBrush: Make ImageEditor forward keydown and keyup events to tool

This commit is contained in:
Andreas Kling 2020-05-13 13:20:25 +02:00
parent 55d96715ff
commit 06405e83d7
Notes: sideshowbarker 2024-07-19 06:40:56 +09:00
2 changed files with 14 additions and 1 deletions

View file

@ -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);
}
}

View file

@ -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;