diff options
author | Yevgeny Makarov <jenkm> | 2020-11-06 19:28:58 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2020-11-06 19:55:05 +0300 |
commit | 60ad4a761ace5fffb2379b8437c26249e194ad26 (patch) | |
tree | c2d943e604bc59688d2012f7b5982c509162f4c4 /intern/ghost | |
parent | 58e9b51f9551bc68011b85554bad4dd6487576ce (diff) |
UI: Improved macOS Application Icon Progress Bar
Nicer appearance for the progress bar that is drawn over the application icon during long processes on macOS.
Differential Revision: https://developer.blender.org/D9398
Reviewed by Brecht Van Lommel
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index ebc08fb411c..360fe73b648 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -869,28 +869,26 @@ GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress) NSImage *dockIcon = [[NSImage alloc] initWithSize:NSMakeSize(128, 128)]; [dockIcon lockFocus]; - NSRect progressBox = {{4, 4}, {120, 16}}; [[NSImage imageNamed:@"NSApplicationIcon"] drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0]; - // Track & Outline - [[NSColor blackColor] setFill]; - NSRectFill(progressBox); + NSRect progressRect = {{8, 8}, {112, 14}}; + NSBezierPath *progressPath; - [[NSColor whiteColor] set]; - NSFrameRect(progressBox); + /* Draw white track. */ + [[[NSColor whiteColor] colorWithAlphaComponent: 0.6] setFill]; + progressPath = [NSBezierPath bezierPathWithRoundedRect:progressRect xRadius:7 yRadius:7]; + [progressPath fill]; - // Progress fill - progressBox = NSInsetRect(progressBox, 1, 1); - - progressBox.size.width = progressBox.size.width * progress; - NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor darkGrayColor] - endingColor:[NSColor lightGrayColor]]; - [gradient drawInRect:progressBox angle:90]; - [gradient release]; + /* Black progress fill. */ + [[[NSColor blackColor] colorWithAlphaComponent: 0.7] setFill]; + progressRect = NSInsetRect(progressRect, 2, 2); + progressRect.size.width *= progress; + progressPath = [NSBezierPath bezierPathWithRoundedRect:progressRect xRadius:5 yRadius:5]; + [progressPath fill]; [dockIcon unlockFocus]; |