Permalink
Browse files

Adding a pretty damn crude segmented control to match the mockup. Als…

…o, documentation.
  • Loading branch information...
1 parent 3ee23b5 commit e0ed1cea94a94767125ed7b3a364c7a8b9eeaf0e @bryanveloso bryanveloso committed Feb 18, 2012
Showing with 20 additions and 1 deletion.
  1. +20 −1 AppDelegate.m
View
@@ -46,8 +46,27 @@ -(void) setTheLoopCount:(int)theLoopCount{
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
- [[self window] setTitleBarHeight:30.0];
+ [[self window] setTitleBarHeight:40.0];
[[self window] setTrafficLightButtonsLeftMargin:7.0];
+
+ // - NOOP -
+ // Implements a very crude NSSegmentControl, used to switch between the album view
+ // of the track currently opened and the listening statistics for that track.
+ NSView *titleBarView = [[self window] titleBarView];
+ NSSize switcherSize = NSMakeSize(100.f, 30.f);
+ NSRect switcherFrame = NSMakeRect(NSMidX([titleBarView bounds]) - (switcherSize.width / 2.f), NSMidY([titleBarView bounds]) - (switcherSize.height / 2.f), switcherSize.width, switcherSize.height);
+ NSSegmentedControl *switcher = [[NSSegmentedControl alloc] initWithFrame:switcherFrame];
+ [switcher setSegmentCount:2];
+ [switcher setSegmentStyle:NSSegmentStyleTexturedRounded];
+ [switcher setLabel:@"Music" forSegment:0];
+ [switcher setLabel:@"Statistics" forSegment:1];
+ [switcher setSelectedSegment:0];
+ [switcher setEnabled:FALSE forSegment:1]; // Disables the statistics segment.
+ [[switcher cell] setTrackingMode:NSSegmentSwitchTrackingSelectOne];
+ [titleBarView addSubview:switcher];
+
+ // Basic implementation of the default loop count.
+ // Infinity = 31 until further notice.
[self setLoopInfiniteCount:31];
[self setTheLoopCount:10];
[[self loopCountStepper] setMaxValue:(double)[self loopInfiniteCount]];

0 comments on commit e0ed1ce

Please sign in to comment.