mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:28:11 +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
|
@ -23,8 +23,8 @@ public:
|
|||
void set_menubar(OwnPtr<GMenuBar>&&);
|
||||
GAction* action_for_key_event(const GKeyEvent&);
|
||||
|
||||
void register_shortcut_action(Badge<GAction>, GAction&);
|
||||
void unregister_shortcut_action(Badge<GAction>, GAction&);
|
||||
void register_global_shortcut_action(Badge<GAction>, GAction&);
|
||||
void unregister_global_shortcut_action(Badge<GAction>, GAction&);
|
||||
|
||||
void show_tooltip(const String&, const Point& screen_location);
|
||||
void hide_tooltip();
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
private:
|
||||
OwnPtr<GEventLoop> m_event_loop;
|
||||
OwnPtr<GMenuBar> m_menubar;
|
||||
HashMap<GShortcut, GAction*> m_shortcut_actions;
|
||||
HashMap<GShortcut, GAction*> m_global_shortcut_actions;
|
||||
class TooltipWindow;
|
||||
TooltipWindow* m_tooltip_window { nullptr };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue