Add accessibility support for wxDataViewCtrl and wxDataViewTreeCtrl

Implemented wxDataViewCtrlAccessible and wxDataViewTreeCtrlAccessible classes.
This commit is contained in:
Artur Wieczorek
2016-10-09 21:12:59 +02:00
parent 29d310c6f0
commit 9c3c6074eb
4 changed files with 943 additions and 4 deletions

View File

@@ -54,6 +54,9 @@ class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl;
class WXDLLIMPEXP_FWD_ADV wxDataViewColumn;
class WXDLLIMPEXP_FWD_ADV wxDataViewRenderer;
class WXDLLIMPEXP_FWD_ADV wxDataViewModelNotifier;
#if wxUSE_ACCESSIBILITY
class WXDLLIMPEXP_FWD_ADV wxDataViewCtrlAccessible;
#endif // wxUSE_ACCESSIBILITY
extern WXDLLIMPEXP_DATA_ADV(const char) wxDataViewCtrlNameStr[];
@@ -1301,9 +1304,17 @@ public:
//-----------------------------------------------------------------------------
#if wxUSE_ACCESSIBILITY
class WXDLLIMPEXP_FWD_ADV wxDataViewTreeCtrlAccessible;
#endif // wxUSE_ACCESSIBILITY
class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl,
public wxWithImages
{
#if wxUSE_ACCESSIBILITY
friend class wxDataViewTreeCtrlAccessible;
#endif // wxUSE_ACCESSIBILITY
public:
wxDataViewTreeCtrl() { }
wxDataViewTreeCtrl(wxWindow *parent,
@@ -1401,6 +1412,21 @@ private:
#define wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE
#define wxEVT_COMMAND_DATAVIEW_ITEM_DROP wxEVT_DATAVIEW_ITEM_DROP
#if wxUSE_ACCESSIBILITY
//-----------------------------------------------------------------------------
// wxDataViewTreeCtrlAccessible
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewTreeCtrlAccessible: public wxDataViewCtrlAccessible
{
public:
wxDataViewTreeCtrlAccessible(wxDataViewTreeCtrl* win);
virtual ~wxDataViewTreeCtrlAccessible() {};
virtual wxAccStatus GetName(int childId, wxString* name) wxOVERRIDE;
};
#endif // wxUSE_ACCESSIBILITY
#endif // wxUSE_DATAVIEWCTRL
#endif

View File

@@ -17,9 +17,15 @@
#include "wx/scrolwin.h"
#include "wx/icon.h"
#include "wx/vector.h"
#if wxUSE_ACCESSIBILITY
#include "wx/access.h"
#endif // wxUSE_ACCESSIBILITY
class WXDLLIMPEXP_FWD_ADV wxDataViewMainWindow;
class WXDLLIMPEXP_FWD_ADV wxDataViewHeaderWindow;
#if wxUSE_ACCESSIBILITY
class WXDLLIMPEXP_FWD_ADV wxDataViewCtrlAccessible;
#endif // wxUSE_ACCESSIBILITY
// ---------------------------------------------------------
// wxDataViewColumn
@@ -172,6 +178,9 @@ class WXDLLIMPEXP_ADV wxDataViewCtrl : public wxDataViewCtrlBase,
friend class wxDataViewHeaderWindow;
friend class wxDataViewHeaderWindowMSW;
friend class wxDataViewColumn;
#if wxUSE_ACCESSIBILITY
friend class wxDataViewCtrlAccessible;
#endif // wxUSE_ACCESSIBILITY
public:
wxDataViewCtrl() : wxScrollHelper(this)
@@ -376,5 +385,58 @@ private:
wxDECLARE_EVENT_TABLE();
};
#if wxUSE_ACCESSIBILITY
//-----------------------------------------------------------------------------
// wxDataViewCtrlAccessible
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewCtrlAccessible: public wxWindowAccessible
{
public:
wxDataViewCtrlAccessible(wxDataViewCtrl* win);
virtual ~wxDataViewCtrlAccessible() {};
virtual wxAccStatus HitTest(const wxPoint& pt, int* childId,
wxAccessible** childObject) wxOVERRIDE;
virtual wxAccStatus GetLocation(wxRect& rect, int elementId) wxOVERRIDE;
virtual wxAccStatus Navigate(wxNavDir navDir, int fromId,
int* toId, wxAccessible** toObject) wxOVERRIDE;
virtual wxAccStatus GetName(int childId, wxString* name) wxOVERRIDE;
virtual wxAccStatus GetChildCount(int* childCount) wxOVERRIDE;
virtual wxAccStatus GetChild(int childId, wxAccessible** child) wxOVERRIDE;
// wxWindowAccessible::GetParent() implementation is enough.
// virtual wxAccStatus GetParent(wxAccessible** parent) wxOVERRIDE;
virtual wxAccStatus DoDefaultAction(int childId) wxOVERRIDE;
virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName) wxOVERRIDE;
virtual wxAccStatus GetDescription(int childId, wxString* description) wxOVERRIDE;
virtual wxAccStatus GetHelpText(int childId, wxString* helpText) wxOVERRIDE;
virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut) wxOVERRIDE;
virtual wxAccStatus GetRole(int childId, wxAccRole* role) wxOVERRIDE;
virtual wxAccStatus GetState(int childId, long* state) wxOVERRIDE;
virtual wxAccStatus GetValue(int childId, wxString* strValue) wxOVERRIDE;
virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags) wxOVERRIDE;
virtual wxAccStatus GetFocus(int* childId, wxAccessible** child) wxOVERRIDE;
#if wxUSE_VARIANT
virtual wxAccStatus GetSelections(wxVariant* selections) wxOVERRIDE;
#endif // wxUSE_VARIANT
};
#endif // wxUSE_ACCESSIBILITY
#endif // __GENERICDATAVIEWCTRLH__