Revision: 27705
http://sourceforge.net/p/bibdesk/svn/27705
Author: hofman
Date: 2022-07-07 16:30:29 +0000 (Thu, 07 Jul 2022)
Log Message:
-----------
implement newer accessibility accessors and actions
Modified Paths:
--------------
trunk/bibdesk/BDSKRatingButtonCell.m
Modified: trunk/bibdesk/BDSKRatingButtonCell.m
===================================================================
--- trunk/bibdesk/BDSKRatingButtonCell.m 2022-07-07 16:07:53 UTC (rev
27704)
+++ trunk/bibdesk/BDSKRatingButtonCell.m 2022-07-07 16:30:29 UTC (rev
27705)
@@ -456,6 +456,44 @@
[super accessibilitySetValue:value forAttribute:attribute];
}
+- (NSString *)accessibilityRole {
+ return NSAccessibilitySliderRole;
+}
+
+- (NSString *)accessibilityRoleDescription {
+ return NSAccessibilityRoleDescription(NSAccessibilitySliderRole, nil);
+}
+
+- (id)accessibilityValue {
+ return [NSNumber numberWithUnsignedInteger:rating];
+}
+
+- (id)accessibilityTitle {
+ return [self title];
+}
+
+- (void)setAccessibilityValue:(id)value {
+ [self setRating:MIN([value unsignedIntegerValue], maxRating)];
+ [(NSControl *)[self controlView] updateCellInside:self];
+ [(NSControl *)[self controlView] sendAction:[self action] to:[self
target]];
+}
+
+- (id)accessibilityMinValue {
+ return [NSNumber numberWithUnsignedInteger:0];
+}
+
+- (id)accessibilityMaxValue {
+ return [NSNumber numberWithUnsignedInteger:maxRating];
+}
+
+- (NSArray *)accessibilityAllowedValues {
+ NSMutableArray *values = [NSMutableArray array];
+ NSUInteger i;
+ for (i = 0; i <= maxRating; i++)
+ [values addObject:[NSNumber numberWithUnsignedInteger:i]];
+ return values;
+}
+
- (NSArray *)accessibilityActionNames {
static NSArray *actions = nil;
if (actions == nil) {
@@ -479,4 +517,24 @@
}
}
+- (BOOL)accessibilityPerformIncrement {
+ if (rating < maxRating) {
+ [self setRating:rating + 1];
+ [(NSControl *)[self controlView] updateCellInside:self];
+ [(NSControl *)[self controlView] sendAction:[self action] to:[self
target]];
+ return YES;
+ }
+ return NO;
+}
+
+- (BOOL)accessibilityPerformDecrement {
+ if (rating > 0) {
+ [self setRating:rating - 1];
+ [(NSControl *)[self controlView] updateCellInside:self];
+ [(NSControl *)[self controlView] sendAction:[self action] to:[self
target]];
+ return YES;
+ }
+ return NO;
+}
+
@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