LibGUI: Add GActionGroup, a way to group a bunch of GActions.

This can be used to make a bunch of actions mutually exclusive.
This patch only implements the exclusivity behavior for buttons.
This commit is contained in:
Andreas Kling 2019-07-09 22:10:03 +02:00
commit 7083a0104a
Notes: sideshowbarker 2024-07-19 13:21:12 +09:00
9 changed files with 97 additions and 6 deletions

View file

@ -0,0 +1,14 @@
#include <LibGUI/GAction.h>
#include <LibGUI/GActionGroup.h>
void GActionGroup::add_action(GAction& action)
{
action.set_group({}, this);
m_actions.set(&action);
}
void GActionGroup::remove_action(GAction& action)
{
action.set_group({}, nullptr);
m_actions.remove(&action);
}