Mercurial > projects > dwt-win
diff dwt/accessibility/Accessible.d @ 213:36f5cb12e1a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 17 May 2008 17:34:28 +0200 |
parents | ab60f3309436 |
children | e2affbeb686d |
line wrap: on
line diff
--- a/dwt/accessibility/Accessible.d Mon May 05 00:12:38 2008 +0200 +++ b/dwt/accessibility/Accessible.d Sat May 17 17:34:28 2008 +0200 @@ -257,7 +257,7 @@ */ public int /*long*/ internal_WM_GETOBJECT (int /*long*/ wParam, int /*long*/ lParam) { if (objIAccessible is null) return 0; - if (cast(int)/*64*/lParam is COM.OBJID_CLIENT) { + if (lParam is COM.OBJID_CLIENT) { /* LresultFromObject([in] riid, [in] wParam, [in] pAcc) * The argument pAcc is owned by the caller so reference count does not * need to be incremented. @@ -511,6 +511,7 @@ if (childID is ACC.CHILDID_NONE) { return iaccessible.accHitTest(xLeft, yTop, pvarChild); } + //TODO - use VARIANT structure pvarChild.vt = COM.VT_I4; pvarChild.lVal = childIDToOs(childID); return COM.S_OK; @@ -537,7 +538,7 @@ } AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID(cast(int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.x = osLeft; event.y = osTop; event.width = osWidth; @@ -585,7 +586,7 @@ } AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID(cast(int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); for (int i = 0; i < accessibleControlListeners.length; i++) { AccessibleControlListener listener = cast(AccessibleControlListener) accessibleControlListeners[i]; listener.getChild(event); @@ -640,7 +641,7 @@ } AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID(cast(int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osDefaultAction; for (int i = 0; i < accessibleControlListeners.length; i++) { AccessibleControlListener listener = cast(AccessibleControlListener) accessibleControlListeners[i]; @@ -673,7 +674,7 @@ } AccessibleEvent event = new AccessibleEvent(this); - event.childID = osToChildID(cast(int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osDescription; // TEMPORARY CODE @@ -724,6 +725,7 @@ int code = iaccessible.get_accFocus(pvarChild); if (accessibleControlListeners.length is 0) return code; if (code is COM.S_OK) { + //TODO - use VARIANT structure short[1] pvt; COM.MoveMemory(pvt.ptr, pvarChild, 2); if (pvt[0] is COM.VT_I4) { @@ -779,7 +781,7 @@ } AccessibleEvent event = new AccessibleEvent(this); - event.childID = osToChildID(cast(int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osHelp; for (int i = 0; i < accessibleListeners.length; i++) { AccessibleListener listener = cast(AccessibleListener) accessibleListeners[i]; @@ -816,7 +818,7 @@ } AccessibleEvent event = new AccessibleEvent(this); - event.childID = osToChildID(cast(int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osKeyboardShortcut; for (int i = 0; i < accessibleListeners.length; i++) { AccessibleListener listener = cast(AccessibleListener) accessibleListeners[i]; @@ -845,7 +847,7 @@ } AccessibleEvent event = new AccessibleEvent(this); - event.childID = osToChildID(cast(int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osName; for (int i = 0; i < accessibleListeners.length; i++) { AccessibleListener listener = cast(AccessibleListener) accessibleListeners[i]; @@ -880,6 +882,7 @@ // TEMPORARY CODE - process tree and table even if there are no apps listening if (accessibleControlListeners.length is 0 && !( null !is cast(Tree)control || null !is cast(Table)control )) return code; if (code is COM.S_OK) { + //TODO - use VARIANT structure short[1] pvt; COM.MoveMemory(pvt.ptr, pvarRole, 2); if (pvt[0] is COM.VT_I4) { @@ -890,7 +893,7 @@ } AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID(cast(int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.detail = osToRole(osRole); // TEMPORARY CODE /* Currently our checkbox table and tree are emulated using state mask @@ -922,6 +925,7 @@ int code = iaccessible.get_accSelection(pvarChildren); if (accessibleControlListeners.length is 0) return code; if (code is COM.S_OK) { + //TODO - use VARIANT structure short[1] pvt; COM.MoveMemory(pvt.ptr, pvarChildren, 2); if (pvt[0] is COM.VT_I4) { @@ -982,6 +986,7 @@ // TEMPORARY CODE - process tree and table even if there are no apps listening if (accessibleControlListeners.length is 0 && !( null !is cast(Tree)control || null !is cast(Table)control )) return code; if (code is COM.S_OK) { + //TODO - use VARIANT structure short[1] pvt; COM.MoveMemory(pvt.ptr, pvarState, 2); if (pvt[0] is COM.VT_I4) { @@ -990,9 +995,9 @@ osState = pState[0]; } } - + bool grayed = false; AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID(cast(int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.detail = osToState(osState); // TEMPORARY CODE /* Currently our checkbox table and tree are emulated using state mask @@ -1011,11 +1016,14 @@ auto result = OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, &tvItem); bool checked = (result !is 0) && (((tvItem.state >> 12) & 1) is 0); if (checked) event.detail |= ACC.STATE_CHECKED; + grayed = tvItem.state >> 12 > 2; } else if (null !is cast(Table)control && (control.getStyle() & DWT.CHECK) !is 0) { Table table = cast(Table) control; - TableItem item = table.getItem(event.childID); - if (item !is null) { + int index = event.childID; + if (0 <= index && index < table.getItemCount()) { + TableItem item = table.getItem(index); if (item.getChecked()) event.detail |= ACC.STATE_CHECKED; + if (item.getGrayed()) grayed = true; } } } @@ -1024,6 +1032,10 @@ listener.getState(event); } int state = stateToOs(event.detail); + if ((state & ACC.STATE_CHECKED) !is 0 && grayed) { + state &= ~ COM.STATE_SYSTEM_CHECKED; + state |= COM.STATE_SYSTEM_MIXED; + } pvarState.vt = COM.VT_I4; pvarState.lVal = state; return COM.S_OK; @@ -1048,7 +1060,7 @@ } AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID(cast(int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osValue; for (int i = 0; i < accessibleControlListeners.length; i++) { AccessibleControlListener listener = cast(AccessibleControlListener) accessibleControlListeners[i]; @@ -1140,6 +1152,7 @@ int item = val.value; rgvar[i].vt = COM.VT_I4; rgvar[i].byRef = cast(void*)item; + COM.MoveMemory(rgvar + i * VARIANT.sizeof + 8, &item, 4); } else { Accessible accessible = cast(Accessible) nextItem; accessible.AddRef(); @@ -1189,7 +1202,7 @@ */ if (accessibleControlListeners.length is 0) { IEnumVARIANT ienumvariant; - int code = cast(int)/*64*/iaccessible.QueryInterface(&COM.IIDIEnumVARIANT, cast(void**)&ienumvariant); + int code = iaccessible.QueryInterface(&COM.IIDIEnumVARIANT, cast(void**)&ienumvariant); if (code !is COM.S_OK) return code; code = ienumvariant.Reset(); ienumvariant.Release(); @@ -1215,7 +1228,7 @@ IEnumVARIANT[1] pEnum; code = ienumvariant.Clone(pEnum.ptr); ienumvariant.Release(); - COM.MoveMemory(ppEnum, pEnum.ptr, 4); + COM.MoveMemory(ppEnum, pEnum.ptr, (void*).sizeof); return code; } @@ -1236,7 +1249,7 @@ */ if (!(cast(Tree)control )) return childID + 1; if (OS.COMCTL32_MAJOR < 6) return childID; - return cast(int)/*64*/OS.SendMessage (control.handle, OS.TVM_MAPHTREEITEMTOACCID, childID, 0); + return OS.SendMessage (control.handle, OS.TVM_MAPHTREEITEMTOACCID, childID, 0); } int osToChildID(int osChildID) { @@ -1250,7 +1263,7 @@ */ if (!(cast(Tree)control )) return osChildID - 1; if (OS.COMCTL32_MAJOR < 6) return osChildID; - return cast(int)/*64*/OS.SendMessage (control.handle, OS.TVM_MAPACCIDTOHTREEITEM, osChildID, 0); + return OS.SendMessage (control.handle, OS.TVM_MAPACCIDTOHTREEITEM, osChildID, 0); } int stateToOs(int state) {