diff options
author | ritsuka <[email protected]> | 2014-08-24 05:54:31 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-08-24 05:54:31 +0000 |
commit | 3857ffc03e9afa793b2820a0f1d1656d26f45225 (patch) | |
tree | b3fa05f61bd0783a0951b090f8f9f8fc583cae92 /macosx/HBHUDView.m | |
parent | b7b954e87586ccc764d23237d8fdbe6e07458da4 (diff) |
MacGui: fixed the HUD background on Snow Leopard.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6352 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBHUDView.m')
-rw-r--r-- | macosx/HBHUDView.m | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/macosx/HBHUDView.m b/macosx/HBHUDView.m index e7414ae57..bc8bb20c9 100644 --- a/macosx/HBHUDView.m +++ b/macosx/HBHUDView.m @@ -18,17 +18,6 @@ @implementation HBHUDView -- (instancetype)init -{ - self = [super init]; - if (self) - { - [self setupOldStyleHUD]; - } - - return self; -} - + (void)setupNewStyleHUD:(NSView *)view { [view setWantsLayer:YES]; @@ -43,27 +32,30 @@ [view setAppearance:[NSAppearance appearanceNamed:@"NSAppearanceNameVibrantDark"]]; } -- (void)setupOldStyleHUD +- (void)drawRect:(NSRect)dirtyRect { - [self setWantsLayer:YES]; - [self.layer setCornerRadius:14]; - - // Black transparent background and white border - CGColorRef white = CGColorCreateGenericRGB(1.0, 1.0, 1.0, 0.9); - [self.layer setBorderColor:white]; - CFRelease(white); - [self.layer setBorderWidth:2]; - - CGColorRef black = CGColorCreateGenericRGB(0.0, 0.0, 0.0, 0.6); - [self.layer setBackgroundColor:black]; - CFRelease(black); + NSGraphicsContext *theContext = [NSGraphicsContext currentContext]; + [theContext saveGraphicsState]; + + NSRect rect = NSMakeRect(0.0, 0.0, [self frame].size.width, [self frame].size.height); + + // Draw a standard HUD with black transparent background and white border. + [[NSColor colorWithCalibratedRed:0.0 green:0.0 blue:0.0 alpha:0.6] setFill]; + [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(rect, 1, 1) xRadius:14.0 yRadius:14.0] fill]; + + [[NSColor whiteColor] setStroke]; + [NSBezierPath setDefaultLineWidth:2.0]; + [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(rect, 1, 1) xRadius:14.0 yRadius:14.0] stroke]; + + [theContext restoreGraphicsState]; } - (instancetype)initWithFrame:(NSRect)frame { if (NSClassFromString(@"NSVisualEffectView")) { - // Return a NSVisualEffectView instance + // If NSVisualEffectView class is loaded + // release ourself and return a NSVisualEffectView instance instead. [self release]; self = [[NSClassFromString(@"NSVisualEffectView") alloc] initWithFrame:frame]; if (self) @@ -76,21 +68,10 @@ self = [super initWithFrame:frame]; if (self) { - [self setupOldStyleHUD]; } } return self; } -- (instancetype)initWithCoder:(NSCoder *)coder -{ - self = [super initWithCoder:coder]; - if (self) - { - [self setupOldStyleHUD]; - } - return self; -} - @end
\ No newline at end of file |