public WindowProperty( String name, boolean maximized, int x, int y, int width, int height ) { this.name = name; this.maximized = maximized; this.rectangle = new Rectangle( x, y, width, height ); }
private Rectangle Real2Screen( Rectangle r ) { return new Rectangle( r.x + offsetx, r.y + offsety, r.width, r.height ); }
private Rectangle Screen2Real( Rectangle r ) { return new Rectangle( r.x - offsetx, r.y - offsety, r.width, r.height ); }
private Rectangle getAndNotSize( GC gc ) { Point p = gc.textExtent( Condition.operators[Condition.OPERATOR_AND_NOT] ); return new Rectangle( 0, 0, p.x, p.y ); }
private Rectangle getUpSize( GC gc ) { Point p = gc.textExtent( STRING_UP ); return new Rectangle( size_not.x + size_not.width + 40, size_not.y, p.x + 20, size_not.height ); }
private Rectangle getNotSize( GC gc ) { Point p = gc.textExtent( STRING_NOT ); return new Rectangle( 0, 0, p.x + 10, p.y + 4 ); }
private Rectangle getAddSize( GC gc ) { Rectangle is = imageAdd.getBounds(); // image size Rectangle cs = getBounds(); // Canvas size return new Rectangle( cs.width - is.width - 5 - X_PADDING, 5, is.width, is.height ); }
public static void setSize( Shell shell, int prefWidth, int prefHeight ) { PropsUI props = PropsUI.getInstance(); WindowProperty winprop = props.getScreen( shell.getText() ); if ( winprop != null ) { winprop.setShell( shell, prefWidth, prefHeight ); } else { shell.layout(); winprop = new WindowProperty( shell.getText(), false, new Rectangle( 0, 0, prefWidth, prefHeight ) ); winprop.setShell( shell ); // Now, as this is the first time it gets opened, try to put it in the middle of the screen... Rectangle shellBounds = shell.getBounds(); Monitor monitor = shell.getDisplay().getPrimaryMonitor(); if ( shell.getParent() != null ) { monitor = shell.getParent().getMonitor(); } Rectangle monitorClientArea = monitor.getClientArea(); int middleX = monitorClientArea.x + ( monitorClientArea.width - shellBounds.width ) / 2; int middleY = monitorClientArea.y + ( monitorClientArea.height - shellBounds.height ) / 2; shell.setLocation( middleX, middleY ); } }
public void paintControl( final PaintEvent event ) { if ( transGraph.trans != null && transGraph.trans.isFinished() ) { refreshImage( event.gc ); if ( image != null && !image.isDisposed() ) { event.gc.drawImage( image, 0, 0 ); } } else { Rectangle bounds = canvas.getBounds(); if ( bounds.width <= 0 || bounds.height <= 0 ) { return; } event.gc.setForeground( GUIResource.getInstance().getColorWhite() ); event.gc.setBackground( GUIResource.getInstance().getColorWhite() ); event.gc.fillRectangle( new Rectangle( 0, 0, bounds.width, bounds.height ) ); event.gc.setForeground( GUIResource.getInstance().getColorBlack() ); String metricsMessage = BaseMessages.getString( PKG, "TransMetricsDelegate.TransformationIsNotRunning.Message" ); org.eclipse.swt.graphics.Point extent = event.gc.textExtent( metricsMessage ); event.gc.drawText( metricsMessage, ( bounds.width - extent.x ) / 2, ( bounds.height - extent.y ) / 2 ); } } } );
public void paintControl( PaintEvent event ) { if ( jobGraph.job != null && ( jobGraph.job.isFinished() || jobGraph.job.isStopped() ) ) { refreshImage( event.gc ); if ( image != null && !image.isDisposed() ) { event.gc.drawImage( image, 0, 0 ); } } else { Rectangle bounds = canvas.getBounds(); if ( bounds.width <= 0 || bounds.height <= 0 ) { return; } event.gc.setForeground( GUIResource.getInstance().getColorWhite() ); event.gc.setBackground( GUIResource.getInstance().getColorWhite() ); event.gc.fillRectangle( new Rectangle( 0, 0, bounds.width, bounds.height ) ); event.gc.setForeground( GUIResource.getInstance().getColorBlack() ); String metricsMessage = BaseMessages.getString( PKG, "JobMetricsDelegate.JobIsNotRunning.Message" ); org.eclipse.swt.graphics.Point extent = event.gc.textExtent( metricsMessage ); event.gc.drawText( metricsMessage, ( bounds.width - extent.x ) / 2, ( bounds.height - extent.y ) / 2 ); } } } );
size_left = new Rectangle( x + 5, y + size_not.height + 5, ext_left.x + 5, ext_left.y + 5 ); new Rectangle( size_left.x + size_left.width + 15, y + size_not.height + 5, ext_fn.x + 5, ext_fn.y + 5 ); new Rectangle( size_fn.x + size_fn.width + 15, y + size_not.height + 5, ext_rval.x + 5, ext_rval.y + 5 ); new Rectangle( size_fn.x + size_fn.width + 15, y + size_not.height + 5 + size_rightval.height + 5, ext_rex.x + 5, ext_rex.y + 5 );
public void setPosition(int x, int y) { if (area == null) { area = new Rectangle(x, y, 0, 0); return; } area.x = x; area.y = y; }
public Rectangle getBoundsRaw() { if (bounds == null) { return null; } return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); }
@Override public Rectangle getBounds() { //TableViewPainted view = (TableViewPainted) getView(); //Rectangle clientArea = view.getClientArea(); return new Rectangle(0, drawOffset.y, 9990, getHeight()); }
private Rectangle getCaretRectangle(int offset) { Point location= fContentAssistSubjectControlAdapter.getLocationAtOffset(offset); Control subjectControl= fContentAssistSubjectControlAdapter.getControl(); Point controlSize= subjectControl.getSize(); constrainLocation(location, new Point(0, 0), new Rectangle(0, 0, controlSize.x, controlSize.y)); location= subjectControl.toDisplay(location); Rectangle subjectRectangle= new Rectangle(location.x, location.y, 1, fContentAssistSubjectControlAdapter.getLineHeight()); return subjectRectangle; }
public Rectangle getDrawBounds() { TableViewPainted view = (TableViewPainted) getView(); Rectangle clientArea = view.getClientArea(); int offsetX = TableViewPainted.DIRECT_DRAW ? -clientArea.x : 0; Rectangle bounds = new Rectangle(offsetX, drawOffset.y - clientArea.y, 9990, getHeight()); return bounds; }
@Override public void paintControl(PaintEvent e) { GC gc = e.gc; gc.setForeground( Colors.grey); Point size = engine_comp.getSize(); gc.drawRectangle( new Rectangle( 0, 0, size.x-1, size.y-1 )); } });
protected Point getStackedLocation(Shell shell, Shell parent) { Point p= parent.getLocation(); Point size= parent.getSize(); p.x += size.x / 4; p.y += size.y; p= parent.toDisplay(p); Point shellSize= shell.getSize(); Monitor monitor= getClosestMonitor(parent.getDisplay(), new Rectangle(p.x, p.y, 0, 0)); Rectangle displayBounds= monitor.getClientArea(); constrainLocation(p, shellSize, displayBounds); return p; }