+#pragma mark Toolbar delegate
+/* Our item identifiers */
+static NSString * VLCToolbarMediaControl = @"VLCToolbarMediaControl";
+
+- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
+{
+ NSLog(@"toolbarAllowedItemIdentifiers %s", __func__);
+
+ return [NSArray arrayWithObjects:
+// NSToolbarCustomizeToolbarItemIdentifier,
+// NSToolbarFlexibleSpaceItemIdentifier,
+// NSToolbarSpaceItemIdentifier,
+// NSToolbarSeparatorItemIdentifier,
+ VLCToolbarMediaControl,
+ nil ];
+}
+
+- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar
+{
+ NSLog(@"toolbarAllowedItemIdentifiers %s", __func__);
+
+ return [NSArray arrayWithObjects:
+ VLCToolbarMediaControl,
+ nil ];
+}
+
+- (NSToolbarItem *) toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
+{
+ NSLog(@"toolbarAllowedItemIdentifiers %s", __func__);
+ NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdentifier] autorelease];
+
+
+ if( [itemIdentifier isEqual: VLCToolbarMediaControl] )
+ {
+ [toolbarItem setLabel:@"Media Controls"];
+ [toolbarItem setPaletteLabel:@"Media Controls"];
+
+ NSSize size = toolbarMediaControl.frame.size;
+ [toolbarItem setView:toolbarMediaControl];
+ [toolbarItem setMinSize:size];
+ size.width += 1000.;
+ [toolbarItem setMaxSize:size];
+
+ // Hack: For some reason we need to make sure
+ // that the those element are on top
+ // Add them again will put them frontmost
+ [toolbarMediaControl addSubview:o_scrollfield];
+ [toolbarMediaControl addSubview:o_timeslider];
+ [toolbarMediaControl addSubview:o_timefield];
+ [toolbarMediaControl addSubview:o_main_pgbar];
+
+ /* TODO: setup a menu */
+ }
+ else
+ {
+ /* itemIdentifier referred to a toolbar item that is not
+ * provided or supported by us or Cocoa
+ * Returning nil will inform the toolbar
+ * that this kind of item is not supported */
+ toolbarItem = nil;
+ }
+ return toolbarItem;
+}
+
+#pragma mark -
+
+- (void)controlTintChanged
+{
+ BOOL b_playing = NO;
+
+ if( [o_btn_play alternateImage] == o_img_play_pressed )
+ b_playing = YES;
+
+ if( [NSColor currentControlTint] == NSGraphiteControlTint )
+ {
+ o_img_play_pressed = [NSImage imageNamed: @"play_graphite"];
+ o_img_pause_pressed = [NSImage imageNamed: @"pause_graphite"];
+
+ [o_btn_prev setAlternateImage: [NSImage imageNamed: @"previous_graphite"]];
+ [o_btn_rewind setAlternateImage: [NSImage imageNamed: @"skip_previous_graphite"]];
+ [o_btn_stop setAlternateImage: [NSImage imageNamed: @"stop_graphite"]];
+ [o_btn_ff setAlternateImage: [NSImage imageNamed: @"skip_forward_graphite"]];
+ [o_btn_next setAlternateImage: [NSImage imageNamed: @"next_graphite"]];
+ [o_btn_fullscreen setAlternateImage: [NSImage imageNamed: @"fullscreen_graphite"]];
+ [o_btn_playlist setAlternateImage: [NSImage imageNamed: @"playlistdrawer_graphite"]];
+ [o_btn_equalizer setAlternateImage: [NSImage imageNamed: @"equalizerdrawer_graphite"]];
+ }
+ else
+ {
+ o_img_play_pressed = [NSImage imageNamed: @"play_blue"];
+ o_img_pause_pressed = [NSImage imageNamed: @"pause_blue"];
+
+ [o_btn_prev setAlternateImage: [NSImage imageNamed: @"previous_blue"]];
+ [o_btn_rewind setAlternateImage: [NSImage imageNamed: @"skip_previous_blue"]];
+ [o_btn_stop setAlternateImage: [NSImage imageNamed: @"stop_blue"]];
+ [o_btn_ff setAlternateImage: [NSImage imageNamed: @"skip_forward_blue"]];
+ [o_btn_next setAlternateImage: [NSImage imageNamed: @"next_blue"]];
+ [o_btn_fullscreen setAlternateImage: [NSImage imageNamed: @"fullscreen_blue"]];
+ [o_btn_playlist setAlternateImage: [NSImage imageNamed: @"playlistdrawer_blue"]];
+ [o_btn_equalizer setAlternateImage: [NSImage imageNamed: @"equalizerdrawer_blue"]];
+ }
+
+ if( b_playing )
+ [o_btn_play setAlternateImage: o_img_play_pressed];
+ else
+ [o_btn_play setAlternateImage: o_img_pause_pressed];
+}
+