Commit 3d72db67 authored by Marvin Scholz's avatar Marvin Scholz

macosx: Add bar drawing for VLCHUDSliderCell

The VLCHUDSliderCell was lacking drawing for the actual bar, this could
cause a weird look on older Mac OS X Versions. This patch adds a first
implementation of bar drawing.

It currently only fully works for horizontal sliders, for vertical
sliders the inactive/active part is ignored and the whole bar is drawn
as active.
parent bdd77f83
......@@ -25,7 +25,6 @@
@implementation VLCHUDSliderCell
- (instancetype)initWithCoder:(NSCoder *)coder
self = [super initWithCoder:coder];
......@@ -142,6 +141,32 @@ NSAffineTransform* RotationTransform(const CGFloat angle, const NSPoint point)
[path stroke];
- (void)drawBarInside:(NSRect)fullRect flipped:(BOOL)flipped
// Determine current position of knob
CGFloat knobPosition = (self.doubleValue - self.minValue) / (self.maxValue - self.minValue);
// Copy rect
NSRect activeRect = fullRect;
// TODO: Implement active/inactive drawing for vetical sliders
if (!self.isVertical) {
// Calculate active rect
activeRect.size.width = knobPosition * (self.controlView.frame.size.width - 1.0);
// Draw inactive bar
[_disabledSliderColor setFill];
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:fullRect xRadius:2.0 yRadius:2.0];
[path fill];
// Draw active bar
[_sliderColor setFill];
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:activeRect xRadius:2.0 yRadius:2.0];
[path fill];
- (void) drawFocusRingMaskWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
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