[vlc-commits] macOS: Draw dividers for VLCHUDSegmentedCell

Marvin Scholz git at videolan.org
Thu Jun 15 20:30:09 CEST 2017


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Thu Jun 15 12:16:27 2017 +0200| [d62cb67685de809fbe79f57bae470144dc67acad] | committer: Marvin Scholz

macOS: Draw dividers for VLCHUDSegmentedCell

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d62cb67685de809fbe79f57bae470144dc67acad
---

 modules/gui/macosx/VLCHUDSegmentedCell.m | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/VLCHUDSegmentedCell.m b/modules/gui/macosx/VLCHUDSegmentedCell.m
index 4b0ead51be..91db2848d2 100644
--- a/modules/gui/macosx/VLCHUDSegmentedCell.m
+++ b/modules/gui/macosx/VLCHUDSegmentedCell.m
@@ -65,11 +65,11 @@
 
 - (void)drawWithFrame:(NSRect)frame inView:(NSView *)view
 {
-    [_strokeColor setStroke];
     for (NSInteger segment = 0; segment < self.segmentCount; segment++) {
         NSRect segmentRect = [self rectForSegment:segment inFrame:frame];
         [self drawBackgroundForSegment:segment inFrame:segmentRect];
         [self drawSegment:segment inFrame:segmentRect withView:view];
+        [self drawDividerForSegment:segment inFrame:segmentRect];
     }
 
     NSBezierPath* rectanglePath = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(frame, 0.55, 0.55) xRadius:3.0 yRadius:3.0];
@@ -131,6 +131,22 @@
     [gradient drawInBezierPath:fillPath angle:90];
 }
 
+- (void)drawDividerForSegment:(NSInteger)segment inFrame:(NSRect)frame
+{
+    if (segment == 0) {
+        // Do not draw for first segment
+        return;
+    }
+
+    // Draw divider on the left of the segment
+    NSBezierPath* dividerPath = [NSBezierPath bezierPath];
+    [dividerPath moveToPoint:NSMakePoint(NSMinX(frame), NSMinY(frame))];
+    [dividerPath lineToPoint:NSMakePoint(NSMinX(frame), NSMaxY(frame))];
+    [_strokeColor setStroke];
+    [dividerPath setLineWidth:1.0];
+    [dividerPath stroke];
+}
+
 - (BOOL)_canAnimate {
     return NO;
 }



More information about the vlc-commits mailing list