Make macro recording an NSToggleButton

This fixes semantics of the button and thus also its
accessibility. The macro recording button represents state - more
specifically a boolean state, so it has to be a NSToggleButton (or
its specialization). Then the button is presented to the VoiceOver
user as an AXCheckbox - that is a checkbox with on and off value -
which is exactly what the button's function is. Examples of this in
system apps is e.g. the "Play" button in QuickTime Player, which is
also an AXCheckbox ("Pause" is then simply an unchecked "Play"
checkbox).
This commit is contained in:
Boris Dušek
2013-03-02 19:14:52 +01:00
committed by Allan Odgaard
parent 21c70057b4
commit 944e1e32fa

View File

@@ -35,12 +35,12 @@ static NSPopUpButton* OakCreatePopUpButton (NSString* initialItem = nil)
return res;
}
static NSButton* OakCreateImageButton (NSImage* image)
static NSButton* OakCreateImageToggleButton (NSImage* image)
{
NSButton* res = [NSButton new];
[[res cell] setBackgroundStyle:NSBackgroundStyleRaised];
[res setButtonType:NSMomentaryChangeButton];
[res setButtonType:NSToggleButton];
[res setBezelStyle:NSRecessedBezelStyle];
[res setBordered:NO];
@@ -80,7 +80,7 @@ static NSImageView* OakCreateImageView (NSImage* image)
self.tabSizePopUp.pullsDown = YES;
self.bundleItemsPopUp = OakCreatePopUpButton();
self.symbolPopUp = OakCreatePopUpButton(@"");
self.macroRecordingButton = OakCreateImageButton([NSImage imageNamed:@"Recording" inSameBundleAsClass:[self class]]);
self.macroRecordingButton = OakCreateImageToggleButton([NSImage imageNamed:@"Recording" inSameBundleAsClass:[self class]]);
self.macroRecordingButton.action = @selector(toggleMacroRecording:);
self.macroRecordingButton.toolTip = @"Click to start recording a macro";