Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Point


    }

  }

  public Point computeSize(int hint, int hint2, boolean changed) {
    Point newSize = super.computeSize(hint, hint2, changed);

    if (newSize.x > maxPreferredWidth) {
      newSize.x = maxPreferredWidth;
    }
    return newSize;
View Full Code Here


      public void handleEvent(Event event) {
        if (links.size() == 0) {
          return;
        }
        try {
          int ofs = styled_text.getOffsetAtLocation(new Point(event.x, event.y));
          for (int i = 0; i < links.size(); i++) {
            linkInfo linkInfo = (linkInfo)links.get(i);
            if (ofs >= linkInfo.ofsStart && ofs <= linkInfo.ofsEnd) {
              Utils.launch(linkInfo.url);
              break;
            }
          }
        } catch (Exception e) {

        }
      }
    });

    final Cursor handCursor = new Cursor(comp.getDisplay(), SWT.CURSOR_HAND);
    styled_text.addListener(SWT.MouseMove, new Listener() {
      Cursor curCursor = null;

      public void handleEvent(Event event) {
        if (links.size() == 0) {
          return;
        }
        boolean onLink = false;
        try {
          int ofs = styled_text.getOffsetAtLocation(new Point(event.x, event.y));
          for (int i = 0; i < links.size(); i++) {
            linkInfo linkInfo = (linkInfo)links.get(i);
            if (ofs >= linkInfo.ofsStart && ofs <= linkInfo.ofsEnd) {
              onLink = true;
              break;
View Full Code Here

       * Set default size and centers the shell if it's configuration does not exist yet
       */
      if (null == COConfigurationManager.getStringParameter(
          "options.rectangle", null)) {
        Rectangle shellBounds = shell.getMonitor().getBounds();
        Point size = new Point(shellBounds.width * 10 / 11,
            shellBounds.height * 10 / 11);
        if (size.x > 1400) {
          size.x = 1400;
        }
        if (size.y > 700) {
View Full Code Here

    y0 = bounds.y + bounds.height;
    y1 = bounds.y + bounds.height - 150;
   
    shell.setLocation(x0,y0);
    shell.open();
    new LinearAnimator(this,new Point(x0,y0),new Point(x0,y1),30,30).start();
  }
View Full Code Here

 
  public void animationEnded(Animator source) {
    if(nbAnimation == 0) {
      nbAnimation++;
      new LinearAnimator(this,new Point(x0,y1),new Point(x0,y1),1,3000).start();
      return;
    }
    if(nbAnimation == 1) {
      nbAnimation++;
      new LinearAnimator(this,new Point(x0,y1),new Point(x1,y1),50,30).start();
      return;
    }
    if(nbAnimation == 2) {
     shell.getDisplay().asyncExec(new AERunnable() {
      public void runSupport() {
View Full Code Here

          itemEdited.setText(((Text)editor.getEditor()).getText());
        removeEditor();
      }
    });
   
    Point size = shell.computeSize(400,SWT.DEFAULT);
    shell.setSize(size);
   
    Utils.centreWindow( shell );
   
    shell.open();
View Full Code Here

  }
 
  private void render(PEPeer[] sortedPeers) {
    if(panel == null || panel.isDisposed() || manager == null)
      return;
    Point panelSize = panel.getSize();
    int x0 = panelSize.x / 2;
    int y0 = panelSize.y / 2
    int a = x0 - 20;
    int b = y0 - 20;
    if(a < 10 || b < 10) return;
View Full Code Here

    switch (event.type) {
      case SWT.MouseHover: {
        if (toolTipShell != null && !toolTipShell.isDisposed())
          toolTipShell.dispose();

        TableItem item = table.getItem( new Point( event.x, event.y ));
       
        if (item == null)
          return;
       
        Object oToolTip = item.getData( "tooltip" );
       
        if ( oToolTip == null ){
       
          oToolTip = item.getText(0);
        }
       
        // TODO: support composite, image, etc
        if (oToolTip == null || !(oToolTip instanceof String))
          return;
        String sToolTip = (String) oToolTip;

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

        // We don't get mouse down notifications on trim or borders..
        toolTipShell = new Shell(table.getShell(), SWT.ON_TOP);
        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));
        //toolTipShell.setData("TableCellSWT", item);
        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 = table.toDisplay(event.x, event.y);
        Rectangle displayRect;
        try {
          displayRect = table.getMonitor().getClientArea();
        } catch (NoSuchMethodError e) {
          displayRect = table.getDisplay().getClientArea();
View Full Code Here

      }
    });
   
    shell.pack();

    Point size = shell.computeSize(400,SWT.DEFAULT);
    shell.setSize(size);
       
    Utils.centreWindow( shell );
   
    shell.open();
View Full Code Here

    minHeight = pt.y;
  }
 
  public Point computeSize(int wHint, int hHint, boolean changed) {
    try {
      Point size = super.computeSize(wHint, hHint, changed);
      return betterComputeSize(this, size, wHint, hHint, changed);
    } catch (Throwable t) {
      Debug.out(t);
      return new Point(wHint == -1 ? 10 : wHint, hHint == -1 ? 10
          : hHint);
    }
  }
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.