?? accessible.java
字號:
/** * Sends a message to accessible clients that the child selection * within a custom container control has changed. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li> * </ul> * * @since 3.0 */ public void selectionChanged () { checkWidget(); COM.NotifyWinEvent (COM.EVENT_OBJECT_SELECTIONWITHIN, control.handle, COM.OBJID_CLIENT, COM.CHILDID_SELF); } /** * Sends a message to accessible clients indicating that the focus * has changed within a custom control. * * @param childID an identifier specifying a child of the control * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li> * </ul> */ public void setFocus(int childID) { checkWidget(); COM.NotifyWinEvent (COM.EVENT_OBJECT_FOCUS, control.handle, COM.OBJID_CLIENT, childIDToOs(childID)); } /** * Sends a message to accessible clients that the text * caret has moved within a custom control. * * @param index the new caret index within the control * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li> * </ul> * * @since 3.0 */ public void textCaretMoved (int index) { checkWidget(); COM.NotifyWinEvent (COM.EVENT_OBJECT_LOCATIONCHANGE, control.handle, COM.OBJID_CARET, COM.CHILDID_SELF); } /** * Sends a message to accessible clients that the text * within a custom control has changed. * * @param type the type of change, one of <code>ACC.NOTIFY_TEXT_INSERT</code> * or <code>ACC.NOTIFY_TEXT_DELETE</code> * @param startIndex the text index within the control where the insertion or deletion begins * @param length the non-negative length in characters of the insertion or deletion * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li> * </ul> * * @see ACC#TEXT_INSERT * @see ACC#TEXT_DELETE * * @since 3.0 */ public void textChanged (int type, int startIndex, int length) { checkWidget(); COM.NotifyWinEvent (COM.EVENT_OBJECT_VALUECHANGE, control.handle, COM.OBJID_CLIENT, COM.CHILDID_SELF); } /** * Sends a message to accessible clients that the text * selection has changed within a custom control. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li> * </ul> * * @since 3.0 */ public void textSelectionChanged () { checkWidget(); // not an MSAA event } int QueryInterface(int arg1, int arg2) { if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; GUID guid = new GUID(); COM.MoveMemory(guid, arg1, GUID.sizeof); if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) { COM.MoveMemory(arg2, new int[] { objIAccessible.getAddress()}, 4); AddRef(); return COM.S_OK; } if (COM.IsEqualGUID(guid, COM.IIDIDispatch)) { COM.MoveMemory(arg2, new int[] { objIAccessible.getAddress()}, 4); AddRef(); return COM.S_OK; } if (COM.IsEqualGUID(guid, COM.IIDIAccessible)) { COM.MoveMemory(arg2, new int[] { objIAccessible.getAddress()}, 4); AddRef(); return COM.S_OK; } if (COM.IsEqualGUID(guid, COM.IIDIEnumVARIANT)) { COM.MoveMemory(arg2, new int[] { objIEnumVARIANT.getAddress()}, 4); AddRef(); enumIndex = 0; return COM.S_OK; } int[] ppvObject = new int[1]; int result = iaccessible.QueryInterface(guid, ppvObject); COM.MoveMemory(arg2, ppvObject, 4); return result; } int AddRef() { refCount++; return refCount; } int Release() { refCount--; if (refCount == 0) { if (objIAccessible != null) objIAccessible.dispose(); objIAccessible = null; if (objIEnumVARIANT != null) objIEnumVARIANT.dispose(); objIEnumVARIANT = null; } return refCount; } int accDoDefaultAction(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2) { if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; // Currently, we don't let the application override this. Forward to the proxy. int code = iaccessible.accDoDefaultAction(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2); if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID return code; } int accHitTest(int xLeft, int yTop, int pvarChild) { if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; if (accessibleControlListeners.size() == 0) { return iaccessible.accHitTest(xLeft, yTop, pvarChild); } AccessibleControlEvent event = new AccessibleControlEvent(this); event.childID = ACC.CHILDID_NONE; event.x = xLeft; event.y = yTop; for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); listener.getChildAtPoint(event); } int childID = event.childID; if (childID == ACC.CHILDID_NONE) { return iaccessible.accHitTest(xLeft, yTop, pvarChild); } COM.MoveMemory(pvarChild, new short[] { COM.VT_I4 }, 2); COM.MoveMemory(pvarChild + 8, new int[] { childIDToOs(childID) }, 4); return COM.S_OK; } int accLocation(int pxLeft, int pyTop, int pcxWidth, int pcyHeight, int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2) { if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG; /* Get the default location from the OS. */ int osLeft = 0, osTop = 0, osWidth = 0, osHeight = 0; int code = iaccessible.accLocation(pxLeft, pyTop, pcxWidth, pcyHeight, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2); if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID if (accessibleControlListeners.size() == 0) return code; if (code == COM.S_OK) { int[] pLeft = new int[1], pTop = new int[1], pWidth = new int[1], pHeight = new int[1]; COM.MoveMemory(pLeft, pxLeft, 4); COM.MoveMemory(pTop, pyTop, 4); COM.MoveMemory(pWidth, pcxWidth, 4); COM.MoveMemory(pHeight, pcyHeight, 4); osLeft = pLeft[0]; osTop = pTop[0]; osWidth = pWidth[0]; osHeight = pHeight[0]; } AccessibleControlEvent event = new AccessibleControlEvent(this); event.childID = osToChildID(varChild_lVal); event.x = osLeft; event.y = osTop; event.width = osWidth; event.height = osHeight; for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); listener.getLocation(event); } OS.MoveMemory(pxLeft, new int[] { event.x }, 4); OS.MoveMemory(pyTop, new int[] { event.y }, 4); OS.MoveMemory(pcxWidth, new int[] { event.width }, 4); OS.MoveMemory(pcyHeight, new int[] { event.height }, 4); return COM.S_OK; } int accNavigate(int navDir, int varStart_vt, int varStart_reserved1, int varStart_lVal, int varStart_reserved2, int pvarEndUpAt) { if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; // Currently, we don't let the application override this. Forward to the proxy. int code = iaccessible.accNavigate(navDir, varStart_vt, varStart_reserved1, varStart_lVal, varStart_reserved2, pvarEndUpAt); if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID return code; } int accSelect(int flagsSelect, int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2) { if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; // Currently, we don't let the application override this. Forward to the proxy. int code = iaccessible.accSelect(flagsSelect, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2); if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID return code; } int get_accChild(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int ppdispChild) { if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG; if (accessibleControlListeners.size() == 0) { int code = iaccessible.get_accChild(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, ppdispChild); if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID return code; } AccessibleControlEvent event = new AccessibleControlEvent(this); event.childID = osToChildID(varChild_lVal); for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); listener.getChild(event); } Accessible accessible = event.accessible; if (accessible != null) { COM.MoveMemory(ppdispChild, new int[] { accessible.objIAccessible.getAddress() }, 4); return COM.S_OK; } return COM.S_FALSE; } int get_accChildCount(int pcountChildren) { if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; /* Get the default child count from the OS. */ int osChildCount = 0; int code = iaccessible.get_accChildCount(pcountChildren); if (accessibleControlListeners.size() == 0) return code; if (code == COM.S_OK) { int[] pChildCount = new int[1]; COM.MoveMemory(pChildCount, pcountChildren, 4); osChildCount = pChildCount[0]; } AccessibleControlEvent event = new AccessibleControlEvent(this); event.childID = ACC.CHILDID_SELF; event.detail = osChildCount; for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); listener.getChildCount(event); } COM.MoveMemory(pcountChildren, new int[] { event.detail }, 4); return COM.S_OK; } int get_accDefaultAction(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszDefaultAction) { if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG; /* Get the default defaultAction from the OS. */ String osDefaultAction = null; int code = iaccessible.get_accDefaultAction(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszDefaultAction); if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID if (accessibleControlListeners.size() == 0) return code; if (code == COM.S_OK) { int[] pDefaultAction = new int[1]; COM.MoveMemory(pDefaultAction, pszDefaultAction, 4); int size = COM.SysStringByteLen(pDefaultAction[0]); if (size > 0) { char[] buffer = new char[(size + 1) /2]; COM.MoveMemory(buffer, pDefaultAction[0], size); osDefaultAction = new String(buffer); } } AccessibleControlEvent event = new AccessibleControlEvent(this); event.childID = osToChildID(varChild_lVal); event.result = osDefaultAction; for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); listener.getDefaultAction(event); } if (event.result == null) return code; char[] data = (event.result + "\0").toCharArray(); int ptr = COM.SysAllocString(data); COM.MoveMemory(pszDefaultAction, new int[] { ptr }, 4); return COM.S_OK; } int get_accDescription(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszDescription) { if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG; /* Get the default description from the OS. */ String osDescription = null; int code = iaccessible.get_accDescription(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszDescription); if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID if (accessibleListeners.size() == 0) return code; if (code == COM.S_OK) { int[] pDescription = new int[1]; COM.MoveMemory(pDescription, pszDescription, 4); int size = COM.SysStringByteLen(pDescription[0]); if (size > 0) { char[] buffer = new char[(size + 1) /2]; COM.MoveMemory(buffer, pDescription[0], size);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -