Commit 882c580c authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/VLC_app: NSToolbar-ify our toolbar.

parent 7271b01d
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -53,6 +53,11 @@ ...@@ -53,6 +53,11 @@
IBOutlet NSButton * addPlaylistButton; IBOutlet NSButton * addPlaylistButton;
IBOutlet NSButton * removePlaylistButton; IBOutlet NSButton * removePlaylistButton;
/* Toolbar */
IBOutlet NSView * toolbarMediaAudioVolume;
IBOutlet NSView * toolbarMediaDescription;
IBOutlet NSView * toolbarMediaControl;
VLCMediaPlayer * mediaPlayer; VLCMediaPlayer * mediaPlayer;
IBOutlet VLCController * controller; /* This is a VLCController binded to the File's Owner of the nib */ IBOutlet VLCController * controller; /* This is a VLCController binded to the File's Owner of the nib */
......
...@@ -191,6 +191,10 @@ ...@@ -191,6 +191,10 @@
[videoView setTarget:self]; [videoView setTarget:self];
[videoView setAction:@selector(videoViewItemClicked:)]; [videoView setAction:@selector(videoViewItemClicked:)];
/***********************************
* Toolbar setup
*/
[[self toolbar] setDelegate:self];
/*********************************** /***********************************
* Other interface element setup * Other interface element setup
...@@ -350,3 +354,81 @@ ...@@ -350,3 +354,81 @@
return proposedFrameSize; return proposedFrameSize;
} }
@end @end
@implementation VLCMainWindow (NSToolbarDelegating)
/* Our item identifiers */
static NSString * VLCToolbarMediaControl = @"VLCToolbarMediaControl";
static NSString * VLCToolbarMediaAudioVolume = @"VLCToolbarMediaAudioVolume";
static NSString * VLCToolbarMediaDescription = @"VLCToolbarMediaDescription";
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
{
NSLog(@"hello");
return [NSArray arrayWithObjects:
NSToolbarCustomizeToolbarItemIdentifier,
NSToolbarFlexibleSpaceItemIdentifier,
NSToolbarSpaceItemIdentifier,
NSToolbarSeparatorItemIdentifier,
VLCToolbarMediaControl,
VLCToolbarMediaAudioVolume,
VLCToolbarMediaDescription,
nil ];
}
- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar
{
return [NSArray arrayWithObjects:
VLCToolbarMediaControl,
VLCToolbarMediaAudioVolume,
VLCToolbarMediaDescription,
nil ];
}
- (NSToolbarItem *) toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
{
NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdentifier] autorelease];
if( [itemIdentifier isEqual: VLCToolbarMediaControl] )
{
[toolbarItem setLabel:@"Media Controls"];
[toolbarItem setPaletteLabel:@"Media Controls"];
[toolbarItem setView:toolbarMediaControl];
[toolbarItem setMinSize:[[toolbarItem view] frame].size];
[toolbarItem setMaxSize:[[toolbarItem view] frame].size];
/* TODO: setup a menu */
}
else if( [itemIdentifier isEqual: VLCToolbarMediaAudioVolume] )
{
[toolbarItem setLabel:@"Audio Volume"];
[toolbarItem setPaletteLabel:@"Audio Volume"];
[toolbarItem setView:toolbarMediaAudioVolume];
[toolbarItem setMinSize:[[toolbarItem view] frame].size];
[toolbarItem setMaxSize:[[toolbarItem view] frame].size];
/* TODO: setup a menu */
}
else if( [itemIdentifier isEqual: VLCToolbarMediaDescription] )
{
[toolbarItem setLabel:@"Media Description"];
[toolbarItem setPaletteLabel:@"Media Description"];
[toolbarItem setView:toolbarMediaDescription];
[toolbarItem setMinSize:[[toolbarItem view] frame].size];
[toolbarItem setMaxSize:NSMakeSize(10000 /* Can be really big */, NSHeight([[toolbarItem view] frame]))];
/* 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;
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment