private int computeScrollBarWidth() { Composite t= new Composite(fTable.getShell(), SWT.V_SCROLL); int result= t.computeTrim(0, 0, 0, 0).width; t.dispose(); return result; }
/** * Try to figure out how much we need to subtract from the hints that we * pass into the given control's computeSize(...) method. This tries to * compensate for bug 46112. To be removed once SWT provides an "official" * way to compute one dimension of a control's size given the other known * dimension. * * @param control */ private void computeHintOffset(Control control) { if (control instanceof Composite) { // For composites, subtract off the trim size Composite composite = (Composite) control; Rectangle trim = composite.computeTrim(0, 0, 0, 0); widthAdjustment = trim.width; heightAdjustment = trim.height; } else { // For non-composites, subtract off 2 * the border size widthAdjustment = control.getBorderWidth() * 2; heightAdjustment = widthAdjustment; } }
private int computeScrollBarWidth() { Composite t= new Composite(fTable.getShell(), SWT.V_SCROLL); int result= t.computeTrim(0, 0, 0, 0).width; t.dispose(); return result; }
private int computeScrollBarWidth() { Composite t= new Composite(fTable.getShell(), SWT.V_SCROLL); int result= t.computeTrim(0, 0, 0, 0).width; t.dispose(); return result; }
private int computeScrollBarWidth() { Composite t= new Composite(fTable.getShell(), SWT.V_SCROLL); int result= t.computeTrim(0, 0, 0, 0).width; t.dispose(); return result; }
public Rectangle computeTrim (int x, int y, int width, int height) { checkWidget (); NSTabView widget = (NSTabView)view; NSRect rect = widget.contentRect (); x -= rect.x; y -= rect.y; NSRect frame = widget.frame(); width += Math.ceil (frame.width - rect.width); height += Math.ceil (frame.height - rect.height); return super.computeTrim (x, y, width, height); }
protected Point betterComputeSize(Composite c, Point size, int wHint, int hHint, boolean changed) { if (c.getChildren().length == 0 && (size.x == 64 || size.y == 64)) { Object ld = c.getLayoutData(); if (ld instanceof FormData) { FormData fd = (FormData) ld; if (fd.width != 0 && fd.height != 0) { Rectangle trim = c.computeTrim (0, 0, fd.width, fd.height); return new Point(trim.width, trim.height); } } return new Point(1, 1); } if (size.x == 0 || size.y == 0) { return size; } if (minWidth > 0 && size.x < minWidth) { size.x = minWidth; } if (minHeight > 0 && size.y < minHeight) { size.y = minHeight; } return size; } }
protected Point betterComputeSize(Composite c, Point size, int wHint, int hHint) { if (c.getChildren().length == 0 && (size.x == 64 || size.y == 64)) { Object ld = c.getLayoutData(); if (ld instanceof FormData) { FormData fd = (FormData) ld; if (fd.width != 0 && fd.height != 0) { Rectangle trim = c.computeTrim (0, 0, fd.width, fd.height); return new Point(trim.width, trim.height); } } return new Point(1, 1); } if (size.x == 0 || size.y == 0) { return size; } if (minWidth > 0 && size.x < minWidth) { size.x = minWidth; } if (minHeight > 0 && size.y < minHeight) { size.y = minHeight; } return size; }
@Override public Rectangle computeTrim( int x, int y, int width, int height ) { BoxDimensions trimmings = getThemeAdapter().getTrimmingSize( this ); int trimmingsWidth = trimmings.left + trimmings.right; int trimmingsHeight = trimmings.top + trimmings.bottom; BoxDimensions border = getBorder(); int borderWidth = border.left + border.right; int borderHeight = border.top + border.bottom; return super.computeTrim( x - trimmings.left - border.left, y - trimmings.top - border.top, width + trimmingsWidth + borderWidth, height + trimmingsHeight + borderHeight ); }
private int getMarginWidths( Control control ) { // get the width added by container margins and (wm-specific) decorations int extraWidth = 0; for ( Composite parent = control.getParent(); !parent.equals( getParent() ); parent = parent.getParent() ) { extraWidth += parent.computeTrim( 0, 0, 0, 0 ).width; if ( parent.getLayout() instanceof FormLayout ) { extraWidth += 2 * ( (FormLayout) parent.getLayout() ).marginWidth; } } return extraWidth; }
private int getMarginWidths( Control control ) { // get the width added by container margins and (wm-specific) decorations int extraWidth = 0; for ( Composite parent = control.getParent(); !parent.equals( getParent() ); parent = parent.getParent() ) { extraWidth += parent.computeTrim( 0, 0, 0, 0 ).width; if ( parent.getLayout() instanceof FormLayout ) { extraWidth += 2 * ( (FormLayout) parent.getLayout() ).marginWidth; } } return extraWidth; }
public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget(); display.runSkin (); Point size; if (layout != null) { if ((wHint == SWT.DEFAULT) || (hHint == SWT.DEFAULT)) { changed |= (state & LAYOUT_CHANGED) != 0; size = layout.computeSize (this, wHint, hHint, changed); state &= ~LAYOUT_CHANGED; } else { size = new Point (wHint, hHint); } } else { size = minimumSize (wHint, hHint, changed); if (size.x == 0) size.x = DEFAULT_WIDTH; if (size.y == 0) size.y = DEFAULT_HEIGHT; } if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; Rectangle trim = computeTrim (0, 0, size.x, size.y); return new Point (trim.width, trim.height); }
private int getMarginWidths( Control control ) { // get the width added by container margins and (wm-specific) decorations int extraWidth = 0; for ( Composite parent = control.getParent(); !parent.equals( getParent() ); parent = parent.getParent() ) { extraWidth += parent.computeTrim( 0, 0, 0, 0 ).width; if ( parent.getLayout() instanceof FormLayout ) { extraWidth += 2 * ( (FormLayout) parent.getLayout() ).marginWidth; } } return extraWidth; }
public Rectangle computeTrim (int x, int y, int width, int height) { checkWidget (); NSBox widget = (NSBox)view; NSRect newRect = new NSRect(); newRect.x = x; newRect.y = y; newRect.width = width; newRect.height = height; NSRect oldRect = widget.frame(); ignoreResize = true; widget.setFrameFromContentFrame(newRect); newRect = widget.frame(); widget.setFrame(oldRect); ignoreResize = false; x = (int) Math.ceil(newRect.x) - hMargin; y = (int) Math.ceil(newRect.y) - vMargin; width = (int) Math.ceil(newRect.width) + (hMargin * 2); height = (int) Math.ceil(newRect.height) + (vMargin * 2); return super.computeTrim(x, y, width, height); }
size.y = hHint; Rectangle trim = computeTrim( 0, 0, size.x, size.y ); return new Point( trim.width, trim.height );
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { display.runSkin (); Point size; if (layout != null) { if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { changed |= (state & LAYOUT_CHANGED) != 0; state &= ~LAYOUT_CHANGED; size = DPIUtil.autoScaleUp(layout.computeSize (this, DPIUtil.autoScaleDown(wHint), DPIUtil.autoScaleDown(hHint), changed)); } else { size = new Point (wHint, hHint); } } else { size = minimumSize (wHint, hHint, changed); if (size.x == 0) size.x = DEFAULT_WIDTH; if (size.y == 0) size.y = DEFAULT_HEIGHT; } if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; /* * Since computeTrim can be overridden by subclasses, we cannot * call computeTrimInPixels directly. */ Rectangle trim = DPIUtil.autoScaleUp(computeTrim (0, 0, DPIUtil.autoScaleDown(size.x), DPIUtil.autoScaleDown(size.y))); return new Point (trim.width, trim.height); }
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); display.runSkin(); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; Point size; if (layout != null) { if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { changed |= (state & LAYOUT_CHANGED) != 0; size = DPIUtil.autoScaleUp(layout.computeSize (this, DPIUtil.autoScaleDown(wHint), DPIUtil.autoScaleDown(hHint), changed)); state &= ~LAYOUT_CHANGED; } else { size = new Point (wHint, hHint); } } else { size = minimumSize (wHint, hHint, changed); if (size.x == 0) size.x = DEFAULT_WIDTH; if (size.y == 0) size.y = DEFAULT_HEIGHT; } if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; Rectangle trim = DPIUtil.autoScaleUp (computeTrim (0, 0, DPIUtil.autoScaleDown(size.x), DPIUtil.autoScaleDown(size.y))); return new Point (trim.width, trim.height); }
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); display.runSkin(); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; Point size; if (layout != null) { if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { changed |= (state & LAYOUT_CHANGED) != 0; size = DPIUtil.autoScaleUp(layout.computeSize (this, DPIUtil.autoScaleDown(wHint), DPIUtil.autoScaleDown(hHint), changed)); state &= ~LAYOUT_CHANGED; } else { size = new Point (wHint, hHint); } } else { size = minimumSize (wHint, hHint, changed); if (size.x == 0) size.x = DEFAULT_WIDTH; if (size.y == 0) size.y = DEFAULT_HEIGHT; } if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; Rectangle trim = DPIUtil.autoScaleUp (computeTrim (0, 0, DPIUtil.autoScaleDown(size.x), DPIUtil.autoScaleDown(size.y))); return new Point (trim.width, trim.height); }
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); display.runSkin(); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; Point size; if (layout != null) { if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { changed |= (state & LAYOUT_CHANGED) != 0; size = DPIUtil.autoScaleUp(layout.computeSize (this, DPIUtil.autoScaleDown(wHint), DPIUtil.autoScaleDown(hHint), changed)); state &= ~LAYOUT_CHANGED; } else { size = new Point (wHint, hHint); } } else { size = minimumSize (wHint, hHint, changed); if (size.x == 0) size.x = DEFAULT_WIDTH; if (size.y == 0) size.y = DEFAULT_HEIGHT; } if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; Rectangle trim = DPIUtil.autoScaleUp (computeTrim (0, 0, DPIUtil.autoScaleDown(size.x), DPIUtil.autoScaleDown(size.y))); return new Point (trim.width, trim.height); }
viewerComposite.layout(true); viewer.getControl().setVisible(true); viewerHeight = viewerComposite.computeTrim(0, 0, 0, viewerCompositeData.heightHint).height; detailsButton.setText(ProgressMessages.ProgressMonitorJobsDialog_HideTitle); shell.setSize(shellSize.x, shellSize.y + viewerHeight);