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
This commit is contained in:
parent
58e9b51f95
commit
60ad4a761a
|
@ -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];
|
||||
|
||||
|
|
Loading…
Reference in New Issue