* added an option to disable the fspanel
[vlc.git] / modules / gui / macosx / fspanel.m
1 /*****************************************************************************\r
2  * fspanel.m: MacOS X full screen panel\r
3  *****************************************************************************\r
4  * Copyright (C) 2006 the VideoLAN team\r
5  * $Id$\r
6  *\r
7  * Authors: J\8er\99me Decoodt <djc at videolan dot org>\r
8  *          Felix K\9fhne <fkuehne at videolan dot org>\r
9  *\r
10  * This program is free software; you can redistribute it and/or modify\r
11  * it under the terms of the GNU General Public License as published by\r
12  * the Free Software Foundation; either version 2 of the License, or\r
13  * (at your option) any later version.\r
14  * \r
15  * This program is distributed in the hope that it will be useful,\r
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
18  * GNU General Public License for more details.\r
19  *\r
20  * You should have received a copy of the GNU General Public License\r
21  * along with this program; if not, write to the Free Software\r
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\r
23  *****************************************************************************/\r
24 \r
25 /*****************************************************************************\r
26  * Preamble\r
27  *****************************************************************************/\r
28 #import "intf.h"\r
29 #import "controls.h"\r
30 #import "vout.h"\r
31 #import "fspanel.h"\r
32 \r
33 #define KEEP_VISIBLE_AFTER_ACTION 4 /* time in half-sec until this panel will hide again after an user's action */\r
34 \r
35 /*****************************************************************************\r
36  * VLCFSPanel\r
37  *****************************************************************************/\r
38 @implementation VLCFSPanel\r
39 /* We override this initializer so we can set the NSBorderlessWindowMask styleMask, and set a few other important settings */\r
40 - (id)initWithContentRect:(NSRect)contentRect \r
41                 styleMask:(unsigned int)aStyle \r
42                   backing:(NSBackingStoreType)bufferingType \r
43                     defer:(BOOL)flag\r
44 {\r
45     id win = [super initWithContentRect:contentRect styleMask:NSTexturedBackgroundWindowMask backing:bufferingType defer:flag];\r
46     [win setOpaque:NO];\r
47     [win setHasShadow: NO];\r
48     [win setBackgroundColor:[NSColor clearColor]];\r
49     \r
50     /* let the window sit on top of everything else and start out completely transparent */\r
51     [win setLevel:NSFloatingWindowLevel];\r
52     [win setAlphaValue:0.0];\r
53     i_device = 0;\r
54 \r
55     [win center];\r
56     return win;\r
57 }\r
58 \r
59 - (void)awakeFromNib\r
60 {\r
61     [self setContentView:[[VLCFSPanelView alloc] initWithFrame: [self frame]]];\r
62     BOOL isInside = (NSPointInRect([NSEvent mouseLocation],[self frame]));\r
63     [[self contentView] addTrackingRect:[[self contentView] bounds] owner:self userData:nil assumeInside:isInside];\r
64     if (isInside)\r
65         [self mouseEntered:NULL];\r
66     if (!isInside)\r
67         [self mouseExited:NULL];\r
68 }\r
69 \r
70 /* Windows created with NSBorderlessWindowMask normally can't be key, but we want ours to be */\r
71 - (BOOL)canBecomeKeyWindow\r
72 {\r
73     return YES;\r
74 }\r
75 \r
76 - (BOOL)mouseDownCanMoveWindow\r
77 {\r
78     return YES;\r
79 }\r
80 \r
81 -(void)dealloc\r
82 {\r
83     if( hideAgainTimer )\r
84         [hideAgainTimer release];\r
85     [self setFadeTimer:nil];\r
86     [super dealloc];\r
87 }\r
88 \r
89 -(void)center\r
90 {\r
91     /* centre the panel in the lower third of the screen */\r
92     NSPoint theCoordinate;\r
93     NSRect theScreensFrame;\r
94     NSRect theWindowsFrame;\r
95 \r
96     if( i_device < 0 || i_device >= (signed int)[[NSScreen screens] count] )\r
97         /* invalid preferences or none specified, using main screen */\r
98         theScreensFrame = [[NSScreen mainScreen] frame];\r
99     else\r
100         /* user-defined screen */\r
101         theScreensFrame = [[[NSScreen screens] objectAtIndex: i_device] frame];\r
102 \r
103     theWindowsFrame = [self frame];\r
104     \r
105     theCoordinate.x = (theScreensFrame.size.width - theWindowsFrame.size.width) / 2 + theScreensFrame.origin.x;\r
106     theCoordinate.y = (theScreensFrame.size.height / 3) - theWindowsFrame.size.height + theScreensFrame.origin.y;\r
107     [self setFrameTopLeftPoint: theCoordinate];\r
108 }\r
109 \r
110 - (void)setPlay\r
111 {\r
112     [[self contentView] setPlay];\r
113 }\r
114 \r
115 - (void)setPause\r
116 {\r
117     [[self contentView] setPause];\r
118 }\r
119 \r
120 - (void)setStreamTitle:(NSString *)o_title\r
121 {\r
122     [[self contentView] setStreamTitle: o_title];\r
123 }\r
124 \r
125 - (void)setStreamPos:(float) f_pos andTime:(NSString *)o_time\r
126 {\r
127     [[self contentView] setStreamPos:f_pos andTime: o_time];\r
128 }\r
129 \r
130 - (void)setSeekable:(BOOL) b_seekable\r
131 {\r
132     [[self contentView] setSeekable: b_seekable];\r
133 }\r
134 \r
135 - (void)setVolumeLevel: (float)f_volumeLevel\r
136 {\r
137     [[self contentView] setVolumeLevel: f_volumeLevel];\r
138 }\r
139 \r
140 /* This routine is called repeatedly to fade in the window */\r
141 - (void)focus:(NSTimer *)timer\r
142 {\r
143     /* we need to push ourselves to front if the vout window was closed since our last display */\r
144     if( b_voutWasUpdated )\r
145     {\r
146         [self orderFront: self];\r
147         b_voutWasUpdated = NO;\r
148     }\r
149 \r
150     if( [self alphaValue] < 1.0 )\r
151         [self setAlphaValue:[self alphaValue]+0.1];\r
152     if( [self alphaValue] >= 1.0 )\r
153     {\r
154         b_displayed = YES;\r
155         [self setAlphaValue: 1.0];\r
156         [self setFadeTimer:nil];\r
157         if( b_fadeQueued )\r
158         {\r
159             b_fadeQueued=NO;\r
160             [self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(unfocus:) userInfo:NULL repeats:YES]];\r
161         }\r
162     }\r
163 }\r
164 \r
165 /* This routine is called repeatedly to hide the window */\r
166 - (void)unfocus:(NSTimer *)timer\r
167 {\r
168     if( b_keptVisible )\r
169     {\r
170         b_keptVisible = NO;\r
171         b_fadeQueued = NO;\r
172         [[self fadeTimer] release];\r
173         [self setFadeTimer: NULL];\r
174         [self fadeIn];\r
175         return;\r
176     }\r
177     if( [self alphaValue] > 0.0 )\r
178         [self setAlphaValue:[self alphaValue]-0.1];\r
179     if( [self alphaValue] <= 0.1 )\r
180     {\r
181         b_displayed = NO;\r
182         [self setAlphaValue:0.0];\r
183         [self setFadeTimer:nil];\r
184         if( b_fadeQueued )\r
185         {\r
186             b_fadeQueued=NO;\r
187             [self setFadeTimer:\r
188                 [NSTimer scheduledTimerWithTimeInterval:0.1 \r
189                                                  target:self \r
190                                                selector:@selector(focus:) \r
191                                                userInfo:NULL \r
192                                                 repeats:YES]];\r
193         }\r
194     }\r
195 }\r
196 \r
197 - (void)mouseExited:(NSEvent *)theEvent\r
198 {\r
199     /* give up our focus, so the vout may show us again without letting the user clicking it */\r
200     if( [[[[VLCMain sharedInstance] getControls] getVoutView] isFullscreen] )\r
201         [[[[[VLCMain sharedInstance] getControls] getVoutView] window] makeKeyWindow];\r
202 }\r
203 \r
204 - (void)fadeIn\r
205 {\r
206     /* in case that the user don't want us to appear, just return here */\r
207     if(! config_GetInt( VLCIntf, "macosx-fspanel" ) )\r
208         return;\r
209     \r
210     if( [self alphaValue] < 1.0 )\r
211     {\r
212         if (![self fadeTimer])\r
213             [self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(focus:) userInfo:[NSNumber numberWithShort:1] repeats:YES]];\r
214         else if ([[[self fadeTimer] userInfo] shortValue]==0)\r
215             b_fadeQueued=YES;\r
216     }\r
217     [self autoHide];\r
218 }\r
219 \r
220 - (void)fadeOut\r
221 {\r
222     if( NSPointInRect([NSEvent mouseLocation],[self frame]))\r
223         return;\r
224 \r
225     if( ( [self alphaValue] > 0.0 ) )\r
226     {\r
227         if (![self fadeTimer])\r
228             [self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(unfocus:) userInfo:[NSNumber numberWithShort:0] repeats:YES]];\r
229         else if ([[[self fadeTimer] userInfo] shortValue]==1)\r
230             b_fadeQueued=YES;\r
231     }\r
232 }\r
233 \r
234 /* triggers a timer to autoHide us again after some seconds of no activity */\r
235 - (void)autoHide\r
236 {\r
237     /* this will tell the timer to start over again or to start at all */\r
238     b_keptVisible = YES;\r
239     \r
240     /* get us a valid timer */\r
241     if(! b_alreadyCounting )\r
242     {\r
243         hideAgainTimer = [NSTimer scheduledTimerWithTimeInterval: 0.5\r
244                                                           target: self \r
245                                                         selector: @selector(keepVisible:)\r
246                                                         userInfo: nil \r
247                                                          repeats: YES];\r
248         [hideAgainTimer fire];\r
249         [hideAgainTimer retain];\r
250         b_alreadyCounting = YES;\r
251     }\r
252 }\r
253 \r
254 - (void)keepVisible:(NSTimer *)timer\r
255 {\r
256     /* if the user triggered an action, start over again */\r
257     if( b_keptVisible )\r
258     {\r
259         i_timeToKeepVisibleInSec = KEEP_VISIBLE_AFTER_ACTION;\r
260         b_keptVisible = NO;\r
261     }\r
262     \r
263     /* count down until we hide ourselfes again and do so if necessary */\r
264     i_timeToKeepVisibleInSec -= 1;\r
265     if( i_timeToKeepVisibleInSec < 1 )\r
266     {\r
267         [self fadeOut];\r
268         [timer invalidate];\r
269         [timer release];\r
270         b_alreadyCounting = NO;\r
271         timer = NULL;\r
272     }\r
273 }\r
274 \r
275 /* A getter and setter for our main timer that handles window fading */\r
276 - (NSTimer *)fadeTimer\r
277 {\r
278     return fadeTimer;\r
279 }\r
280 \r
281 - (void)setFadeTimer:(NSTimer *)timer\r
282 {\r
283     [timer retain];\r
284     [fadeTimer invalidate];\r
285     [fadeTimer release];\r
286     fadeTimer=timer;\r
287 }\r
288 \r
289 - (void)mouseDown:(NSEvent *)theEvent\r
290 {\r
291     mouseClic = [theEvent locationInWindow];\r
292 }\r
293 \r
294 - (void)mouseDragged:(NSEvent *)theEvent\r
295 {\r
296     NSPoint point = [NSEvent mouseLocation];\r
297     point.x -= mouseClic.x;\r
298     point.y -= mouseClic.y;\r
299     [self setFrameOrigin:point];\r
300 }\r
301 \r
302 - (BOOL)isDisplayed\r
303 {\r
304     return b_displayed;\r
305 }\r
306 \r
307 - (void)setVoutWasUpdated: (int)i_newdevice;\r
308 {\r
309     b_voutWasUpdated = YES;\r
310     if( i_newdevice != i_device )\r
311     {\r
312         i_device = i_newdevice;\r
313         [self center];\r
314     }\r
315 }\r
316 @end\r
317 \r
318 /*****************************************************************************\r
319  * FSPanelView\r
320  *****************************************************************************/\r
321 @implementation VLCFSPanelView\r
322 \r
323 #define addButton( o_button, imageOff, imageOn, _x, _y, action )                                \\r
324     s_rc.origin.x = _x;                                                                         \\r
325     s_rc.origin.y = _y;                                                                         \\r
326     o_button = [[NSButton alloc] initWithFrame: s_rc];                                 \\r
327     [o_button setButtonType: NSMomentaryChangeButton];                                          \\r
328     [o_button setBezelStyle: NSRegularSquareBezelStyle];                                        \\r
329     [o_button setBordered: NO];                                                                 \\r
330     [o_button setFont:[NSFont systemFontOfSize:0]];                                             \\r
331     [o_button setImage:[NSImage imageNamed:imageOff]];                                 \\r
332     [o_button setAlternateImage:[NSImage imageNamed:imageOn]];                         \\r
333     [o_button sizeToFit];                                                                       \\r
334     [o_button setTarget: self];                                                                 \\r
335     [o_button setAction: @selector(action:)];                                                   \\r
336     [self addSubview:o_button];\r
337 \r
338 #define addTextfield( o_text, align, font, color, size )                                    \\r
339     o_text = [[NSTextField alloc] initWithFrame: s_rc];                            \\r
340     [o_text setDrawsBackground: NO];                                                        \\r
341     [o_text setBordered: NO];                                                               \\r
342     [o_text setEditable: NO];                                                               \\r
343     [o_text setSelectable: NO];                                                             \\r
344     [o_text setStringValue: _NS("(no item is being played)")];                                                    \\r
345     [o_text setAlignment: align];                                                           \\r
346     [o_text setTextColor: [NSColor color]];                                                 \\r
347     [o_text setFont:[NSFont font:[NSFont smallSystemFontSize] - size]];                     \\r
348     [self addSubview:o_text];\r
349 \r
350 - (id)initWithFrame:(NSRect)frameRect\r
351 {\r
352     id view = [super initWithFrame:frameRect];\r
353     fillColor = [[NSColor clearColor] retain];\r
354     NSRect s_rc = [self frame];\r
355     addButton( o_prev, @"fs_skip_previous" , @"fs_skip_previous_highlight", 174, 15, prev );\r
356     addButton( o_bwd, @"fs_rewind"        , @"fs_rewind_highlight"       , 211, 14, backward );\r
357     addButton( o_play, @"fs_play"          , @"fs_play_highlight"         , 267, 10, play );\r
358     addButton( o_fwd, @"fs_forward"       , @"fs_forward_highlight"      , 313, 14, forward );\r
359     addButton( o_next, @"fs_skip_next"     , @"fs_skip_next_highlight"    , 365, 15, next );\r
360     addButton( o_fullscreen, @"fs_exit_fullscreen", @"fs_exit_fullscreen_hightlight", 507, 13, windowAction );\r
361 /*\r
362     addButton( o_button, @"image (off state)", @"image (on state)", 38, 51, something );\r
363  */\r
364 \r
365     /* time slider */\r
366     s_rc = [self frame];\r
367     s_rc.origin.x = 15;\r
368     s_rc.origin.y = 53;\r
369     s_rc.size.width = 518;\r
370     s_rc.size.height = 9;\r
371     o_fs_timeSlider = [[VLCFSTimeSlider alloc] initWithFrame: s_rc];\r
372     [o_fs_timeSlider setMinValue:0];\r
373     [o_fs_timeSlider setMaxValue:10000];\r
374     [o_fs_timeSlider setFloatValue: 0];\r
375     [o_fs_timeSlider setContinuous: YES];\r
376     [o_fs_timeSlider setTarget: self];\r
377     [o_fs_timeSlider setAction: @selector(fsTimeSliderUpdate:)];\r
378     [self addSubview: o_fs_timeSlider];\r
379 \r
380     /* volume slider */\r
381     s_rc = [self frame];\r
382     s_rc.origin.x = 26;\r
383     s_rc.origin.y = 17.5;\r
384     s_rc.size.width = 95;\r
385     s_rc.size.height = 10;\r
386     o_fs_volumeSlider = [[VLCFSVolumeSlider alloc] initWithFrame: s_rc];\r
387     [o_fs_volumeSlider setMinValue:0];\r
388     [o_fs_volumeSlider setMaxValue:32];\r
389     [o_fs_volumeSlider setFloatValue: 0];\r
390     [o_fs_volumeSlider setContinuous: YES];\r
391     [o_fs_volumeSlider setTarget: self];\r
392     [o_fs_volumeSlider setAction: @selector(fsVolumeSliderUpdate:)];\r
393     [self addSubview: o_fs_volumeSlider];\r
394     \r
395     /* time counter and stream title output fields */\r
396     s_rc = [self frame];\r
397     s_rc.origin.x = 98;\r
398     s_rc.origin.y = 64;\r
399     s_rc.size.width = 352;\r
400     s_rc.size.height = 14;\r
401     addTextfield( o_streamTitle_txt, NSCenterTextAlignment, systemFontOfSize, whiteColor, 0 );\r
402     s_rc.origin.x = 486;\r
403     s_rc.origin.y = 64;\r
404     s_rc.size.width = 50;\r
405     addTextfield( o_streamPosition_txt, NSRightTextAlignment, systemFontOfSize, whiteColor, 0 );\r
406 \r
407     return view;\r
408 }\r
409 \r
410 - (void)dealloc\r
411 {\r
412     [o_fs_timeSlider release];\r
413     [o_fs_volumeSlider release];\r
414     [o_prev release];\r
415     [o_next release];\r
416     [o_bwd release];\r
417     [o_play release];\r
418     [o_fwd release];\r
419     [o_fullscreen release];\r
420     [o_streamTitle_txt release];\r
421     [o_streamPosition_txt release];\r
422     [super dealloc];\r
423 }\r
424 \r
425 - (void)setPlay\r
426 {\r
427     [o_play setImage:[NSImage imageNamed:@"fs_play"]];\r
428     [o_play setAlternateImage: [NSImage imageNamed:@"fs_play_highlight"]];\r
429 }\r
430 \r
431 - (void)setPause\r
432 {\r
433     [o_play setImage: [NSImage imageNamed:@"fs_pause"]];\r
434     [o_play setAlternateImage: [NSImage imageNamed:@"fs_pause_highlight"]];\r
435 }\r
436 \r
437 - (void)setStreamTitle:(NSString *)o_title\r
438 {\r
439     [o_streamTitle_txt setStringValue: o_title];\r
440 }\r
441 \r
442 - (void)setStreamPos:(float) f_pos andTime:(NSString *)o_time\r
443 {\r
444     [o_streamPosition_txt setStringValue: o_time];\r
445     [o_fs_timeSlider setFloatValue: f_pos];\r
446 }\r
447 \r
448 - (void)setSeekable:(BOOL)b_seekable\r
449 {\r
450     [o_bwd setEnabled: b_seekable];\r
451     [o_fwd setEnabled: b_seekable];\r
452     [o_fs_timeSlider setEnabled: b_seekable];\r
453 }\r
454 \r
455 - (void)setVolumeLevel: (float)f_volumeLevel\r
456 {\r
457     [o_fs_volumeSlider setFloatValue: f_volumeLevel];\r
458 }\r
459 \r
460 - (IBAction)play:(id)sender\r
461 {\r
462     [[[VLCMain sharedInstance] getControls] play: sender];\r
463 }\r
464 \r
465 - (IBAction)forward:(id)sender\r
466 {\r
467     [[[VLCMain sharedInstance] getControls] forward: sender];\r
468 }\r
469 \r
470 - (IBAction)backward:(id)sender\r
471 {\r
472     [[[VLCMain sharedInstance] getControls] backward: sender];\r
473 }\r
474 \r
475 - (IBAction)prev:(id)sender\r
476 {\r
477     [[[VLCMain sharedInstance] getControls] prev: sender];\r
478 }\r
479 \r
480 - (IBAction)next:(id)sender\r
481 {\r
482     [[[VLCMain sharedInstance] getControls] next: sender];\r
483 }\r
484 \r
485 - (IBAction)windowAction:(id)sender\r
486 {\r
487     [[[VLCMain sharedInstance] getControls] windowAction: sender];\r
488 }\r
489 \r
490 - (IBAction)fsTimeSliderUpdate:(id)sender\r
491 {\r
492     [[VLCMain sharedInstance] timesliderUpdate: sender];\r
493 }\r
494 \r
495 - (IBAction)fsVolumeSliderUpdate:(id)sender\r
496 {\r
497     [[[VLCMain sharedInstance] getControls] volumeSliderUpdated: sender];\r
498 }\r
499 \r
500 #define addImage(image, _x, _y, mode, _width)                                               \\r
501     img = [NSImage imageNamed:image];                                              \\r
502     image_rect.size = [img size];                                                           \\r
503     image_rect.origin.x = 0;                                                                \\r
504     image_rect.origin.y = 0;                                                                \\r
505     frame.origin.x = _x;                                                                    \\r
506     frame.origin.y = _y;                                                                    \\r
507     frame.size = [img size];                                                                \\r
508     if( _width ) frame.size.width = _width;                                                 \\r
509     [img drawInRect:frame fromRect:image_rect operation:mode fraction:1];\r
510 \r
511 - (void)drawRect:(NSRect)rect\r
512 {\r
513         NSRect frame = [self frame];\r
514     NSRect image_rect;\r
515     NSImage *img;\r
516     addImage( @"fs_background", 0, 0, NSCompositeCopy, 0 );\r
517     addImage( @"fs_volume_slider_bar", 26, 22, NSCompositeSourceOver, 0 );\r
518     addImage( @"fs_volume_mute", 16, 18, NSCompositeSourceOver, 0 );\r
519     addImage( @"fs_volume_max", 124, 17, NSCompositeSourceOver, 0 );\r
520     addImage( @"fs_time_slider", 15, 53, NSCompositeSourceOver, 0);\r
521 }\r
522 \r
523 @end\r
524 \r
525 /*****************************************************************************\r
526  * VLCFSTimeSlider\r
527  *****************************************************************************/\r
528 @implementation VLCFSTimeSlider\r
529 - (void)drawKnobInRect:(NSRect)knobRect\r
530 {\r
531     NSRect image_rect;\r
532     NSImage *img = [NSImage imageNamed:@"fs_time_slider_knob_highlight"];\r
533     image_rect.size = [img size];\r
534     image_rect.origin.x = 0;\r
535     image_rect.origin.y = 0;\r
536     knobRect.origin.x += (knobRect.size.width - image_rect.size.width) / 2;\r
537     knobRect.size.width = image_rect.size.width;\r
538     knobRect.size.height = image_rect.size.height;\r
539     [img drawInRect:knobRect fromRect:image_rect operation:NSCompositeSourceOver fraction:1];\r
540 }\r
541 \r
542 - (void)drawRect:(NSRect)rect\r
543 {\r
544     /* Draw default to make sure the slider behaves correctly */\r
545     [[NSGraphicsContext currentContext] saveGraphicsState];\r
546     NSRectClip(NSZeroRect);\r
547     [super drawRect:rect];\r
548     [[NSGraphicsContext currentContext] restoreGraphicsState];\r
549     \r
550     NSRect knobRect = [[self cell] knobRectFlipped:NO];\r
551     knobRect.origin.y+=7.5;\r
552     [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];\r
553     [self drawKnobInRect: knobRect];\r
554 }\r
555 \r
556 @end\r
557 \r
558 /*****************************************************************************\r
559 * VLCFSVolumeSlider\r
560 *****************************************************************************/\r
561 @implementation VLCFSVolumeSlider\r
562 - (void)drawKnobInRect:(NSRect) knobRect\r
563 {\r
564     NSRect image_rect;\r
565     NSImage *img = [NSImage imageNamed:@"fs_volume_slider_knob"];\r
566     image_rect.size = [img size];\r
567     image_rect.origin.x = 0;\r
568     image_rect.origin.y = 0;\r
569     knobRect.origin.x += (knobRect.size.width - image_rect.size.width) / 2;\r
570     knobRect.size.width = image_rect.size.width;\r
571     knobRect.size.height = image_rect.size.height;\r
572     [img drawInRect:knobRect fromRect:image_rect operation:NSCompositeSourceOver fraction:1];\r
573 }\r
574 \r
575 - (void)drawRect:(NSRect)rect\r
576 {\r
577     /* Draw default to make sure the slider behaves correctly */\r
578     [[NSGraphicsContext currentContext] saveGraphicsState];\r
579     NSRectClip(NSZeroRect);\r
580     [super drawRect:rect];\r
581     [[NSGraphicsContext currentContext] restoreGraphicsState];\r
582     \r
583     NSRect knobRect = [[self cell] knobRectFlipped:NO];\r
584     knobRect.origin.y+=6;\r
585     [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];\r
586     [self drawKnobInRect: knobRect];\r
587 }\r
588 \r
589 @end\r
590 \r