org.eclipse.swt.win32.win32.x86_3.7.2.v3740f

 {
              if (childID == -1)
              {
                AccessibleEvent event = new AccessibleEvent(Accessible.this);
                childID = val$childID;
                for (int i = 0; i < accessibleListeners.size(); i++)
                {
                  AccessibleListener listener = (AccessibleListener)accessibleListeners.elementAt(i);
                  listener.getName(event);
                }
                result = result;
              }
            }
          });
        }
      }
    }
    AccessibleControlEvent event = new AccessibleControlEvent(this);
    childID = childID;
    for (int i = 0; i < accessibleControlListeners.size(); i++)
    {
      AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
      listener.getChild(event);
    }
    Accessible accessible = accessible;
    if (accessible == null) {
      accessible = osAccessible;
    }
    if (accessible != null)
    {
      accessible.AddRef();
      COM.MoveMemory(ppdispChild, new int[] { accessible.getAddress() }, OS.PTR_SIZEOF);
      return 0;
    }
    return code;
  }
  
  int get_accChildCount(int pcountChildren)
  {
    int osChildCount = 0;
    if (iaccessible != null)
    {
      int code = iaccessible.get_accChildCount(pcountChildren);
      if (code == 0)
      {
        int[] pChildCount = new int[1];
        COM.MoveMemory(pChildCount, pcountChildren, 4);
        osChildCount = pChildCount[0];
      }
      if (accessibleControlListeners.size() == 0) {
        return code;
      }
    }
    AccessibleControlEvent event = new AccessibleControlEvent(this);
    childID = -1;
    detail = osChildCount;
    for (int i = 0; i < accessibleControlListeners.size(); i++)
    {
      AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
      listener.getChildCount(event);
    }
    COM.MoveMemory(pcountChildren, new int[] { detail }, 4);
    return 0;
  }
  
  int get_accDefaultAction(int varChild, int pszDefaultAction)
  {
    VARIANT v = getVARIANT(varChild);
    if (vt != 3) {
      return -2147024809;
    }
    int code = -2147352573;
    String osDefaultAction = null;
    if (iaccessible != null)
    {
      code = iaccessible.get_accDefaultAction(varChild, pszDefaultAction);
      if (code == -2147024809) {
        code = 1;
      }
      if (accessibleControlListeners.size() == 0) {
        return code;
      }
      if (code == 0)
      {
        int[] pDefaultAction = new int[1];
        COM.MoveMemory(pDefaultAction, pszDefaultAction, OS.PTR_SIZEOF);
        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);
    childID = osToChildID(lVal);
    result = osDefaultAction;
    for (int i = 0; i < accessibleControlListeners.size(); i++)
    {
      AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
      listener.getDefaultAction(event);
    }
    if (((result == null) || (result.length() == 0)) && (lVal == 0)) {
      code = get_name(0, pszDefaultAction);
    }
    if (result == null) {
      return code;
    }
    if (result.length() == 0) {
      return 1;
    }
    setString(pszDefaultAction, result);
    return 0;
  }
  
  int get_accDescription(int varChild, int pszDescription)
  {
    VARIANT v = getVARIANT(varChild);
    if (vt != 3) {
      return -2147024809;
    }
    int code = -2147352573;
    String osDescription = null;
    if (iaccessible != null)
    {
      code = iaccessible.get_accDescription(varChild, pszDescription);
      if (code == -2147024809) {
        code = 1;
      }
      if ((accessibleListeners.size() == 0) && (!(control instanceof Tree))) {
        return code;
      }
      if (code == 0)
      {
        int[] pDescription = new int[1];
        COM.MoveMemory(pDescription, pszDescription, OS.PTR_SIZEOF);
        int size = COM.SysStringByteLen(pDescription[0]);
        if (size > 0)
        {
          char[] buffer = new char[(size + 1) / 2];
          COM.MoveMemory(buffer, pDescription[0], size);
          osDescription = new String(buffer);
        }
      }
    }
    AccessibleEvent event = new AccessibleEvent(this);
    childID = osToChildID(lVal);
    result = osDescription;
    if ((lVal != 0) && 
      ((control instanceof Tree)))
    {
      Tree tree = (Tree)control;
      int columnCount = tree.getColumnCount();
      if (columnCount > 1)
      {
        int hwnd = control.handle;int hItem = 0;
        if (OS.COMCTL32_MAJOR >= 6) {
          hItem = OS.SendMessage(hwnd, 4394, lVal, 0);
        } else {
          hItem = lVal;
        }
        Widget widget = tree.getDisplay().findWidget(hwnd, hItem);
        result = "";
        if ((widget != null) && ((widget instanceof TreeItem)))
        {
          TreeItem item = (TreeItem)widget;
          for (int i = 1; i < columnCount; i++)
          {
            AccessibleEvent tmp306_304 = event;306304result = (306304result + tree.getColumn(i).getText() + ": " + item.getText(i));
            if (i + 1 < columnCount) {
              result += ", ";
            }
          }
        }
      }
    }
    for (int i = 0; i < accessibleListeners.size(); i++)
    {
      AccessibleListener listener = (AccessibleListener)accessibleListeners.elementAt(i);
      listener.getDescription(event);
    }
    if (result == null) {
      return code;
    }
    if (result.length() == 0) {
      return 1;
    }
    setString(pszDescription, result);
    return 0;
  }
  
  int get_accFocus(int pvarChild)
  {
    int osChild = -2;
    if (iaccessible != null)
    {
      int code = iaccessible.get_accFocus(pvarChild);
      if (code == 0)
      {
        VARIANT v = getVARIANT(pvarChild);
        if (vt == 3) {
          osChild = lVal;
        }
      }
      if (accessibleControlListeners.size() == 0) {
        return code;
      }
    }
    AccessibleControlEvent event = new AccessibleControlEvent(this);
    childID = (osChild == -2 ? -2 : osToChildID(osChild));
    for (int i = 0; i < accessibleControlListeners.size(); i++)
    {
      AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
      listener.getFocus(event);
    }
    Accessible accessible = accessible;
    if (accessible != null)
    {
      accessible.AddRef();
      setPtrVARIANT(pvarChild, (short)9, accessible.getAddress());
      return 0;
    }
    int childID = childID;
    if (childID == -2)
    {
      setIntVARIANT(pvarChild, (short)0, 0);
      return 1;
    }
    if (childID == -1)
    {
      AddRef();
      setIntVARIANT(pvarChild, (short)3, 0);
      return 0;
    }
    setIntVARIANT(pvarChild, (short)3, childIDToOs(childID));
    return 0;
  }
  
  int get_accHelp(int varChild, int pszHelp)
  {
    VARIANT v = getVARIANT(varChild);
    if (vt != 3) {
      return -2147024809;
    }
    int code = -2147352573;
    String osHelp = null;
    if (iaccessible != null)
    {
      code = iaccessible.get_accHelp(varChild, pszHelp);
      if (code == -2147024809) {
        code = 1;
      }
      if (accessibleListeners.size() == 0) {
        return code;
      }
      if (code == 0)
      {
        int[] pHelp = new int[1];
        COM.MoveMemory(pHelp, pszHelp, OS.PTR_SIZEOF);
        int size = COM.SysStringByteLen(pHelp[0]);
        if (size > 0)
        {
          char[] buffer = new char[(size + 1) / 2];
          COM.MoveMemory(buffer, pHelp[0], size);
          osHelp = new String(buffer);
        }
      }
    }
    AccessibleEvent event = new AccessibleEvent(this);
    childID = osToChildID(lVal);
    result = osHelp;
    for (int i = 0; i < accessibleListeners.size(); i++)
    {
      AccessibleListener listener = (AccessibleListener)accessibleListeners.elementAt(i);
      listener.getHelp(event);
    }
    if (result == null) {
      return code;
    }
    if (result.length() == 0) {
      return 1;
    }
    setString(pszHelp, result);
    return 0;
  }
  
  int get_accHelpTopic(int pszHelpFile, int varChild, int pidTopic)
  {
    int code = -2147352573;
    if (iaccessible != null)
    {
      code = iaccessible.get_accHelpTopic(pszHelpFile, varChild, pidTopic);
      if (code == -2147024809) {
        code = -2147352573;
      }
    }
    return code;
  }
  
  int get_accKeyboardShortcut(int varChild, int pszKeyboardShortcut)
  {
    VARIANT v = getVARIANT(varChild);
    if (vt != 3) {
      return -2147024809;
    }
    int code = -2147352573;
    String osKeyboardShortcut = null;
    if (iaccessible != null)
    {
      code = iaccessible.get_accKeyboardShortcut(varChild, pszKeyboardShortcut);
      if (code == -2147024809) {
        code = 1;
      }
      if ((accessibleListeners.size() == 0) && (!(control instanceof TabFolder))) {
        return code;
      }
      if (code == 0)
      {
        int[] pKeyboardShortcut = new int[1];
        COM.MoveMemory(pKeyboardShortcut, pszKeyboardShortcut, OS.PTR_SIZEOF);
        int size = COM.SysStringByteLen(pKeyboardShortcut[0]);
        if (size > 0)
        {
          char[] buffer = new char[(size + 1) / 2];
          COM.MoveMemory(buffer, pKeyboardShortcut[0], size);
          osKeyboardShortcut = new String(buffer);
        }
      }
    }
    AccessibleEvent event = new AccessibleEvent(this);
    childID = osToChildID(lVal);
    result = osKeyboardShortcut;
    if ((lVal == 0) && ((control instanceof TabFolder))) {
      result = "Ctrl+PageDown";
    }
    for (int i = 0; i < accessibleListeners.size(); i++)
    {
      AccessibleListener listener = (AccessibleListener)accessibleListeners.elementAt(i);
      listener.getKeyboardShortcut(event);
    }
    if (result == null) {
      return code;
    }
    if (result.length() == 0) {
      return 1;
    }
    setString(pszKeyboardShortcut, result);
    return 0;
  }
  
  int get_accName(int varChild, int pszName)
  {
    VARIANT v = getVARIANT(varChild);
    if (vt != 3) {
      return -2147024809;
    }
    int code = 1;
    String osName = null;
    if (iaccessible != null)
    {
      code = iaccessible.get_accName(varChild, pszName);
      if (code == 0)
      {
        int[] pName = new int[1];
        COM.MoveMemory(pName, pszName, OS.PTR_SIZEOF);
        int size = COM.SysStringByteLen(pName[0]);
        if (size > 0)
        {
          char[] buffer = new char[(size + 1) / 2];
          COM.MoveMemory(buffer, pName[0], size);
          osName = new String(buffer);
        }
      }
      if (code == -2147024809) {
        code = 1;
      }
      if (accessibleListeners.size() == 0) {
        return code;
      }
    }
    AccessibleEvent event = new AccessibleEvent(this);
    childID = osToChildID(lVal);
    result = osName;
    for (int i = 0; i < accessibleListeners.size(); i++)
    {
      AccessibleListener listener = (AccessibleListener)accessibleListeners.elementAt(i);
      listener.getName(event);
    }
    if (result == null) {
      return code;
    }
    if (result.length() == 0) {
      return 1;
    }
    setString(pszName, result);
    return 0;
  }
  
  int get_accParent(int ppdispParent)
  {
    int code = -2147352573;
    if (iaccessible != null) {
      code = iaccessible.get_accParent(ppdispParent);
    }
    if (parent != null)
    {
      parent.AddRef();
      COM.MoveMemory(ppdispParent, new int[] { parent.getAddress() }, OS.PTR_SIZEOF);
      code = 0;
    }
    return code;
  }
  
  int get_accRole(int varChild, int pvarRole)
  {
    VARIANT v = getVARIANT(varChild);
    if (vt != 3) {
      return -2147024809;
    }
    int osRole = 10;
    if (iaccessible != null)
    {
      int code = iaccessible.get_accRole(varChild, pvarRole);
      if (code == 0)
      {
        VARIANT v2 = getVARIANT(pvarRole);
        if (vt == 3) {
          osRole = lVal;
        }
      }
    }
    AccessibleControlEvent event = new AccessibleControlEvent(this);
    childID = osToChildID(lVal);
    detail = osToRole(osRole);
    if ((((control instanceof Tree)) || ((control instanceof Table))) && 
      (lVal != 0) && ((control.getStyle() & 0x20) != 0)) {
      detail = 44;
    }
    for (int i = 0; i < accessibleControlListeners.size(); i++)
    {
      AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
      listener.getRole(event);
    }
    setIntVARIANT(pvarRole, (short)3, roleToOs(detail));
    return 0;
  }
  
  int get_accSelection(int pvarChildren)
  {
    int osChild = -2;
    int osChildObject = 0;
    if (iaccessible != null)
    {
      int code = iaccessible.get_accSelection(pvarChildren);
      if (accessibleControlListeners.size() == 0) {
        return code;
      }
      if (code == 0)
      {
        VARIANT v = getVARIANT(pvarChildren);
        if (vt == 3) {
          osChild = osToChildID(lVal);
        } else if (vt == 9) {
          osChildObject = lVal;
        } else if (vt == 13) {
          osChild = -3;
        }
      }
    }
    AccessibleControlEvent event = new AccessibleControlEvent(this);
    childID = osChild;
    for (int i = 0; i < accessibleControlListeners.size(); i++)
    {
      AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
      listener.getSelection(event);
    }
    Accessible accessible = accessible;
    if (accessible != null)
    {
      accessible.AddRef();
      setPtrVARIANT(pvarChildren, (short)9, accessible.getAddress());
      return 0;
    }
    int childID = childID;
    if (childID == -2)
    {
      if (osChildObject != 0) {
        return 0;
      }
      setIntVARIANT(pvarChildren, (short)0, 0);
      return 1;
    }
    if (childID == -3) {
      return 0;
    }
    if (childID == -1)
    {
      AddRef();
      setPtrVARIANT(pvarChildren, (short)9, getAddress());
      return 0;
    }
    setIntVARIANT(pvarChildren, (short)3, childIDToOs(childID));
    return 0;
  }
  
  int get_accState(int varChild, int pvarState)
  {
    VARIANT v = getVARIANT(varChild);
    if (vt != 3) {
      return -2147024809;
    }
    int osState = 0;
    if (iaccessible != null)
    {
      int code = iaccessible.get_accState(varChild, pvarState);
      if (code == 0)
      {
        VARIANT v2 = getVARIANT(pvarState);
        if (vt == 3) {
          osState = lVal;
        }
      }
    }
    boolean grayed = false;
    AccessibleControlEvent event = new AccessibleControlEvent(this);
    childID = osToChildID(lVal);
    detail = osToState(osState);
    if (lVal != 0) {
      if (((control instanceof Tree)) && ((control.getStyle() & 0x20) != 0))
      {
        int hwnd = control.handle;
        TVITEM tvItem = new TVITEM();
        mask = 24;
        stateMask = 61440;
        if (OS.COMCTL32_MAJOR >= 6) {
          hItem = OS.SendMessage(hwnd, 4394, lVal, 0);
        } else {
          hItem = lVal;
        }
        int result = OS.SendMessage(hwnd, OS.TVM_GETITEM, 0, tvItem);
        boolean checked = (result != 0) && ((state >> 12 & 0x1) == 0);
        if (checked) {
          detail |= 0x10;
        }
        grayed = state >> 12 > 2;
      }
      else if (((control instanceof Table)) && ((control.getStyle() & 0x20) != 0))
      {
        Table table = (Table)control;
        int index = childID;
        if ((index >= 0) && (index < table.getItemCount()))
        {
          TableItem item = table.getItem(index);
          if (item.getChecked()) {
            detail |= 0x10;
          }
          if (item.getGrayed()) {
            grayed = true;
          }
        }
      }
    }
    for (int i = 0; i < accessibleControlListeners.size(); i++)
    {
      AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
      listener.getState(event);
    }
    int state = stateToOs(detail);
    if (((state & 0x10) != 0) && (grayed))
    {
      state &= 0xFFFFFFEF;
      state |= 0x20;
    }
    setIntVARIANT(pvarState, (short)3, state);
    return 0;
  }
  
  int get_accValue(int varChild, int pszValue)
  {
    VARIANT v = getVARIANT(varChild);
    if (vt != 3) {
      return -2147024809;
    }
    int code = -2147352573;
    String osValue = null;
    if (iaccessible != null)
    {
      code = iaccessible.get_accValue(varChild, pszValue);
      if (code == 0)
      {
        int[] pValue = new int[1];
        COM.MoveMemory(pValue, pszValue, OS.PTR_SIZEOF);
        int size = COM.SysStringByteLen(pValue[0]);
        if (size > 0)
        {
          char[] buffer = new char[(size + 1) / 2];
          COM.MoveMemory(buffer, pValue[0], size);
          osValue = new String(buffer);
        }
      }
      if (code == -2147024809) {
        code = -2147352573;
      }
      if (accessibleControlListeners.size() == 0) {
        return code;
      }
    }
    AccessibleControlEvent event = new AccessibleControlEvent(this);
    childID = osToChildID(lVal);
    result = osValue;
    for (int i = 0; i < accessibleControlListeners.size(); i++)
    {
      AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
      listener.getValue(event);
    }
    if (result == null) {
      return code;
    }
    setString(pszValue, result);
    return 0;
  }
  
  int put_accName(int varChild, int szName)
  {
    return -2147467263;
  }
  
  int put_accValue(int varChild, int szValue)
  {
    VARIANT v = getVARIANT(varChild);
    if (vt != 3) {
      return -2147024809;
    }
    int code = -2147352573;
    if ((lVal == 0) && (accessibleEditableTextListeners.size() > 0))
    {
      AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this);
      start = 0;
      end = getCharacterCount();
      if (end >= 0)
      {
        int size = COM.SysStringByteLen(szValue);
        char[] buffer = new char[(size + 1) / 2];
        OS.MoveMemory(buffer, szValue, size);
        string = new String(buffer);
        for (int i = 0; i < accessibleEditableTextListeners.size(); i++)
        {
          AccessibleEditableTextListener listener = (AccessibleEditableTextListener)accessibleEditableTextListeners.elementAt(i);
          listener.replaceText(event);
        }
        if ((result != null) && (result.equals("OK"))) {
          code = 0;
        }
      }
    }
    if ((code != 0) && (iaccessible != null))
    {
      code = iaccessible.put_accValue(varChild, szValue);
      if (code == -2147024809) {
        code = -2147352573;
      }
    }
    return code;
  }
  
  int Next(int celt, int rgvar, int pceltFetched)
  {
    if ((iaccessible != null) && (accessibleControlListeners.size() == 0))
    {
      int[] ppvObject = new int[1];
      int code = iaccessible.QueryInterface(COM.IIDIEnumVARIANT, ppvObject);
      if (code != 0) {
        return code;
      }
      IEnumVARIANT ienumvariant = new IEnumVARIANT(ppvObject[0]);
      int[] celtFetched = new int[1];
      code = ienumvariant.Next(celt, rgvar, celtFetched);
      ienumvariant.Release();
      COM.MoveMemory(pceltFetched, celtFetched, 4);
      return code;
    }
    if (rgvar == 0) {
      return -2147024809;
    }
    if ((pceltFetched == 0) && (celt != 1)) {
      return -2147024809;
    }
    if (enumIndex == 0)
    {
      AccessibleControlEvent event = new AccessibleControlEvent(this);
      childID = -1;
      for (int i = 0; i < accessibleControlListeners.size(); i++)
      {
        AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
        listener.getChildren(event);
      }
      variants = children;
    }
    Object[] nextItems = (Object[])null;
    if ((variants != null) && (celt >= 1))
    {
      int endIndex = enumIndex + celt - 1;
      if (endIndex > variants.length - 1) {
        endIndex = variants.length - 1;
      }
      if (enumIndex <= endIndex)
      {
        nextItems = new Object[endIndex - enumIndex + 1];
        for (int i = 0; i < nextItems.length; i++)
        {
          Object child = variants[enumIndex];
          if ((child instanceof Integer)) {
            nextItems[i] = new Integer(childIDToOs(((Integer)child).intValue()));
          } else {
            nextItems[i] = child;
          }
          enumIndex += 1;
        }
      }
    }
    if (nextItems != null)
    {
      for (int i = 0; i < nextItems.length; i++)
      {
        Object nextItem = nextItems[i];
        if ((nextItem instanceof Integer))
        {
          int item = ((Integer)nextItem).intValue();
          setIntVARIANT(rgvar + i * VARIANT.sizeof, (short)3, item);
        }
        else
        {
          Accessible accessible = (Accessible)nextItem;
          accessible.AddRef();
          setPtrVARIANT(rgvar + i * VARIANT.sizeof, (short)9, accessible.getAddress());
        }
      }
      if (pceltFetched != 0) {
        COM.MoveMemory(pceltFetched, new int[] { nextItems.length }, 4);
      }
      if (nextItems.length == celt) {
        return 0;
      }
    }
    else if (pceltFetched != 0)
    {
      COM.MoveMemory(pceltFetched, new int[1], 4);
    }
    return 1;
  }
  
  int Skip(int celt)
  {
    if ((iaccessible != null) && (accessibleControlListeners.size() == 0))
    {
      int[] ppvObject = new int[1];
      int code = iaccessible.QueryInterface(COM.IIDIEnumVARIANT, ppvObject);
      if (code != 0) {
        return code;
      }
      IEnumVARIANT ienumvariant = new IEnumVARIANT(ppvObject[0]);
      code = ienumvariant.Skip(celt);
      ienumvariant.Release();
      return code;
    }
    if (celt < 1) {
      return -2147024809;
    }
    enumIndex += celt;
    if (enumIndex > variants.length - 1)
    {
      enumIndex = (variants.length - 1);
      return 1;
    }
    return 0;
  }
  
  int Reset()
  {
    if ((iaccessible != null) && (accessibleControlListeners.size() == 0))
    {
      int[] ppvObject = new int[1];
      int code = iaccessible.QueryInterface(COM.IIDIEnumVARIANT, ppvObject);
      if (code != 0) {
        return code;
      }
      IEnumVARIANT ienumvariant = new IEnumVARIANT(ppvObject[0]);
      code = ienumvariant.Reset();
      ienumvariant.Release();
      return code;
    }
    enumIndex = 0;
    return 0;
  }
  
  int Clone(int ppEnum)
  {
    if ((iaccessible != null) && (accessibleControlListeners.size() == 0))
    {
      int[] ppvObject = new int[1];
      int code = iaccessible.QueryInterface(COM.IIDIEnumVARIANT, ppvObject);
      if (code != 0) {
        return code;
      }
      IEnumVARIANT ienumvariant = new IEnumVARIANT(ppvObject[0]);
      int[] pEnum = new int[1];
      code = ienumvariant.Clone(pEnum);
      ienumvariant.Release();
      COM.MoveMemory(ppEnum, pEnum, OS.PTR_SIZEOF);
      return code;
    }
    if (ppEnum == 0) {
      return -2147024809;
    }
    COM.MoveMemory(ppEnum, new int[] { objIEnumVARIANT.getAddress() }, OS.PTR_SIZEOF);
    AddRef();
    return 0;
  }
  
  int get_nRelations(int pNRelations)
  {
    int count = getRelationCount();
    
    COM.MoveMemory(pNRelations, new int[] { count }, 4);
    return 0;
  }
  
  int get_relation(int relationIndex, int ppRelation)
  {
    int i = -1;
    for (int type = 0; type < 15; type++)
    {
      Relation relation = relations[type];
      if (relation != null) {
        i++;
      }
      if (i == relationIndex)
      {
        relation.AddRef();
        COM.MoveMemory(ppRelation, new int[] { relation.getAddress() }, OS.PTR_SIZEOF);
        return 0;
      }
    }
    return -2147024809;
  }
  
  int get_relations(int maxRelations, int ppRelations, int pNRelations)
  {
    int count = 0;
    for (int type = 0; type < 15; type++)
    {
      if (count == maxRelations) {
        break;
      }
      Relation relation = relations[type];
      if (relation != null)
      {
        relation.AddRef();
        COM.MoveMemory(ppRelations + count * OS.PTR_SIZEOF, new int[] { relation.getAddress() }, OS.PTR_SIZEOF);
        count++;
      }
    }
    COM.MoveMemory(pNRelations, new int[] { count }, 4);
    return 0;
  }
  
  int get_role(int pRole)
  {
    int role = getRole();
    if (role == 0) {
      role = getDefaultRole();
    }
    COM.MoveMemory(pRole, new int[] { role }, 4);
    return 0;
  }
  
  int scrollTo(int scrollType)
  {
    if ((scrollType < 4) || (scrollType > 6)) {
      return -2147024809;
    }
    return -2147467263;
  }
  
  int scrollToPoint(int coordinateType, int x, int y)
  {
    if (coordinateType != 0) {
      return -2147024809;
    }
    return -2147467263;
  }
  
  int get_groupPosition(int pGroupLevel, int pSimilarItemsInGroup, int pPositionInGroup)
  {
    int groupLevel = 0;
    COM.MoveMemory(pGroupLevel, new int[] { groupLevel }, 4);
    
    int similarItemsInGroup = 0;
    COM.MoveMemory(pSimilarItemsInGroup, new int[] { similarItemsInGroup }, 4);
    
    int positionInGroup = 0;
    COM.MoveMemory(pPositionInGroup, new int[] { positionInGroup }, 4);
    if ((groupLevel == 0) && (similarItemsInGroup == 0) && (positionInGroup == 0)) {
      return 1;
    }
    return 0;
  }
  
  int get_states(int pStates)
  {
    AccessibleControlEvent event = new AccessibleControlEvent(this);
    childID = -1;
    for (int i = 0; i < accessibleControlListeners.size(); i++)
    {
      AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
      listener.getState(event);
    }
    int states = detail;
    int ia2States = 0;
    if ((states & 0x4000000) != 0) {
      ia2States |= 0x1;
    }
    if ((states & 0x8000000) != 0) {
      ia2States |= 0x2000;
    }
    if ((states & 0x10000000) != 0) {
      ia2States |= 0x200;
    }
    if ((states & 0x2000000) != 0) {
      ia2States |= 0x800;
    }
    if ((states & 0x20000000) != 0) {
      ia2States |= 0x40;
    }
    if ((states & 0x40000000) != 0) {
      ia2States |= 0x8000;
    }
    if ((getRole() == 42) && (accessibleTextExtendedListeners.size() > 0)) {
      ia2States |= 0x8;
    }
    COM.MoveMemory(pStates, new int[] { ia2States }, 4);
    return 0;
  }
  
  int get_extendedRole(int pbstrExtendedRole)
  {
    setString(pbstrExtendedRole, null);
    return 1;
  }
  
  int get_localizedExtendedRole(int pbstrLocalizedExtendedRole)
  {
    setString(pbstrLocalizedExtendedRole, null);
    return 1;
  }
  
  int get_nExtendedStates(int pNExtendedStates)
  {
    COM.MoveMemory(pNExtendedStates, new int[1], 4);
    return 0;
  }
  
  int get_extendedStates(int maxExtendedStates, int ppbstrExtendedStates, int pNExtendedStates)
  {
    setString(ppbstrExtendedStates, null);
    COM.MoveMemory(pNExtendedStates, new int[1], 4);
    return 1;
  }
  
  int get_localizedExtendedStates(int maxLocalizedExtendedStates, int ppbstrLocalizedExtendedStates, int pNLocalizedExtendedStates)
  {
    setString(ppbstrLocalizedExtendedStates, null);
    COM.MoveMemory(pNLocalizedExtendedStates, new int[1], 4);
    return 1;
  }
  
  int get_uniqueID(int pUniqueID)
  {
    if (uniqueID == -1) {
      uniqueID = (UniqueID--);
    }
    COM.MoveMemory(pUniqueID, new int[] { uniqueID }, 4);
    return 0;
  }
  
  int get_windowHandle(int pWindowHandle)
  {
    COM.MoveMemory(pWindowHandle, new int[] { control.handle }, OS.PTR_SIZEOF);
    return 0;
  }
  
  int get_indexInParent(int pIndexInParent)
  {
    AccessibleControlEvent event = new AccessibleControlEvent(this);
    childID = -5;
    detail = -1;
    for (int i = 0; i < accessibleControlListeners.size(); i++)
    {
      AccessibleControlListener listener = (AccessibleControlListener)accessibleControlListeners.elementAt(i);
      listener.getChild(event);
    }
    int indexInParent = detail;
    
    COM.MoveMemory(pIndexInParent, new int[] { indexInParent }, 4);
    return indexInParent == -1 ? 1 : 0;
  }
  
  int get_locale(int pLocale)
  {
    Locale locale = Locale.getDefault();
    
    char[] data = (locale.getLanguage() + "\000").toCharArray();
    int ptr = COM.SysAllocString(data);
    COM.MoveMemory(pLocale, new int[] { ptr }, OS.PTR_SIZEOF);
    
    data = (locale.getCountry() + "\000").toCharArray();
    ptr = COM.SysAllocString(data);
    COM.MoveMemory(pLocale + OS.PTR_SIZEOF, new int[] { ptr }, OS.PTR_SIZEOF);
    
    data = (locale.getVariant() + "\000").toCharArray();
    ptr = COM.SysAllocString(data);
    COM.MoveMemory(pLocale + 2 * OS.PTR_SIZEOF, new int[] { ptr }, OS.PTR_SIZEOF);
    
    return 0;
  }
  
  int get_attributes(int pbstrAttributes)
  {
    AccessibleAttributeEvent event = new AccessibleAttributeEvent(this);
    for (int i = 0; i < accessibleAttributeListeners.size(); i++)
    {
      AccessibleAttributeListener listener = (AccessibleAttributeListener)accessibleAttributeListeners.elementAt(i);
      listener.getAttributes(event);
    }
    String attributes = "";
    attributes = attributes + "margin-left:" + leftMargin + ";";
    attributes = attributes + "margin-top:" + topMargin + ";";
    attributes = attributes + "margin-right:" + rightMargin + ";";
    attributes = attributes + "margin-bottom:" + bottomMargin + ";";
    if (tabStops != null) {
      for (int i = 0; i < tabStops.length; i++) {
        attributes = attributes + "tab-stop:position=" + tabStops[i] + ";";
      }
    }
    if (justify) {
      attributes = attributes + "text-align:justify;";
    }
    attributes = attributes + "text-align:" + (alignment == 131072 ? "right" : alignment == 16384 ? "left" : "center") + ";";
    attributes = attributes + "text-indent:" + indent + ";";
    if (attributes != null) {
      for (int i = 0; i + 1 < attributes.length; i += 2) {
        attributes = attributes + attributes[i] + ":" + attributes[(i + 1)] + ";";
      }
    }
    if (getRole() == 42) {
      attributes = attributes + "text-model:a1;";
    }
    setString(pbstrAttributes, attributes);
    if (attributes.length() == 0) {
      return 1;
    }
    return 0;
  }
  
  int get_nActions(int pNActions)
  {
    AccessibleActionEvent event = new AccessibleActionEvent(this);
    for (int i = 0; i < accessibleActionListeners.size(); i++)
    {
      AccessibleActionListener listener = (AccessibleActionListener)accessibleActionListeners.elementAt(i);
      listener.getActionCount(event);
    }
    COM.MoveMemory(pNActions, new int[] { count }, 4);
    return 0;
  }
  
  int doAction(int actionIndex)
  {
    AccessibleActionEvent event = new AccessibleActionEvent(this);
    index = actionIndex;
    for (int i = 0; i < accessibleActionListeners.size(); i++)
    {
      AccessibleActionListener listener = (AccessibleActionListener)accessibleActionListeners.elementAt(i);
      listener.doAction(event);
    }
    if ((result == null) || (!result.equals("OK"))) {
      return -2147024809;
    }
    return 0;
  }
  
  int get_description(int actionIndex, int pbstrDescription)
  {
    AccessibleActionEvent event = new AccessibleActionEvent(this);
    index = actionIndex;
    for (int i = 0; i < accessibleActionListeners.size(); i++)
    {
      AccessibleActionListener listener = (AccessibleActionListener)accessibleActionListeners.elementAt(i);
      listener.getDescription(event);
    }
    setString(pbstrDescription, result);
    if ((result == null) || (result.length() == 0)) {
      return 1;
    }
    return 0;
  }
  
  int get_keyBinding(int actionIndex, int nMaxBindings, int ppbstrKeyBindings, int pNBindings)
  {
    AccessibleActionEvent event = new AccessibleActionEvent(this);
    index = actionIndex;
    for (int i = 0; i < accessibleActionListeners.size(); i++)
    {
      AccessibleActionListener listener = (AccessibleActionListener)accessibleActionListeners.elementAt(i);
      listener.getKeyBinding(event);
    }
    String keyBindings = result;
    int length = 0;
    if (keyBindings != null) {
      length = keyBindings.length();
    }
    int i = 0;int count = 0;
    while (i < length)
    {
      if (count == nMaxBindings) {
        break;
      }
      int j = keyBindings.indexOf(';', i);
      if (j == -1) {
        j = length;
      }
      String keyBinding = keyBindings.substring(i, j);
      if (keyBinding.length() > 0)
      {
        setString(ppbstrKeyBindings + count * OS.PTR_SIZEOF, keyBinding);
        count++;
      }
      i = j + 1;
    }
    COM.MoveMemory(pNBindings, new int[] { count }, 4);
    if (count == 0)
    {
      setString(ppbstrKeyBindings, null);
      return 1;
    }
    return 0;
  }
  
  int get_name(int actionIndex, int pbstrName)
  {
    AccessibleActionEvent event = new AccessibleActionEvent(this);
    index = actionIndex;
    localized = false;
    for (int i = 0; i < accessibleActionListeners.size(); i++)
    {
      AccessibleActionListener listener = (AccessibleActionListener)accessibleActionListeners.elementAt(i);
      listener.getName(event);
    }
    if ((result == null) || (result.length() == 0))
    {
      setString(pbstrName, null);
      return 1;
    }
    setString(pbstrName, result);
    return 0;
  }
  
  int get_localizedName(int actionIndex, int pbstrLocalizedName)
  {
    AccessibleActionEvent event = new AccessibleActionEvent(this);
    index = actionIndex;
    localized = true;
    for (int i = 0; i < accessibleActionListeners.size(); i++)
    {
      AccessibleActionListener listener = (AccessibleActionListener)accessibleActionListeners.elementAt(i);
      listener.getName(event);
    }
    if ((result == null) || (result.length() == 0))
    {
      setString(pbstrLocalizedName, null);
      return 1;
    }
    setString(pbstrLocalizedName, result);
    return 0;
  }
  
  int get_appName(int pbstrName)
  {
    String appName = Display.getAppName();
    if ((appName == null) || (appName.length() == 0))
    {
      setString(pbstrName, null);
      return 1;
    }
    setString(pbstrName, appName);
    return 0;
  }
  
  int get_appVersion(int pbstrVersion)
  {
    String appVersion = Display.getAppVersion();
    if ((appVersion == null) || (appVersion.length() == 0))
    {
      setString(pbstrVersion, null);
      return 1;
    }
    setString(pbstrVersion, appVersion);
    return 0;
  }
  
  int get_toolkitName(int pbstrName)
  {
    String toolkitName = "SWT";
    
    setString(pbstrName, toolkitName);
    return 0;
  }
  
  int get_toolkitVersion(int pbstrVersion)
  {
    String toolkitVersion = SWT.getVersion();
    
    setString(pbstrVersion, toolkitVersion);
    return 0;
  }
  
  int copyText(int startOffset, int endOffset)
  {
    AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this);
    start = (startOffset == -1 ? getCharacterCount() : startOffset);
    end = (endOffset == -1 ? getCharacterCount() : endOffset);
    for (int i = 0; i < accessibleEditableTextListeners.size(); i++)
    {
      AccessibleEditableTextListener listener = (AccessibleEditableTextListener)accessibleEditableTextListeners.elementAt(i);
      listener.copyText(event);
    }
    if ((result == null) || (!result.equals("OK"))) {
      return -2147024809;
    }
    return 0;
  }
  
  int deleteText(int startOffset, int endOffset)
  {
    AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this);
    start = (startOffset == -1 ? getCharacterCount() : startOffset);
    end = (endOffset == -1 ? getCharacterCount() : endOffset);
    string = "";
    for (int i = 0; i < accessibleEditableTextListeners.size(); i++)
    {
      AccessibleEditableTextListener listener = (AccessibleEditableTextListener)accessibleEditableTextListeners.elementAt(i);
      listener.replaceText(event);
    }
    if ((result == null) || (!result.equals("OK"))) {
      return -2147024809;
    }
    return 0;
  }
  
  int insertText(int offset, int pbstrText)
  {
    AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this);
    start = (offset == -1 ? getCharacterCount() : offset);
    end = start;
    string = getString(pbstrText);
    for (int i = 0; i < accessibleEditableTextListeners.size(); i++)
    {
      AccessibleEditableTextListener listener = (AccessibleEditableTextListener)accessibleEditableTextListeners.elementAt(i);
      listener.replaceText(event);
    }
    if ((result == null) || (!result.equals("OK"))) {
      return -2147024809;
    }
    return 0;
  }
  
  int cutText(int startOffset, int endOffset)
  {
    AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this);
    start = (startOffset == -1 ? getCharacterCount() : startOffset);
    end = (endOffset == -1 ? getCharacterCount() : endOffset);
    for (int i = 0; i < accessibleEditableTextListeners.size(); i++)
    {
      AccessibleEditableTextListener listener = (AccessibleEditableTextListener)accessibleEditableTextListeners.elementAt(i);
      listener.cutText(event);
    }
    if ((result == null) || (!result.equals("OK"))) {
      return -2147024809;
    }
    return 0;
  }
  
  int pasteText(int offset)
  {
    AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this);
    start = (offset == -1 ? getCharacterCount() : offset);
    end = start;
    for (int i = 0; i < accessibleEditableTextListeners.size(); i++)
    {
      AccessibleEditableTextListener listener = (AccessibleEditableTextListener)accessibleEditableTextListeners.elementAt(i);
      listener.pasteText(event);
    }
    if ((result == null) || (!result.equals("OK"))) {
      return -2147024809;
    }
    return 0;
  }
  
  int replaceText(int startOffset, int endOffset, int pbstrText)
  {
    AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this);
    start = (startOffset == -1 ? getCharacterCount() : startOffset);
    end = (endOffset == -1 ? getCharacterCount() : endOffset);
    string = getString(pbstrText);
    for (int i = 0; i < accessibleEditableTextListeners.size(); i++)
    {
      AccessibleEditableTextListener listener = (AccessibleEditableTextListener)accessibleEditableTextListeners.elementAt(i);
      listener.replaceText(event);
    }
    if ((result == null) || (!result.equals("OK"))) {
      return -2147024809;
    }
    return 0;
  }
  
  int setAttributes(int startOffset, int endOffset, int pbstrAttributes)
  {
    AccessibleTextAttributeEvent event = new AccessibleTextAttributeEvent(this);
    String string = getString(pbstrAttributes);
    if ((string != null) && (string.length() > 0))
    {
      start = (startOffset == -1 ? getCharacterCount() : startOffset);
      end = (endOffset == -1 ? getCharacterCount() : endOffset);
      TextStyle style = new TextStyle();
      FontData fontData = null;
      int points = 10;
      String[] attributes = new String[0];
      int begin = 0;
      int end = string.indexOf(';');
      while ((end != -1) && (end < string.length()))
      {
        String keyValue = string.substring(begin, end).trim();
        int colonIndex = keyValue.indexOf(':');
        if ((colonIndex != -1) && (colonIndex + 1 < keyValue.length()))
        {
          String[] newAttributes = new String[attributes.length + 2];
          System.arraycopy(attributes, 0, newAttributes, 0, attributes.length);
          newAttributes[attributes.length] = keyValue.substring(0, colonIndex).trim();
          newAttributes[(attributes.length + 1)] = keyValue.substring(colonIndex + 1).trim();
          attributes = newAttributes;
        }
        begin = end + 1;
        end = string.indexOf(';', begin);
      }
      for (int i = 0; i + 1 < attributes.length; i += 2)
      {
        String key = attributes[i];
        String value = attributes[(i + 1)];
        if (key.equals("text-position"))
        {
          if (value.equals("super")) {
            rise = (points / 2);
          } else if (value.equals("sub")) {
            rise = (-points / 2);
          }
        }
        else if (key.equals("text-underline-type"))
        {
          underline = true;
          if (value.equals("double")) {
            underlineStyle = 1;
          } else if ((valu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd