Revision: 27736
http://sourceforge.net/p/bibdesk/svn/27736
Author: hofman
Date: 2022-07-14 09:15:21 +0000 (Thu, 14 Jul 2022)
Log Message:
-----------
return accessibility label from accessor
Modified Paths:
--------------
trunk/bibdesk/BDSKColorLabelWell.m
Modified: trunk/bibdesk/BDSKColorLabelWell.m
===================================================================
--- trunk/bibdesk/BDSKColorLabelWell.m 2022-07-14 08:51:57 UTC (rev 27735)
+++ trunk/bibdesk/BDSKColorLabelWell.m 2022-07-14 09:15:21 UTC (rev 27736)
@@ -42,8 +42,7 @@
#if SDK_BEFORE(10_10)
@interface NSObject (BDSKYosemiteDeclarations)
-- (id)accessibilityValue;
-- (void)setAccessibilityValue:(id)value;
+- (id)accessibilityLabel;
@end
#endif
@@ -77,17 +76,6 @@
updatingColorPanel = flag;
}
-+ (NSString *)labelAtIndex:(NSUInteger)i {
- if (i == 0)
- return NSLocalizedString(@"Clear", @"");
- else if (i < 8)
- return [[NSColor labelNames] objectAtIndex:i - 1];
- else if (i == 8)
- return [NSLocalizedString(@"Other", @"") stringByAppendingEllipsis];
- else
- return @"";
-}
-
- (void)commonInit {
if (matrix == nil) {
matrix = [[NSMatrix alloc] initWithFrame:NSMakeRect(0.0, 2.0, 178.0,
22.0)];
@@ -128,14 +116,6 @@
[matrix addTrackingArea:area];
[areas addObject:area];
[area release];
- NSCell *cell = [matrix cellAtRow:0 column:i];
- if ([cell respondsToSelector:@selector(setAccessibilityLabel:)])
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
- [cell setAccessibilityLabel:[[self class] labelAtIndex:i]];
-#pragma clang diagnostic pop
- else
- [cell accessibilitySetOverrideValue:[[self class] labelAtIndex:i]
forAttribute:NSAccessibilityTitleAttribute];
}
trackingAreas = [areas copy];
@@ -396,7 +376,14 @@
[[matrix cellAtRow:0 column:i] setHovered:YES];
[matrix setNeedsDisplay:YES];
if (labelCell) {
- [labelCell setStringValue:[[self class] labelAtIndex:i]];
+ NSString *label = @"";
+ if (i == 0)
+ label = NSLocalizedString(@"Clear", @"");
+ else if (i < 8)
+ label = [[NSColor labelNames] objectAtIndex:i - 1];
+ else if (i == 8)
+ label = [NSLocalizedString(@"Other", @"")
stringByAppendingEllipsis];
+ [labelCell setStringValue:label];
[self setNeedsDisplay:YES];
}
}
@@ -427,6 +414,10 @@
[super mouseExited:event];
}
+- (BOOL)isAccessibilityElement {
+ return NO;
+}
+
@end
#pragma mark -
@@ -476,4 +467,24 @@
[NSGraphicsContext restoreGraphicsState];
}
+- (NSString *)accessibilityLabel {
+ NSInteger i = [self tag];
+ if (i == 0)
+ return NSLocalizedString(@"Clear", @"");
+ else if (i < 8)
+ return [[NSColor labelNames] objectAtIndex:i - 1];
+ else if (i == 8)
+ return NSLocalizedString(@"Other", @"");
+ else
+ return nil;
+}
+
+- (id)accessibilityAttributeValue:(NSString *)attribute {
+ if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) {
+ return [self accessibilityLabel];
+ } else {
+ return [super accessibilityAttributeValue:attribute];
+ }
+}
+
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit