Improve VoiceOver labels for images/pop-ups etc. #857
These patches improve accessibility of UI elements in the main window by
Non-obvious stuff is discussed in commit messages of individual commits.
These patches are released to public domain by my employer, BRAILCOM,o.p.s.
VoiceOver reads an AXValue for a pop-up button - that is the selected item. But button's title does not set an AXValue, as it probably is not a menu item. So change the code set to the title by setting a single menu item with that title. This fixes accessibility of the pop-up when accessing its value before it is first popped up. It makes the code consistent with setGrammarName: which works fine (that's how I discovered how to fix it).
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).