Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Point


   * @see org.eclipse.jface.dialogs.Dialog#initializeBounds()
   */
  @Override
  protected void initializeBounds() {
    super.initializeBounds();
    Point bestSize = getShell().computeSize(convertHorizontalDLUsToPixels(dialogMinWidth), SWT.DEFAULT);
    Point location = getInitialLocation(bestSize);
    getShell().setBounds(location.x, location.y, bestSize.x, bestSize.y);
  }
View Full Code Here


     * @see org.eclipse.jface.viewers.ColumnViewerToolTipSupport#getToolTipArea(org.eclipse.swt.widgets.Event)
     */
    @Override
    protected Object getToolTipArea(Event event) {
      Table table = (Table) event.widget;
      Point point = new Point(event.x, event.y);
      TableItem item = table.getItem(point);

      /* Only valid for Feed Column */
      if (item != null) {
        if (item.getBounds(COL_FEED).contains(point))
View Full Code Here

   * @see org.eclipse.swt.widgets.Composite#computeSize(int, int, boolean)
   */
  @Override
  public Point computeSize(int wHint, int hHint, boolean changed) {
    checkWidget();
    Point e = getTotalSize(image, text);
    if (wHint == SWT.DEFAULT) {
      e.x += 2 * hIndent;
    } else {
      e.x = wHint;
    }
View Full Code Here

  /**
   * Compute the minimum size.
   */
  private Point getTotalSize(Image image, String text) {
    Point size = new Point(0, 0);

    if (image != null) {
      Rectangle r = image.getBounds();
      size.x += r.width;
      size.y += r.height;
    }

    GC gc = new GC(this);
    if (text != null && text.length() > 0) {
      Point e = gc.textExtent(text, DRAW_FLAGS);
      size.x += e.x;
      size.y = Math.max(size.y, e.y);
      if (image != null)
        size.x += GAP;
    } else {
View Full Code Here

    boolean shortenText = false;
    String t = text;
    Image img = image;
    int availableWidth = Math.max(0, rect.width - 2 * hIndent);
    Point extent = getTotalSize(img, t);
    if (extent.x > availableWidth) {
      availableWidth -= img != null ? img.getBounds().width : 0;
      extent = getTotalSize(img, t);
      if (extent.x > availableWidth) {
        shortenText = true;
      }
    }

    GC gc = event.gc;
    String[] lines = text == null ? null : splitString(text);

    // shorten the text
    if (shortenText) {
      extent.x = 0;
      for (int i = 0; i < lines.length; i++) {
        Point e = gc.textExtent(lines[i], DRAW_FLAGS);
        if (e.x > availableWidth) {
          lines[i] = shortenText(gc, lines[i], availableWidth);
          extent.x = Math.max(extent.x, getTotalSize(null, lines[i]).x);
        } else {
          extent.x = Math.max(extent.x, e.x);
View Full Code Here

    /* Layout */
    fOuterContentCircle.layout(true, true);

    /* Update Shell Bounds */
    Point oldSize = getShell().getSize();
    int labelHeight = fTitleCircleLabel.computeSize(DEFAULT_WIDTH, SWT.DEFAULT).y;
    int newHeight = oldSize.y + (fVisibleNewsCount - oldVisibleNewsCount) * labelHeight;

    Point newSize = new Point(oldSize.x, newHeight);
    Point newLocation = getInitialLocation(newSize);
    getShell().setBounds(newLocation.x, newLocation.y, newSize.x, newSize.y);
  }
View Full Code Here

   */
  @Override
  protected Point getInitialLocation(Point initialSize) {
    Rectangle clArea = getPrimaryClientArea();

    return new Point(clArea.width + clArea.x - initialSize.x, clArea.height + clArea.y - initialSize.y);
  }
View Full Code Here

  @Override
  protected Point getInitialSize() {
    int initialHeight = getShell().computeSize(DEFAULT_WIDTH, SWT.DEFAULT).y;
    int labelHeight = fTitleCircleLabel.computeSize(DEFAULT_WIDTH, SWT.DEFAULT).y;

    return new Point(DEFAULT_WIDTH, initialHeight + fVisibleNewsCount * labelHeight);
  }
View Full Code Here

    /* Dialog to show progress */
    final ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell(Display.getDefault())) {
      @Override
      protected Point getInitialLocation(Point initialSize) {
        Rectangle displayBounds = getParentShell().getDisplay().getPrimaryMonitor().getBounds();
        Point shellSize = getInitialSize();
        int x = displayBounds.x + (displayBounds.width - shellSize.x) >> 1;
        int y = displayBounds.y + (displayBounds.height - shellSize.y) >> 1;

        return new Point(x, y);
      }
    };
    dialog.setOpenOnRun(false);

    /* Runnable to start core */
 
View Full Code Here

   * @param shell The shell to set the location
   * @param computeSize If TRUE, initialSize is computed from the Shell
   */
  public static void positionShell(Shell shell, boolean computeSize) {
    Rectangle containerBounds = shell.getParent().getBounds();
    Point initialSize = (computeSize == true) ? shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true) : shell.getSize();
    int x = Math.max(0, containerBounds.x + (containerBounds.width - initialSize.x) / 2);
    int y = Math.max(0, containerBounds.y + (containerBounds.height - initialSize.y) / 3);
    shell.setLocation(x, y);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.Point

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.