vlc | branch: master | Marvin Scholz <[email protected]> | Tue Jul 19 03:07:59 2016 +0200| [3d72db679e968680c724456cbaad3422651901d5] | committer: 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. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3d72db679e968680c724456cbaad3422651901d5 --- modules/gui/macosx/VLCHUDSliderCell.m | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/modules/gui/macosx/VLCHUDSliderCell.m b/modules/gui/macosx/VLCHUDSliderCell.m index 8e3ac28..2dcba9e 100644 --- a/modules/gui/macosx/VLCHUDSliderCell.m +++ b/modules/gui/macosx/VLCHUDSliderCell.m @@ -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 { _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
