mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 01:41:59 -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:
|
case Web::HTML::AudioPlayState::Playing:
|
||||||
[button setImage:[self iconForPageMuteState]];
|
[button setImage:[self iconForPageMuteState]];
|
||||||
|
[button setToolTip:[self toolTipForPageMuteState]];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,6 +211,20 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
|
||||||
VERIFY_NOT_REACHED();
|
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
|
- (void)onContentScroll:(NSNotification*)notification
|
||||||
{
|
{
|
||||||
[[self web_view] handleScroll];
|
[[self web_view] handleScroll];
|
||||||
|
@ -321,6 +336,8 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
|
||||||
auto* button = [NSButton buttonWithImage:[self iconForPageMuteState]
|
auto* button = [NSButton buttonWithImage:[self iconForPageMuteState]
|
||||||
target:self
|
target:self
|
||||||
action:@selector(togglePageMuteState:)];
|
action:@selector(togglePageMuteState:)];
|
||||||
|
[button setToolTip:[self toolTipForPageMuteState]];
|
||||||
|
|
||||||
[[self tab] setAccessoryView:button];
|
[[self tab] setAccessoryView:button];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue