diff options
author | George Hazan <ghazan@miranda.im> | 2022-12-15 14:35:39 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-12-15 14:35:39 +0300 |
commit | ac2cfbd42fe8ee343c40aef7c4198e257df1ec98 (patch) | |
tree | b3bee3f0a89aae8d792bbdb123a92e619d57b61c /src | |
parent | b1991e51d5c53383e4cf2bb8fc1830eef7ed20b8 (diff) |
fixes #3268 (Accessibility: Can't determine states of checkboxes with a screen reader in the trees of Jabber options)
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/skinicons.cpp | 1 | ||||
-rw-r--r-- | src/mir_core/src/Windows/CCtrlTreeOpts.cpp | 29 | ||||
-rw-r--r-- | src/mir_core/src/Windows/CCtrlTreeView.cpp | 23 | ||||
-rw-r--r-- | src/mir_core/src/mir_core.def | 1 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 1 |
5 files changed, 15 insertions, 40 deletions
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index 8994333313..927f5e798f 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -95,6 +95,7 @@ static struct StandardIconDescription mainIcons[] = { SKINICON_WARNING, LPGEN("Warning"), -IDI_MWARNING, 0, nullptr }, // 54
{ SKINICON_INFORMATION, LPGEN("Information"), -IDI_MINFO, 0, nullptr }, // 55
{ SKINICON_OTHER_EDIT, LPGEN("Edit"), -IDI_TYPING, 0, nullptr }, // 56
+ { SKINICON_OTHER_BLANK, LPGEN("Blank"), -IDI_BLANK, 0, nullptr }, // 57
{ SKINICON_OTHER_VISIBLE_ALL, LPGEN("Always visible"), -IDI_ALWAYSVIS, 0, LPGEN("Contact list") },
{ SKINICON_OTHER_INVISIBLE_ALL, LPGEN("Always invisible"), -IDI_NEVERVIS, 0, LPGEN("Contact list") },
diff --git a/src/mir_core/src/Windows/CCtrlTreeOpts.cpp b/src/mir_core/src/Windows/CCtrlTreeOpts.cpp index 13a6b79bd3..132b5082d7 100644 --- a/src/mir_core/src/Windows/CCtrlTreeOpts.cpp +++ b/src/mir_core/src/Windows/CCtrlTreeOpts.cpp @@ -22,12 +22,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../stdafx.h" -enum { IMG_GROUP, IMG_CHECK, IMG_NOCHECK, IMG_GRPOPEN, IMG_GRPCLOSED }; +enum { IMG_SHIT, IMG_GRPOPEN, IMG_GRPCLOSED }; CCtrlTreeOpts::CCtrlTreeOpts(CDlgBase* dlg, int ctrlId): CCtrlTreeView(dlg, ctrlId), m_options(5) { + m_bCheckBox = true; } CCtrlTreeOpts::~CCtrlTreeOpts() @@ -99,9 +100,7 @@ void CCtrlTreeOpts::OnInit() DeleteAllItems(); HIMAGELIST hImgLst = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR | ILC_COLOR32 | ILC_MASK, 5, 1); - ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_MIRANDA); - ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_TICK); - ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_NOTICK); + ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_BLANK); ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_GROUPOPEN); ImageList_AddSkinIcon(hImgLst, SKINICON_OTHER_GROUPSHUT); SetImageList(hImgLst, TVSIL_NORMAL); @@ -116,7 +115,8 @@ void CCtrlTreeOpts::OnInit() tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvis.item.pszText = (LPWSTR)it->m_pwszSection; - tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED | TVIS_BOLD; + tvis.item.state = TVIS_EXPANDED | TVIS_BOLD | INDEXTOSTATEIMAGEMASK(3); + tvis.item.stateMask = TVIS_EXPANDED | TVIS_BOLD | TVIS_STATEIMAGEMASK; tvis.item.iImage = tvis.item.iSelectedImage = IMG_GRPOPEN; hSection = InsertItem(&tvis); } @@ -139,11 +139,11 @@ void CCtrlTreeOpts::OnInit() TVINSERTSTRUCT tvis = {}; tvis.hParent = hSection; tvis.hInsertAfter = TVI_LAST; - tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE; tvis.item.pszText = (LPWSTR)it->m_pwszName; - tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED; tvis.item.lParam = m_options.indexOf(&it); - tvis.item.iImage = tvis.item.iSelectedImage = (bValue) ? IMG_CHECK : IMG_NOCHECK; + tvis.item.state = INDEXTOSTATEIMAGEMASK(bValue ? 2 : 1); + tvis.item.stateMask = TVIS_STATEIMAGEMASK; it->m_hItem = InsertItem(&tvis); } @@ -165,9 +165,10 @@ bool CCtrlTreeOpts::OnApply() for (auto &it : m_options) { TVITEMEX tvi; + tvi.mask = TVIF_STATE; GetItem(it->m_hItem, &tvi); - bool bValue = (tvi.iImage == IMG_CHECK); + bool bValue = (tvi.state >> 12) == 2; switch (it->m_type) { case COptionsItem::CMOPTION: *it->m_option = bValue; @@ -189,6 +190,7 @@ bool CCtrlTreeOpts::OnApply() void CCtrlTreeOpts::ProcessItemClick(HTREEITEM hti) { TVITEMEX tvi; + tvi.mask = TVIF_IMAGE; GetItem(hti, &tvi); switch (tvi.iImage) { case IMG_GRPOPEN: @@ -201,15 +203,6 @@ void CCtrlTreeOpts::ProcessItemClick(HTREEITEM hti) Expand(tvi.hItem, TVE_EXPAND); break; - case IMG_CHECK: - tvi.iImage = tvi.iSelectedImage = IMG_NOCHECK; - NotifyChange(); - break; - - case IMG_NOCHECK: - tvi.iImage = tvi.iSelectedImage = IMG_CHECK; - NotifyChange(); - break; } SetItem(&tvi); diff --git a/src/mir_core/src/Windows/CCtrlTreeView.cpp b/src/mir_core/src/Windows/CCtrlTreeView.cpp index e5e97e8cd4..6f435920f2 100644 --- a/src/mir_core/src/Windows/CCtrlTreeView.cpp +++ b/src/mir_core/src/Windows/CCtrlTreeView.cpp @@ -60,20 +60,8 @@ void CCtrlTreeView::OnInit() Subclass(); - if (m_bCheckBox) { - HIMAGELIST himlCheckBoxes = ::ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 2); - ::ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_NOTICK); - ::ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_TICK); - SetImageList(himlCheckBoxes, TVSIL_NORMAL); - } -} - -void CCtrlTreeView::OnDestroy() -{ if (m_bCheckBox) - ::ImageList_Destroy(GetImageList(TVSIL_NORMAL)); - - CSuper::OnDestroy(); + SetWindowLongW(m_hwnd, GWL_STYLE, TVS_CHECKBOXES | GetWindowLongW(m_hwnd, GWL_STYLE)); } HTREEITEM CCtrlTreeView::MoveItemAbove(HTREEITEM hItem, HTREEITEM hInsertAfter, HTREEITEM hParent) @@ -314,8 +302,6 @@ BOOL CCtrlTreeView::OnNotify(int, NMHDR *pnmh) case TVN_KEYDOWN: if (evt.nmtvkey->wVKey == VK_SPACE) { evt.hItem = GetSelection(); - if (m_bCheckBox) - InvertCheck(evt.hItem); OnItemChanged(&evt); NotifyChange(); } @@ -330,11 +316,8 @@ BOOL CCtrlTreeView::OnNotify(int, NMHDR *pnmh) hti.pt.y = (short)HIWORD(GetMessagePos()); ScreenToClient(pnmh->hwndFrom, &hti.pt); if (HitTest(&hti)) { - if (m_bCheckBox && (hti.flags & TVHT_ONITEMICON) || !m_bCheckBox && (hti.flags & TVHT_ONITEMSTATEICON)) { - if (m_bCheckBox) - InvertCheck(hti.hItem); - else - SelectItem(hti.hItem); + if (hti.flags & TVHT_ONITEMSTATEICON) { + SelectItem(hti.hItem); evt.hItem = hti.hItem; OnItemChanged(&evt); diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 0b62e5dcda..5d50debe41 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1029,7 +1029,6 @@ IsTerminalDisconnected @1245 ?FindControl@CDlgBase@@QAEPAVCCtrlBase@@H@Z @1246 NONAME
?FindControl@CDlgBase@@QAEPAVCCtrlBase@@PAUHWND__@@@Z @1247 NONAME
?GlobalFieldEnum@CDlgBase@@CGHPAUHWND__@@J@Z @1248 NONAME
-?OnDestroy@CCtrlTreeView@@MAEXXZ @1249 NONAME
?GetUrl@CCtrlHyperlink@@QAEPBDXZ @1250 NONAME
?IsChecked@CCtrlCheck@@QAE_NXZ @1251 NONAME
?OnApply@CCtrlSpin@@UAE_NXZ @1252 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index e7da28b523..f5f58713cd 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1029,7 +1029,6 @@ IsTerminalDisconnected @1245 ?FindControl@CDlgBase@@QEAAPEAVCCtrlBase@@H@Z @1246 NONAME
?FindControl@CDlgBase@@QEAAPEAVCCtrlBase@@PEAUHWND__@@@Z @1247 NONAME
?GlobalFieldEnum@CDlgBase@@CAHPEAUHWND__@@_J@Z @1248 NONAME
-?OnDestroy@CCtrlTreeView@@MEAAXXZ @1249 NONAME
?Default_OnClick@CCtrlHyperlink@@IEAAXPEAV1@@Z @1250 NONAME
?GetUrl@CCtrlHyperlink@@QEAAPEBDXZ @1251 NONAME
?IsChecked@CCtrlCheck@@QEAA_NXZ @1252 NONAME
|