diff options
author | Carolyn MacLeod | 2008-11-07 20:48:31 +0000 |
---|---|---|
committer | Carolyn MacLeod | 2008-11-07 20:48:31 +0000 |
commit | 98086b150579b7d7c258fc8a39488e048bccb2fc (patch) | |
tree | 5f12474cd4dfb9eafbd9d9940a3fd441c3a99360 | |
parent | 736f0ab3a3f6ac44ab7492215eca5a4a9c1e9290 (diff) | |
download | eclipse.platform.swt-98086b150579b7d7c258fc8a39488e048bccb2fc.tar.gz eclipse.platform.swt-98086b150579b7d7c258fc8a39488e048bccb2fc.tar.xz eclipse.platform.swt-98086b150579b7d7c258fc8a39488e048bccb2fc.zip |
Catch up to HEAD
2 files changed, 54 insertions, 26 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java index 0e173ab06d..f761e5e6ed 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -37,6 +37,8 @@ import org.eclipse.swt.internal.ole.win32.*; * @see AccessibleEvent * @see AccessibleControlListener * @see AccessibleControlEvent + * @see <a href="http://www.eclipse.org/swt/snippets/#accessibility">Accessibility snippets</a> + * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 2.0 */ @@ -99,6 +101,10 @@ public class Accessible { public int /*long*/ method27(int /*long*/[] args) {return put_accValue(args[0], args[1]);} }; + /* If the callback takes a struct parameter (for example, a variant), + * then create a custom callback that dereferences the struct and + * passes a pointer to the original callback. + */ int /*long*/ ppVtable = objIAccessible.ppVtable; int /*long*/[] pVtable = new int /*long*/[1]; COM.MoveMemory(pVtable, ppVtable, OS.PTR_SIZEOF); @@ -126,8 +132,8 @@ public class Accessible { public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);} public int /*long*/ method1(int /*long*/[] args) {return AddRef();} public int /*long*/ method2(int /*long*/[] args) {return Release();} - public int /*long*/ method3(int /*long*/[] args) {return Next((int)args[0], args[1], args[2]);} - public int /*long*/ method4(int /*long*/[] args) {return Skip((int)args[0]);} + public int /*long*/ method3(int /*long*/[] args) {return Next((int)/*64*/args[0], args[1], args[2]);} + public int /*long*/ method4(int /*long*/[] args) {return Skip((int)/*64*/args[0]);} public int /*long*/ method5(int /*long*/[] args) {return Reset();} public int /*long*/ method6(int /*long*/[] args) {return Clone(args[0]);} }; @@ -560,6 +566,7 @@ public class Accessible { if (childID == ACC.CHILDID_NONE) { return iaccessible.accHitTest(xLeft, yTop, pvarChild); } + //TODO - use VARIANT structure COM.MoveMemory(pvarChild, new short[] { COM.VT_I4 }, 2); COM.MoveMemory(pvarChild + 8, new int[] { childIDToOs(childID) }, 4); return COM.S_OK; @@ -586,7 +593,7 @@ public class Accessible { } AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID((int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.x = osLeft; event.y = osTop; event.width = osWidth; @@ -634,7 +641,7 @@ public class Accessible { } AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID((int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); listener.getChild(event); @@ -696,7 +703,7 @@ public class Accessible { } AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID((int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osDefaultAction; for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); @@ -733,7 +740,7 @@ public class Accessible { } AccessibleEvent event = new AccessibleEvent(this); - event.childID = osToChildID((int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osDescription; // TEMPORARY CODE @@ -786,6 +793,7 @@ public class Accessible { int code = iaccessible.get_accFocus(pvarChild); if (accessibleControlListeners.size() == 0) return code; if (code == COM.S_OK) { + //TODO - use VARIANT structure short[] pvt = new short[1]; COM.MoveMemory(pvt, pvarChild, 2); if (pvt[0] == COM.VT_I4) { @@ -847,7 +855,7 @@ public class Accessible { } AccessibleEvent event = new AccessibleEvent(this); - event.childID = osToChildID((int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osHelp; for (int i = 0; i < accessibleListeners.size(); i++) { AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i); @@ -891,7 +899,7 @@ public class Accessible { } AccessibleEvent event = new AccessibleEvent(this); - event.childID = osToChildID((int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osKeyboardShortcut; for (int i = 0; i < accessibleListeners.size(); i++) { AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i); @@ -927,7 +935,7 @@ public class Accessible { } AccessibleEvent event = new AccessibleEvent(this); - event.childID = osToChildID((int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osName; for (int i = 0; i < accessibleListeners.size(); i++) { AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i); @@ -963,6 +971,7 @@ public class Accessible { // TEMPORARY CODE - process tree and table even if there are no apps listening if (accessibleControlListeners.size() == 0 && !(control instanceof Tree || control instanceof Table)) return code; if (code == COM.S_OK) { + //TODO - use VARIANT structure short[] pvt = new short[1]; COM.MoveMemory(pvt, pvarRole, 2); if (pvt[0] == COM.VT_I4) { @@ -973,7 +982,7 @@ public class Accessible { } AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID((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 @@ -1005,6 +1014,7 @@ public class Accessible { int code = iaccessible.get_accSelection(pvarChildren); if (accessibleControlListeners.size() == 0) return code; if (code == COM.S_OK) { + //TODO - use VARIANT structure short[] pvt = new short[1]; COM.MoveMemory(pvt, pvarChildren, 2); if (pvt[0] == COM.VT_I4) { @@ -1065,6 +1075,7 @@ public class Accessible { // TEMPORARY CODE - process tree and table even if there are no apps listening if (accessibleControlListeners.size() == 0 && !(control instanceof Tree || control instanceof Table)) return code; if (code == COM.S_OK) { + //TODO - use VARIANT structure short[] pvt = new short[1]; COM.MoveMemory(pvt, pvarState, 2); if (pvt[0] == COM.VT_I4) { @@ -1073,9 +1084,9 @@ public class Accessible { osState = pState[0]; } } - + boolean grayed = false; AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID((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 @@ -1094,11 +1105,14 @@ public class Accessible { int /*long*/ result = OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem); boolean checked = (result != 0) && (((tvItem.state >> 12) & 1) == 0); if (checked) event.detail |= ACC.STATE_CHECKED; + grayed = tvItem.state >> 12 > 2; } else if (control instanceof Table && (control.getStyle() & SWT.CHECK) != 0) { Table table = (Table) control; - TableItem item = table.getItem(event.childID); - if (item != 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; } } } @@ -1107,6 +1121,10 @@ public class Accessible { listener.getState(event); } int state = stateToOs(event.detail); + if ((state & ACC.STATE_CHECKED) != 0 && grayed) { + state &= ~ COM.STATE_SYSTEM_CHECKED; + state |= COM.STATE_SYSTEM_MIXED; + } COM.MoveMemory(pvarState, new short[] { COM.VT_I4 }, 2); COM.MoveMemory(pvarState + 8, new int[] { state }, 4); return COM.S_OK; @@ -1135,7 +1153,7 @@ public class Accessible { } AccessibleControlEvent event = new AccessibleControlEvent(this); - event.childID = osToChildID((int)/*64*/v.lVal); + event.childID = osToChildID(v.lVal); event.result = osValue; for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); @@ -1227,13 +1245,14 @@ public class Accessible { Object nextItem = nextItems[i]; if (nextItem instanceof Integer) { int item = ((Integer) nextItem).intValue(); - COM.MoveMemory(rgvar + i * 16, new short[] { COM.VT_I4 }, 2); - COM.MoveMemory(rgvar + i * 16 + 8, new int[] { item }, 4); + //TODO - use VARIANT struct + COM.MoveMemory(rgvar + i * VARIANT.sizeof, new short[] { COM.VT_I4 }, 2); + COM.MoveMemory(rgvar + i * VARIANT.sizeof + 8, new int[] { item }, 4); } else { Accessible accessible = (Accessible) nextItem; accessible.AddRef(); - COM.MoveMemory(rgvar + i * 16, new short[] { COM.VT_DISPATCH }, 2); - COM.MoveMemory(rgvar + i * 16 + 8, new int /*long*/[] { accessible.objIAccessible.getAddress() }, OS.PTR_SIZEOF); + COM.MoveMemory(rgvar + i * VARIANT.sizeof, new short[] { COM.VT_DISPATCH }, 2); + COM.MoveMemory(rgvar + i * VARIANT.sizeof + 8, new int /*long*/[] { accessible.objIAccessible.getAddress() }, OS.PTR_SIZEOF); } } if (pceltFetched != 0) @@ -1302,10 +1321,10 @@ public class Accessible { int code = iaccessible.QueryInterface(COM.IIDIEnumVARIANT, ppvObject); if (code != COM.S_OK) return code; IEnumVARIANT ienumvariant = new IEnumVARIANT(ppvObject[0]); - int[] pEnum = new int[1]; + int /*long*/ [] pEnum = new int /*long*/ [1]; code = ienumvariant.Clone(pEnum); ienumvariant.Release(); - COM.MoveMemory(ppEnum, pEnum, 4); + COM.MoveMemory(ppEnum, pEnum, OS.PTR_SIZEOF); return code; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java index b7d2cfaa8e..a1d06f6059 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,6 +14,10 @@ import org.eclipse.swt.internal.win32.*; public class COM extends OS { /** GUID Constants */ + public static final GUID CLSID_DragDropHelper = COM.IIDFromString("{4657278A-411B-11d2-839A-00C04FD918D0}"); //$NON-NLS-1$ + public static final GUID IID_IDropTargetHelper = COM.IIDFromString("{4657278B-411B-11d2-839A-00C04FD918D0}"); //$NON-NLS-1$ + public static final GUID IID_IDragSourceHelper = COM.IIDFromString("{DE5BF786-477A-11d2-839D-00C04FD918D0}"); //$NON-NLS-1$ + public static final GUID IID_IDragSourceHelper2 = COM.IIDFromString("{83E07D0D-0C5F-4163-BF1A-60B274051E40}"); //$NON-NLS-1$ public static final GUID IIDJavaBeansBridge = COM.IIDFromString("{8AD9C840-044E-11D1-B3E9-00805F499D93}"); //$NON-NLS-1$ public static final GUID IIDShockwaveActiveXControl = COM.IIDFromString("{166B1BCA-3F9C-11CF-8075-444553540000}"); //$NON-NLS-1$ public static final GUID IIDIEditorSiteTime = IIDFromString("{6BD2AEFE-7876-45e6-A6E7-3BFCDF6540AA}"); //$NON-NLS-1$ @@ -28,7 +32,7 @@ public class COM extends OS { public static final GUID IIDIAdviseSink = IIDFromString("{0000010F-0000-0000-C000-000000000046}"); //$NON-NLS-1$ //public static final GUID IIDIAdviseSink2 = IIDFromString("{00000125-0000-0000-C000-000000000046}"); //$NON-NLS-1$ //public static final GUID IIDIBindCtx = IIDFromString("{0000000E-0000-0000-C000-000000000046}"); //$NON-NLS-1$ - //public static final GUID IIDIClassFactory = IIDFromString("{00000001-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + public static final GUID IIDIClassFactory = IIDFromString("{00000001-0000-0000-C000-000000000046}"); //$NON-NLS-1$ public static final GUID IIDIClassFactory2 = IIDFromString("{B196B28F-BAB4-101A-B69C-00AA00341D07}"); //$NON-NLS-1$ public static final GUID IIDIConnectionPoint = IIDFromString("{B196B286-BAB4-101A-B69C-00AA00341D07}"); //$NON-NLS-1$ public static final GUID IIDIConnectionPointContainer = IIDFromString("{B196B284-BAB4-101A-B69C-00AA00341D07}"); //$NON-NLS-1$ @@ -202,13 +206,17 @@ public class COM extends OS { public static final int DISPID_FONT_WEIGHT = 7; public static final int DISPID_FORECOLOR = -513; public static final int DISPID_HTMLDOCUMENTEVENTS_ONDBLCLICK = 0xFFFFFDA7; + public static final int DISPID_HTMLDOCUMENTEVENTS_ONDRAGEND = 0x80010015; public static final int DISPID_HTMLDOCUMENTEVENTS_ONDRAGSTART = 0x8001000B; + public static final int DISPID_HTMLDOCUMENTEVENTS_ONKEYDOWN = 0xFFFFFDA6; + public static final int DISPID_HTMLDOCUMENTEVENTS_ONKEYPRESS = 0xFFFFFDA5; + public static final int DISPID_HTMLDOCUMENTEVENTS_ONKEYUP = 0xFFFFFDA4; public static final int DISPID_HTMLDOCUMENTEVENTS_ONMOUSEOUT = 0x80010009; public static final int DISPID_HTMLDOCUMENTEVENTS_ONMOUSEOVER = 0x80010008; public static final int DISPID_HTMLDOCUMENTEVENTS_ONMOUSEMOVE = 0xFFFFFDA2; public static final int DISPID_HTMLDOCUMENTEVENTS_ONMOUSEDOWN = 0xFFFFFDA3; public static final int DISPID_HTMLDOCUMENTEVENTS_ONMOUSEUP = 0xFFFFFDA1; - public static final int DISPID_HTMLDOCUMENTEVENTS_ONSTOP = 0x00000402; + public static final int DISPID_HTMLDOCUMENTEVENTS_ONMOUSEWHEEL = 0x00000402; //public static final int DISPID_READYSTATE = -525; //public static final int DISPID_READYSTATECHANGE = -609; @@ -220,6 +228,7 @@ public class COM extends OS { public static final int DROPEFFECT_MOVE = 2; public static final int DROPEFFECT_LINK = 4; public static final int DROPEFFECT_SCROLL = 0x80000000; + public static final int DSH_ALLOWDROPDESCRIPTIONTEXT = 0x1; public static final int DV_E_FORMATETC = -2147221404; public static final int DV_E_STGMEDIUM = -2147221402; public static final int DV_E_TYMED = -2147221399; @@ -610,7 +619,7 @@ public static final int STATE_SYSTEM_SELECTED = 0x2; public static final int STATE_SYSTEM_FOCUSED = 0x4; public static final int STATE_SYSTEM_PRESSED = 0x8; public static final int STATE_SYSTEM_CHECKED = 0x10; -//public static final int STATE_SYSTEM_MIXED = 0x20; +public static final int STATE_SYSTEM_MIXED = 0x20; //public static final int STATE_SYSTEM_INDETERMINATE = STATE_SYSTEM_MIXED; public static final int STATE_SYSTEM_READONLY = 0x40; public static final int STATE_SYSTEM_HOTTRACKED = 0x80; |