From f0915641c58295b8f117d04845d31724aae86ea6 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 20 Mar 2019 18:16:04 +0100 Subject: TextEditor: Add "delete" action. --- Applications/TextEditor/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Applications/TextEditor/main.cpp') diff --git a/Applications/TextEditor/main.cpp b/Applications/TextEditor/main.cpp index 16023de124..71ae2ad5d1 100644 --- a/Applications/TextEditor/main.cpp +++ b/Applications/TextEditor/main.cpp @@ -77,6 +77,10 @@ int main(int argc, char** argv) text_editor->paste(); }); + auto delete_action = GAction::create("Delete", { 0, Key_Delete }, GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/16x16/delete.rgb", { 16, 16 }), [&] (const GAction&) { + text_editor->delete_selection(); + }); + auto menubar = make(); auto app_menu = make("TextEditor"); app_menu->add_action(GAction::create("Quit", { Mod_Alt, Key_F4 }, [] (const GAction&) { @@ -98,6 +102,7 @@ int main(int argc, char** argv) edit_menu->add_action(cut_action.copy_ref()); edit_menu->add_action(copy_action.copy_ref()); edit_menu->add_action(paste_action.copy_ref()); + edit_menu->add_action(delete_action.copy_ref()); menubar->add_menu(move(edit_menu)); auto font_menu = make("Font"); @@ -126,6 +131,7 @@ int main(int argc, char** argv) toolbar->add_action(move(cut_action)); toolbar->add_action(move(copy_action)); toolbar->add_action(move(paste_action)); + toolbar->add_action(move(delete_action)); toolbar->add_separator(); -- cgit v1.2.3