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

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

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

Accessible.accessibleTextExtendedListenersSize介绍

暂无

代码示例

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

int removeSelection(int selectionIndex) {
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.index = selectionIndex;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.removeSelection(event);
  }
  if (DEBUG) print(this + ".IAccessibleText::removeSelection(" + selectionIndex + ") returning" + hresult(event.result == null || !event.result.equals(ACC.OK) ? COM.E_INVALIDARG : COM.S_OK));
  if (event.result == null || !event.result.equals(ACC.OK)) return COM.E_INVALIDARG;
  return COM.S_OK;
}

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

int scrollSubstringToPoint(int startIndex, int endIndex, int coordinateType, int x, int y) {
  if (DEBUG) print(this + ".IAccessibleText::scrollSubstringToPoint");
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.start = startIndex;
  event.end = endIndex;
  event.type = ACC.SCROLL_TYPE_POINT;
  event.x = x;
  event.y = y;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.scrollText(event);
  }
  if (event.result == null || !event.result.equals(ACC.OK)) return COM.E_INVALIDARG; // TODO: @retval S_FALSE if the object is already at the specified location.
  return COM.S_OK;
}

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

int setCaretOffset(int offset) {
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.offset = offset == COM.IA2_TEXT_OFFSET_LENGTH ? getCharacterCount() : offset;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.setCaretOffset(event);
  }
  if (DEBUG) print(this + ".IAccessibleText::setCaretOffset(" + offset + ") returning" + hresult(event.result == null || !event.result.equals(ACC.OK) ? COM.E_INVALIDARG : COM.S_OK));
  if (event.result == null || !event.result.equals(ACC.OK)) return COM.E_INVALIDARG; // TODO: @retval E_FAIL if the caret cannot be set ?
  return COM.S_OK;
}

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

void setVisibleCharacterRangeAttribute(id value, int childId) {
  NSRange newRange = new NSValue(value.id).rangeValue();
  if (accessibleTextExtendedListenersSize() > 0) {
    AccessibleTextEvent event = new AccessibleTextEvent(this);
    event.type = ACC.SCROLL_TYPE_TOP_LEFT;
    event.start = (int)newRange.location;
    event.end = (int)(newRange.location + newRange.length);
    for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
      AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
      listener.scrollText(event);
    }
  } 
}

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

int scrollSubstringTo(int startIndex, int endIndex, int scrollType) {
  if (DEBUG) print(this + ".IAccessibleText::scrollSubstringTo");
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.start = startIndex;
  event.end = endIndex;
  switch (scrollType) {
    case COM.IA2_SCROLL_TYPE_TOP_LEFT: event.type = ACC.SCROLL_TYPE_TOP_LEFT; break;
    case COM.IA2_SCROLL_TYPE_BOTTOM_RIGHT: event.type = ACC.SCROLL_TYPE_BOTTOM_RIGHT; break;
    case COM.IA2_SCROLL_TYPE_TOP_EDGE: event.type = ACC.SCROLL_TYPE_TOP_EDGE; break;
    case COM.IA2_SCROLL_TYPE_BOTTOM_EDGE: event.type = ACC.SCROLL_TYPE_BOTTOM_EDGE; break;
    case COM.IA2_SCROLL_TYPE_LEFT_EDGE: event.type = ACC.SCROLL_TYPE_LEFT_EDGE; break;
    case COM.IA2_SCROLL_TYPE_RIGHT_EDGE: event.type = ACC.SCROLL_TYPE_RIGHT_EDGE; break;
    case COM.IA2_SCROLL_TYPE_ANYWHERE: event.type = ACC.SCROLL_TYPE_ANYWHERE; break;
  }
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.scrollText(event);
  }
  if (event.result == null || !event.result.equals(ACC.OK)) return COM.E_INVALIDARG;
  return COM.S_OK;
}

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

int setSelection(int selectionIndex, int startOffset, int endOffset) {
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.index = selectionIndex;
  event.start = startOffset == COM.IA2_TEXT_OFFSET_LENGTH ? getCharacterCount() : startOffset;
  event.end = endOffset == COM.IA2_TEXT_OFFSET_LENGTH ? getCharacterCount() : endOffset;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.setSelection(event);
  }
  if (DEBUG) print(this + ".IAccessibleText::setSelection(index=" + selectionIndex + ", start=" + event.start + ", end=" + event.end + ") returning " + (event.result.equals(ACC.OK) ? "OK" : "INVALIDARG"));
  if (event.result == null || !event.result.equals(ACC.OK)) return COM.E_INVALIDARG;
  return COM.S_OK;
}

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

void setSelectedTextRangeAttribute(id value, int childId) {
  NSRange newRange = new NSValue(value.id).rangeValue();
  if (accessibleTextExtendedListenersSize() > 0) {
    AccessibleTextEvent event = new AccessibleTextEvent(this);
    event.index = 0;
    event.start = (int)newRange.location;
    event.end = (int)(newRange.location + newRange.length);
    for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
      AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
      listener.removeSelection(event);
      listener.addSelection(event);
    }
  } 
}

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

int addSelection(int startOffset, int endOffset) {
  if (DEBUG) print(this + ".IAccessibleText::addSelection(" + startOffset + ", " + endOffset + ")");
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.start = startOffset == COM.IA2_TEXT_OFFSET_LENGTH ? getCharacterCount() : startOffset;
  event.end = endOffset == COM.IA2_TEXT_OFFSET_LENGTH ? getCharacterCount() : endOffset;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.addSelection(event);
  }
  if (event.result == null || !event.result.equals(ACC.OK)) return COM.E_INVALIDARG;
  return COM.S_OK;
}

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

int get_nHyperlinks(int /*long*/ pHyperlinkCount) {
  if (DEBUG) print(this + ".IAccessibleHypertext::get_nHyperlinks");
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.getHyperlinkCount(event);
  }
  COM.MoveMemory(pHyperlinkCount, new int [] { event.count }, 4);
  return COM.S_OK;
}

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

int get_hyperlinkIndex(int charIndex, int /*long*/ pHyperlinkIndex) {
  if (DEBUG) print(this + ".IAccessibleHypertext::get_hyperlinkIndex");
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.offset = charIndex;
  event.index = -1;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.getHyperlinkIndex(event);
  }
  COM.MoveMemory(pHyperlinkIndex, new int [] { event.index }, 4);
  if (event.index == -1) return COM.S_FALSE;
  return COM.S_OK;
}

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

int get_offsetAtPoint(int x, int y, int coordType, int /*long*/ pOffset) {
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.x = x;
  event.y = y;
  event.offset = -1;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.getOffsetAtPoint(event);
  }
  if (DEBUG) print(this + ".IAccessibleText::get_offsetAtPoint(" + x + ", " + y + ") returning " + event.offset + hresult(event.offset == -1 ? COM.S_FALSE : COM.S_OK));
  /*
   * Note that the current IA2 spec says to return 0 when there's nothing to return,
   * but since 0 is a valid return value, the spec is going to be updated to return -1.
   */
  COM.MoveMemory(pOffset, new int [] { event.offset }, 4);
  if (event.offset == -1) return COM.S_FALSE;
  return COM.S_OK;
}

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

int getCaretOffset() {
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.offset = -1;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextListener listener = accessibleTextExtendedListeners.get(i);
    listener.getCaretOffset (event);
  }
  if (event.offset == -1) {
    for (int i = 0; i < accessibleTextListenersSize(); i++) {
      event.childID = ACC.CHILDID_SELF;
      AccessibleTextListener listener = accessibleTextListeners.get(i);
      listener.getCaretOffset (event);
    }
  }
  return event.offset;
}

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

int get_nSelections(int /*long*/ pNSelections) {
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.count = -1;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.getSelectionCount(event);
  }
  if (event.count == -1) {
    event.childID = ACC.CHILDID_SELF;
    event.offset = -1;
    event.length = 0;
    for (int i = 0; i < accessibleTextListenersSize(); i++) {
      AccessibleTextListener listener = accessibleTextListeners.get(i);
      listener.getSelectionRange (event);
    }
    event.count = event.offset != -1 && event.length > 0 ? 1 : 0;
  }
  if (DEBUG) print(this + ".IAccessibleText::get_nSelections returning " + event.count);
  COM.MoveMemory(pNSelections, new int [] { event.count }, 4);
  return COM.S_OK;
}

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

int getCharacterCount() {
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.count = -1;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.getCharacterCount(event);
  }
  if (event.count == -1) {
    AccessibleControlEvent e = new AccessibleControlEvent(this);
    e.childID = ACC.CHILDID_SELF;
    for (int i = 0; i < accessibleControlListenersSize(); i++) {
      AccessibleControlListener listener = accessibleControlListeners.get(i);
      listener.getRole(e);
      listener.getValue(e);
    }
    // TODO: Consider passing the value through for other roles as well (i.e. combo, etc). Keep in sync with get_text.
    event.count = e.detail == ACC.ROLE_TEXT && e.result != null ? e.result.length() : 0;
  }
  return event.count;
}

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

id getVisibleCharacterRangeAttribute (int childID) {
  NSRange range = null;
  if (accessibleTextExtendedListenersSize() > 0) {
    AccessibleTextEvent event = new AccessibleTextEvent(this);
    event.childID = childID;
    for (int i=0; i<accessibleTextExtendedListenersSize(); i++) {
      AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
      listener.getVisibleRanges(event);
    }
    range = new NSRange();
    range.location = event.start;
    range.length = event.end - event.start;
  } else if (accessibleControlListenersSize() > 0) {
    AccessibleControlEvent event = new AccessibleControlEvent(this);
    event.childID = childID;
    event.result = null;
    for (int i = 0; i < accessibleControlListenersSize(); i++) {
      AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
      listener.getValue(event);
    }
    if (event.result != null) {
      range = new NSRange();
      range.location = 0;
      range.length = event.result.length();
    }
  }
  return (range != null) ? NSValue.valueWithRange(range) : null;
}

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

id getNumberOfCharactersAttribute (int childID) {
  id returnValue = null;
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.count = -1;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
    listener.getCharacterCount(event);
  }
  if (event.count != -1) {
    AccessibleControlEvent e = new AccessibleControlEvent(this);
    e.childID = ACC.CHILDID_SELF;
    for (int i = 0; i < accessibleControlListenersSize(); i++) {
      AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
      listener.getRole(e);
      listener.getValue(e);
    }
    // TODO: Consider passing the value through for other roles as well (i.e. combo, etc). Keep in sync with get_text.
    event.count = e.detail == ACC.ROLE_TEXT && e.result != null ? e.result.length() : 0;
    returnValue = NSNumber.numberWithInt(event.count);
  }
  return returnValue;
}

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

int get_hyperlink(int index, int /*long*/ ppHyperlink) {
  if (DEBUG) print(this + ".IAccessibleHypertext::get_hyperlink");
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.index = index;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.getHyperlink(event);
  }
  Accessible accessible = event.accessible;
  if (accessible == null) {
    setIntVARIANT(ppHyperlink, COM.VT_EMPTY, 0);
    return COM.E_INVALIDARG;
  }
  accessible.AddRef();
  COM.MoveMemory(ppHyperlink, new int /*long*/[] { accessible.getAddress() }, OS.PTR_SIZEOF);
  return COM.S_OK;
}

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

id getRangeForPositionParameterizedAttribute(id parameter, int childID) {
  id returnValue = null;
  NSValue parameterObject = new NSValue(parameter.id);
  NSPoint point = parameterObject.pointValue();
  NSRange range = new NSRange();
  if (accessibleTextExtendedListenersSize() > 0) {
    NSArray screens = NSScreen.screens();
    NSScreen screen = new NSScreen(screens.objectAtIndex(0));
    NSRect frame = screen.frame();
    point.y = frame.height - point.y;
    AccessibleTextEvent event  = new AccessibleTextEvent(this);
    event.childID = childID;
    event.x = (int)point.x;
    event.y = (int)point.y;
    for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
      AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
      listener.getOffsetAtPoint(event);
    }
    range.location = event.offset;
    range.length = 1;
  } else {
    //FIXME???
    //how to implement with old listener
  }
  returnValue = NSValue.valueWithRange(range);
  return returnValue;
}

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

int get_characterExtents(int offset, int coordType, int /*long*/ pX, int /*long*/ pY, int /*long*/ pWidth, int /*long*/ pHeight) {
  int length = getCharacterCount();
  AccessibleTextEvent event = new AccessibleTextEvent(this);
  event.start = offset == COM.IA2_TEXT_OFFSET_LENGTH ? length : offset < 0 ? 0 : offset;
  event.end = offset == COM.IA2_TEXT_OFFSET_LENGTH || offset >= length ? length : offset + 1;
  for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
    AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
    listener.getTextBounds(event);
  }
  /* Note: event.rectangles is not used here, because IAccessibleText::get_characterExtents is just for one character. */
  if (DEBUG) print(this + ".IAccessibleText::get_characterExtents(" + offset + ") returning " + event.x + ", " + event.y + ", " + event.width + ", " + event.height);
  COM.MoveMemory(pX, new int [] { event.x }, 4);
  COM.MoveMemory(pY, new int [] { event.y }, 4);
  COM.MoveMemory(pWidth, new int [] { event.width }, 4);
  COM.MoveMemory(pHeight, new int [] { event.height }, 4);
  if (event.width == 0 && event.height == 0) return COM.E_INVALIDARG;
  return COM.S_OK;
}

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

/**
 * Checks to see if the specified attribute can be set by a screen reader or other
 * assistive service. 
 * <p>
 * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
 * public API. It is marked public only so that it can be shared
 * within the packages provided by SWT. It is not available on all
 * platforms and should never be accessed from application code.
 * </p>
 * 
 * @noreference This method is not intended to be referenced by clients.
 */
public boolean internal_accessibilityIsAttributeSettable(NSString attribute, int childID) {
  if (accessibleTextExtendedListenersSize() > 0) {
    if (attribute.isEqualToString(OS.NSAccessibilitySelectedTextRangeAttribute)) return true;
    if (attribute.isEqualToString(OS.NSAccessibilityVisibleCharacterRangeAttribute)) return true;
  }
  if (accessibleEditableTextListenersSize() > 0) {
    if (attribute.isEqualToString(OS.NSAccessibilitySelectedTextAttribute)) return true;
  }
  if (accessibleValueListenersSize() > 0) {
    if (attribute.isEqualToString(OS.NSAccessibilityValueAttribute)) return true;
  }
  return false;
}

相关文章