mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 23:45:10 +00:00
LibGUI: Allow GActions to be scoped either globally or widget-locally.
This makes it possible for e.g GTextEditor to create a bunch of actions with popular shortcuts like Ctrl+C, etc, without polluting the global shortcut namespace. Widget-local actions will only activate while their corresponding widget has focus. :^)
This commit is contained in:
parent
a56e1afb64
commit
5c5ce4f885
8 changed files with 102 additions and 41 deletions
|
@ -35,27 +35,27 @@ void GTextEditor::create_actions()
|
|||
{
|
||||
m_undo_action = GAction::create("Undo", { Mod_Ctrl, Key_Z }, GraphicsBitmap::load_from_file("/res/icons/16x16/undo.png"), [&] (const GAction&) {
|
||||
// FIXME: Undo
|
||||
});
|
||||
}, this);
|
||||
|
||||
m_redo_action = GAction::create("Redo", { Mod_Ctrl, Key_Y }, GraphicsBitmap::load_from_file("/res/icons/16x16/redo.png"), [&] (const GAction&) {
|
||||
// FIXME: Redo
|
||||
});
|
||||
}, this);
|
||||
|
||||
m_cut_action = GAction::create("Cut", { Mod_Ctrl, Key_X }, GraphicsBitmap::load_from_file("/res/icons/cut16.png"), [&] (const GAction&) {
|
||||
cut();
|
||||
});
|
||||
}, this);
|
||||
|
||||
m_copy_action = GAction::create("Copy", { Mod_Ctrl, Key_C }, GraphicsBitmap::load_from_file("/res/icons/16x16/edit-copy.png"), [&] (const GAction&) {
|
||||
copy();
|
||||
});
|
||||
}, this);
|
||||
|
||||
m_paste_action = GAction::create("Paste", { Mod_Ctrl, Key_V }, GraphicsBitmap::load_from_file("/res/icons/paste16.png"), [&] (const GAction&) {
|
||||
paste();
|
||||
});
|
||||
}, this);
|
||||
|
||||
m_delete_action = GAction::create("Delete", { 0, Key_Delete }, GraphicsBitmap::load_from_file("/res/icons/16x16/delete.png"), [&] (const GAction&) {
|
||||
do_delete();
|
||||
});
|
||||
}, this);
|
||||
}
|
||||
|
||||
void GTextEditor::set_text(const String& text)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue