org.eclipse.swt.accessibility.Accessible.roleToOs()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.eclipse.swt.accessibility.Accessible.roleToOs()方法的一些代码示例,展示了Accessible.roleToOs()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Accessible.roleToOs()方法的具体详情如下:
包路径:org.eclipse.swt.accessibility.Accessible
类名称:Accessible
方法名:roleToOs

Accessible.roleToOs介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

NSString getRoleAttribute(int childID) {
  NSString returnValue = null;
  AccessibleControlEvent event = new AccessibleControlEvent(this);
  event.childID = childID;
  event.detail = -1;
  for (int i = 0; i < accessibleControlListenersSize(); i++) {
    AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
    listener.getRole(event);
  }
  if (event.detail != -1) {
    String appRole = roleToOs (event.detail);
    int index = appRole.indexOf(':');
    if (index != -1) appRole = appRole.substring(0, index);
    returnValue = NSString.stringWith(appRole);
  }
  return returnValue;
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

id getSubroleAttribute (int childID) {
  id returnValue = null;
  AccessibleControlEvent event = new AccessibleControlEvent(this);
  event.childID = childID;
  event.detail = -1;
  for (int i = 0; i < accessibleControlListenersSize(); i++) {
    AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
    listener.getRole(event);
  }
  if (event.detail != -1) {
    String appRole = roleToOs (event.detail);
    int index = appRole.indexOf(':');
    if (index != -1) {
      appRole = appRole.substring(index + 1);
      returnValue = NSString.stringWith(appRole);
    }
  }
  return returnValue;
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

id getRoleDescriptionAttribute (int childID) {
  id returnValue = null;
  AccessibleControlEvent event = new AccessibleControlEvent(this);
  event.childID = childID;
  event.detail = -1;
  for (int i = 0; i < accessibleControlListenersSize(); i++) {
    AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
    listener.getRole(event);
  }
  if (event.detail != -1) {
    if (event.detail == ACC.ROLE_TABITEM) {
      returnValue = new NSString(OS.NSAccessibilityRoleDescription (NSString.stringWith("AXTab").id, 0));
    } else {
      String appRole = roleToOs (event.detail);
      String appSubrole = null;
      int index = appRole.indexOf(':');
      if (index != -1) {
        appSubrole = appRole.substring(index + 1);
        appRole = appRole.substring(0, index);
      }
      NSString nsAppRole = NSString.stringWith(appRole);
      NSString nsAppSubrole = null;
      
      if (appSubrole != null) nsAppSubrole = NSString.stringWith(appSubrole);
      returnValue = new NSString(OS.NSAccessibilityRoleDescription (((nsAppRole != null) ? nsAppRole.id : 0), (nsAppSubrole != null) ? nsAppSubrole.id : 0));
    }
  }
  return returnValue;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

int get_accRole(int /*long*/ varChild, int /*long*/ pvarRole) {
  if (control != null && control.isDisposed()) return COM.CO_E_OBJNOTCONNECTED;
  VARIANT v = getVARIANT(varChild);
  if (v.vt != COM.VT_I4) return COM.E_INVALIDARG;
  int osRole = COM.ROLE_SYSTEM_CLIENT;
  if (iaccessible != null) {
    /* Get the default role from the OS. */
    int code = iaccessible.get_accRole(varChild, pvarRole);
    if (code == COM.S_OK) {
      VARIANT v2 = getVARIANT(pvarRole);
      if (v2.vt == COM.VT_I4) osRole = v2.lVal;
    }
  }
  AccessibleControlEvent event = new AccessibleControlEvent(this);
  event.childID = osToChildID(v.lVal);
  event.detail = osToRole(osRole);
  // TEMPORARY CODE
  /* Currently our checkbox table and tree are emulated using state mask images,
   * so we need to specify 'checkbox' role for the items. */
  if (control instanceof Tree || control instanceof Table) {
    if (v.lVal != COM.CHILDID_SELF && (control.getStyle() & SWT.CHECK) != 0) event.detail = ACC.ROLE_CHECKBUTTON;
  }
  for (int i = 0; i < accessibleControlListenersSize(); i++) {
    AccessibleControlListener listener = accessibleControlListeners.get(i);
    listener.getRole(event);
  }
  if (DEBUG) print(this + ".IAccessible::get_accRole(" + v.lVal + ") returning " + getRoleString(roleToOs(event.detail)) + hresult(COM.S_OK));
  setIntVARIANT(pvarRole, COM.VT_I4, roleToOs(event.detail));
  return COM.S_OK;
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

String osRole = roleToOs(event.detail);
if (osRole.indexOf(':') == -1)
  returnValue.removeObject(OS.NSAccessibilitySubroleAttribute);

相关文章