Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Rectangle


        } else if (e.type == SWT.Selection) {
          if (FASTDRAG && e.detail == SWT.DRAG) {
            return;
          }

          Rectangle area = parentComposite.getBounds();
          FormData aboveData = (FormData) above.getLayoutData();
          FormData belowData = (FormData) below.getLayoutData();
          if (isVertical) {
            // Need to figure out if we have to use border width elsewhere
            // in calculations (probably)
View Full Code Here


    mdiEntry = (MdiEntry) treeItem.getData("MdiEntry");
    if (mdiEntry == null) {
      return;
    }

    Rectangle itemBounds = treeItem.getBounds();
    Point relPos = new Point(mousePos.x, mousePos.y - itemBounds.y);
    String sToolTip = getToolTip(relPos);
    if (sToolTip == null || sToolTip.length() == 0) {
      return;
    }

    lastRelMouseHoverPos = relPos;

    Display d = tree.getDisplay();
    if (d == null)
      return;

    // We don't get mouse down notifications on trim or borders..
    toolTipShell = new Shell(tree.getShell(), SWT.ON_TOP);
    toolTipShell.addListener(SWT.Dispose, new Listener() {

      public void handleEvent(Event event) {
        UIUpdaterSWT.getInstance().removeUpdater(SideBarToolTips.this);
      }
    });
    FillLayout f = new FillLayout();
    try {
      f.marginWidth = 3;
      f.marginHeight = 1;
    } catch (NoSuchFieldError e) {
      /* Ignore for Pre 3.0 SWT.. */
    }
    toolTipShell.setLayout(f);
    toolTipShell.setBackground(d.getSystemColor(SWT.COLOR_INFO_BACKGROUND));

    toolTipLabel = new Label(toolTipShell, SWT.WRAP);
    toolTipLabel.setForeground(d.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
    toolTipLabel.setBackground(d.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    toolTipLabel.setText(sToolTip.replaceAll("&", "&&"));
    // compute size on label instead of shell because label
    // calculates wrap, while shell doesn't
    Point size = toolTipLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    if (size.x > 600) {
      size = toolTipLabel.computeSize(600, SWT.DEFAULT, true);
    }
    size.x += toolTipShell.getBorderWidth() * 2 + 2;
    size.y += toolTipShell.getBorderWidth() * 2;
    try {
      size.x += toolTipShell.getBorderWidth() * 2 + (f.marginWidth * 2);
      size.y += toolTipShell.getBorderWidth() * 2 + (f.marginHeight * 2);
    } catch (NoSuchFieldError e) {
      /* Ignore for Pre 3.0 SWT.. */
    }
    Point pt = tree.toDisplay(mousePos.x, mousePos.y);
    Rectangle displayRect;
    try {
      displayRect = tree.getMonitor().getClientArea();
    } catch (NoSuchMethodError e) {
      displayRect = tree.getDisplay().getClientArea();
    }
View Full Code Here

      }
      String indicatorToolTip = vitalityImage.getToolTip();
      if (indicatorToolTip == null || !vitalityImage.isVisible()) {
        continue;
      }
      Rectangle hitArea = vitalityImage.getHitArea();
      if (hitArea == null) {
        continue;
      }
      if (hitArea.contains(mousePos_RelativeToItem)) {
        return indicatorToolTip;
      }
    }

    if (mdiEntry.getViewTitleInfo() != null) {
View Full Code Here

      fd.right = new FormAttachment(100, -14);
      textWidget.setLayoutData(fd);

      cBubble.addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
          Rectangle clientArea = cBubble.getClientArea();
          e.gc.setBackground(textWidget.getBackground());
          e.gc.setAdvanced(true);
          e.gc.setAntialias(SWT.ON);
          e.gc.fillRoundRectangle(clientArea.x, clientArea.y,
              clientArea.width - 1, clientArea.height - 1, clientArea.height,
              clientArea.height);
          e.gc.setAlpha(127);
          e.gc.drawRoundRectangle(clientArea.x, clientArea.y,
              clientArea.width - 1, clientArea.height - 1, clientArea.height,
              clientArea.height);

          e.gc.setLineCap(SWT.CAP_ROUND);

          int iconHeight = clientArea.height - 9;
          if (iconHeight > 13) {
            iconHeight = 13;
          }
          int iconY = clientArea.y + ((clientArea.height - iconHeight + 1) / 2);
         
          e.gc.setAlpha(120);
          e.gc.setLineWidth(2);
          e.gc.drawOval(clientArea.x + 6, iconY, 7, 6);
          e.gc.drawPolyline(new int[] {
            clientArea.x + 12,
            iconY + 6,
            clientArea.x + 15,
            iconY + iconHeight,
          });
         
          boolean textIsBlank = text.length() == 0;
          if (!textIsBlank) {
            //e.gc.setLineWidth(1);
            e.gc.setAlpha(80);
            Rectangle rXArea = new Rectangle(clientArea.x + clientArea.width
                - 16, clientArea.y + 1, 11, clientArea.height - 2);
            cBubble.setData("XArea", rXArea);

            e.gc.drawPolyline(new int[] {
              clientArea.x + clientArea.width - 7,
              clientArea.y + 7,
              clientArea.x + clientArea.width - (7 + 5),
              clientArea.y + clientArea.height - 7,
            });
            e.gc.drawPolyline(new int[] {
              clientArea.x + clientArea.width - 7,
              clientArea.y + clientArea.height - 7,
              clientArea.x + clientArea.width - (7 + 5),
              clientArea.y + 7,
            });
          }
        }
      });
     
      cBubble.addListener(SWT.MouseDown, new Listener() {
        public void handleEvent(Event event) {
          Rectangle r = (Rectangle) event.widget.getData("XArea");
          if (r != null && r.contains(event.x, event.y)) {
            textWidget.setText("");
          }
        }
      });
    }
View Full Code Here

  protected void resizeGap() {
    if (soGap == null) {
      skinObject.getControl().getParent().layout();
      return;
    }
    Rectangle boundsLeft = skinObject.getControl().getBounds();
    Rectangle boundsRight = so2nd.getControl().getBounds();

    Rectangle clientArea = soGap.getControl().getParent().getClientArea();

    FormData fd = (FormData) soGap.getControl().getLayoutData();
    fd.width = clientArea.width - (boundsLeft.x + boundsLeft.width)
        - (boundsRight.width);
    if (fd.width < 0) {
View Full Code Here

  public BrowserWindow(Shell parent, String url, double wPct, double hPct,
      boolean allowResize, boolean isModal) {
    if (parent == null) {
      init(parent, url, 0, 0, allowResize, isModal);
    } else {
      Rectangle clientArea = parent.getClientArea();
      init(parent, url, (int) (clientArea.width * wPct),
          (int) (clientArea.height * hPct), allowResize, isModal);
    }
  }
View Full Code Here

        });
      }
    });

    if (w > 0 && h > 0) {
      Rectangle computeTrim = shell.computeTrim(0, 0, w, h);
      shell.setSize(computeTrim.width, computeTrim.height);
      //shell.setSize(w, h);
    }

    Utils.centerWindowRelativeTo(shell, parent);
View Full Code Here

          private int mouseDownAt = 0;

          public void handleEvent(Event event) {
            Composite c = (Composite) event.widget;
            if (event.type == SWT.MouseDown) {
              Rectangle clientArea = c.getClientArea();
              if (event.y > clientArea.height - 10) {
                mouseDownAt = event.y;
              }
            } else if (event.type == SWT.MouseUp && mouseDownAt > 0) {
              int diff = event.y - mouseDownAt;
              mouseDownAt = 0;
              FormData formData = (FormData) c.getLayoutData();
              formData.height += diff;
              if (formData.height < 50) {
                formData.height = 50;
              } else {
                Rectangle clientArea = c.getShell().getClientArea();
                int max = clientArea.height - 350;
                if (formData.height > max) {
                  formData.height = max;
                }
              }
              COConfigurationManager.setParameter("v3.topbar.height",
                  formData.height);
              Utils.relayout(c);
            } else if (event.type == SWT.MouseMove) {
              Rectangle clientArea = c.getClientArea();
              boolean draggable = (event.y > clientArea.height - 10);
              c.setCursor(draggable ? c.getDisplay().getSystemCursor(
                  SWT.CURSOR_SIZENS) : null);
            } else if (event.type == SWT.MouseExit) {
              c.setCursor(null);
View Full Code Here

  // @see org.gudy.azureus2.ui.swt.views.table.TableCellSWTPaintListener#cellPaint(org.eclipse.swt.graphics.GC, org.gudy.azureus2.plugins.ui.tables.TableCell)
  public void cellPaint(GC gc, TableCellSWT cell) {
    Subscription sub = (Subscription) cell.getDataSource();

    if (sub.getHistory().getNumUnread() > 0) {
      Rectangle cellBounds = cell.getBounds();
      gc.drawImage(imgNew, cellBounds.x
          + ((cellBounds.width - imgBounds.width) / 2), cellBounds.y
          + ((cellBounds.height - imgBounds.height) / 2));
    }
  }
View Full Code Here

      } else {
        imgIcon = imageLoader.getImage(iconID);
      }

      if (ImageLoader.isRealImage(imgIcon)) {
        Rectangle cellBounds = cell.getBounds();
        Rectangle imgBounds = imgIcon.getBounds();
        gc.drawImage(imgIcon, cellBounds.x
            + ((cellBounds.width - imgBounds.width) / 2), cellBounds.y
            + ((cellBounds.height - imgBounds.height) / 2));
      }
      imageLoader.releaseImage(iconID);
View Full Code Here

TOP

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

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.