1 /*****************************************************************************
2 * misc.m: code not specific to vlc
3 *****************************************************************************
4 * Copyright (C) 2003-2012 VLC authors and VideoLAN
7 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8 * Felix Paul Kühne <fkuehne at videolan dot org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
26 #import "intf.h" /* VLCApplication */
27 #import "MainWindow.h"
29 #import "CoreInteraction.h"
30 #import <CoreAudio/CoreAudio.h>
32 /*****************************************************************************
33 * NSSound (VLCAdditions)
35 * added code to change the system volume, needed for the apple remote code
36 * this is simplified code, which won't let you set the exact volume
37 * (that's what the audio output is for after all), but just the system volume
38 * in steps of 1/16 (matching the default AR or volume key implementation).
39 *****************************************************************************/
41 @implementation NSSound (VLCAdditions)
43 + (float)systemVolumeForChannel:(int)channel
45 AudioDeviceID i_device;
50 i_size = sizeof( i_device );
51 AudioObjectPropertyAddress deviceAddress = { kAudioHardwarePropertyDefaultOutputDevice, kAudioDevicePropertyScopeOutput, kAudioObjectPropertyElementMaster };
52 err = AudioObjectGetPropertyData( kAudioObjectSystemObject, &deviceAddress, 0, NULL, &i_size, &i_device );
55 msg_Warn( VLCIntf, "couldn't get main audio output device" );
59 AudioObjectPropertyAddress propertyAddress = { kAudioDevicePropertyVolumeScalar, kAudioDevicePropertyScopeOutput, channel };
60 i_size = sizeof( f_volume );
61 err = AudioObjectGetPropertyData(i_device, &propertyAddress, 0, NULL, &i_size, &f_volume);
64 msg_Warn( VLCIntf, "couldn't get volume value" );
71 + (bool)setSystemVolume:(float)f_volume forChannel:(int)i_channel
73 /* the following code will fail on S/PDIF devices. there is an easy work-around, but we'd like to match the OS behavior */
75 AudioDeviceID i_device;
80 i_size = sizeof( i_device );
81 AudioObjectPropertyAddress deviceAddress = { kAudioHardwarePropertyDefaultOutputDevice, kAudioDevicePropertyScopeOutput, kAudioObjectPropertyElementMaster };
82 err = AudioObjectGetPropertyData( kAudioObjectSystemObject, &deviceAddress, 0, NULL, &i_size, &i_device );
85 msg_Warn( VLCIntf, "couldn't get main audio output device" );
89 AudioObjectPropertyAddress propertyAddress = { kAudioDevicePropertyVolumeScalar, kAudioDevicePropertyScopeOutput, i_channel };
90 i_size = sizeof( f_volume );
91 err = AudioObjectIsPropertySettable( i_device, &propertyAddress, &b_writeable );
92 if (err != noErr || !b_writeable ) {
93 msg_Warn( VLCIntf, "we can't set the main audio devices' volume" );
96 err = AudioObjectSetPropertyData(i_device, &propertyAddress, 0, NULL, i_size, &f_volume);
101 + (void)increaseSystemVolume
103 float f_volume = [NSSound systemVolumeForChannel:1]; // we trust that mono is always available and that all channels got the same volume
104 f_volume += .0625; // 1/16 to match the OS
105 bool b_returned = YES;
107 /* since core audio doesn't provide a reasonable way to see how many channels we got, let's see how long we can do this */
108 for (NSUInteger x = 1; b_returned ; x++)
109 b_returned = [NSSound setSystemVolume: f_volume forChannel:x];
112 + (void)decreaseSystemVolume
114 float f_volume = [NSSound systemVolumeForChannel:1]; // we trust that mono is always available and that all channels got the same volume
115 f_volume -= .0625; // 1/16 to match the OS
116 bool b_returned = YES;
118 /* since core audio doesn't provide a reasonable way to see how many channels we got, let's see how long we can do this */
119 for (NSUInteger x = 1; b_returned ; x++)
120 b_returned = [NSSound setSystemVolume: f_volume forChannel:x];
125 /*****************************************************************************
126 * NSAnimation (VLCAdditions)
128 * Missing extension to NSAnimation
129 *****************************************************************************/
131 @implementation NSAnimation (VLCAdditions)
132 /* fake class attributes */
133 static NSMapTable *VLCAdditions_userInfo = NULL;
137 /* init our fake object attribute */
138 VLCAdditions_userInfo = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks, NSObjectMapValueCallBacks, 16);
143 NSMapRemove(VLCAdditions_userInfo, self);
147 - (void)setUserInfo: (void *)userInfo
149 NSMapInsert(VLCAdditions_userInfo, self, (void*)userInfo);
154 return NSMapGet(VLCAdditions_userInfo, self);
158 /*****************************************************************************
159 * NSScreen (VLCAdditions)
161 * Missing extension to NSScreen
162 *****************************************************************************/
164 @implementation NSScreen (VLCAdditions)
166 static NSMutableArray *blackoutWindows = NULL;
170 /* init our fake object attribute */
171 blackoutWindows = [[NSMutableArray alloc] initWithCapacity:1];
174 + (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID
176 NSUInteger count = [[NSScreen screens] count];
178 for( NSUInteger i = 0; i < count; i++ )
180 NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
181 if([screen displayID] == displayID)
189 return ([self displayID] == [[[NSScreen screens] objectAtIndex:0] displayID]);
192 - (BOOL)isScreen: (NSScreen*)screen
194 return ([self displayID] == [screen displayID]);
197 - (CGDirectDisplayID)displayID
199 return (CGDirectDisplayID)[[[self deviceDescription] objectForKey: @"NSScreenNumber"] intValue];
202 - (void)blackoutOtherScreens
204 /* Free our previous blackout window (follow blackoutWindow alloc strategy) */
205 [blackoutWindows makeObjectsPerformSelector:@selector(close)];
206 [blackoutWindows removeAllObjects];
208 NSUInteger screenCount = [[NSScreen screens] count];
209 for(NSUInteger i = 0; i < screenCount; i++)
211 NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
212 VLCWindow *blackoutWindow;
215 if([self isScreen: screen])
218 screen_rect = [screen frame];
219 screen_rect.origin.x = screen_rect.origin.y = 0;
221 /* blackoutWindow alloc strategy
222 - The NSMutableArray blackoutWindows has the blackoutWindow references
223 - blackoutOtherDisplays is responsible for alloc/releasing its Windows
225 blackoutWindow = [[VLCWindow alloc] initWithContentRect: screen_rect styleMask: NSBorderlessWindowMask
226 backing: NSBackingStoreBuffered defer: NO screen: screen];
227 [blackoutWindow setBackgroundColor:[NSColor blackColor]];
228 [blackoutWindow setLevel: NSFloatingWindowLevel]; /* Disappear when Expose is triggered */
230 [blackoutWindow displayIfNeeded];
231 [blackoutWindow orderFront: self animate: YES];
233 [blackoutWindows addObject: blackoutWindow];
234 [blackoutWindow release];
236 if( [screen isMainScreen] )
237 [NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
241 + (void)unblackoutScreens
243 NSUInteger blackoutWindowCount = [blackoutWindows count];
245 for(NSUInteger i = 0; i < blackoutWindowCount; i++)
247 VLCWindow *blackoutWindow = [blackoutWindows objectAtIndex: i];
248 [blackoutWindow closeAndAnimate: YES];
251 [NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
256 /*****************************************************************************
259 * Missing extension to NSWindow
260 *****************************************************************************/
262 @implementation VLCWindow
263 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask
264 backing:(NSBackingStoreType)backingType defer:(BOOL)flag
266 self = [super initWithContentRect:contentRect styleMask:styleMask backing:backingType defer:flag];
269 b_isset_canBecomeKeyWindow = NO;
270 /* we don't want this window to be restored on relaunch */
272 [self setRestorable:NO];
277 - (void)setCanBecomeKeyWindow: (BOOL)canBecomeKey
279 b_isset_canBecomeKeyWindow = YES;
280 b_canBecomeKeyWindow = canBecomeKey;
283 - (BOOL)canBecomeKeyWindow
285 if(b_isset_canBecomeKeyWindow)
286 return b_canBecomeKeyWindow;
288 return [super canBecomeKeyWindow];
291 - (void)setCanBecomeMainWindow: (BOOL)canBecomeMain
293 b_isset_canBecomeMainWindow = YES;
294 b_canBecomeMainWindow = canBecomeMain;
297 - (BOOL)canBecomeMainWindow
299 if(b_isset_canBecomeMainWindow)
300 return b_canBecomeMainWindow;
302 return [super canBecomeMainWindow];
305 - (void)closeAndAnimate: (BOOL)animate
315 invoc = [NSInvocation invocationWithMethodSignature:[super methodSignatureForSelector:@selector(close)]];
316 [invoc setTarget: self];
318 if (![self isVisible] || [self alphaValue] == 0.0)
324 [self orderOut: self animate: YES callback: invoc];
327 - (void)orderOut: (id)sender animate: (BOOL)animate
329 NSInvocation *invoc = [NSInvocation invocationWithMethodSignature:[super methodSignatureForSelector:@selector(orderOut:)]];
330 [invoc setTarget: self];
331 [invoc setArgument: sender atIndex: 0];
332 [self orderOut: sender animate: animate callback: invoc];
335 - (void)orderOut: (id)sender animate: (BOOL)animate callback:(NSInvocation *)callback
337 NSViewAnimation *anim;
338 NSViewAnimation *current_anim;
339 NSMutableDictionary *dict;
343 [self orderOut: sender];
347 dict = [[NSMutableDictionary alloc] initWithCapacity:2];
349 [dict setObject:self forKey:NSViewAnimationTargetKey];
351 [dict setObject:NSViewAnimationFadeOutEffect forKey:NSViewAnimationEffectKey];
352 anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]];
355 [anim setAnimationBlockingMode:NSAnimationNonblocking];
356 [anim setDuration:0.9];
357 [anim setFrameRate:30];
358 [anim setUserInfo: callback];
360 @synchronized(self) {
361 current_anim = self->animation;
363 if ([[[current_anim viewAnimations] objectAtIndex:0] objectForKey: NSViewAnimationEffectKey] == NSViewAnimationFadeOutEffect && [current_anim isAnimating])
371 [current_anim stopAnimation];
372 [anim setCurrentProgress:1.0-[current_anim currentProgress]];
373 [current_anim release];
376 [anim setCurrentProgress:1.0 - [self alphaValue]];
377 self->animation = anim;
378 [self setDelegate: self];
379 [anim startAnimation];
384 - (void)orderFront: (id)sender animate: (BOOL)animate
386 NSViewAnimation *anim;
387 NSViewAnimation *current_anim;
388 NSMutableDictionary *dict;
392 [super orderFront: sender];
393 [self setAlphaValue: 1.0];
397 if (![self isVisible])
399 [self setAlphaValue: 0.0];
400 [super orderFront: sender];
402 else if ([self alphaValue] == 1.0)
404 [super orderFront: self];
408 dict = [[NSMutableDictionary alloc] initWithCapacity:2];
410 [dict setObject:self forKey:NSViewAnimationTargetKey];
412 [dict setObject:NSViewAnimationFadeInEffect forKey:NSViewAnimationEffectKey];
413 anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]];
416 [anim setAnimationBlockingMode:NSAnimationNonblocking];
417 [anim setDuration:0.5];
418 [anim setFrameRate:30];
420 @synchronized(self) {
421 current_anim = self->animation;
423 if ([[[current_anim viewAnimations] objectAtIndex:0] objectForKey: NSViewAnimationEffectKey] == NSViewAnimationFadeInEffect && [current_anim isAnimating])
431 [current_anim stopAnimation];
432 [anim setCurrentProgress:1.0 - [current_anim currentProgress]];
433 [current_anim release];
436 [anim setCurrentProgress:[self alphaValue]];
437 self->animation = anim;
438 [self setDelegate: self];
439 [self orderFront: sender];
440 [anim startAnimation];
445 - (void)animationDidEnd:(NSAnimation*)anim
447 if ([self alphaValue] <= 0.0)
449 NSInvocation * invoc;
450 [super orderOut: nil];
451 [self setAlphaValue: 1.0];
452 if ((invoc = [anim userInfo]))
457 - (IBAction)fullscreen:(id)sender
459 [[VLCCoreInteraction sharedInstance] toggleFullscreen];
464 /*****************************************************************************
465 * VLBrushedMetalImageView
466 *****************************************************************************/
468 @implementation VLBrushedMetalImageView
470 - (BOOL)mouseDownCanMoveWindow
477 [self unregisterDraggedTypes];
483 [self registerForDraggedTypes:[NSArray arrayWithObject: NSFilenamesPboardType]];
484 [self setImageScaling: NSScaleToFit];
485 [self setImageFrameStyle: NSImageFrameNone];
486 [self setImageAlignment: NSImageAlignCenter];
489 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
491 if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) == NSDragOperationGeneric)
492 return NSDragOperationGeneric;
494 return NSDragOperationNone;
497 - (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
502 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
505 b_returned = [[VLCCoreInteraction sharedInstance] performDragOperation: sender];
507 [self setNeedsDisplay:YES];
511 - (void)concludeDragOperation:(id <NSDraggingInfo>)sender
513 [self setNeedsDisplay:YES];
519 /*****************************************************************************
521 *****************************************************************************/
522 @implementation MPSlider
524 void _drawKnobInRect(NSRect knobRect)
526 // Center knob in given rect
527 knobRect.origin.x += (int)((float)(knobRect.size.width - 7)/2.0);
528 knobRect.origin.y += (int)((float)(knobRect.size.height - 7)/2.0);
531 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 3, knobRect.origin.y + 6, 1, 1), NSCompositeSourceOver);
532 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 2, knobRect.origin.y + 5, 3, 1), NSCompositeSourceOver);
533 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 1, knobRect.origin.y + 4, 5, 1), NSCompositeSourceOver);
534 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 0, knobRect.origin.y + 3, 7, 1), NSCompositeSourceOver);
535 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 1, knobRect.origin.y + 2, 5, 1), NSCompositeSourceOver);
536 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 2, knobRect.origin.y + 1, 3, 1), NSCompositeSourceOver);
537 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 3, knobRect.origin.y + 0, 1, 1), NSCompositeSourceOver);
540 void _drawFrameInRect(NSRect frameRect)
543 NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width, 1), NSCompositeSourceOver);
544 NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x, frameRect.origin.y + frameRect.size.height-1, frameRect.size.width, 1), NSCompositeSourceOver);
545 NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x, frameRect.origin.y, 1, frameRect.size.height), NSCompositeSourceOver);
546 NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x+frameRect.size.width-1, frameRect.origin.y, 1, frameRect.size.height), NSCompositeSourceOver);
549 - (void)drawRect:(NSRect)rect
551 // Draw default to make sure the slider behaves correctly
552 [[NSGraphicsContext currentContext] saveGraphicsState];
553 NSRectClip(NSZeroRect);
554 [super drawRect:rect];
555 [[NSGraphicsContext currentContext] restoreGraphicsState];
558 rect = [self bounds];
559 int diff = (int)(([[self cell] knobThickness] - 7.0)/2.0) - 1;
560 rect.origin.x += diff-1;
561 rect.origin.y += diff;
562 rect.size.width -= 2*diff-2;
563 rect.size.height -= 2*diff;
566 NSRect knobRect = [[self cell] knobRectFlipped:NO];
567 [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
568 _drawFrameInRect(rect);
569 _drawKnobInRect(knobRect);
572 [[[NSColor blackColor] colorWithAlphaComponent:0.1] set];
577 _drawFrameInRect(rect);
578 _drawKnobInRect(knobRect);
583 /*****************************************************************************
585 *****************************************************************************/
587 @implementation TimeLineSlider
591 if (config_GetInt( VLCIntf, "macosx-interfacestyle" )) {
592 o_knob_img = [NSImage imageNamed:@"progression-knob_dark"];
595 o_knob_img = [NSImage imageNamed:@"progression-knob"];
598 img_rect.size = [o_knob_img size];
599 img_rect.origin.x = img_rect.origin.y = 0;
604 [o_knob_img release];
608 - (CGFloat)knobPosition
610 NSRect knobRect = [[self cell] knobRectFlipped:NO];
611 knobRect.origin.x += knobRect.size.width / 2;
612 return knobRect.origin.x;
615 - (void)drawKnobInRect:(NSRect)knobRect
617 knobRect.origin.x += (knobRect.size.width - img_rect.size.width) / 2;
618 knobRect.size.width = img_rect.size.width;
619 knobRect.size.height = img_rect.size.height;
620 [o_knob_img drawInRect:knobRect fromRect:img_rect operation:NSCompositeSourceOver fraction:1];
623 - (void)drawRect:(NSRect)rect
625 [[[VLCMain sharedInstance] mainWindow] drawFancyGradientEffectForTimeSlider];
626 msleep( 10000 ); //wait for the gradient to draw completely
628 /* Draw default to make sure the slider behaves correctly */
629 [[NSGraphicsContext currentContext] saveGraphicsState];
630 NSRectClip(NSZeroRect);
631 [super drawRect:rect];
632 [[NSGraphicsContext currentContext] restoreGraphicsState];
634 NSRect knobRect = [[self cell] knobRectFlipped:NO];
636 knobRect.origin.y+=2;
638 knobRect.origin.y+=1;
639 [self drawKnobInRect: knobRect];
644 /*****************************************************************************
646 *****************************************************************************/
648 @implementation ITSlider
652 BOOL b_dark = config_GetInt( VLCIntf, "macosx-interfacestyle" );
654 img = [NSImage imageNamed:@"volume-slider-knob_dark"];
656 img = [NSImage imageNamed:@"volume-slider-knob"];
658 image_rect.size = [img size];
659 image_rect.origin.x = 0;
662 image_rect.origin.y = -1;
664 image_rect.origin.y = 0;
667 - (void)drawKnobInRect:(NSRect)knobRect
669 knobRect.origin.x += (knobRect.size.width - image_rect.size.width) / 2;
670 knobRect.size.width = image_rect.size.width;
671 knobRect.size.height = image_rect.size.height;
672 [img drawInRect:knobRect fromRect:image_rect operation:NSCompositeSourceOver fraction:1];
675 - (void)drawRect:(NSRect)rect
677 /* Draw default to make sure the slider behaves correctly */
678 [[NSGraphicsContext currentContext] saveGraphicsState];
679 NSRectClip(NSZeroRect);
680 [super drawRect:rect];
681 [[NSGraphicsContext currentContext] restoreGraphicsState];
683 NSRect knobRect = [[self cell] knobRectFlipped:NO];
684 knobRect.origin.y+=2;
685 [self drawKnobInRect: knobRect];
690 /*****************************************************************************
691 * VLCTimeField implementation
692 *****************************************************************************
693 * we need this to catch our click-event in the controller window
694 *****************************************************************************/
696 @implementation VLCTimeField
698 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
699 NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"DisplayTimeAsTimeRemaining"];
701 [defaults registerDefaults:appDefaults];
706 NSColor *o_string_color;
707 if (!config_GetInt( VLCIntf, "macosx-interfacestyle"))
708 o_string_color = [NSColor colorWithCalibratedRed:0.229 green:0.229 blue:0.229 alpha:100.0];
710 o_string_color = [NSColor colorWithCalibratedRed:0.64 green:0.64 blue:0.64 alpha:100.0];
712 textAlignment = NSCenterTextAlignment;
713 o_string_attributes_dict = [[NSDictionary dictionaryWithObjectsAndKeys: o_string_color, NSForegroundColorAttributeName, [NSFont titleBarFontOfSize:10.0], NSFontAttributeName, nil] retain];
716 - (void)setAlignment:(NSTextAlignment)alignment
718 textAlignment = alignment;
719 [self setStringValue:[self stringValue]];
724 [o_string_shadow release];
725 [o_string_attributes_dict release];
729 - (void)setStringValue:(NSString *)string
731 if (!o_string_shadow)
733 o_string_shadow = [[NSShadow alloc] init];
734 [o_string_shadow setShadowColor: [NSColor colorWithCalibratedWhite:1.0 alpha:0.5]];
735 [o_string_shadow setShadowOffset:NSMakeSize(0.0, -1.5)];
736 [o_string_shadow setShadowBlurRadius:0.0];
739 NSMutableAttributedString *o_attributed_string = [[NSMutableAttributedString alloc] initWithString:string attributes: o_string_attributes_dict];
740 NSUInteger i_stringLength = [string length];
742 [o_attributed_string addAttribute: NSShadowAttributeName value: o_string_shadow range: NSMakeRange(0, i_stringLength)];
743 [o_attributed_string setAlignment: textAlignment range: NSMakeRange(0, i_stringLength)];
744 [self setAttributedStringValue: o_attributed_string];
745 [o_attributed_string release];
748 - (void)mouseDown: (NSEvent *)ourEvent
750 if( [ourEvent clickCount] > 1 )
751 [[[VLCMain sharedInstance] controls] goToSpecificTime: nil];
754 if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayTimeAsTimeRemaining"])
755 [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"DisplayTimeAsTimeRemaining"];
757 [[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"DisplayTimeAsTimeRemaining"];
761 - (BOOL)timeRemaining
763 return [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayTimeAsTimeRemaining"];
767 /*****************************************************************************
768 * VLCMainWindowSplitView implementation
769 * comment 1 + 2 taken from NSSplitView.h (10.7 SDK)
770 *****************************************************************************/
771 @implementation VLCMainWindowSplitView : NSSplitView
772 /* Return the color of the dividers that the split view is drawing between subviews. The default implementation of this method returns [NSColor clearColor] for the thick divider style. It will also return [NSColor clearColor] for the thin divider style when the split view is in a textured window. All other thin dividers are drawn with a color that looks good between two white panes. You can override this method to change the color of dividers.
774 - (NSColor *)dividerColor
776 return [NSColor colorWithCalibratedRed:.60 green:.60 blue:.60 alpha:1.];
779 /* Return the thickness of the dividers that the split view is drawing between subviews. The default implementation returns a value that depends on the divider style. You can override this method to change the size of dividers.
781 - (CGFloat)dividerThickness
787 /*****************************************************************************
788 * VLCThreePartImageView interface
789 *****************************************************************************/
790 @implementation VLCThreePartImageView
793 [o_left_img release];
794 [o_middle_img release];
795 [o_right_img release];
800 - (void)setImagesLeft:(NSImage *)left middle: (NSImage *)middle right:(NSImage *)right
803 [o_left_img release];
805 [o_middle_img release];
807 [o_right_img release];
809 o_left_img = [left retain];
810 o_middle_img = [middle retain];
811 o_right_img = [right retain];
814 - (void)drawRect:(NSRect)rect
816 NSRect bnds = [self bounds];
817 NSDrawThreePartImage( bnds, o_left_img, o_middle_img, o_right_img, NO, NSCompositeSourceOver, 1, NO );
822 @implementation VLCThreePartDropView
824 - (BOOL)mouseDownCanMoveWindow
831 [self unregisterDraggedTypes];
837 [self registerForDraggedTypes:[NSArray arrayWithObject: NSFilenamesPboardType]];
840 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
842 if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) == NSDragOperationGeneric)
843 return NSDragOperationGeneric;
845 return NSDragOperationNone;
848 - (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
853 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
856 b_returned = [[VLCCoreInteraction sharedInstance] performDragOperation: sender];
858 [self setNeedsDisplay:YES];
862 - (void)concludeDragOperation:(id <NSDraggingInfo>)sender
864 [self setNeedsDisplay:YES];