Commit aef2d858 authored by Marvin Scholz's avatar Marvin Scholz

macosx: Remove MPSlider

Remove unused MPSlider class
parent 02723c8d
......@@ -49,15 +49,6 @@
@end
/*****************************************************************************
* MPSlider
*****************************************************************************/
@interface MPSlider : NSSlider
@end
/*****************************************************************************
* ProgressView
*****************************************************************************/
......
......@@ -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
*****************************************************************************/
......
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