Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Point


          /* Ignore for Pre 3.0 SWT.. */
        }
        toolTipShell.setLayout(f);
        toolTipShell.setBackground(d.getSystemColor(SWT.COLOR_INFO_BACKGROUND));

        Point size = new Point(0, 0);
       
        if (oToolTip instanceof String) {
          String sToolTip = (String) oToolTip;
          toolTipLabel = new Label(toolTipShell, SWT.WRAP);
          toolTipLabel.setForeground(d.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
          toolTipLabel.setBackground(d.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
          toolTipShell.setData("TableCellSWT", cell);
          toolTipLabel.setText(sToolTip.replaceAll("&", "&&"));
          // compute size on label instead of shell because label
          // calculates wrap, while shell doesn't
          size = toolTipLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
          if (size.x > 600) {
            size = toolTipLabel.computeSize(600, SWT.DEFAULT, true);
          }
        } else if (oToolTip instanceof Image) {
          Image image = (Image) oToolTip;
          toolTipLabel = new Label(toolTipShell, SWT.CENTER);
          toolTipLabel.setForeground(d.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
          toolTipLabel.setBackground(d.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
          toolTipShell.setData("TableCellSWT", cell);
          toolTipLabel.setImage(image);
          size = toolTipLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
        }
        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 = composite.toDisplay(event.x, event.y);
        Rectangle displayRect;
        try {
          displayRect = composite.getMonitor().getClientArea();
        } catch (NoSuchMethodError e) {
          displayRect = composite.getDisplay().getClientArea();
View Full Code Here


          break;
        case DockPosition.TOP_RIGHT:
          break;

        case DockPosition.BOTTOM_LEFT: {
          Point p = mainShell.toDisplay(anchorControl.getLocation());
          p.x += anchorControlPosition.getOffset().xOffset;
          p.y += anchorControlPosition.getOffset().yOffset;
          p.y += anchorControl.getSize().y;
          dockedShell.setLocation(p);
        }
          break;

        case DockPosition.BOTTOM_RIGHT: {
          Point p = mainShell.toDisplay(anchorControl.getLocation());
          p.x += anchorControlPosition.getOffset().xOffset;
          p.y += anchorControlPosition.getOffset().yOffset;

          p.x += anchorControl.getSize().x;
          p.y += anchorControl.getSize().y;
View Full Code Here

      if (isExit && (skinObject instanceof SWTSkinObjectContainer)) {
        // check if exiting and going into child
        SWTSkinObjectContainer soContainer = (SWTSkinObjectContainer) skinObject;
        if (soContainer.getPropogation()) {
          Point pt = control.toDisplay(event.x, event.y);
          Composite composite = soContainer.getComposite();
          Point relPt = composite.toControl(pt);
          // mouse exit and enter happens on client area (not full widget area)
          Rectangle bounds = composite.getClientArea();
          if (bounds.contains(relPt)
              && composite.getDisplay().getActiveShell() != null) {
            if (skinObject != null && (DEBUG || skinObject.isDebug())) {
              System.out.println("skip " + skinObject
                  + " because going into child");
            }
            return;
          }
        }
      }

      if (isExit && control.getParent() != null) {
        // check if exiting and going into parent
        Composite parent = control.getParent();
        SWTSkinObject soParent = (SWTSkinObject) parent.getData("SkinObject");
        if (soParent != null && (soParent instanceof SWTSkinObjectContainer)) {
          SWTSkinObjectContainer container = (SWTSkinObjectContainer) soParent;
          if (container.getPropogation()) {
            Point pt = control.toDisplay(event.x, event.y);
            Point relPt = container.getComposite().toControl(pt);
            Rectangle bounds = parent.getClientArea();
            if (bounds.contains(relPt)
                && parent.getDisplay().getActiveShell() != null) {
              if (skinObject != null && (DEBUG || skinObject.isDebug())) {
                System.out.println("skip " + skinObject
                    + " because going into parent " + bounds + ";" + relPt + ";" + parent.getDisplay().getActiveShell());
              }
              // XXX Disabled for now as it doesn't always work
              //return;
            }
          }
        }
      }

      if (skinObject != null) {
        String sSuffix = (event.type == eventOn) ? suffix : "";
        if (skinObject != null && (DEBUG || skinObject.isDebug())) {
          System.out.println(System.currentTimeMillis() + ": " + skinObject
              + "--" + sSuffix);
        }
       
        Point ptMouse = control.toDisplay(0, 0);
        while (skinObject != null) {
          Rectangle bounds = skinObject.getControl().getBounds();
          Point pt = skinObject.getControl().toDisplay(0, 0);
          bounds.x = pt.x;
          bounds.y = pt.y;

         
          if (bounds.contains(ptMouse)) {
View Full Code Here

          }
        }

        if (wiggleBrowser ) {
          Shell shell = browser.getShell();
          Point size = shell.getSize();
          size.x -= 1;
          size.y -= 1;
          shell.setSize(size);
          size.x += 1;
          size.y += 1;
View Full Code Here

      soWaitTask = (SWTSkinObjectText) getSkinObject("library-wait-task");
      if (soWaitProgress != null) {
        soWaitProgress.getControl().addPaintListener(new PaintListener() {
          public void paintControl(PaintEvent e) {
            Control c = (Control) e.widget;
            Point size = c.getSize();
            e.gc.setBackground(ColorCache.getColor(e.display, "#23a7df"));
            int breakX = size.x * waitProgress / 100;
            e.gc.fillRectangle(0, 0, breakX, size.y);
            e.gc.setBackground(ColorCache.getColor(e.display, "#cccccc"));
            e.gc.fillRectangle(breakX, 0, size.x - breakX, size.y);
View Full Code Here

    if (sBorder != null) {
      sash.addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
          e.gc.setForeground(e.gc.getDevice().getSystemColor(
              SWT.COLOR_WIDGET_NORMAL_SHADOW));
          Point size = sash.getSize();
          if (bVertical) {
            e.gc.drawLine(0, 0, 0, size.y);
            if (!sBorder.startsWith("thin-top")) {
              int x = size.x - 1;
              e.gc.drawLine(x, 0, x, 0 + size.y);
View Full Code Here

  }

  public void handleEvent(Event event) {
    switch (event.type) {
      case SWT.MouseHover: {
        handleHover(new Point(event.x, event.y));
        break;
      }

      case SWT.Dispose:
        if (mainShell != null && !mainShell.isDisposed()) {
View Full Code Here

    if (tree.getItemCount() == 0) {
      return;
    }
    int indent = SideBar.END_INDENT ? tree.getClientArea().width - 1 : 0;
    TreeItem treeItem = tree.getItem(new Point(indent, mousePos.y));
    if (treeItem == null) {
      return;
    }
    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

      if (sTypeParams == null || sTypeParams.length < 2
          || !sTypeParams[1].equalsIgnoreCase("group")) {
        // Lovely SWT has a default size of 64x64 if no children have sizes.
        // Let's fix that..
        parentComposite = new CompositeMinSize(createOn, style);
        ((CompositeMinSize) parentComposite).setMinSize(new Point(minWidth, minHeight));
      } else {
        parentComposite = new Group(createOn, style);
      }
    }
   
View Full Code Here

  // @see com.aelitis.azureus.ui.swt.skin.SWTSkinObjectBasic#obfusticatedImage(org.eclipse.swt.graphics.Image, org.eclipse.swt.graphics.Point)
  public Image obfusticatedImage(Image image) {
    if (!isVisible()) {
      return image;
    }
    Point ourOfs = Utils.getLocationRelativeToShell(control);

    Control[] swtChildren = ((Composite) control).getChildren();
    for (int i = 0; i < swtChildren.length; i++) {
      Control childControl = swtChildren[i];
      TableOrTreeSWT tableOrTree = TableOrTreeUtils.getTableOrTreeSWT(childControl);
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.