void layout() { Composite parent = canvas.getParent(); Rectangle rect = parent.getClientArea(); int width = 0; String[] items = list.getItems(); GC gc = new GC( list ); for ( int i = 0; i < objects.length; i++ ) { width = Math.max( width, gc.stringExtent( items[i] ).x ); } gc.dispose(); Point size1 = start.computeSize( SWT.DEFAULT, SWT.DEFAULT ); Point size2 = stop.computeSize( SWT.DEFAULT, SWT.DEFAULT ); Point size3 = check.computeSize( SWT.DEFAULT, SWT.DEFAULT ); Point size4 = label.computeSize( SWT.DEFAULT, SWT.DEFAULT ); width = Math.max( size1.x, Math.max( size2.x, Math.max( size3.x, width ) ) ); width = Math.max( 64, Math.max( size4.x, list.computeSize( width, SWT.DEFAULT ).x ) ); start.setBounds( 0, 0, width, size1.y ); stop.setBounds( 0, size1.y, width, size2.y ); check.setBounds( 0, size1.y + size2.y, width, size3.y ); label.setBounds( 0, rect.height - size4.y, width, size4.y ); int height = size1.y + size2.y + size3.y; list.setBounds( 0, height, width, rect.height - height - size4.y ); text.setBounds( width, 0, rect.width - width, rect.height ); canvas.setBounds( width, 0, rect.width - width, rect.height ); }
@Override public void runSupport() { if (cHeaderArea != null && !cHeaderArea.isDisposed()) { cHeaderArea.setVisible(visible); FormData fd = Utils.getFilledFormData(); fd.height = visible ? headerHeight : 1; fd.bottom = null; cHeaderArea.setLayoutData(fd); cHeaderArea.getParent().layout(true); } } });
@Override public void renderInitialization( Canvas canvas ) throws IOException { RemoteObject remoteObject = createRemoteObject( canvas, TYPE ); remoteObject.setHandler( new CanvasOperationHandler( canvas ) ); remoteObject.set( "parent", getId( canvas.getParent() ) ); remoteObject.set( "style", createJsonArray( getStyles( canvas, ALLOWED_STYLES ) ) ); RemoteObject remoteObjectForGC = createRemoteObject( getGcId( canvas ), TYPE_GC ); remoteObjectForGC.set( "parent", WidgetUtil.getId( canvas ) ); }
@Override public void handleEvent(Event event) { Widget widget = (event.widget instanceof Canvas) ? ((Canvas) event.widget).getParent() : event.widget;
int xOffset = 0; if (numShowItems == 1) {//If there is a single item try to center it Rectangle clientArea = canvas.getParent().getClientArea(); if (orientation == SWT.HORIZONTAL) { int size1 = clientArea.height;