From 944e1e32fad2ee729b0156cd2906076789652a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Dus=CC=8Cek?= Date: Sat, 2 Mar 2013 19:14:52 +0100 Subject: [PATCH] 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). --- Frameworks/OakTextView/src/OTVStatusBar.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Frameworks/OakTextView/src/OTVStatusBar.mm b/Frameworks/OakTextView/src/OTVStatusBar.mm index 89c64217..acba27de 100644 --- a/Frameworks/OakTextView/src/OTVStatusBar.mm +++ b/Frameworks/OakTextView/src/OTVStatusBar.mm @@ -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";