Revision: 13588
          http://sourceforge.net/p/skim-app/code/13588
Author:   hofman
Date:     2023-08-17 21:37:02 +0000 (Thu, 17 Aug 2023)
Log Message:
-----------
use segmented control for close button

Modified Paths:
--------------
    trunk/SKNavigationWindow.h
    trunk/SKNavigationWindow.m

Modified: trunk/SKNavigationWindow.h
===================================================================
--- trunk/SKNavigationWindow.h  2023-08-17 16:39:24 UTC (rev 13587)
+++ trunk/SKNavigationWindow.h  2023-08-17 21:37:02 UTC (rev 13588)
@@ -64,7 +64,7 @@
     NSSegmentedControl *styleButton;
     NSSegmentedControl *removeShadowButton;
     NSSegmentedControl *drawButton;
-    NSButton *closeButton;
+    NSSegmentedControl *closeButton;
 }
 - (void)selectCursorStyle:(NSInteger)style;
 - (void)removeShadow:(BOOL)removeShadow;

Modified: trunk/SKNavigationWindow.m
===================================================================
--- trunk/SKNavigationWindow.m  2023-08-17 16:39:24 UTC (rev 13587)
+++ trunk/SKNavigationWindow.m  2023-08-17 21:37:02 UTC (rev 13588)
@@ -344,19 +344,22 @@
         
         rect.origin.x = NSMaxX(rect);
         rect.size.width = NSHeight(rect);
-        closeButton = [[NSButton alloc] initWithFrame:rect];
-        [closeButton setBordered:NO];
-        [closeButton setImage:[NSImage 
imageNamed:NSImageNameStopProgressTemplate]];
+        closeButton = [[SKHUDSegmentedControl alloc] initWithFrame:rect];
+        [closeButton setSegmentCount:1];
+        [closeButton setTrackingMode:NSSegmentSwitchTrackingMomentary];
+        [closeButton setWidth:24.0 forSegment:0];
+        [closeButton setImage:[NSImage 
imageNamed:NSImageNameStopProgressTemplate] forSegment:0];
         [closeButton setTarget:pdfView];
         [closeButton setAction:@selector(closeCursorStyleWindow:)];
         if (RUNNING_BEFORE(10_14))
             [[closeButton cell] setBackgroundStyle:NSBackgroundStyleDark];
-        [[closeButton cell] setAccessibilityLabel:NSLocalizedString(@"close", 
@"Accessibility description")];
+        [[[NSAccessibilityUnignoredDescendant(closeButton) 
accessibilityChildren] firstObject] 
setAccessibilityLabel:NSLocalizedString(@"close", @"Accessibility 
description")];
+        [closeButton sizeToFit];
         [[self contentView] addSubview:closeButton];
         
         NSScreen *screen = [[pdfView window] screen] ?: [NSScreen mainScreen];
         NSRect frame;
-        frame.size.width = NSWidth([styleButton frame]) + 
NSWidth([removeShadowButton frame]) + NSWidth([drawButton frame]) + 
NSHeight(rect) + 2.0 * BUTTON_MARGIN + 2.0 * SMALL_SEP_WIDTH;
+        frame.size.width = NSWidth([styleButton frame]) + 
NSWidth([removeShadowButton frame]) + NSWidth([drawButton frame]) + 
NSWidth([closeButton frame]) + 2.0 * BUTTON_MARGIN + 2.0 * SMALL_SEP_WIDTH;
         frame.size.height = NSHeight(rect) + 2.0 * BUTTON_MARGIN;
         frame.origin.x = NSMidX([screen frame]) - 0.5 * NSWidth(frame);
         frame.origin.y = NSMinY([screen frame]) + WINDOW_OFFSET;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to