mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
Ladybird/AppKit: Display a tool tip on the tab mute button
This commit is contained in:
parent
9e4ffbcf70
commit
f374e64dfc
1 changed files with 17 additions and 0 deletions
|
@ -192,6 +192,7 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
|
|||
|
||||
case Web::HTML::AudioPlayState::Playing:
|
||||
[button setImage:[self iconForPageMuteState]];
|
||||
[button setToolTip:[self toolTipForPageMuteState]];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -210,6 +211,20 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
- (NSString*)toolTipForPageMuteState
|
||||
{
|
||||
auto& view = [[self web_view] view];
|
||||
|
||||
switch (view.page_mute_state()) {
|
||||
case Web::HTML::MuteState::Muted:
|
||||
return @"Unmute tab";
|
||||
case Web::HTML::MuteState::Unmuted:
|
||||
return @"Mute tab";
|
||||
}
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
- (void)onContentScroll:(NSNotification*)notification
|
||||
{
|
||||
[[self web_view] handleScroll];
|
||||
|
@ -321,6 +336,8 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
|
|||
auto* button = [NSButton buttonWithImage:[self iconForPageMuteState]
|
||||
target:self
|
||||
action:@selector(togglePageMuteState:)];
|
||||
[button setToolTip:[self toolTipForPageMuteState]];
|
||||
|
||||
[[self tab] setAccessoryView:button];
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue