Commit graph

8 commits

Author SHA1 Message Date
Andreas Kling 8f81a3f9dd LibGUI+WindowServer: Make it possible to have checkable GActions.
They show up as checkable GButtons in GToolBar, and with (or without) check
marks in menus.

There are a bunch of places to make use of this. This patch only takes
advantage of it in the FileManager for the view type actions.
2019-04-26 21:09:56 +02:00
Andreas Kling 5c5ce4f885 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. :^)
2019-04-20 21:56:56 +02:00
Andreas Kling 054c982181 LibGUI+WindowServer: Add support for enabled/disabled actions.
The enabled state of a GAction now propagates both to any toolbar buttons
and any menu items linked to the action. Toolbar buttons are painted in
a grayed out style when disabled. Menu items are gray when disabled. :^)
2019-04-12 02:53:27 +02:00
Andreas Kling b0c673265a Applications: Map Alt+F4 to Quit in FileManager/ProcessManager/Terminal. 2019-03-03 02:52:22 +01:00
Andreas Kling 596a5ce5a4 LibGUI+WindowServer: Add app-global keyboard shortcuts.
This patch adds a GShortcut class. Each GAction can have a GShortcut which
will cause the event loop to listen for that key combination app-globally
and activate the event in case it's pressed.

The shortcut will also be displayed when the action is added to a menu.

Use this to hook up Alt+Up with the "open parent directory" action in the
FileManager app. :^)
2019-03-02 10:10:06 +01:00
Andreas Kling 2cfcbdc735 AK: Add Retained<T>, like RetainPtr, but never null.
Also use some Clang attribute wizardry to get a warning for use-after-move.
2019-02-25 12:43:52 +01:00
Andreas Kling b704d3d295 LibGUI: Add a GToolBar class that can be populated with GActions.
The same action can be added to both a menu and a toolbar.
Use this to put a toolbar into FileManager. This is pretty neat. :^)
2019-02-20 02:39:46 +01:00
Andreas Kling 3085e400bc LibGUI: Add GAction class and make GMenu deal in actions rather than strings. 2019-02-12 14:09:48 +01:00