+#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 -
+