mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 14:35:07 +00:00
LibGUI: Allow finding the source of a GAction activation
When a GAction is activated by a menu, or by a toolbar button, you can now use GAction::activator() to get a pointer to whomever activated it. This can be used to implement context-specific behaviors in situations where the same action is exposed through multiple paths. This addresses an issue that was brought up in #826.
This commit is contained in:
parent
fd5eb79d19
commit
571c4d3fb8
4 changed files with 11 additions and 4 deletions
|
@ -69,7 +69,7 @@ void GButton::click()
|
|||
if (on_click)
|
||||
on_click(*this);
|
||||
if (m_action)
|
||||
m_action->activate();
|
||||
m_action->activate(this);
|
||||
}
|
||||
|
||||
bool GButton::supports_keyboard_activation() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue