Package org.eclipse.swt.accessibility

Examples of org.eclipse.swt.accessibility.Accessible


    checkWidget();
    return appToolTipText;
  }

  private void initAccessible() {
    Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter() {
      @Override
      public void getName(AccessibleEvent e) {
        e.result = getText();
      }

      @Override
      public void getHelp(AccessibleEvent e) {
        e.result = getToolTipText();
      }

      @Override
      public void getKeyboardShortcut(AccessibleEvent e) {
        char mnemonic = _findMnemonic(CCLabel.this.text);
        if (mnemonic != '\0') {
          e.result = "Alt+" + mnemonic; //$NON-NLS-1$
        }
      }
    });

    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
      @Override
      public void getChildAtPoint(AccessibleControlEvent e) {
        e.childID = ACC.CHILDID_SELF;
      }
View Full Code Here


    checkWidget();
    return appToolTipText;
  }

  private void initAccessible() {
    Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter() {
      @Override
      public void getName(AccessibleEvent e) {
        e.result = getText();
      }

      @Override
      public void getHelp(AccessibleEvent e) {
        e.result = getToolTipText();
      }

      @Override
      public void getKeyboardShortcut(AccessibleEvent e) {
        char mnemonic = _findMnemonic(CCLabel.this.text);
        if (mnemonic != '\0') {
          e.result = "Alt+" + mnemonic; //$NON-NLS-1$
        }
      }
    });

    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
      @Override
      public void getChildAtPoint(AccessibleControlEvent e) {
        e.childID = ACC.CHILDID_SELF;
      }
View Full Code Here

    checkWidget();
    return appToolTipText;
  }

  private void initAccessible() {
    Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter() {
      @Override
      public void getName(AccessibleEvent e) {
        e.result = getText();
      }

      @Override
      public void getHelp(AccessibleEvent e) {
        e.result = getToolTipText();
      }

      @Override
      public void getKeyboardShortcut(AccessibleEvent e) {
        char mnemonic = _findMnemonic(CCLabel.this.text);
        if (mnemonic != '\0') {
          e.result = "Alt+" + mnemonic; //$NON-NLS-1$
        }
      }
    });

    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
      @Override
      public void getChildAtPoint(AccessibleControlEvent e) {
        e.childID = ACC.CHILDID_SELF;
      }
View Full Code Here

  /**
   * Initialize the accessibility adapter.
   */
  private void initAccessible() {
    final Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter() {

      public void getName(AccessibleEvent e) {
        if (getSelectionIndex() != NONE) {
          e.result = elements[getSelectionIndex()].getTabItem()
              .getText();
        }
      }

      public void getHelp(AccessibleEvent e) {
        if (getSelectionIndex() != NONE) {
          e.result = elements[getSelectionIndex()].getTabItem()
              .getText();
        }
      }
    });

    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {

      public void getChildAtPoint(AccessibleControlEvent e) {
        Point pt = toControl(new Point(e.x, e.y));
        e.childID = (getBounds().contains(pt)) ? ACC.CHILDID_SELF
          : ACC.CHILDID_NONE;
      }

      public void getLocation(AccessibleControlEvent e) {
        if (getSelectionIndex() != NONE) {
          Rectangle location = elements[getSelectionIndex()]
            .getBounds();
          Point pt = toDisplay(new Point(location.x, location.y));
          e.x = pt.x;
          e.y = pt.y;
          e.width = location.width;
          e.height = location.height;
        }
      }

      public void getChildCount(AccessibleControlEvent e) {
        e.detail = 0;
      }

      public void getRole(AccessibleControlEvent e) {
        e.detail = ACC.ROLE_TABITEM;
      }

      public void getState(AccessibleControlEvent e) {
        e.detail = ACC.STATE_NORMAL | ACC.STATE_SELECTABLE
          | ACC.STATE_SELECTED | ACC.STATE_FOCUSED
          | ACC.STATE_FOCUSABLE;
      }
    });

    addListener(SWT.Selection, new Listener() {

      public void handleEvent(Event event) {
        if (isFocusControl()) {
          accessible.setFocus(ACC.CHILDID_SELF);
        }
      }
    });

    addListener(SWT.FocusIn, new Listener() {

      public void handleEvent(Event event) {
        accessible.setFocus(ACC.CHILDID_SELF);
      }
    });
  }
View Full Code Here

 
 
  public String getText() { return text; }
 
  private void initAccessible() {
    Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter() {
      public void getName(AccessibleEvent e) {
        e.result = getText();
      }
     
      public void getHelp(AccessibleEvent e) {
        e.result = getToolTipText();
      }
     
    });
   
    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
      public void getChildAtPoint(AccessibleControlEvent e) {
        e.childID = ACC.CHILDID_SELF;
      }
     
      public void getLocation(AccessibleControlEvent e) {
View Full Code Here

    super(parent, SWT.NO_BACKGROUND | style);
    initAccessible();
  }

  protected void initAccessible() {
    Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter() {
      public void getName(AccessibleEvent e) {
        e.result = getText();
        if (e.result == null)
          getHelp(e);
      }

      public void getHelp(AccessibleEvent e) {
        e.result = getToolTipText();
      }
    });
    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
      public void getChildAtPoint(AccessibleControlEvent e) {
        Point pt = toControl(new Point(e.x, e.y));
        e.childID = (getBounds().contains(pt)) ? ACC.CHILDID_SELF
            : ACC.CHILDID_NONE;
      }
View Full Code Here

      if (items[i] == item) return i;
    }
    return -1;
  }
  void initAccessible() {
    final Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter() {
      public void getName(AccessibleEvent e) {
        String name = null;
        int childID = e.childID;
        if (childID >= 0 && childID < items.length) {
          name = items[childID].getText();
          int index = name.indexOf('&');
          if (index > 0) {
            name = name.substring(0, index) + name.substring(index + 1);
          }
        }
        e.result = name;
      }
     
      public void getHelp(AccessibleEvent e) {
        String help = null;
        int childID = e.childID;
        if (childID == ACC.CHILDID_SELF) {
          help = getToolTipText();
        } else if (childID >= 0 && childID < items.length) {
          help = items[childID].getToolTipText();
        }
        e.result = help;
      }
     
      public void getKeyboardShortcut(AccessibleEvent e) {
        String shortcut = null;
        int childID = e.childID;
        if (childID >= 0 && childID < items.length) {
          String text = items[childID].getText();
          if (text != null) {
            char mnemonic = _findMnemonic(text)
            if (mnemonic != '\0') {
              shortcut = "Alt+"+mnemonic; //$NON-NLS-1$
            }
          }
        }
        e.result = shortcut;
      }
    });
   
    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
      public void getChildAtPoint(AccessibleControlEvent e) {
        Point testPoint = toControl(e.x, e.y);
        int childID = ACC.CHILDID_NONE;
        for (int i = 0; i < items.length; i++) {
          if (items[i].getBounds().contains(testPoint)) {
            childID = i;
            break;
          }
        }
        if (childID == ACC.CHILDID_NONE) {
          Rectangle location = getBounds();
          location.height = location.height - getClientArea().height;
          if (location.contains(testPoint)) {
            childID = ACC.CHILDID_SELF;
          }
        }
        e.childID = childID;
      }
     
     
      public void getLocation(AccessibleControlEvent e) {
        Rectangle location = null;
        int childID = e.childID;
        if (childID == ACC.CHILDID_SELF) {
          location = getBounds();
        }
        if (childID >= 0 && childID < items.length) {
          location = items[childID].getBounds();
        }
        if (location != null) {
          Point pt = toDisplay(location.x, location.y);
          e.x = pt.x;
          e.y = pt.y;
          e.width = location.width;
          e.height = location.height;
        }
      }
     
      public void getChildCount(AccessibleControlEvent e) {
        e.detail = items.length;
      }
     
      public void getDefaultAction(AccessibleControlEvent e) {
        String action = null;
        int childID = e.childID;
        if (childID >= 0 && childID < items.length) {
          action = SWT.getMessage ("SWT_Switch"); //$NON-NLS-1$
        }
        e.result = action;
      }
     
      public void getFocus(AccessibleControlEvent e) {
        int childID = ACC.CHILDID_NONE;
        if (isFocusControl()) {
          if (selectedIndex == -1) {
            childID = ACC.CHILDID_SELF;
          } else {
            childID = selectedIndex;
          }
        }
        e.childID = childID;
      }
     
      public void getRole(AccessibleControlEvent e) {
        int role = 0;
        int childID = e.childID;
        if (childID == ACC.CHILDID_SELF) {
          role = ACC.ROLE_TABFOLDER;
        } else if (childID >= 0 && childID < items.length) {
          role = ACC.ROLE_TABITEM;
        }
        e.detail = role;
      }
     
      public void getSelection(AccessibleControlEvent e) {
        e.childID = (selectedIndex == -1) ? ACC.CHILDID_NONE : selectedIndex;
      }
     
      public void getState(AccessibleControlEvent e) {
        int state = 0;
        int childID = e.childID;
        if (childID == ACC.CHILDID_SELF) {
          state = ACC.STATE_NORMAL;
        } else if (childID >= 0 && childID < items.length) {
          state = ACC.STATE_SELECTABLE;
          if (isFocusControl()) {
            state |= ACC.STATE_FOCUSABLE;
          }
          if (selectedIndex == childID) {
            state |= ACC.STATE_SELECTED;
            if (isFocusControl()) {
              state |= ACC.STATE_FOCUSED;
            }
          }
        }
        e.detail = state;
      }
     
      public void getChildren(AccessibleControlEvent e) {
        Object[] children = new Object[items.length];
        for (int i = 0; i < items.length; i++) {
          children[i] = new Integer(i);
        }
        e.children = children;
      }
    });
   
    addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        if (isFocusControl()) {
          if (selectedIndex == -1) {
            accessible.setFocus(ACC.CHILDID_SELF);
          } else {
            accessible.setFocus(selectedIndex);
          }
        }
      }
    });
   
    addListener(SWT.FocusIn, new Listener() {
      public void handleEvent(Event event) {
        if (selectedIndex == -1) {
          accessible.setFocus(ACC.CHILDID_SELF);
        } else {
          accessible.setFocus(selectedIndex);
        }
      }
    });
  }
View Full Code Here

      return (IHyperlinkSegment) segment;
    return null;
  }

  private void initAccessible() {
    Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter() {
      public void getName(AccessibleEvent e) {
        if (e.childID == ACC.CHILDID_SELF)
          e.result = model.getAccessibleText();
        else {
          int linkCount = model.getHyperlinkCount();
          if (e.childID >= 0 && e.childID < linkCount) {
            IHyperlinkSegment link = model.getHyperlink(e.childID);
            e.result = link.getText();
          }
        }
      }

      public void getHelp(AccessibleEvent e) {
        e.result = getToolTipText();
        int linkCount = model.getHyperlinkCount();
        if (e.result == null && e.childID >= 0 && e.childID < linkCount) {
          IHyperlinkSegment link = model.getHyperlink(e.childID);
          e.result = link.getText();
        }
      }
    });
    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
      public void getChildAtPoint(AccessibleControlEvent e) {
        Point pt = toControl(new Point(e.x, e.y));
        IHyperlinkSegment link = model.findHyperlinkAt(pt.x, pt.y);
        if (link != null)
          e.childID = model.indexOf(link);
View Full Code Here

      return (IHyperlinkSegment) segment;
    return null;
  }

  private void initAccessible() {
    Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter() {
      public void getName(AccessibleEvent e) {
        if (e.childID == ACC.CHILDID_SELF)
          e.result = model.getAccessibleText();
        else {
          int linkCount = model.getHyperlinkCount();
          if (e.childID >= 0 && e.childID < linkCount) {
            IHyperlinkSegment link = model.getHyperlink(e.childID);
            e.result = link.getText();
          }
        }
      }

      public void getHelp(AccessibleEvent e) {
        e.result = getToolTipText();
        int linkCount = model.getHyperlinkCount();
        if (e.result == null && e.childID >= 0 && e.childID < linkCount) {
          IHyperlinkSegment link = model.getHyperlink(e.childID);
          e.result = link.getText();
        }
      }
    });
    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
      public void getChildAtPoint(AccessibleControlEvent e) {
        Point pt = toControl(new Point(e.x, e.y));
        IHyperlinkSegment link = model.findHyperlinkAt(pt.x, pt.y);
        if (link != null)
          e.childID = model.indexOf(link);
View Full Code Here

    /**
     * Initialize the accessibility adapter.
     */
    private void initAccessible() {
        final Accessible accessible = getAccessible();
        accessible.addAccessibleListener(new AccessibleAdapter() {

            public void getName(AccessibleEvent e) {
                if (getSelectionIndex() != NONE) {
                    e.result = TabbedPropertyList.this.elements[getSelectionIndex()].getTabItem()
                            .getText();
                }
            }

            public void getHelp(AccessibleEvent e) {
                if (getSelectionIndex() != NONE) {
                    e.result = TabbedPropertyList.this.elements[getSelectionIndex()].getTabItem()
                            .getText();
                }
            }
        });

        accessible.addAccessibleControlListener(new AccessibleControlAdapter() {

            public void getChildAtPoint(AccessibleControlEvent e) {
                Point pt = toControl(new Point(e.x, e.y));
                e.childID = (getBounds().contains(pt)) ? ACC.CHILDID_SELF
                    : ACC.CHILDID_NONE;
            }

            public void getLocation(AccessibleControlEvent e) {
                if (getSelectionIndex() != NONE) {
                    Rectangle location = TabbedPropertyList.this.elements[getSelectionIndex()]
                        .getBounds();
                    Point pt = toDisplay(new Point(location.x, location.y));
                    e.x = pt.x;
                    e.y = pt.y;
                    e.width = location.width;
                    e.height = location.height;
                }
            }

            public void getChildCount(AccessibleControlEvent e) {
                e.detail = 0;
            }

            public void getRole(AccessibleControlEvent e) {
                e.detail = ACC.ROLE_TABITEM;
            }

            public void getState(AccessibleControlEvent e) {
                e.detail = ACC.STATE_NORMAL | ACC.STATE_SELECTABLE
                    | ACC.STATE_SELECTED | ACC.STATE_FOCUSED
                    | ACC.STATE_FOCUSABLE;
            }
        });

        addListener(SWT.Selection, new Listener() {

            public void handleEvent(Event event) {
                if (isFocusControl()) {
                    accessible.setFocus(ACC.CHILDID_SELF);
                }
            }
        });

        addListener(SWT.FocusIn, new Listener() {

            public void handleEvent(Event event) {
                accessible.setFocus(ACC.CHILDID_SELF);
            }
        });
    }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.accessibility.Accessible

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.