diff --git a/modules/gui/macosx/misc.h b/modules/gui/macosx/misc.h index fb3893b3cfedf73dae0517c4cb074a0f8d75e8e6..81bc2e42c49d2125fb85e53b0e40e0ba9793fde6 100644 --- a/modules/gui/macosx/misc.h +++ b/modules/gui/macosx/misc.h @@ -49,15 +49,6 @@ @end - -/***************************************************************************** - * MPSlider - *****************************************************************************/ - -@interface MPSlider : NSSlider - -@end - /***************************************************************************** * ProgressView *****************************************************************************/ diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m index 73e20dfc17fb147b6b726aa6ee7f41453f13e3d4..b2cde3d88a15fcf9dc4e3233cc134bb3337b26a7 100644 --- a/modules/gui/macosx/misc.m +++ b/modules/gui/macosx/misc.m @@ -149,70 +149,6 @@ @end -/***************************************************************************** - * MPSlider - *****************************************************************************/ -@implementation MPSlider - -void _drawKnobInRect(NSRect knobRect) -{ - // Center knob in given rect - knobRect.origin.x += (int)((float)(knobRect.size.width - 7)/2.0); - knobRect.origin.y += (int)((float)(knobRect.size.height - 7)/2.0); - - // Draw diamond - NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 3, knobRect.origin.y + 6, 1, 1), NSCompositeSourceOver); - NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 2, knobRect.origin.y + 5, 3, 1), NSCompositeSourceOver); - NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 1, knobRect.origin.y + 4, 5, 1), NSCompositeSourceOver); - NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 0, knobRect.origin.y + 3, 7, 1), NSCompositeSourceOver); - NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 1, knobRect.origin.y + 2, 5, 1), NSCompositeSourceOver); - NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 2, knobRect.origin.y + 1, 3, 1), NSCompositeSourceOver); - NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 3, knobRect.origin.y + 0, 1, 1), NSCompositeSourceOver); -} - -void _drawFrameInRect(NSRect frameRect) -{ - // Draw frame - NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width, 1), NSCompositeSourceOver); - NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x, frameRect.origin.y + frameRect.size.height-1, frameRect.size.width, 1), NSCompositeSourceOver); - NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x, frameRect.origin.y, 1, frameRect.size.height), NSCompositeSourceOver); - NSRectFillUsingOperation(NSMakeRect(frameRect.origin.x+frameRect.size.width-1, frameRect.origin.y, 1, frameRect.size.height), NSCompositeSourceOver); -} - -- (void)drawRect:(NSRect)rect -{ - // Draw default to make sure the slider behaves correctly - [[NSGraphicsContext currentContext] saveGraphicsState]; - NSRectClip(NSZeroRect); - [super drawRect:rect]; - [[NSGraphicsContext currentContext] restoreGraphicsState]; - - // Full size - rect = [self bounds]; - int diff = (int)(([[self cell] knobThickness] - 7.0)/2.0) - 1; - rect.origin.x += diff-1; - rect.origin.y += diff; - rect.size.width -= 2*diff-2; - rect.size.height -= 2*diff; - - // Draw dark - NSRect knobRect = [[self cell] knobRectFlipped:NO]; - [[[NSColor blackColor] colorWithAlphaComponent:0.6] set]; - _drawFrameInRect(rect); - _drawKnobInRect(knobRect); - - // Draw shadow - [[[NSColor blackColor] colorWithAlphaComponent:0.1] set]; - rect.origin.x++; - rect.origin.y++; - knobRect.origin.x++; - knobRect.origin.y++; - _drawFrameInRect(rect); - _drawKnobInRect(knobRect); -} - -@end - /***************************************************************************** * ProgressView *****************************************************************************/