public void open() { sShell = new Shell( parent, SWT.DIALOG_TRIM | SWT.NO_REDRAW_RESIZE | SWT.APPLICATION_MODAL ); sShell.setImage( GUIResource.getInstance().getImageSpoon() ); sShell.setText( strHeader ); sShell.setSize( new Point( 360, 126 ) ); FormLayout formLayout = new FormLayout(); sShell.setLayout( formLayout );
public JobGraph( Composite par, final Spoon spoon, final JobMeta jobMeta ) { super( par, SWT.NONE ); shell = par.getShell(); this.log = spoon.getLog(); this.spoon = spoon; mainComposite = new Composite( this, SWT.NONE ); mainComposite.setLayout( new FillLayout() ); toolbarFd.right = new FormAttachment( 100, 0 ); toolbarControl.setLayoutData( toolbarFd ); toolbarControl.setParent( this ); toolTip.setRespectDisplayBounds( true ); toolTip.setPopupDelay( 350 ); toolTip.setShift( new org.eclipse.swt.graphics.Point( ConstUI.TOOLTIP_OFFSET, ConstUI.TOOLTIP_OFFSET ) );
@Override public Point computeSizeConstraints(int widthInChars, int heightInChars) { GC gc= new GC(fText); gc.setFont(fTextFont); int width= gc.getFontMetrics().getAverageCharWidth(); int height= fText.getLineHeight(); //https://bugs.eclipse.org/bugs/show_bug.cgi?id=377109 gc.dispose(); return new Point(widthInChars * width, heightInChars * height); } }
public void printImage( Shell sh, Image img ) { if ( printerdata != null ) { Rectangle imgbounds = img.getBounds(); Point max = new Point( imgbounds.width, imgbounds.height ); GC gc_printer = new GC( printer ); gc_printer.drawImage( img, fromx, fromy, imx, imy, (int) page_left, (int) page_top, (int) printx, (int) printy ); System.out.println( "img dept = " + img.getImageData().depth ); System.out.println( "prn dept = " + printer.getDepth() ); System.out.println( "img size = (" + img.getBounds().x + "," + img.getBounds().y + ") : (" + img.getBounds().width + "," + img.getBounds().height + ")" ); System.out.println( "fromx=" gc_printer.dispose();
@Override protected Point getInitialLocation(Point initialSize) { if (getShell().getParent() == null) { return super.getInitialLocation(initialSize); } Rectangle bounds = getShell().getParent().getMonitor().getBounds(); GC gc = new GC(getShell().getDisplay()); int textExtendX = gc.textExtent(message).x; gc.dispose(); return new Point(bounds.x + bounds.width / 2 - textExtendX / 2, bounds.y + bounds.height / 5); }
@Override protected Point getInitialSize() { return new Point( DIALOG_WIDTH, DIALOG_HEIGHT ); }
Display disp = parent.getDisplay(); TableView.dummyImage = new Image( disp, 1, 1 ); TableView.dummyGC = new GC( TableView.dummyImage ); TableView.dummyGC.setFont( gridFont ); if ( !shift && !control ) { Rectangle clientArea = table.getClientArea(); Point pt = new Point( event.x, event.y ); int index = table.getTopIndex(); while ( index < table.getItemCount() ) {
Image renderStatic() { size = new org.eclipse.swt.graphics.Point((int) (m * viewRect.width), (int) (m * viewRect.height)); final Image img = new Image(getDisplay(), size.x, size.y); final GC gc = new GC(img); for (final CanvasRenderer r : canvasRenderers) { r.renderStatic(gc, new ViewPort(new Point(0, 0), viewRect, m)); } gc.dispose(); return img; }
@Override protected Point getDefaultLocation(Point initialSize) { Control textWidget = (Control) xtextEditor.getAdapter(Control.class); Point size = textWidget.getSize(); Point popupLocation = new Point((size.x / 2) - (initialSize.x / 2), (size.y / 2) - (initialSize.y / 2)); return textWidget.toDisplay(popupLocation); }
@Override protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { Control[] children= composite.getChildren(); Point size= new Point(0, 0); for (Control element : children) { Point s= element.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache); size.x += s.x; size.y= Math.max(size.y, s.y); } size.x += (Math.max(0, children.length -1) * fGap); return size; }
int SizeBrowserTo (int aCX, int aCY) { size = new Point (aCX, aCY); boolean isChrome = (chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0; if (isChrome) { Shell shell = browser.getShell (); shell.setSize (shell.computeSize (size.x, size.y)); } return XPCOM.NS_OK; }
private boolean willLicenseTextFit( String licenseText, GC gc ) { Point splashSize = splash.getSize(); Point licenseDrawLocation = new Point( 290, 290 ); Point requiredSize = gc.textExtent( licenseText ); int width = splashSize.x - licenseDrawLocation.x; int height = splashSize.y - licenseDrawLocation.y; boolean fitsVertically = width >= requiredSize.x; boolean fitsHorizontally = height >= requiredSize.y; return ( fitsVertically && fitsHorizontally ); }
@Override public Point draw(GC gc, StyledText textWidget, Color color, int x, int y) { Image image = getImage(); gc.drawImage(image, x, y + gc.getFontMetrics().getDescent()); Rectangle bounds = image.getBounds(); return new Point(bounds.width, bounds.height); }
protected Point getSize() { if (fSize == null) { ImageData data = fOriginalImage.getImageData(); fSize = new Point(data.width, data.height); } return fSize; }
private Point getInitialDialogLocation( Point initialSize ) { Rectangle dispayBounds = getShell().getDisplay().getBounds(); Point centerPoint = Geometry.centerPoint( dispayBounds ); int x = centerPoint.x - ( initialSize.x / 2 ); int y = Math.min( centerPoint.y - ( initialSize.y * 2 / 3 ), dispayBounds.height - initialSize.y ); return new Point( x, Math.max( 0, y ) ); } //RAPEND [if]
public static Point getLocationRelativeToShell(Control control) { Point controlLocation = control.toDisplay(0, 0); Point shellLocation = control.getShell().getLocation(); return new Point(controlLocation.x - shellLocation.x, controlLocation.y - shellLocation.y); }
@Override public Point computeSizeHint() { Point preferedSize= getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); Point constrains= getSizeConstraints(); if (constrains == null) return preferedSize; int trimWidth= getShell().computeTrim(0, 0, 0, 0).width; Point constrainedSize= getShell().computeSize(constrains.x - trimWidth, SWT.DEFAULT, true); int width= Math.min(preferedSize.x, constrainedSize.x); int height= Math.max(preferedSize.y, constrainedSize.y); return new Point(width, height); }
Point textExtentInPixels(String string, int flags) { setString(string, flags); checkGC(FONT); if (data.stringWidth == -1) { computeStringSize(); } return new Point(data.stringWidth, data.stringHeight); }