diff --git a/Base/res/icons/16x16/move-to-back.png b/Base/res/icons/16x16/move-to-back.png new file mode 100644 index 0000000000000000000000000000000000000000..a7556652f3035dc5b9b27d0e1fe670ca33f70451 Binary files /dev/null and b/Base/res/icons/16x16/move-to-back.png differ diff --git a/Base/res/icons/16x16/move-to-front.png b/Base/res/icons/16x16/move-to-front.png new file mode 100644 index 0000000000000000000000000000000000000000..17e33bbf0c7f72ffca52bd28355d6d86ebc9745e Binary files /dev/null and b/Base/res/icons/16x16/move-to-front.png differ diff --git a/DevTools/VisualBuilder/VBForm.cpp b/DevTools/VisualBuilder/VBForm.cpp index 94891cfbe33843baebde7cca0027794266ad5603..cb7f140b71c92c491230c73d4b0beab6b2024988 100644 --- a/DevTools/VisualBuilder/VBForm.cpp +++ b/DevTools/VisualBuilder/VBForm.cpp @@ -27,11 +27,11 @@ VBForm::VBForm(const String& name, GWidget* parent) set_greedy_for_hits(true); m_context_menu = make(); - m_context_menu->add_action(GAction::create("Move to front", [this](auto&) { + m_context_menu->add_action(GCommonActions::make_move_to_front_action([this](auto&) { if (auto* widget = single_selected_widget()) widget->gwidget()->move_to_front(); })); - m_context_menu->add_action(GAction::create("Move to back", [this](auto&) { + m_context_menu->add_action(GCommonActions::make_move_to_back_action([this](auto&) { if (auto* widget = single_selected_widget()) widget->gwidget()->move_to_back(); })); diff --git a/Libraries/LibGUI/GAction.cpp b/Libraries/LibGUI/GAction.cpp index c5df20869bcac53ea35a24349fd094c1e0988a86..61b9a775eefd592027c27c1b3184ee648270c73a 100644 --- a/Libraries/LibGUI/GAction.cpp +++ b/Libraries/LibGUI/GAction.cpp @@ -6,6 +6,16 @@ namespace GCommonActions { +NonnullRefPtr make_move_to_front_action(Function callback, GWidget* widget) +{ + return GAction::create("Move to front", { Mod_Ctrl | Mod_Shift, Key_Up }, GraphicsBitmap::load_from_file("/res/icons/16x16/move-to-front.png"), move(callback), widget); +} + +NonnullRefPtr make_move_to_back_action(Function callback, GWidget* widget) +{ + return GAction::create("Move to back", { Mod_Ctrl | Mod_Shift, Key_Down }, GraphicsBitmap::load_from_file("/res/icons/16x16/move-to-back.png"), move(callback), widget); +} + NonnullRefPtr make_undo_action(Function callback, GWidget* widget) { return GAction::create("Undo", { Mod_Ctrl, Key_Z }, GraphicsBitmap::load_from_file("/res/icons/16x16/undo.png"), move(callback), widget); diff --git a/Libraries/LibGUI/GAction.h b/Libraries/LibGUI/GAction.h index f17cd377e28b856ffa8fc496de27b63b0e08bdb2..b3c591098a7ff136540a9c6534bd814a0dabb4f5 100644 --- a/Libraries/LibGUI/GAction.h +++ b/Libraries/LibGUI/GAction.h @@ -25,6 +25,8 @@ NonnullRefPtr make_cut_action(Function, GWidget* widget NonnullRefPtr make_copy_action(Function, GWidget* widget = nullptr); NonnullRefPtr make_paste_action(Function, GWidget* widget = nullptr); NonnullRefPtr make_delete_action(Function, GWidget* widget = nullptr); +NonnullRefPtr make_move_to_front_action(Function, GWidget* widget = nullptr); +NonnullRefPtr make_move_to_back_action(Function, GWidget* widget = nullptr); NonnullRefPtr make_quit_action(Function); };