1 /*****************************************************************************
2 * misc.m: code not specific to vlc
3 *****************************************************************************
4 * Copyright (C) 2003-2011 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 *****************************************************************************/
25 #import <Cocoa/Cocoa.h>
26 #import <Carbon/Carbon.h>
28 #import "CompatibilityFixes.h"
29 #import "intf.h" /* VLCApplication */
30 #import "MainWindow.h"
36 /*****************************************************************************
37 * NSAnimation (VLCAdditions)
39 * Missing extension to NSAnimation
40 *****************************************************************************/
42 @implementation NSAnimation (VLCAdditions)
43 /* fake class attributes */
44 static NSMapTable *VLCAdditions_userInfo = NULL;
48 /* init our fake object attribute */
49 VLCAdditions_userInfo = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks, NSObjectMapValueCallBacks, 16);
54 NSMapRemove(VLCAdditions_userInfo, self);
58 - (void)setUserInfo: (void *)userInfo
60 NSMapInsert(VLCAdditions_userInfo, self, (void*)userInfo);
65 return NSMapGet(VLCAdditions_userInfo, self);
69 /*****************************************************************************
70 * NSScreen (VLCAdditions)
72 * Missing extension to NSScreen
73 *****************************************************************************/
75 @implementation NSScreen (VLCAdditions)
77 static NSMutableArray *blackoutWindows = NULL;
81 /* init our fake object attribute */
82 blackoutWindows = [[NSMutableArray alloc] initWithCapacity:1];
85 + (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID
87 NSUInteger count = [[NSScreen screens] count];
89 for( NSUInteger i = 0; i < count; i++ )
91 NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
92 if([screen displayID] == displayID)
100 return ([self displayID] == [[[NSScreen screens] objectAtIndex:0] displayID]);
103 - (BOOL)isScreen: (NSScreen*)screen
105 return ([self displayID] == [screen displayID]);
108 - (CGDirectDisplayID)displayID
110 return (CGDirectDisplayID)[[[self deviceDescription] objectForKey: @"NSScreenNumber"] intValue];
113 - (void)blackoutOtherScreens
115 /* Free our previous blackout window (follow blackoutWindow alloc strategy) */
116 [blackoutWindows makeObjectsPerformSelector:@selector(close)];
117 [blackoutWindows removeAllObjects];
119 NSUInteger screenCount = [[NSScreen screens] count];
120 for(NSUInteger i = 0; i < screenCount; i++)
122 NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
123 VLCWindow *blackoutWindow;
126 if([self isScreen: screen])
129 screen_rect = [screen frame];
130 screen_rect.origin.x = screen_rect.origin.y = 0;
132 /* blackoutWindow alloc strategy
133 - The NSMutableArray blackoutWindows has the blackoutWindow references
134 - blackoutOtherDisplays is responsible for alloc/releasing its Windows
136 blackoutWindow = [[VLCWindow alloc] initWithContentRect: screen_rect styleMask: NSBorderlessWindowMask
137 backing: NSBackingStoreBuffered defer: NO screen: screen];
138 [blackoutWindow setBackgroundColor:[NSColor blackColor]];
139 [blackoutWindow setLevel: NSFloatingWindowLevel]; /* Disappear when Expose is triggered */
141 [blackoutWindow displayIfNeeded];
142 [blackoutWindow orderFront: self animate: YES];
144 [blackoutWindows addObject: blackoutWindow];
145 [blackoutWindow release];
147 if( [screen isMainScreen ] )
149 if ([screen isMainScreen])
152 SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
154 [NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
160 + (void)unblackoutScreens
162 NSUInteger blackoutWindowCount = [blackoutWindows count];
164 for(NSUInteger i = 0; i < blackoutWindowCount; i++)
166 VLCWindow *blackoutWindow = [blackoutWindows objectAtIndex: i];
167 [blackoutWindow closeAndAnimate: YES];
171 SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
173 [NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
178 /*****************************************************************************
181 * Missing extension to NSWindow
182 *****************************************************************************/
184 @implementation VLCWindow
185 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask
186 backing:(NSBackingStoreType)backingType defer:(BOOL)flag
188 self = [super initWithContentRect:contentRect styleMask:styleMask backing:backingType defer:flag];
192 b_isset_canBecomeKeyWindow = NO;
193 /* we don't want this window to be restored on relaunch */
195 [self setRestorable:NO];
199 - (void)setCanBecomeKeyWindow: (BOOL)canBecomeKey
201 b_isset_canBecomeKeyWindow = YES;
202 b_canBecomeKeyWindow = canBecomeKey;
205 - (BOOL)canBecomeKeyWindow
207 if(b_isset_canBecomeKeyWindow)
208 return b_canBecomeKeyWindow;
210 return [super canBecomeKeyWindow];
213 - (void)closeAndAnimate: (BOOL)animate
223 invoc = [NSInvocation invocationWithMethodSignature:[super methodSignatureForSelector:@selector(close)]];
224 [invoc setTarget: self];
226 if (![self isVisible] || [self alphaValue] == 0.0)
232 [self orderOut: self animate: YES callback: invoc];
235 - (void)orderOut: (id)sender animate: (BOOL)animate
237 NSInvocation *invoc = [NSInvocation invocationWithMethodSignature:[super methodSignatureForSelector:@selector(orderOut:)]];
238 [invoc setTarget: self];
239 [invoc setArgument: sender atIndex: 0];
240 [self orderOut: sender animate: animate callback: invoc];
243 - (void)orderOut: (id)sender animate: (BOOL)animate callback:(NSInvocation *)callback
245 NSViewAnimation *anim;
246 NSViewAnimation *current_anim;
247 NSMutableDictionary *dict;
251 [self orderOut: sender];
255 dict = [[NSMutableDictionary alloc] initWithCapacity:2];
257 [dict setObject:self forKey:NSViewAnimationTargetKey];
259 [dict setObject:NSViewAnimationFadeOutEffect forKey:NSViewAnimationEffectKey];
260 anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]];
263 [anim setAnimationBlockingMode:NSAnimationNonblocking];
264 [anim setDuration:0.9];
265 [anim setFrameRate:30];
266 [anim setUserInfo: callback];
268 @synchronized(self) {
269 current_anim = self->animation;
271 if ([[[current_anim viewAnimations] objectAtIndex:0] objectForKey: NSViewAnimationEffectKey] == NSViewAnimationFadeOutEffect && [current_anim isAnimating])
279 [current_anim stopAnimation];
280 [anim setCurrentProgress:1.0-[current_anim currentProgress]];
281 [current_anim release];
284 [anim setCurrentProgress:1.0 - [self alphaValue]];
285 self->animation = anim;
286 [self setDelegate: self];
287 [anim startAnimation];
292 - (void)orderFront: (id)sender animate: (BOOL)animate
294 NSViewAnimation *anim;
295 NSViewAnimation *current_anim;
296 NSMutableDictionary *dict;
300 [super orderFront: sender];
301 [self setAlphaValue: 1.0];
305 if (![self isVisible])
307 [self setAlphaValue: 0.0];
308 [super orderFront: sender];
310 else if ([self alphaValue] == 1.0)
312 [super orderFront: self];
316 dict = [[NSMutableDictionary alloc] initWithCapacity:2];
318 [dict setObject:self forKey:NSViewAnimationTargetKey];
320 [dict setObject:NSViewAnimationFadeInEffect forKey:NSViewAnimationEffectKey];
321 anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]];
324 [anim setAnimationBlockingMode:NSAnimationNonblocking];
325 [anim setDuration:0.5];
326 [anim setFrameRate:30];
328 @synchronized(self) {
329 current_anim = self->animation;
331 if ([[[current_anim viewAnimations] objectAtIndex:0] objectForKey: NSViewAnimationEffectKey] == NSViewAnimationFadeInEffect && [current_anim isAnimating])
339 [current_anim stopAnimation];
340 [anim setCurrentProgress:1.0 - [current_anim currentProgress]];
341 [current_anim release];
344 [anim setCurrentProgress:[self alphaValue]];
345 self->animation = anim;
346 [self setDelegate: self];
347 [self orderFront: sender];
348 [anim startAnimation];
353 - (void)animationDidEnd:(NSAnimation*)anim
355 if ([self alphaValue] <= 0.0)
357 NSInvocation * invoc;
358 [super orderOut: nil];
359 [self setAlphaValue: 1.0];
360 if ((invoc = [anim userInfo]))
365 - (void)setFullscreen:(BOOL)b_var
367 b_isFullscreen = b_var;
372 return b_isFullscreen;
377 /*****************************************************************************
379 *****************************************************************************/
381 @implementation VLCControllerView
385 [self unregisterDraggedTypes];
391 [self registerForDraggedTypes:[NSArray arrayWithObjects:NSTIFFPboardType,
392 NSFilenamesPboardType, nil]];
395 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
397 if ((NSDragOperationGeneric & [sender draggingSourceOperationMask])
398 == NSDragOperationGeneric)
400 return NSDragOperationGeneric;
404 return NSDragOperationNone;
408 - (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
413 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
415 NSPasteboard *o_paste = [sender draggingPasteboard];
416 NSArray *o_types = [NSArray arrayWithObjects: NSFilenamesPboardType, nil];
417 NSString *o_desired_type = [o_paste availableTypeFromArray:o_types];
418 NSData *o_carried_data = [o_paste dataForType:o_desired_type];
422 if ([o_desired_type isEqualToString:NSFilenamesPboardType])
424 NSArray *o_array = [NSArray array];
425 NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
426 NSUInteger count = [o_values count];
428 for( NSUInteger i = 0; i < count; i++)
431 char *psz_uri = make_URI([[o_values objectAtIndex:i] UTF8String], NULL);
435 o_dic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:psz_uri encoding:NSUTF8StringEncoding] forKey:@"ITEM_URL"];
438 o_array = [o_array arrayByAddingObject: o_dic];
440 [(VLCPlaylist *)[[VLCMain sharedInstance] playlist] appendArray: o_array atPos: -1 enqueue:NO];
444 [self setNeedsDisplay:YES];
448 - (void)concludeDragOperation:(id <NSDraggingInfo>)sender
450 [self setNeedsDisplay:YES];
455 /*****************************************************************************
456 * VLBrushedMetalImageView
457 *****************************************************************************/
459 @implementation VLBrushedMetalImageView
461 - (BOOL)mouseDownCanMoveWindow
468 [self unregisterDraggedTypes];
474 [self registerForDraggedTypes:[NSArray arrayWithObjects:NSTIFFPboardType,
475 NSFilenamesPboardType, nil]];
476 [self setImageScaling: NSScaleToFit];
477 [self setImageFrameStyle: NSImageFrameNone];
478 [self setImageAlignment: NSImageAlignCenter];
481 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
483 if ((NSDragOperationGeneric & [sender draggingSourceOperationMask])
484 == NSDragOperationGeneric)
486 return NSDragOperationGeneric;
490 return NSDragOperationNone;
494 - (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
499 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
501 NSPasteboard *o_paste = [sender draggingPasteboard];
502 NSArray *o_types = [NSArray arrayWithObjects: NSFilenamesPboardType, nil];
503 NSString *o_desired_type = [o_paste availableTypeFromArray:o_types];
504 NSData *o_carried_data = [o_paste dataForType:o_desired_type];
505 BOOL b_autoplay = config_GetInt( VLCIntf, "macosx-autoplay" );
509 if ([o_desired_type isEqualToString:NSFilenamesPboardType])
511 NSArray *o_array = [NSArray array];
512 NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
513 NSUInteger count = [o_values count];
515 for( NSUInteger i = 0; i < count; i++)
518 char *psz_uri = make_URI([[o_values objectAtIndex:i] UTF8String], NULL);
522 o_dic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:psz_uri encoding:NSUTF8StringEncoding] forKey:@"ITEM_URL"];
525 o_array = [o_array arrayByAddingObject: o_dic];
528 [[[VLCMain sharedInstance] playlist] appendArray: o_array atPos: -1 enqueue:NO];
530 [[[VLCMain sharedInstance] playlist] appendArray: o_array atPos: -1 enqueue:YES];
534 [self setNeedsDisplay:YES];
538 - (void)concludeDragOperation:(id <NSDraggingInfo>)sender
540 [self setNeedsDisplay:YES];
546 /*****************************************************************************
548 *****************************************************************************/
549 @implementation MPSlider
551 void _drawKnobInRect(NSRect knobRect)
553 // Center knob in given rect
554 knobRect.origin.x += (int)((float)(knobRect.size.width - 7)/2.0);
555 knobRect.origin.y += (int)((float)(knobRect.size.height - 7)/2.0);
558 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 3, knobRect.origin.y + 6, 1, 1), NSCompositeSourceOver);
559 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 2, knobRect.origin.y + 5, 3, 1), NSCompositeSourceOver);
560 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 1, knobRect.origin.y + 4, 5, 1), NSCompositeSourceOver);
561 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 0, knobRect.origin.y + 3, 7, 1), NSCompositeSourceOver);
562 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 1, knobRect.origin.y + 2, 5, 1), NSCompositeSourceOver);
563 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 2, knobRect.origin.y + 1, 3, 1), NSCompositeSourceOver);
564 NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 3, knobRect.origin.y + 0, 1, 1), NSCompositeSourceOver);
567 void _drawFrameInRect(NSRect frameRect)
570 NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width, 1), NSCompositeSourceOver);
571 NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x, frameRect.origin.y + frameRect.size.height-1, frameRect.size.width, 1), NSCompositeSourceOver);
572 NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x, frameRect.origin.y, 1, frameRect.size.height), NSCompositeSourceOver);
573 NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x+frameRect.size.width-1, frameRect.origin.y, 1, frameRect.size.height), NSCompositeSourceOver);
576 - (void)drawRect:(NSRect)rect
578 // Draw default to make sure the slider behaves correctly
579 [[NSGraphicsContext currentContext] saveGraphicsState];
580 NSRectClip(NSZeroRect);
581 [super drawRect:rect];
582 [[NSGraphicsContext currentContext] restoreGraphicsState];
585 rect = [self bounds];
586 int diff = (int)(([[self cell] knobThickness] - 7.0)/2.0) - 1;
587 rect.origin.x += diff-1;
588 rect.origin.y += diff;
589 rect.size.width -= 2*diff-2;
590 rect.size.height -= 2*diff;
593 NSRect knobRect = [[self cell] knobRectFlipped:NO];
594 [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
595 _drawFrameInRect(rect);
596 _drawKnobInRect(knobRect);
599 [[[NSColor blackColor] colorWithAlphaComponent:0.1] set];
604 _drawFrameInRect(rect);
605 _drawKnobInRect(knobRect);
610 /*****************************************************************************
612 *****************************************************************************/
614 @implementation TimeLineSlider
618 if (config_GetInt( VLCIntf, "macosx-interfacestyle" ))
619 o_knob_img = [NSImage imageNamed:@"progression-knob_dark"];
621 o_knob_img = [NSImage imageNamed:@"progression-knob"];
622 img_rect.size = [o_knob_img size];
623 img_rect.origin.x = img_rect.origin.y = 0;
628 [o_knob_img release];
632 - (CGFloat)knobPosition
634 NSRect knobRect = [[self cell] knobRectFlipped:NO];
635 knobRect.origin.x += knobRect.size.width / 2;
636 return knobRect.origin.x;
639 - (void)drawKnobInRect:(NSRect)knobRect
641 knobRect.origin.x += (knobRect.size.width - img_rect.size.width) / 2;
642 knobRect.size.width = img_rect.size.width;
643 knobRect.size.height = img_rect.size.height;
644 [o_knob_img drawInRect:knobRect fromRect:img_rect operation:NSCompositeSourceOver fraction:1];
647 - (void)drawRect:(NSRect)rect
649 /* Draw default to make sure the slider behaves correctly */
650 [[NSGraphicsContext currentContext] saveGraphicsState];
651 NSRectClip(NSZeroRect);
652 [super drawRect:rect];
653 [[NSGraphicsContext currentContext] restoreGraphicsState];
655 NSRect knobRect = [[self cell] knobRectFlipped:NO];
656 knobRect.origin.y+=1;
657 [self drawKnobInRect: knobRect];
662 /*****************************************************************************
664 *****************************************************************************/
666 @implementation ITSlider
670 BOOL b_dark = config_GetInt( VLCIntf, "macosx-interfacestyle" );
672 img = [NSImage imageNamed:@"volume-slider-knob_dark"];
674 img = [NSImage imageNamed:@"volume-slider-knob"];
676 image_rect.size = [img size];
677 image_rect.origin.x = 0;
680 image_rect.origin.y = -1;
682 image_rect.origin.y = 0;
685 - (void)drawKnobInRect:(NSRect)knobRect
687 knobRect.origin.x += (knobRect.size.width - image_rect.size.width) / 2;
688 knobRect.size.width = image_rect.size.width;
689 knobRect.size.height = image_rect.size.height;
690 [img drawInRect:knobRect fromRect:image_rect operation:NSCompositeSourceOver fraction:1];
693 - (void)drawRect:(NSRect)rect
695 /* Draw default to make sure the slider behaves correctly */
696 [[NSGraphicsContext currentContext] saveGraphicsState];
697 NSRectClip(NSZeroRect);
698 [super drawRect:rect];
699 [[NSGraphicsContext currentContext] restoreGraphicsState];
701 NSRect knobRect = [[self cell] knobRectFlipped:NO];
702 knobRect.origin.y+=2;
703 [self drawKnobInRect: knobRect];
708 /*****************************************************************************
709 * VLCTimeField implementation
710 *****************************************************************************
711 * we need this to catch our click-event in the controller window
712 *****************************************************************************/
714 @implementation VLCTimeField
716 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
717 NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"DisplayTimeAsTimeRemaining"];
719 [defaults registerDefaults:appDefaults];
724 NSColor *o_string_color;
725 if (!config_GetInt( VLCIntf, "macosx-interfacestyle"))
726 o_string_color = [NSColor colorWithCalibratedRed:0.229 green:0.229 blue:0.229 alpha:100.0];
728 o_string_color = [NSColor colorWithCalibratedRed:0.64 green:0.64 blue:0.64 alpha:100.0];
730 textAlignment = NSCenterTextAlignment;
731 o_string_attributes_dict = [[NSDictionary dictionaryWithObjectsAndKeys: o_string_color, NSForegroundColorAttributeName, [NSFont titleBarFontOfSize:10.0], NSFontAttributeName, nil] retain];
734 - (void)setAlignment:(NSTextAlignment)alignment
736 textAlignment = alignment;
737 [self setStringValue:[self stringValue]];
742 [o_string_shadow release];
743 [o_string_attributes_dict release];
746 - (void)setStringValue:(NSString *)string
748 if (!o_string_shadow)
750 o_string_shadow = [[NSShadow alloc] init];
751 [o_string_shadow setShadowColor: [NSColor colorWithCalibratedWhite:1.0 alpha:0.5]];
752 [o_string_shadow setShadowOffset:NSMakeSize(0.0, -1.5)];
753 [o_string_shadow setShadowBlurRadius:0.0];
756 NSMutableAttributedString *o_attributed_string = [[NSMutableAttributedString alloc] initWithString:string attributes: o_string_attributes_dict];
757 NSUInteger i_stringLength = [string length];
759 [o_attributed_string addAttribute: NSShadowAttributeName value: o_string_shadow range: NSMakeRange(0, i_stringLength)];
760 [o_attributed_string setAlignment: textAlignment range: NSMakeRange(0, i_stringLength)];
761 [self setAttributedStringValue: o_attributed_string];
762 [o_attributed_string release];
765 - (void)mouseDown: (NSEvent *)ourEvent
767 if( [ourEvent clickCount] > 1 )
768 [[[VLCMain sharedInstance] controls] goToSpecificTime: nil];
771 if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayTimeAsTimeRemaining"])
772 [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"DisplayTimeAsTimeRemaining"];
774 [[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"DisplayTimeAsTimeRemaining"];
778 - (BOOL)timeRemaining
780 return [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayTimeAsTimeRemaining"];
784 /*****************************************************************************
785 * VLCMainWindowSplitView implementation
786 * comment 1 + 2 taken from NSSplitView.h (10.7 SDK)
787 *****************************************************************************/
788 @implementation VLCMainWindowSplitView : NSSplitView
789 /* 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.
791 - (NSColor *)dividerColor
793 return [NSColor colorWithCalibratedRed:.60 green:.60 blue:.60 alpha:1.];
796 /* 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.
798 - (CGFloat)dividerThickness
803 - (void)adjustSubviews
805 NSArray *o_subviews = [self subviews];
806 NSRect viewDimensions = [self frame];
807 NSRect leftViewDimensions = [[o_subviews objectAtIndex:0] frame];
808 NSRect rightViewDimensions = [[o_subviews objectAtIndex:1] frame];
809 CGFloat f_dividerThickness = [self dividerThickness];
811 leftViewDimensions.size.height = viewDimensions.size.height;
812 [[o_subviews objectAtIndex:0] setFrame: leftViewDimensions];
814 rightViewDimensions.origin.x = leftViewDimensions.size.width + f_dividerThickness;
815 rightViewDimensions.size.width = viewDimensions.size.width - leftViewDimensions.size.width - f_dividerThickness;
816 rightViewDimensions.size.height = viewDimensions.size.height;
817 [[o_subviews objectAtIndex:1] setFrame: rightViewDimensions];
821 /*****************************************************************************
822 * VLCThreePartImageView interface
823 *****************************************************************************/
824 @implementation VLCThreePartImageView
827 [o_left_img release];
828 [o_middle_img release];
829 [o_right_img release];
834 - (void)setImagesLeft:(NSImage *)left middle: (NSImage *)middle right:(NSImage *)right
837 [o_left_img release];
839 [o_middle_img release];
841 [o_right_img release];
843 o_left_img = [left retain];
844 o_middle_img = [middle retain];
845 o_right_img = [right retain];
848 - (void)drawRect:(NSRect)rect
850 NSRect bnds = [self bounds];
851 NSDrawThreePartImage( bnds, o_left_img, o_middle_img, o_right_img, NO, NSCompositeSourceOver, 1, NO );