├── .gitignore ├── GRProgressIndicator ├── GRProgressIndicator.h ├── GRProgressIndicator.m └── GRProgressIndicatorThemes.h ├── GRProgressIndicatorDemo.gif ├── LICENSE ├── Progressbar Fun.xcodeproj └── project.pbxproj ├── Progressbar Fun ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── MainMenu.xib ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── pi_bottomFill.imageset │ │ ├── Contents.json │ │ ├── pi_bottomFill.png │ │ └── pi_bottomFill@2x.png │ ├── pi_bottomLeft.imageset │ │ ├── Contents.json │ │ ├── pi_bottomLeft.png │ │ └── pi_bottomLeft@2x.png │ ├── pi_bottomRight.imageset │ │ ├── Contents.json │ │ ├── pi_bottomRight.png │ │ └── pi_bottomRight@2x.png │ ├── pi_centerFill.imageset │ │ ├── Contents.json │ │ ├── pi_centerFill.png │ │ └── pi_centerFill@2x.png │ ├── pi_leftFill.imageset │ │ ├── Contents.json │ │ ├── pi_leftFill.png │ │ └── pi_leftFill@2x.png │ ├── pi_rightFill.imageset │ │ ├── Contents.json │ │ ├── pi_rightFill.png │ │ └── pi_rightFill@2x.png │ ├── pi_topFill.imageset │ │ ├── Contents.json │ │ ├── pi_topFill.png │ │ └── pi_topFill@2x.png │ ├── pi_topLeft.imageset │ │ ├── Contents.json │ │ ├── pi_topLeft.png │ │ └── pi_topLeft@2x.png │ └── pi_topRight.imageset │ │ ├── Contents.json │ │ ├── pi_topRight.png │ │ └── pi_topRight@2x.png ├── Progressbar Fun-Info.plist ├── Progressbar Fun-Prefix.pch ├── en.lproj │ ├── Credits.rtf │ └── InfoPlist.strings └── main.m └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | __MACOSX 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | *.xcworkspace 12 | !default.xcworkspace 13 | xcuserdata 14 | profile 15 | *.moved-aside 16 | DerivedData 17 | .idea/ 18 | _design/ -------------------------------------------------------------------------------- /GRProgressIndicator/GRProgressIndicator.h: -------------------------------------------------------------------------------- 1 | // 2 | // GRProgressIndicator.h 3 | // GRProgressIndicator 4 | // 5 | // Created by Guilherme Rambo on 13/12/13. 6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GRProgressIndicatorThemes.h" 11 | 12 | @interface GRProgressIndicator : NSView 13 | 14 | @property (nonatomic, assign) double doubleValue; 15 | @property (nonatomic, assign) double minValue; 16 | @property (nonatomic, assign) double maxValue; 17 | 18 | @property (nonatomic, assign, getter = isIndeterminate) BOOL indeterminate; 19 | 20 | @property (nonatomic, assign) GRProgressIndicatorTheme_t theme; 21 | 22 | - (void)startAnimation:(id)sender; 23 | - (void)stopAnimation:(id)sender; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /GRProgressIndicator/GRProgressIndicator.m: -------------------------------------------------------------------------------- 1 | // 2 | // GRProgressIndicator.m 3 | // GRProgressIndicator 4 | // 5 | // Created by Guilherme Rambo on 13/12/13. 6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import "GRProgressIndicator.h" 10 | 11 | #import 12 | 13 | // progress bar corner radius 14 | #define kProgressBarCornerRadius 3.0 15 | 16 | // defines the width and spacing of the "water" particles 17 | #define kParticleWidth 34.0 18 | #define kParticleSpacing 15.0 19 | 20 | // defines the duration of each animation step, 21 | // tweak this to change animation behavior 22 | #define kProgressIndicatorAnimationSleepInterval 0.02 23 | 24 | // defines the duration of the animation used 25 | // when doubleValue is changed 26 | #define kDoubleValueAnimationDuration 0.3 27 | 28 | @interface GRProgressIndicator () 29 | 30 | @property (nonatomic, assign) double internalDoubleValue; 31 | 32 | @end 33 | 34 | @implementation GRProgressIndicator 35 | { 36 | // cached data 37 | NSColor *_particleGrad1; 38 | NSColor *_particleGrad2; 39 | NSGradient *_particleGradient; 40 | NSImage *_bezelTopLeftCorner; 41 | NSImage *_bezelTopEdgeFill; 42 | NSImage *_bezelTopRightCorner; 43 | NSImage *_bezelLeftEdgeFill; 44 | NSImage *_bezelCenterFill; 45 | NSImage *_bezelRightEdgeFill; 46 | NSImage *_bezelBottomLeftCorner; 47 | NSImage *_bezelBottomEdgeFill; 48 | NSImage *_bezelBottomRightCorner; 49 | NSShadow *_progressBarInnerShadow; 50 | NSGradient *_progressBarGradient; 51 | NSGradient *_progressBarLineGradient; 52 | NSColor *_indeterminateGradientColor0; 53 | NSColor *_indeterminateGradientColor1; 54 | NSColor *_indeterminateGradientColor2; 55 | NSColor *_indeterminateGradientColor3; 56 | NSGradient *_indeterminateGradient; 57 | 58 | // theme colors 59 | NSColor *_gradientColor0; 60 | NSColor *_gradientColor1; 61 | NSColor *_gradientColor2; 62 | NSColor *_gradientColor3; 63 | NSColor *_gradientColor4; 64 | NSColor *_graphiteGradientColor0; 65 | NSColor *_graphiteGradientColor1; 66 | NSColor *_graphiteGradientColor2; 67 | NSColor *_graphiteGradientColor3; 68 | NSColor *_graphiteGradientColor4; 69 | NSColor *_inactiveGradientColor0; 70 | NSColor *_inactiveGradientColor1; 71 | NSColor *_inactiveGradientColor2; 72 | NSColor *_inactiveGradientColor3; 73 | NSColor *_inactiveGradientColor4; 74 | 75 | // defines if we are currently animating or not 76 | BOOL _animating; 77 | 78 | // animation counter 79 | int _currentAnimationStep; 80 | } 81 | 82 | - (id)initWithFrame:(NSRect)frame 83 | { 84 | self = [super initWithFrame:frame]; 85 | if (self) { 86 | // initialize images used to draw our bezel 87 | _bezelTopLeftCorner = [NSImage imageNamed:@"pi_topLeft"]; 88 | _bezelTopEdgeFill = [NSImage imageNamed:@"pi_topFill"]; 89 | _bezelTopRightCorner = [NSImage imageNamed:@"pi_topRight"]; 90 | _bezelLeftEdgeFill = [NSImage imageNamed:@"pi_leftFill"]; 91 | _bezelCenterFill = [NSImage imageNamed:@"pi_centerFill"]; 92 | _bezelRightEdgeFill = [NSImage imageNamed:@"pi_rightFill"]; 93 | _bezelBottomLeftCorner = [NSImage imageNamed:@"pi_bottomLeft"]; 94 | _bezelBottomEdgeFill = [NSImage imageNamed:@"pi_bottomFill"]; 95 | _bezelBottomRightCorner = [NSImage imageNamed:@"pi_bottomRight"]; 96 | 97 | // setup defaults 98 | self.theme = GRProgressIndicatorThemeDefault; 99 | self.minValue = 0; 100 | self.maxValue = 100; 101 | self.doubleValue = 0; 102 | } 103 | return self; 104 | } 105 | 106 | - (void)setTheme:(GRProgressIndicatorTheme_t)theme 107 | { 108 | _theme = theme; 109 | [self setupTheme]; 110 | _progressBarGradient = nil; 111 | } 112 | 113 | // set up instance variables according to the current theme 114 | - (void)setupTheme 115 | { 116 | // by default the inactive state and graphite look don't change 117 | // for each theme, but this can be changed by creating new constants and 118 | // using them here, that's why I've decided to keep setting "_graphiteGradientColor..." 119 | // and "_inactiveGradientColor..." in all cases 120 | switch (self.theme) { 121 | case GRProgressIndicatorThemeForceGraphite: 122 | _gradientColor0 = kProgressBarGraphiteGradientColor0; 123 | _gradientColor1 = kProgressBarGraphiteGradientColor1; 124 | _gradientColor2 = kProgressBarGraphiteGradientColor2; 125 | _gradientColor3 = kProgressBarGraphiteGradientColor3; 126 | _gradientColor4 = kProgressBarGraphiteGradientColor4; 127 | _graphiteGradientColor0 = kProgressBarGraphiteGradientColor0; 128 | _graphiteGradientColor1 = kProgressBarGraphiteGradientColor1; 129 | _graphiteGradientColor2 = kProgressBarGraphiteGradientColor2; 130 | _graphiteGradientColor3 = kProgressBarGraphiteGradientColor3; 131 | _graphiteGradientColor4 = kProgressBarGraphiteGradientColor4; 132 | _inactiveGradientColor0 = kProgressBarInactiveGradientColor0; 133 | _inactiveGradientColor1 = kProgressBarInactiveGradientColor1; 134 | _inactiveGradientColor2 = kProgressBarInactiveGradientColor2; 135 | _inactiveGradientColor3 = kProgressBarInactiveGradientColor3; 136 | _inactiveGradientColor4 = kProgressBarInactiveGradientColor4; 137 | break; 138 | case GRProgressIndicatorThemeGreen: 139 | _gradientColor0 = kProgressBarGreenGradientColor0; 140 | _gradientColor1 = kProgressBarGreenGradientColor1; 141 | _gradientColor2 = kProgressBarGreenGradientColor2; 142 | _gradientColor3 = kProgressBarGreenGradientColor3; 143 | _gradientColor4 = kProgressBarGreenGradientColor4; 144 | _graphiteGradientColor0 = kProgressBarGraphiteGradientColor0; 145 | _graphiteGradientColor1 = kProgressBarGraphiteGradientColor1; 146 | _graphiteGradientColor2 = kProgressBarGraphiteGradientColor2; 147 | _graphiteGradientColor3 = kProgressBarGraphiteGradientColor3; 148 | _graphiteGradientColor4 = kProgressBarGraphiteGradientColor4; 149 | _inactiveGradientColor0 = kProgressBarInactiveGradientColor0; 150 | _inactiveGradientColor1 = kProgressBarInactiveGradientColor1; 151 | _inactiveGradientColor2 = kProgressBarInactiveGradientColor2; 152 | _inactiveGradientColor3 = kProgressBarInactiveGradientColor3; 153 | _inactiveGradientColor4 = kProgressBarInactiveGradientColor4; 154 | break; 155 | case GRProgressIndicatorThemeRed: 156 | _gradientColor0 = kProgressBarRedGradientColor0; 157 | _gradientColor1 = kProgressBarRedGradientColor1; 158 | _gradientColor2 = kProgressBarRedGradientColor2; 159 | _gradientColor3 = kProgressBarRedGradientColor3; 160 | _gradientColor4 = kProgressBarRedGradientColor4; 161 | _graphiteGradientColor0 = kProgressBarGraphiteGradientColor0; 162 | _graphiteGradientColor1 = kProgressBarGraphiteGradientColor1; 163 | _graphiteGradientColor2 = kProgressBarGraphiteGradientColor2; 164 | _graphiteGradientColor3 = kProgressBarGraphiteGradientColor3; 165 | _graphiteGradientColor4 = kProgressBarGraphiteGradientColor4; 166 | _inactiveGradientColor0 = kProgressBarInactiveGradientColor0; 167 | _inactiveGradientColor1 = kProgressBarInactiveGradientColor1; 168 | _inactiveGradientColor2 = kProgressBarInactiveGradientColor2; 169 | _inactiveGradientColor3 = kProgressBarInactiveGradientColor3; 170 | _inactiveGradientColor4 = kProgressBarInactiveGradientColor4; 171 | break; 172 | case GRProgressIndicatorThemePink: 173 | _gradientColor0 = kProgressBarPinkGradientColor0; 174 | _gradientColor1 = kProgressBarPinkGradientColor1; 175 | _gradientColor2 = kProgressBarPinkGradientColor2; 176 | _gradientColor3 = kProgressBarPinkGradientColor3; 177 | _gradientColor4 = kProgressBarPinkGradientColor4; 178 | _graphiteGradientColor0 = kProgressBarGraphiteGradientColor0; 179 | _graphiteGradientColor1 = kProgressBarGraphiteGradientColor1; 180 | _graphiteGradientColor2 = kProgressBarGraphiteGradientColor2; 181 | _graphiteGradientColor3 = kProgressBarGraphiteGradientColor3; 182 | _graphiteGradientColor4 = kProgressBarGraphiteGradientColor4; 183 | _inactiveGradientColor0 = kProgressBarInactiveGradientColor0; 184 | _inactiveGradientColor1 = kProgressBarInactiveGradientColor1; 185 | _inactiveGradientColor2 = kProgressBarInactiveGradientColor2; 186 | _inactiveGradientColor3 = kProgressBarInactiveGradientColor3; 187 | _inactiveGradientColor4 = kProgressBarInactiveGradientColor4; 188 | break; 189 | case GRProgressIndicatorThemeOrange: 190 | _gradientColor0 = kProgressBarOrangeGradientColor0; 191 | _gradientColor1 = kProgressBarOrangeGradientColor1; 192 | _gradientColor2 = kProgressBarOrangeGradientColor2; 193 | _gradientColor3 = kProgressBarOrangeGradientColor3; 194 | _gradientColor4 = kProgressBarOrangeGradientColor4; 195 | _graphiteGradientColor0 = kProgressBarGraphiteGradientColor0; 196 | _graphiteGradientColor1 = kProgressBarGraphiteGradientColor1; 197 | _graphiteGradientColor2 = kProgressBarGraphiteGradientColor2; 198 | _graphiteGradientColor3 = kProgressBarGraphiteGradientColor3; 199 | _graphiteGradientColor4 = kProgressBarGraphiteGradientColor4; 200 | _inactiveGradientColor0 = kProgressBarInactiveGradientColor0; 201 | _inactiveGradientColor1 = kProgressBarInactiveGradientColor1; 202 | _inactiveGradientColor2 = kProgressBarInactiveGradientColor2; 203 | _inactiveGradientColor3 = kProgressBarInactiveGradientColor3; 204 | _inactiveGradientColor4 = kProgressBarInactiveGradientColor4; 205 | break; 206 | default: 207 | _gradientColor0 = kProgressBarGradientColor0; 208 | _gradientColor1 = kProgressBarGradientColor1; 209 | _gradientColor2 = kProgressBarGradientColor2; 210 | _gradientColor3 = kProgressBarGradientColor3; 211 | _gradientColor4 = kProgressBarGradientColor4; 212 | _graphiteGradientColor0 = kProgressBarGraphiteGradientColor0; 213 | _graphiteGradientColor1 = kProgressBarGraphiteGradientColor1; 214 | _graphiteGradientColor2 = kProgressBarGraphiteGradientColor2; 215 | _graphiteGradientColor3 = kProgressBarGraphiteGradientColor3; 216 | _graphiteGradientColor4 = kProgressBarGraphiteGradientColor4; 217 | _inactiveGradientColor0 = kProgressBarInactiveGradientColor0; 218 | _inactiveGradientColor1 = kProgressBarInactiveGradientColor1; 219 | _inactiveGradientColor2 = kProgressBarInactiveGradientColor2; 220 | _inactiveGradientColor3 = kProgressBarInactiveGradientColor3; 221 | _inactiveGradientColor4 = kProgressBarInactiveGradientColor4; 222 | break; 223 | } 224 | 225 | if(!_animating) [self setNeedsDisplay:YES]; 226 | } 227 | 228 | // setup our observation of the window's properties 229 | - (void)viewDidMoveToWindow 230 | { 231 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 232 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowKeyChanged:) name:NSWindowDidBecomeKeyNotification object:self.window]; 233 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowKeyChanged:) name:NSWindowDidResignKeyNotification object:self.window]; 234 | } 235 | 236 | - (void)windowKeyChanged:(NSNotification *)notification 237 | { 238 | _progressBarGradient = nil; 239 | 240 | // we avoid calling setNeedsDisplay: while animation is on to prevent glitches 241 | if(!_animating) [self setNeedsDisplay:YES]; 242 | } 243 | 244 | - (void)setDoubleValue:(double)doubleValue 245 | { 246 | // the setting of the doubleValue is not animated if the new value is less than 247 | // the current value and if the PI is indeterminate 248 | if (doubleValue > _doubleValue && !self.isIndeterminate) { 249 | self.animator.internalDoubleValue = doubleValue; 250 | } else { 251 | self.internalDoubleValue = doubleValue; 252 | } 253 | 254 | _doubleValue = doubleValue; 255 | } 256 | 257 | - (void)setInternalDoubleValue:(double)internalDoubleValue 258 | { 259 | _internalDoubleValue = internalDoubleValue; 260 | 261 | // we only call setNeedsDisplay: if the animation is not in progress, 262 | // if we where to call It during animation, this could cause glitches 263 | if(!_animating) [self setNeedsDisplay:YES]; 264 | } 265 | 266 | - (void)setIndeterminate:(BOOL)indeterminate 267 | { 268 | _indeterminate = indeterminate; 269 | } 270 | 271 | // calculate the rect of the progress bar inside based on the current doubleValue 272 | - (NSRect)progressBarRect 273 | { 274 | double scaledDoubleValue; 275 | 276 | if (_indeterminate) { 277 | scaledDoubleValue = 1.0; // 100% 278 | } else { 279 | 280 | // the below line is wrong. It just multiplies internalDoubleValue by 1.0 281 | // scaledDoubleValue = _internalDoubleValue*(_maxValue-_minValue)/_maxValue-_minValue; 282 | 283 | scaledDoubleValue = (_internalDoubleValue-_minValue)/(_maxValue-_minValue); 284 | } 285 | 286 | return NSMakeRect(1, 2, round(scaledDoubleValue*NSWidth(self.frame)), NSHeight(self.frame)-3); 287 | } 288 | 289 | - (void)startAnimation:(id)sender 290 | { 291 | if(_animating) return; 292 | 293 | // detach a new thread to handle animation updates 294 | [NSThread detachNewThreadSelector:@selector(render:) toTarget:self withObject:nil]; 295 | } 296 | 297 | - (void)stopAnimation:(id)sender 298 | { 299 | if(!_animating) return; 300 | 301 | _animating = NO; 302 | [self setNeedsDisplay:YES]; 303 | } 304 | 305 | - (id)animationForKey:(NSString *)key 306 | { 307 | // our internalDoubleValue is used to make the value increments smoother 308 | if ([key isEqualToString:@"internalDoubleValue"]) { 309 | CABasicAnimation *animation = [CABasicAnimation animation]; 310 | animation.duration = kDoubleValueAnimationDuration; 311 | 312 | return animation; 313 | } 314 | 315 | return [super animationForKey:key]; 316 | } 317 | 318 | // animation thread loop 319 | - (void)render:(id)sender 320 | { 321 | @autoreleasepool { 322 | 323 | // we are now animating 324 | _animating = YES; 325 | 326 | // animation loop 327 | while (_animating) { 328 | // the animation happens until it's walked back the width of a particle, 329 | // when this is the case, the frame will look the same as in the start, so we go back and loop 330 | if(_currentAnimationStep >= kParticleWidth) _currentAnimationStep = 0; 331 | 332 | _currentAnimationStep++; 333 | 334 | // render the view in the main thread 335 | dispatch_async(dispatch_get_main_queue(), ^{ 336 | [self setNeedsDisplay:YES]; 337 | }); 338 | 339 | // delay to control framerate 340 | [NSThread sleepForTimeInterval:kProgressIndicatorAnimationSleepInterval]; 341 | } 342 | 343 | } 344 | } 345 | 346 | - (void)drawRect:(NSRect)dirtyRect 347 | { 348 | // draw bezel using nine images 349 | NSDrawNinePartImage(dirtyRect, _bezelTopLeftCorner, _bezelTopEdgeFill, _bezelTopRightCorner, _bezelLeftEdgeFill, _bezelCenterFill, _bezelRightEdgeFill, _bezelBottomLeftCorner, _bezelBottomEdgeFill, _bezelBottomRightCorner, NSCompositeSourceOver, 1.0, NO); 350 | 351 | // this will limit our drawing to the inside of the bezel 352 | NSRect clipRect = NSMakeRect(1, 2, NSWidth(self.frame)-2, NSHeight([self progressBarRect])); 353 | [[NSBezierPath bezierPathWithRoundedRect:clipRect xRadius:kProgressBarCornerRadius yRadius:kProgressBarCornerRadius] addClip]; 354 | 355 | // draw progress bar 356 | [self drawProgressBar]; 357 | 358 | // draw particle animation step if needed 359 | if(_animating) { 360 | if (!self.isIndeterminate) { 361 | [self drawAnimationStep]; 362 | } else { 363 | [self drawIndeterminateAnimationStep]; 364 | } 365 | } 366 | } 367 | 368 | // this method is responsible of drawing the progress bar itself 369 | - (void)drawProgressBar 370 | { 371 | if (self.doubleValue <= 0) return; 372 | 373 | NSRect progressBarRect = [self progressBarRect]; 374 | 375 | // the progress bar innner shadow 376 | if (!_progressBarInnerShadow) { 377 | _progressBarInnerShadow = [[NSShadow alloc] init]; 378 | 379 | [_progressBarInnerShadow setShadowOffset: NSMakeSize(0.1, -1.1)]; 380 | [_progressBarInnerShadow setShadowBlurRadius: 1]; 381 | } 382 | 383 | // determine the correct gradient and shadow colors based on 384 | // the window's key state, the system's appearance preferences and current theme 385 | if(!_progressBarGradient) { 386 | if ([self.window isKeyWindow]) { 387 | if ([NSColor currentControlTint] == NSGraphiteControlTint) { 388 | [_progressBarInnerShadow setShadowColor: kProgressBarGraphiteInnerShadowColor]; 389 | 390 | _progressBarGradient = [[NSGradient alloc] initWithColorsAndLocations: 391 | _graphiteGradientColor0, 0.0, 392 | _graphiteGradientColor1, 0.48, 393 | _graphiteGradientColor2, 0.49, 394 | _graphiteGradientColor3, 0.82, 395 | _graphiteGradientColor4, 1.0, nil]; 396 | } else { 397 | [_progressBarInnerShadow setShadowColor: kProgressBarInnerShadowColor]; 398 | 399 | _progressBarGradient = [[NSGradient alloc] initWithColorsAndLocations: 400 | _gradientColor0, 0.0, 401 | _gradientColor1, 0.48, 402 | _gradientColor2, 0.49, 403 | _gradientColor3, 0.82, 404 | _gradientColor4, 1.0, nil]; 405 | } 406 | } else { 407 | [_progressBarInnerShadow setShadowColor: kProgressBarInnerShadowColor]; 408 | 409 | _progressBarGradient = [[NSGradient alloc] initWithColorsAndLocations: 410 | _inactiveGradientColor0, 0.0, 411 | _inactiveGradientColor1, 0.48, 412 | _inactiveGradientColor2, 0.49, 413 | _inactiveGradientColor3, 1.0, nil]; 414 | } 415 | } 416 | 417 | // the progress bar rectangle 418 | NSBezierPath *rectanglePath = [NSBezierPath bezierPathWithRect:progressBarRect]; 419 | [_progressBarGradient drawInBezierPath: rectanglePath angle: -90]; 420 | 421 | // this huge code section is used to draw a tiny whiteish inner shadow 422 | NSRect roundedRectangleBorderRect = NSInsetRect([rectanglePath bounds], -_progressBarInnerShadow.shadowBlurRadius, -_progressBarInnerShadow.shadowBlurRadius); 423 | roundedRectangleBorderRect = NSOffsetRect(roundedRectangleBorderRect, -_progressBarInnerShadow.shadowOffset.width, -_progressBarInnerShadow.shadowOffset.height); 424 | roundedRectangleBorderRect = NSInsetRect(NSUnionRect(roundedRectangleBorderRect, [rectanglePath bounds]), -1, -1); 425 | 426 | NSBezierPath* roundedRectangleNegativePath = [NSBezierPath bezierPathWithRect: roundedRectangleBorderRect]; 427 | [roundedRectangleNegativePath appendBezierPath: rectanglePath]; 428 | [roundedRectangleNegativePath setWindingRule: NSEvenOddWindingRule]; 429 | 430 | [NSGraphicsContext saveGraphicsState]; 431 | { 432 | NSShadow* shadowWithOffset = [_progressBarInnerShadow copy]; 433 | CGFloat xOffset = shadowWithOffset.shadowOffset.width + round(roundedRectangleBorderRect.size.width); 434 | CGFloat yOffset = shadowWithOffset.shadowOffset.height; 435 | shadowWithOffset.shadowOffset = NSMakeSize(xOffset + copysign(0.1, xOffset), yOffset + copysign(0.1, yOffset)); 436 | [shadowWithOffset set]; 437 | [[NSColor grayColor] setFill]; 438 | [rectanglePath addClip]; 439 | NSAffineTransform* transform = [NSAffineTransform transform]; 440 | [transform translateXBy: -round(roundedRectangleBorderRect.size.width) yBy: 0]; 441 | [[transform transformBezierPath: roundedRectangleNegativePath] fill]; 442 | } 443 | [NSGraphicsContext restoreGraphicsState]; 444 | 445 | // draw line after progress bar 446 | 447 | if(!_progressBarLineGradient) _progressBarLineGradient = [[NSGradient alloc] initWithStartingColor: kProgressBarProgressLineGradient0 endingColor: kProgressBarProgressLineGradient1]; 448 | 449 | NSBezierPath *progressLinePath = [NSBezierPath bezierPathWithRect: NSMakeRect(NSWidth(progressBarRect)+1, progressBarRect.origin.y, 1, NSHeight(progressBarRect))]; 450 | [_progressBarLineGradient drawInBezierPath: progressLinePath angle: 90]; 451 | } 452 | 453 | 454 | // this method is responsible of drawing the aqua "water" particles animation 455 | - (void)drawAnimationStep 456 | { 457 | // initialize colors and gradient only once 458 | if(!_particleGrad1) { 459 | _particleGrad1 = [NSColor colorWithCalibratedRed: 1 green: 1 blue: 1 alpha: 0.07]; 460 | _particleGrad2 = [NSColor colorWithCalibratedRed: 1 green: 1 blue: 1 alpha: 0]; 461 | _particleGradient = [[NSGradient alloc] initWithStartingColor: _particleGrad1 endingColor: _particleGrad2]; 462 | } 463 | 464 | // get progress rect and check if it's empty 465 | NSRect progressBarRect = [self progressBarRect]; 466 | NSBezierPath *progressPath = [NSBezierPath bezierPathWithRoundedRect:progressBarRect xRadius:kProgressBarCornerRadius yRadius:kProgressBarCornerRadius]; 467 | // if the rect is empty we don't do anything 468 | if ([progressPath isEmpty]) return; 469 | 470 | // limits the drawing of the particles to be only inside the progress area 471 | [progressPath addClip]; 472 | 473 | // calculate how many particles we can fit inside the progress rect and add some extra for good luck :P 474 | int particlePitch = round(NSWidth(progressBarRect)/kParticleWidth)+2; 475 | 476 | // value used to calculate the X position of a particle 477 | CGFloat particleDelta = kParticleWidth+kParticleSpacing-kParticleWidth/2; 478 | 479 | for (int i = 0; i < particlePitch; i++) { 480 | // calculate X position of particle 481 | CGFloat particleX = (i*particleDelta)-_currentAnimationStep; 482 | 483 | // make circle used do draw the particle's gradient 484 | NSBezierPath *particlePath = [NSBezierPath bezierPathWithOvalInRect: NSMakeRect(particleX, 3, kParticleWidth, 15)]; 485 | [NSGraphicsContext saveGraphicsState]; 486 | [[NSGraphicsContext currentContext] setCompositingOperation:NSCompositePlusLighter]; 487 | [particlePath addClip]; 488 | 489 | // draw particle gradient 490 | NSPoint gradientPoint = NSMakePoint(particleX+17, NSHeight(self.frame)/2.0); 491 | NSGradientDrawingOptions options = NSGradientDrawsBeforeStartingLocation | NSGradientDrawsAfterEndingLocation; 492 | [_particleGradient drawFromCenter: gradientPoint radius: 0 493 | toCenter: gradientPoint radius: 12.72 494 | options: options]; 495 | 496 | [NSGraphicsContext restoreGraphicsState]; 497 | } 498 | } 499 | 500 | // this method is responsible of drawing the stripes animation when the PI is indeterminate 501 | - (void)drawIndeterminateAnimationStep 502 | { 503 | #define kIndeterminateParticleWidth 34.0 504 | #define kIndeterminateParticleSpacing 16.0 505 | 506 | if(!_indeterminateGradient) { 507 | _indeterminateGradientColor0 = [NSColor colorWithCalibratedRed: 0.917 green: 0.917 blue: 0.916 alpha: 1]; 508 | _indeterminateGradientColor1 = [NSColor colorWithCalibratedRed: 1 green: 1 blue: 1 alpha: 1]; 509 | _indeterminateGradientColor2 = [NSColor colorWithCalibratedRed: 0.951 green: 0.951 blue: 0.951 alpha: 1]; 510 | _indeterminateGradientColor3 = [NSColor colorWithCalibratedRed: 0.907 green: 0.907 blue: 0.907 alpha: 1]; 511 | 512 | _indeterminateGradient = [[NSGradient alloc] initWithColorsAndLocations: 513 | _indeterminateGradientColor0, 0.0, 514 | _indeterminateGradientColor1, 0.48, 515 | _indeterminateGradientColor2, 0.49, 516 | _indeterminateGradientColor3, 1.0, nil]; 517 | } 518 | 519 | NSRect progressBarRect = [self progressBarRect]; 520 | int particlePitch = round(NSWidth(progressBarRect)/kIndeterminateParticleWidth)+2; 521 | 522 | CGFloat particleDelta = kIndeterminateParticleWidth+kIndeterminateParticleSpacing-kIndeterminateParticleWidth/2; 523 | 524 | for (int i = 0; i < particlePitch; i++) { 525 | CGFloat particleX = (i*particleDelta)+_currentAnimationStep; 526 | 527 | NSBezierPath *particlePath = [NSBezierPath bezierPath]; 528 | [particlePath moveToPoint: NSMakePoint(particleX-10, NSHeight(self.frame))]; 529 | [particlePath lineToPoint: NSMakePoint(particleX+kIndeterminateParticleWidth/2-30, NSHeight(self.frame))]; 530 | [particlePath lineToPoint: NSMakePoint(particleX+kIndeterminateParticleWidth-30, 0)]; 531 | [particlePath lineToPoint: NSMakePoint(particleX+kIndeterminateParticleWidth/2-30, 0)]; 532 | [particlePath lineToPoint: NSMakePoint(particleX-30, NSHeight(self.frame))]; 533 | [particlePath closePath]; 534 | [_indeterminateGradient drawInBezierPath:particlePath angle:-90]; 535 | } 536 | } 537 | 538 | - (void)dealloc { 539 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 540 | } 541 | 542 | @end 543 | -------------------------------------------------------------------------------- /GRProgressIndicator/GRProgressIndicatorThemes.h: -------------------------------------------------------------------------------- 1 | // 2 | // GRProgressIndicatorThemes.h 3 | // GRProgressIndicator 4 | // 5 | // Created by Guilherme Rambo on 13/12/13. 6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | typedef enum GRProgressIndicatorTheme { 10 | GRProgressIndicatorThemeDefault = 0, 11 | GRProgressIndicatorThemeForceGraphite = 1, 12 | GRProgressIndicatorThemeGreen = 2, 13 | GRProgressIndicatorThemeRed = 3, 14 | GRProgressIndicatorThemePink = 4, 15 | GRProgressIndicatorThemeOrange = 5 16 | } GRProgressIndicatorTheme_t; 17 | 18 | /**** these constants define the colors for the themes ****/ 19 | 20 | // progress bar gradient colors from top to bottom, aqua 21 | #define kProgressBarGradientColor0 [NSColor colorWithCalibratedRed: 0.635 green: 0.766 blue: 0.957 alpha: 1] 22 | #define kProgressBarGradientColor1 [NSColor colorWithCalibratedRed: 0.395 green: 0.647 blue: 0.935 alpha: 1] 23 | #define kProgressBarGradientColor2 [NSColor colorWithCalibratedRed: 0.248 green: 0.582 blue: 0.935 alpha: 1] 24 | #define kProgressBarGradientColor3 [NSColor colorWithCalibratedRed: 0.425 green: 0.7 blue: 0.947 alpha: 1] 25 | #define kProgressBarGradientColor4 [NSColor colorWithCalibratedRed: 0.622 green: 0.842 blue: 0.957 alpha: 1] 26 | 27 | // progress bar gradient colors from top to bottom, green 28 | #define kProgressBarGreenGradientColor0 [NSColor colorWithCalibratedRed:0.787 green:0.904 blue:0.765 alpha:1.000] 29 | #define kProgressBarGreenGradientColor1 [NSColor colorWithCalibratedRed:0.562 green:0.795 blue:0.518 alpha:1.000] 30 | #define kProgressBarGreenGradientColor2 [NSColor colorWithCalibratedRed:0.460 green:0.742 blue:0.404 alpha:1.000] 31 | #define kProgressBarGreenGradientColor3 [NSColor colorWithCalibratedRed:0.546 green:0.786 blue:0.501 alpha:1.000] 32 | #define kProgressBarGreenGradientColor4 [NSColor colorWithCalibratedRed:0.732 green:0.876 blue:0.701 alpha:1.000] 33 | 34 | // progress bar gradient colors from top to bottom, red 35 | #define kProgressBarRedGradientColor0 [NSColor colorWithCalibratedRed:0.873 green:0.637 blue:0.643 alpha:1.000] 36 | #define kProgressBarRedGradientColor1 [NSColor colorWithCalibratedRed:0.761 green:0.344 blue:0.357 alpha:1.000] 37 | #define kProgressBarRedGradientColor2 [NSColor colorWithCalibratedRed:0.729 green:0.263 blue:0.279 alpha:1.000] 38 | #define kProgressBarRedGradientColor3 [NSColor colorWithCalibratedRed:0.780 green:0.396 blue:0.408 alpha:1.000] 39 | #define kProgressBarRedGradientColor4 [NSColor colorWithCalibratedRed:0.853 green:0.583 blue:0.590 alpha:1.000] 40 | 41 | // progress bar gradient colors from top to bottom, pink 42 | #define kProgressBarPinkGradientColor0 [NSColor colorWithCalibratedRed:0.860 green:0.708 blue:0.811 alpha:1.000] 43 | #define kProgressBarPinkGradientColor1 [NSColor colorWithCalibratedRed:0.801 green:0.552 blue:0.714 alpha:1.000] 44 | #define kProgressBarPinkGradientColor2 [NSColor colorWithCalibratedRed:0.777 green:0.473 blue:0.669 alpha:1.000] 45 | #define kProgressBarPinkGradientColor3 [NSColor colorWithCalibratedRed:0.820 green:0.592 blue:0.751 alpha:1.000] 46 | #define kProgressBarPinkGradientColor4 [NSColor colorWithCalibratedRed:0.894 green:0.739 blue:0.864 alpha:1.000] 47 | 48 | // progress bar gradient colors from top to bottom, orange 49 | #define kProgressBarOrangeGradientColor0 [NSColor colorWithCalibratedRed:0.926 green:0.682 blue:0.535 alpha:1.000] 50 | #define kProgressBarOrangeGradientColor1 [NSColor colorWithCalibratedRed:0.885 green:0.522 blue:0.320 alpha:1.000] 51 | #define kProgressBarOrangeGradientColor2 [NSColor colorWithCalibratedRed:0.865 green:0.446 blue:0.225 alpha:1.000] 52 | #define kProgressBarOrangeGradientColor3 [NSColor colorWithCalibratedRed:0.885 green:0.526 blue:0.332 alpha:1.000] 53 | #define kProgressBarOrangeGradientColor4 [NSColor colorWithCalibratedRed:0.936 green:0.727 blue:0.604 alpha:1.000] 54 | 55 | // progress bar gradient colors from top to bottom, graphite 56 | #define kProgressBarGraphiteGradientColor0 [NSColor colorWithCalibratedRed:0.688 green:0.718 blue:0.765 alpha:1.000] 57 | #define kProgressBarGraphiteGradientColor1 [NSColor colorWithCalibratedRed:0.527 green:0.580 blue:0.646 alpha:1.000] 58 | #define kProgressBarGraphiteGradientColor2 [NSColor colorWithCalibratedRed:0.448 green:0.511 blue:0.598 alpha:1.000] 59 | #define kProgressBarGraphiteGradientColor3 [NSColor colorWithCalibratedRed:0.493 green:0.554 blue:0.633 alpha:1.000] 60 | #define kProgressBarGraphiteGradientColor4 [NSColor colorWithCalibratedRed:0.729 green:0.779 blue:0.807 alpha:1.000] 61 | 62 | // progress bar gradient colors from top to bottom, inactive window 63 | #define kProgressBarInactiveGradientColor0 [NSColor colorWithCalibratedWhite:0.845 alpha:1.000] 64 | #define kProgressBarInactiveGradientColor1 [NSColor colorWithCalibratedWhite:0.737 alpha:1.000] 65 | #define kProgressBarInactiveGradientColor2 [NSColor colorWithCalibratedWhite:0.665 alpha:1.000] 66 | #define kProgressBarInactiveGradientColor3 [NSColor colorWithCalibratedWhite:0.585 alpha:1.000] 67 | #define kProgressBarInactiveGradientColor4 [NSColor colorWithCalibratedRed: 0.53 green: 0.587 blue: 0.662 alpha: 1] 68 | 69 | // progress bar inner shadow, aqua 70 | #define kProgressBarInnerShadowColor [NSColor colorWithCalibratedRed: 1 green: 1 blue: 1 alpha: 0.293] 71 | 72 | // progress bar inner shadow, graphite 73 | #define kProgressBarGraphiteInnerShadowColor [NSColor colorWithCalibratedRed: 0.776 green: 0.801 blue: 0.828 alpha: 1] 74 | 75 | // line after progress bar gradient colors from top to bottom 76 | #define kProgressBarProgressLineGradient0 [NSColor colorWithCalibratedRed: 0.742 green: 0.742 blue: 0.742 alpha: 1] 77 | #define kProgressBarProgressLineGradient1 [NSColor colorWithCalibratedRed: 0.463 green: 0.463 blue: 0.463 alpha: 1] -------------------------------------------------------------------------------- /GRProgressIndicatorDemo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/GRProgressIndicatorDemo.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Guilherme Rambo 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | - Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | - Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /Progressbar Fun.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DDD88F4E185B728300DA97A6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDD88F4D185B728300DA97A6 /* QuartzCore.framework */; }; 11 | DDD88F54185B991C00DA97A6 /* GRProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = DDD88F52185B991C00DA97A6 /* GRProgressIndicator.m */; }; 12 | F4BFA2A5185B269700F75999 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F4BFA2A4185B269700F75999 /* Cocoa.framework */; }; 13 | F4BFA2AF185B269700F75999 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F4BFA2AD185B269700F75999 /* InfoPlist.strings */; }; 14 | F4BFA2B1185B269700F75999 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F4BFA2B0185B269700F75999 /* main.m */; }; 15 | F4BFA2B5185B269700F75999 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = F4BFA2B3185B269700F75999 /* Credits.rtf */; }; 16 | F4BFA2B8185B269700F75999 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F4BFA2B7185B269700F75999 /* AppDelegate.m */; }; 17 | F4BFA2BB185B269700F75999 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = F4BFA2B9185B269700F75999 /* MainMenu.xib */; }; 18 | F4BFA2BD185B269700F75999 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F4BFA2BC185B269700F75999 /* Images.xcassets */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | DDD88F4D185B728300DA97A6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 23 | DDD88F51185B991C00DA97A6 /* GRProgressIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProgressIndicator.h; sourceTree = ""; }; 24 | DDD88F52185B991C00DA97A6 /* GRProgressIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProgressIndicator.m; sourceTree = ""; }; 25 | DDD88F53185B991C00DA97A6 /* GRProgressIndicatorThemes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProgressIndicatorThemes.h; sourceTree = ""; }; 26 | F4BFA2A1185B269700F75999 /* Progressbar Fun.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Progressbar Fun.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | F4BFA2A4185B269700F75999 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 28 | F4BFA2A7185B269700F75999 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 29 | F4BFA2A8185B269700F75999 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 30 | F4BFA2A9185B269700F75999 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 31 | F4BFA2AC185B269700F75999 /* Progressbar Fun-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Progressbar Fun-Info.plist"; sourceTree = ""; }; 32 | F4BFA2AE185B269700F75999 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 33 | F4BFA2B0185B269700F75999 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | F4BFA2B2185B269700F75999 /* Progressbar Fun-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Progressbar Fun-Prefix.pch"; sourceTree = ""; }; 35 | F4BFA2B4185B269700F75999 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; 36 | F4BFA2B6185B269700F75999 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | F4BFA2B7185B269700F75999 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | F4BFA2BA185B269700F75999 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 39 | F4BFA2BC185B269700F75999 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | F4BFA2C3185B269700F75999 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 41 | F4BFA2DB185B58A600F75999 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; 42 | /* End PBXFileReference section */ 43 | 44 | /* Begin PBXFrameworksBuildPhase section */ 45 | F4BFA29E185B269700F75999 /* Frameworks */ = { 46 | isa = PBXFrameworksBuildPhase; 47 | buildActionMask = 2147483647; 48 | files = ( 49 | DDD88F4E185B728300DA97A6 /* QuartzCore.framework in Frameworks */, 50 | F4BFA2A5185B269700F75999 /* Cocoa.framework in Frameworks */, 51 | ); 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXFrameworksBuildPhase section */ 55 | 56 | /* Begin PBXGroup section */ 57 | DDD88F50185B991C00DA97A6 /* GRProgressIndicator */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | DDD88F51185B991C00DA97A6 /* GRProgressIndicator.h */, 61 | DDD88F52185B991C00DA97A6 /* GRProgressIndicator.m */, 62 | DDD88F53185B991C00DA97A6 /* GRProgressIndicatorThemes.h */, 63 | ); 64 | path = GRProgressIndicator; 65 | sourceTree = SOURCE_ROOT; 66 | }; 67 | F4BFA298185B269700F75999 = { 68 | isa = PBXGroup; 69 | children = ( 70 | F4BFA2AA185B269700F75999 /* Progressbar Fun */, 71 | F4BFA2A3185B269700F75999 /* Frameworks */, 72 | F4BFA2A2185B269700F75999 /* Products */, 73 | ); 74 | sourceTree = ""; 75 | }; 76 | F4BFA2A2185B269700F75999 /* Products */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | F4BFA2A1185B269700F75999 /* Progressbar Fun.app */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | F4BFA2A3185B269700F75999 /* Frameworks */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | DDD88F4D185B728300DA97A6 /* QuartzCore.framework */, 88 | F4BFA2DB185B58A600F75999 /* CoreVideo.framework */, 89 | F4BFA2A4185B269700F75999 /* Cocoa.framework */, 90 | F4BFA2C3185B269700F75999 /* XCTest.framework */, 91 | F4BFA2A6185B269700F75999 /* Other Frameworks */, 92 | ); 93 | name = Frameworks; 94 | sourceTree = ""; 95 | }; 96 | F4BFA2A6185B269700F75999 /* Other Frameworks */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | F4BFA2A7185B269700F75999 /* AppKit.framework */, 100 | F4BFA2A8185B269700F75999 /* CoreData.framework */, 101 | F4BFA2A9185B269700F75999 /* Foundation.framework */, 102 | ); 103 | name = "Other Frameworks"; 104 | sourceTree = ""; 105 | }; 106 | F4BFA2AA185B269700F75999 /* Progressbar Fun */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | DDD88F50185B991C00DA97A6 /* GRProgressIndicator */, 110 | F4BFA2B6185B269700F75999 /* AppDelegate.h */, 111 | F4BFA2B7185B269700F75999 /* AppDelegate.m */, 112 | F4BFA2B9185B269700F75999 /* MainMenu.xib */, 113 | F4BFA2BC185B269700F75999 /* Images.xcassets */, 114 | F4BFA2AB185B269700F75999 /* Supporting Files */, 115 | ); 116 | path = "Progressbar Fun"; 117 | sourceTree = ""; 118 | }; 119 | F4BFA2AB185B269700F75999 /* Supporting Files */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | F4BFA2AC185B269700F75999 /* Progressbar Fun-Info.plist */, 123 | F4BFA2AD185B269700F75999 /* InfoPlist.strings */, 124 | F4BFA2B0185B269700F75999 /* main.m */, 125 | F4BFA2B2185B269700F75999 /* Progressbar Fun-Prefix.pch */, 126 | F4BFA2B3185B269700F75999 /* Credits.rtf */, 127 | ); 128 | name = "Supporting Files"; 129 | sourceTree = ""; 130 | }; 131 | /* End PBXGroup section */ 132 | 133 | /* Begin PBXNativeTarget section */ 134 | F4BFA2A0185B269700F75999 /* Progressbar Fun */ = { 135 | isa = PBXNativeTarget; 136 | buildConfigurationList = F4BFA2D2185B269700F75999 /* Build configuration list for PBXNativeTarget "Progressbar Fun" */; 137 | buildPhases = ( 138 | F4BFA29D185B269700F75999 /* Sources */, 139 | F4BFA29E185B269700F75999 /* Frameworks */, 140 | F4BFA29F185B269700F75999 /* Resources */, 141 | ); 142 | buildRules = ( 143 | ); 144 | dependencies = ( 145 | ); 146 | name = "Progressbar Fun"; 147 | productName = "Progressbar Fun"; 148 | productReference = F4BFA2A1185B269700F75999 /* Progressbar Fun.app */; 149 | productType = "com.apple.product-type.application"; 150 | }; 151 | /* End PBXNativeTarget section */ 152 | 153 | /* Begin PBXProject section */ 154 | F4BFA299185B269700F75999 /* Project object */ = { 155 | isa = PBXProject; 156 | attributes = { 157 | LastUpgradeCheck = 0500; 158 | ORGANIZATIONNAME = "Guilherme Rambo"; 159 | }; 160 | buildConfigurationList = F4BFA29C185B269700F75999 /* Build configuration list for PBXProject "Progressbar Fun" */; 161 | compatibilityVersion = "Xcode 3.2"; 162 | developmentRegion = English; 163 | hasScannedForEncodings = 0; 164 | knownRegions = ( 165 | en, 166 | Base, 167 | ); 168 | mainGroup = F4BFA298185B269700F75999; 169 | productRefGroup = F4BFA2A2185B269700F75999 /* Products */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | F4BFA2A0185B269700F75999 /* Progressbar Fun */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | F4BFA29F185B269700F75999 /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | F4BFA2AF185B269700F75999 /* InfoPlist.strings in Resources */, 184 | F4BFA2BD185B269700F75999 /* Images.xcassets in Resources */, 185 | F4BFA2B5185B269700F75999 /* Credits.rtf in Resources */, 186 | F4BFA2BB185B269700F75999 /* MainMenu.xib in Resources */, 187 | ); 188 | runOnlyForDeploymentPostprocessing = 0; 189 | }; 190 | /* End PBXResourcesBuildPhase section */ 191 | 192 | /* Begin PBXSourcesBuildPhase section */ 193 | F4BFA29D185B269700F75999 /* Sources */ = { 194 | isa = PBXSourcesBuildPhase; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | F4BFA2B8185B269700F75999 /* AppDelegate.m in Sources */, 198 | DDD88F54185B991C00DA97A6 /* GRProgressIndicator.m in Sources */, 199 | F4BFA2B1185B269700F75999 /* main.m in Sources */, 200 | ); 201 | runOnlyForDeploymentPostprocessing = 0; 202 | }; 203 | /* End PBXSourcesBuildPhase section */ 204 | 205 | /* Begin PBXVariantGroup section */ 206 | F4BFA2AD185B269700F75999 /* InfoPlist.strings */ = { 207 | isa = PBXVariantGroup; 208 | children = ( 209 | F4BFA2AE185B269700F75999 /* en */, 210 | ); 211 | name = InfoPlist.strings; 212 | sourceTree = ""; 213 | }; 214 | F4BFA2B3185B269700F75999 /* Credits.rtf */ = { 215 | isa = PBXVariantGroup; 216 | children = ( 217 | F4BFA2B4185B269700F75999 /* en */, 218 | ); 219 | name = Credits.rtf; 220 | sourceTree = ""; 221 | }; 222 | F4BFA2B9185B269700F75999 /* MainMenu.xib */ = { 223 | isa = PBXVariantGroup; 224 | children = ( 225 | F4BFA2BA185B269700F75999 /* Base */, 226 | ); 227 | name = MainMenu.xib; 228 | sourceTree = ""; 229 | }; 230 | /* End PBXVariantGroup section */ 231 | 232 | /* Begin XCBuildConfiguration section */ 233 | F4BFA2D0185B269700F75999 /* Debug */ = { 234 | isa = XCBuildConfiguration; 235 | buildSettings = { 236 | ALWAYS_SEARCH_USER_PATHS = NO; 237 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 238 | CLANG_CXX_LIBRARY = "libc++"; 239 | CLANG_ENABLE_OBJC_ARC = YES; 240 | CLANG_WARN_BOOL_CONVERSION = YES; 241 | CLANG_WARN_CONSTANT_CONVERSION = YES; 242 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 243 | CLANG_WARN_EMPTY_BODY = YES; 244 | CLANG_WARN_ENUM_CONVERSION = YES; 245 | CLANG_WARN_INT_CONVERSION = YES; 246 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 247 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 248 | COPY_PHASE_STRIP = NO; 249 | GCC_C_LANGUAGE_STANDARD = gnu99; 250 | GCC_DYNAMIC_NO_PIC = NO; 251 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 252 | GCC_OPTIMIZATION_LEVEL = 0; 253 | GCC_PREPROCESSOR_DEFINITIONS = ( 254 | "DEBUG=1", 255 | "$(inherited)", 256 | ); 257 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 258 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 259 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 260 | GCC_WARN_UNDECLARED_SELECTOR = YES; 261 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 262 | GCC_WARN_UNUSED_FUNCTION = YES; 263 | GCC_WARN_UNUSED_VARIABLE = YES; 264 | MACOSX_DEPLOYMENT_TARGET = 10.8; 265 | ONLY_ACTIVE_ARCH = YES; 266 | SDKROOT = macosx; 267 | }; 268 | name = Debug; 269 | }; 270 | F4BFA2D1185B269700F75999 /* Release */ = { 271 | isa = XCBuildConfiguration; 272 | buildSettings = { 273 | ALWAYS_SEARCH_USER_PATHS = NO; 274 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 275 | CLANG_CXX_LIBRARY = "libc++"; 276 | CLANG_ENABLE_OBJC_ARC = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_CONSTANT_CONVERSION = YES; 279 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 280 | CLANG_WARN_EMPTY_BODY = YES; 281 | CLANG_WARN_ENUM_CONVERSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | COPY_PHASE_STRIP = YES; 286 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 287 | ENABLE_NS_ASSERTIONS = NO; 288 | GCC_C_LANGUAGE_STANDARD = gnu99; 289 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | MACOSX_DEPLOYMENT_TARGET = 10.8; 297 | SDKROOT = macosx; 298 | }; 299 | name = Release; 300 | }; 301 | F4BFA2D3185B269700F75999 /* Debug */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 305 | COMBINE_HIDPI_IMAGES = YES; 306 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 307 | GCC_PREFIX_HEADER = "Progressbar Fun/Progressbar Fun-Prefix.pch"; 308 | INFOPLIST_FILE = "Progressbar Fun/Progressbar Fun-Info.plist"; 309 | MACOSX_DEPLOYMENT_TARGET = 10.8; 310 | PRODUCT_NAME = "$(TARGET_NAME)"; 311 | WRAPPER_EXTENSION = app; 312 | }; 313 | name = Debug; 314 | }; 315 | F4BFA2D4185B269700F75999 /* Release */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 319 | COMBINE_HIDPI_IMAGES = YES; 320 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 321 | GCC_PREFIX_HEADER = "Progressbar Fun/Progressbar Fun-Prefix.pch"; 322 | INFOPLIST_FILE = "Progressbar Fun/Progressbar Fun-Info.plist"; 323 | MACOSX_DEPLOYMENT_TARGET = 10.8; 324 | PRODUCT_NAME = "$(TARGET_NAME)"; 325 | WRAPPER_EXTENSION = app; 326 | }; 327 | name = Release; 328 | }; 329 | /* End XCBuildConfiguration section */ 330 | 331 | /* Begin XCConfigurationList section */ 332 | F4BFA29C185B269700F75999 /* Build configuration list for PBXProject "Progressbar Fun" */ = { 333 | isa = XCConfigurationList; 334 | buildConfigurations = ( 335 | F4BFA2D0185B269700F75999 /* Debug */, 336 | F4BFA2D1185B269700F75999 /* Release */, 337 | ); 338 | defaultConfigurationIsVisible = 0; 339 | defaultConfigurationName = Release; 340 | }; 341 | F4BFA2D2185B269700F75999 /* Build configuration list for PBXNativeTarget "Progressbar Fun" */ = { 342 | isa = XCConfigurationList; 343 | buildConfigurations = ( 344 | F4BFA2D3185B269700F75999 /* Debug */, 345 | F4BFA2D4185B269700F75999 /* Release */, 346 | ); 347 | defaultConfigurationIsVisible = 0; 348 | defaultConfigurationName = Release; 349 | }; 350 | /* End XCConfigurationList section */ 351 | }; 352 | rootObject = F4BFA299185B269700F75999 /* Project object */; 353 | } 354 | -------------------------------------------------------------------------------- /Progressbar Fun/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Progressbar Fun 4 | // 5 | // Created by Guilherme Rambo on 13/12/13. 6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GRProgressIndicator.h" 11 | 12 | @interface AppDelegate : NSObject 13 | 14 | @property (assign) IBOutlet NSWindow *window; 15 | @property (weak) IBOutlet NSProgressIndicator *appleProgress; 16 | @property (weak) IBOutlet GRProgressIndicator *grProgress; 17 | @property (weak) IBOutlet NSPopUpButton *themeSelect; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Progressbar Fun/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Progressbar Fun 4 | // 5 | // Created by Guilherme Rambo on 13/12/13. 6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | { 13 | NSTimer *_appleTimer; 14 | double _appleDoubleValue; 15 | 16 | NSTimer *_grTimer; 17 | double _grDoubleValue; 18 | } 19 | 20 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 21 | { 22 | [self.appleProgress setUsesThreadedAnimation:YES]; 23 | } 24 | 25 | - (IBAction)startApple:(id)sender { 26 | if(_appleTimer) return; 27 | 28 | [self.appleProgress startAnimation:nil]; 29 | _appleDoubleValue = 0; 30 | _appleTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateAppleProgress:) userInfo:nil repeats:YES]; 31 | } 32 | 33 | - (void)updateAppleProgress:(NSTimer *)timer 34 | { 35 | _appleDoubleValue++; 36 | self.appleProgress.doubleValue = _appleDoubleValue; 37 | 38 | if(_appleDoubleValue >= 100) { 39 | [_appleTimer invalidate]; 40 | _appleTimer = nil; 41 | [self.appleProgress stopAnimation:nil]; 42 | } 43 | } 44 | 45 | - (IBAction)startGR:(id)sender { 46 | if(_grTimer) return; 47 | 48 | [self.grProgress startAnimation:nil]; 49 | _grDoubleValue = 0; 50 | _grTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateGRProgress:) userInfo:nil repeats:YES]; 51 | } 52 | 53 | - (void)updateGRProgress:(NSTimer *)timer 54 | { 55 | _grDoubleValue++; 56 | self.grProgress.doubleValue = _grDoubleValue; 57 | 58 | if(_grDoubleValue >= 100) { 59 | [_grTimer invalidate]; 60 | _grTimer = nil; 61 | [self.grProgress stopAnimation:nil]; 62 | } 63 | } 64 | 65 | - (IBAction)changeTheme:(id)sender { 66 | if([self.themeSelect.selectedItem.title isEqualToString:@"Force Graphite"]) { 67 | self.grProgress.theme = GRProgressIndicatorThemeForceGraphite; 68 | } else if([self.themeSelect.selectedItem.title isEqualToString:@"Red"]) { 69 | self.grProgress.theme = GRProgressIndicatorThemeRed; 70 | } else if([self.themeSelect.selectedItem.title isEqualToString:@"Green"]) { 71 | self.grProgress.theme = GRProgressIndicatorThemeGreen; 72 | } else if([self.themeSelect.selectedItem.title isEqualToString:@"Orange"]) { 73 | self.grProgress.theme = GRProgressIndicatorThemeOrange; 74 | } else if([self.themeSelect.selectedItem.title isEqualToString:@"Pink"]) { 75 | self.grProgress.theme = GRProgressIndicatorThemePink; 76 | } else { 77 | self.grProgress.theme = GRProgressIndicatorThemeDefault; 78 | } 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /Progressbar Fun/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | Default 523 | 524 | 525 | 526 | 527 | 528 | 529 | Left to Right 530 | 531 | 532 | 533 | 534 | 535 | 536 | Right to Left 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | Default 548 | 549 | 550 | 551 | 552 | 553 | 554 | Left to Right 555 | 556 | 557 | 558 | 559 | 560 | 561 | Right to Left 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 675 | 676 | 677 | 678 | 679 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_bottomFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "pi_bottomFill.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "pi_bottomFill@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_bottomFill.imageset/pi_bottomFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_bottomFill.imageset/pi_bottomFill.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_bottomFill.imageset/pi_bottomFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_bottomFill.imageset/pi_bottomFill@2x.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_bottomLeft.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "pi_bottomLeft.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "pi_bottomLeft@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_bottomLeft.imageset/pi_bottomLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_bottomLeft.imageset/pi_bottomLeft.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_bottomLeft.imageset/pi_bottomLeft@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_bottomLeft.imageset/pi_bottomLeft@2x.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_bottomRight.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "pi_bottomRight.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "pi_bottomRight@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_bottomRight.imageset/pi_bottomRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_bottomRight.imageset/pi_bottomRight.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_bottomRight.imageset/pi_bottomRight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_bottomRight.imageset/pi_bottomRight@2x.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_centerFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "pi_centerFill.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "pi_centerFill@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_centerFill.imageset/pi_centerFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_centerFill.imageset/pi_centerFill.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_centerFill.imageset/pi_centerFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_centerFill.imageset/pi_centerFill@2x.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_leftFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "pi_leftFill.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "pi_leftFill@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_leftFill.imageset/pi_leftFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_leftFill.imageset/pi_leftFill.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_leftFill.imageset/pi_leftFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_leftFill.imageset/pi_leftFill@2x.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_rightFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "pi_rightFill.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "pi_rightFill@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_rightFill.imageset/pi_rightFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_rightFill.imageset/pi_rightFill.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_rightFill.imageset/pi_rightFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_rightFill.imageset/pi_rightFill@2x.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_topFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "pi_topFill.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "pi_topFill@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_topFill.imageset/pi_topFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_topFill.imageset/pi_topFill.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_topFill.imageset/pi_topFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_topFill.imageset/pi_topFill@2x.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_topLeft.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "pi_topLeft.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "pi_topLeft@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_topLeft.imageset/pi_topLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_topLeft.imageset/pi_topLeft.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_topLeft.imageset/pi_topLeft@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_topLeft.imageset/pi_topLeft@2x.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_topRight.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "pi_topRight.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "pi_topRight@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_topRight.imageset/pi_topRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_topRight.imageset/pi_topRight.png -------------------------------------------------------------------------------- /Progressbar Fun/Images.xcassets/pi_topRight.imageset/pi_topRight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/GRProgressIndicator/1955dd12ed6cd1561fc0cc85ef90cc0858f7830f/Progressbar Fun/Images.xcassets/pi_topRight.imageset/pi_topRight@2x.png -------------------------------------------------------------------------------- /Progressbar Fun/Progressbar Fun-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | br.com.guilhermerambo.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 Guilherme Rambo. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Progressbar Fun/Progressbar Fun-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /Progressbar Fun/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Progressbar Fun/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Progressbar Fun/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Progressbar Fun 4 | // 5 | // Created by Guilherme Rambo on 13/12/13. 6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) 12 | { 13 | return NSApplicationMain(argc, argv); 14 | } 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GRProgressIndicator 2 | 3 | This is a reimplementation of NSProgressIndicator with some customization support 4 | 5 | ## Usage 6 | 7 | Place a custom view in your xib and set its class to "GRProgressIndicator" 8 | 9 | IMPORTANT: this view will work best if It's height is 19 or less, you can use bigger heights but the gradient may look strange 10 | 11 | ## Changing the look 12 | 13 | Without any changes the progress indicator looks pretty much the same as NSProgressIndicator, but you can change its look by setting the theme property 14 | 15 | Available themes: 16 | * GRProgressIndicatorThemeDefault 17 | * GRProgressIndicatorThemeForceGraphite 18 | * GRProgressIndicatorThemeGreen 19 | * GRProgressIndicatorThemeRed 20 | * GRProgressIndicatorThemePink 21 | * GRProgressIndicatorThemeOrange 22 | 23 | You can change the colors or create your own themes by editing the "GRProgressIndicatorThemes.h" file 24 | 25 | ### Animated Gif Demo :) 26 | 27 | ![screenshot](https://raw.github.com/insidegui/GRProgressIndicator/master/GRProgressIndicatorDemo.gif) 28 | 29 | ### Contributing 30 | 31 | You can contribute with code, just send me a pull request, or open an issue for any bug/enhancement. 32 | 33 | If you like this and will use It in one of your apps, you can show me some love by [donating through PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=386Y2DFSN5X94&lc=BR&item_name=Guilherme%20Rambo&item_number=1001¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) --------------------------------------------------------------------------------