From e26b81417553aa6b1e4364a2e581b471ecf94535 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Wed, 26 Dec 2007 16:28:13 +0000 Subject: [PATCH] experiment with badging the dock with "Quitting" --- macosx/BadgeView.h | 1 + macosx/BadgeView.m | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/macosx/BadgeView.h b/macosx/BadgeView.h index 4b3111f03..59365d5a6 100644 --- a/macosx/BadgeView.h +++ b/macosx/BadgeView.h @@ -32,6 +32,7 @@ NSDictionary * fAttributes; BOOL fQuitting; + NSImage * fQuitBadge; } - (id) initWithFrame: (NSRect) frame lib: (tr_handle *) lib; diff --git a/macosx/BadgeView.m b/macosx/BadgeView.m index 9c067e661..446bd4591 100644 --- a/macosx/BadgeView.m +++ b/macosx/BadgeView.m @@ -28,6 +28,8 @@ #define BOTTOM_PADDING 2.0 #define BETWEEN_PADDING 2.0 +#define BADGE_HEIGHT 30.0 + @interface BadgeView (Private) - (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (float) height; @@ -54,6 +56,7 @@ - (void) dealloc { [fAttributes release]; + [fQuitBadge release]; [super dealloc]; } @@ -63,8 +66,22 @@ if (fQuitting) { - #warning make better - //[self badge: [NSImage imageNamed: @"UploadBadge"] string: @"Quitting" atHeight: 0.0]; + if (!fQuitBadge) + { + NSRect badgeRect = NSMakeRect(0.0, 0.0, rect.size.width, BADGE_HEIGHT); + NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: badgeRect xRadius: 15.0 yRadius: 15.0]; + + fQuitBadge = [[NSImage alloc] initWithSize: badgeRect.size]; + [fQuitBadge lockFocus]; + + [[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.75] set]; + [bp fill]; + + [fQuitBadge unlockFocus]; + } + + [self badge: fQuitBadge string: NSLocalizedString(@"Quitting", "Dock Badger -> quit message") + atHeight: (rect.size.height - BADGE_HEIGHT) * 0.5]; return; }