Skip to content
Snippets Groups Projects
Commit b5962bbd authored by George Nachman's avatar George Nachman
Browse files

Update announcement button appearance when window appearance changes. Issue 6091

parent f75987b1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -16,6 +16,7 @@
#import "iTerm.h"
#import "iTermAboutWindow.h"
#import "iTermAdvancedSettingsModel.h"
#import "iTermAnnouncementView.h"
#import "iTermApplication.h"
#import "iTermApplicationDelegate.h"
#import "iTermColorPresets.h"
Loading
Loading
@@ -4792,6 +4793,7 @@ ITERM_WEAKLY_REFERENCEABLE
} else {
self.window.appearance = nil;
}
[[NSNotificationCenter defaultCenter] postNotificationName:iTermWindowAppearanceDidChange object:self.window];
}
 
 
Loading
Loading
Loading
Loading
@@ -8,6 +8,8 @@
 
#import <Cocoa/Cocoa.h>
 
extern NSString *const iTermWindowAppearanceDidChange;
typedef NS_ENUM(NSInteger, iTermAnnouncementViewStyle) {
kiTermAnnouncementViewStyleWarning,
kiTermAnnouncementViewStyleQuestion
Loading
Loading
Loading
Loading
@@ -12,6 +12,7 @@
#import "NSStringITerm.h"
 
static const CGFloat kMargin = 8;
NSString *const iTermWindowAppearanceDidChange = @"iTermWindowAppearanceDidChange";
 
@interface iTermAnnouncementInternalView : NSView
@end
Loading
Loading
@@ -108,11 +109,17 @@ static const CGFloat kMargin = 8;
 
_actionButtons = [[NSMutableArray alloc] init];
self.autoresizesSubviews = YES;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowAppearanceDidChange:)
name:iTermWindowAppearanceDidChange
object:nil];
}
return self;
}
 
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_block release];
[_textView release];
[_icon release];
Loading
Loading
@@ -201,6 +208,10 @@ static const CGFloat kMargin = 8;
}
 
- (void)viewDidMoveToWindow {
[self updateAppearance];
}
- (void)updateAppearance {
if ([self.window.appearance.name isEqual:NSAppearanceNameVibrantDark]) {
for (NSButton *button in _actionButtons) {
button.appearance = [NSAppearance appearanceNamed:NSAppearanceNameVibrantLight];
Loading
Loading
@@ -208,6 +219,12 @@ static const CGFloat kMargin = 8;
}
}
 
- (void)windowAppearanceDidChange:(NSNotification *)notification {
if (notification.object == self.window) {
[self updateAppearance];
}
}
- (NSImage *)iconImage {
NSString *iconString;
switch (_style) {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment