Gets the name of the specified object.
| 901 | |
| 902 | // Gets the name of the specified object. |
| 903 | wxAccStatus AButtonAx::GetName(int WXUNUSED(childId), wxString* name) |
| 904 | { |
| 905 | AButton *ab = wxDynamicCast( GetWindow(), AButton ); |
| 906 | |
| 907 | *name = ab->GetName(); |
| 908 | if( name->empty() ) |
| 909 | { |
| 910 | *name = ab->GetLabel(); |
| 911 | } |
| 912 | |
| 913 | if( name->empty() ) |
| 914 | { |
| 915 | *name = _("Button"); |
| 916 | } |
| 917 | |
| 918 | /* In the MSAA frame work, there isn't such a thing as a toggle button. |
| 919 | In particular, narrator does not read the wxACC_STATE_SYSTEM_PRESSED state at all. |
| 920 | So to imitate a toggle button, include the role and the state in the name, and |
| 921 | create a name change event when the state changes. To enable screen reader |
| 922 | scripts to determine the state of the toggle button in the absence of the |
| 923 | accessibility state indicating this, add the '\a' character to the end of the name |
| 924 | when the button is pressed. ('\a' is read silently by screen readers.) */ |
| 925 | if (ab->mToggle) { |
| 926 | *name += wxT(" ") + |
| 927 | _("Button") |
| 928 | + wxT(" ") + |
| 929 | /* i18n-hint: whether a button is pressed or not pressed */ |
| 930 | (ab->IsDown() ? _("pressed") + wxT('\a') : _("not pressed")); |
| 931 | } |
| 932 | |
| 933 | return wxACC_OK; |
| 934 | } |
| 935 | |
| 936 | // Returns a role constant. |
| 937 | wxAccStatus AButtonAx::GetRole(int WXUNUSED(childId), wxAccRole* role) |