1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-26 14:41:14 +01:00

Addresses meter accessibility mentioned in bug #33

And also corrects the missing focus rectangle display on
the toolbar buttons on Linux.
This commit is contained in:
lllucius
2015-01-04 09:24:26 +00:00
parent 3a23757e2e
commit 8bef14df36
4 changed files with 391 additions and 10 deletions

View File

@@ -85,6 +85,8 @@ class MeterUpdateQueue
MeterUpdateMsg *mBuffer;
};
class MeterAx;
class Meter : public wxPanel
{
DECLARE_DYNAMIC_CLASS(Meter)
@@ -185,6 +187,8 @@ class Meter : public wxPanel
void OnMouse(wxMouseEvent &evt);
void OnKeyDown(wxKeyEvent &evt);
void OnContext(wxContextMenuEvent &evt);
void OnSetFocus(wxFocusEvent &evt);
void OnKillFocus(wxFocusEvent &evt);
void OnAudioIOStatus(wxCommandEvent &evt);
@@ -263,7 +267,89 @@ class Meter : public wxPanel
wxString mLeftText;
wxString mRightText;
bool mIsFocused;
wxRect mFocusRect;
friend class MeterAx;
DECLARE_EVENT_TABLE()
};
#if wxUSE_ACCESSIBILITY
class MeterAx: public wxWindowAccessible
{
public:
MeterAx(wxWindow * window);
virtual ~ MeterAx();
// Performs the default action. childId is 0 (the action for this object)
// or > 0 (the action for a child).
// Return wxACC_NOT_SUPPORTED if there is no default action for this
// window (e.g. an edit control).
virtual wxAccStatus DoDefaultAction(int childId);
// Retrieves the address of an IDispatch interface for the specified child.
// All objects must support this property.
virtual wxAccStatus GetChild(int childId, wxAccessible** child);
// Gets the number of children.
virtual wxAccStatus GetChildCount(int* childCount);
// Gets the default action for this object (0) or > 0 (the action for a child).
// Return wxACC_OK even if there is no action. actionName is the action, or the empty
// string if there is no action.
// The retrieved string describes the action that is performed on an object,
// not what the object does as a result. For example, a toolbar button that prints
// a document has a default action of "Press" rather than "Prints the current document."
virtual wxAccStatus GetDefaultAction(int childId, wxString *actionName);
// Returns the description for this object or a child.
virtual wxAccStatus GetDescription(int childId, wxString *description);
// Gets the window with the keyboard focus.
// If childId is 0 and child is NULL, no object in
// this subhierarchy has the focus.
// If this object has the focus, child should be 'this'.
virtual wxAccStatus GetFocus(int *childId, wxAccessible **child);
// Returns help text for this object or a child, similar to tooltip text.
virtual wxAccStatus GetHelpText(int childId, wxString *helpText);
// Returns the keyboard shortcut for this object or child.
// Return e.g. ALT+K
virtual wxAccStatus GetKeyboardShortcut(int childId, wxString *shortcut);
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
virtual wxAccStatus GetLocation(wxRect& rect, int elementId);
// Gets the name of the specified object.
virtual wxAccStatus GetName(int childId, wxString *name);
// Returns a role constant.
virtual wxAccStatus GetRole(int childId, wxAccRole *role);
// Gets a variant representing the selected children
// of this object.
// Acceptable values:
// - a null variant (IsNull() returns TRUE)
// - a list variant (GetType() == wxT("list"))
// - an integer representing the selected child element,
// or 0 if this object is selected (GetType() == wxT("long"))
// - a "void*" pointer to a wxAccessible child object
virtual wxAccStatus GetSelections(wxVariant *selections);
// Returns a state constant.
virtual wxAccStatus GetState(int childId, long* state);
// Returns a localized string representing the value for the object
// or child.
virtual wxAccStatus GetValue(int childId, wxString* strValue);
};
#endif // wxUSE_ACCESSIBILITY
#endif // __AUDACITY_METER__