mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibGUI: Update buttons' text/tooltips in Action::set_text
This allows Actions that change based on some state to update their associated buttons' text and tooltips to match their new text. The play/pause button in SoundPlayer (and VideoPlayer if it's merged) will now change tooltips when the playback changes state, rather than always displaying "Play (Space)".
This commit is contained in:
parent
1de1d6423b
commit
e20756f9f7
4 changed files with 23 additions and 12 deletions
|
@ -241,6 +241,9 @@ void Action::set_text(String text)
|
|||
if (m_text == text)
|
||||
return;
|
||||
m_text = move(text);
|
||||
for_each_toolbar_button([&](auto& button) {
|
||||
button.set_text_from_action();
|
||||
});
|
||||
for_each_menu_item([&](auto& menu_item) {
|
||||
menu_item.update_from_action({});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue