mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:37:34 +00:00
LibGUI: Add GUI::CommonActions::make_select_all_action() :^)
This commit is contained in:
parent
8001a85fc7
commit
eec22acb8e
3 changed files with 7 additions and 2 deletions
|
@ -114,6 +114,11 @@ NonnullRefPtr<Action> make_reload_action(Function<void(Action&)> callback, Core:
|
||||||
return Action::create("Reload", { Mod_Ctrl, Key_R }, Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"), move(callback), parent);
|
return Action::create("Reload", { Mod_Ctrl, Key_R }, Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"), move(callback), parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NonnullRefPtr<Action> make_select_all_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||||
|
{
|
||||||
|
return Action::create("Select all", { Mod_Ctrl, Key_A }, Gfx::Bitmap::load_from_file("/res/icons/16x16/select-all.png"), move(callback), parent);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Action::Action(const StringView& text, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
|
Action::Action(const StringView& text, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
|
||||||
|
|
|
@ -58,6 +58,7 @@ namespace CommonActions {
|
||||||
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)>, Core::Object* parent = nullptr);
|
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)>, Core::Object* parent = nullptr);
|
||||||
NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||||
NonnullRefPtr<Action> make_reload_action(Function<void(Action&)>, Core::Object* parent = nullptr);
|
NonnullRefPtr<Action> make_reload_action(Function<void(Action&)>, Core::Object* parent = nullptr);
|
||||||
|
NonnullRefPtr<Action> make_select_all_action(Function<void(Action&)>, Core::Object* parent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Action final : public Core::Object {
|
class Action final : public Core::Object {
|
||||||
|
|
|
@ -98,8 +98,7 @@ void TextEditor::create_actions()
|
||||||
},
|
},
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
m_select_all_action = Action::create(
|
m_select_all_action = CommonActions::make_select_all_action([this](auto&) { select_all(); }, this);
|
||||||
"Select all", { Mod_Ctrl, Key_A }, Gfx::Bitmap::load_from_file("/res/icons/16x16/select-all.png"), [this](auto&) { select_all(); }, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditor::set_text(const StringView& text)
|
void TextEditor::set_text(const StringView& text)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue