/** * Overrides the method by fully trusting the layout manager (computed width * or height may be larger than the provider width or height hints). Callers * should be prepared that the computed width is larger than the provided * wHint. * * @see org.eclipse.swt.widgets.Composite#computeSize(int, int, boolean) */ @Override public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget(); Point size; FormTextLayout layout = (FormTextLayout) getLayout(); if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { size = layout.computeSize(this, wHint, hHint, changed); } else { size = new Point(wHint, hHint); } Rectangle trim = computeTrim(0, 0, size.x, size.y); if (DEBUG_TEXTSIZE) System.out.println("FormText Computed size: "+trim); //$NON-NLS-1$ return new Point(trim.width, trim.height); }
@Override public Point computeSize(Composite composite, int wHint, int hHint, boolean changed) { long start = 0; if (DEBUG_TEXT) start = System.currentTimeMillis(); int innerWidth = wHint; if (innerWidth != SWT.DEFAULT) innerWidth -= marginWidth * 2; Point textSize = computeTextSize(innerWidth); int textWidth = textSize.x + 2 * marginWidth; int textHeight = textSize.y + 2 * marginHeight; Point result = new Point(textWidth, textHeight); if (DEBUG_TEXT) { long stop = System.currentTimeMillis(); System.out.println("FormText computeSize: " + (stop - start) //$NON-NLS-1$ + "ms"); //$NON-NLS-1$ } if (DEBUG_TEXTSIZE) { System.out.println("FormText ("+model.getAccessibleText()+"), computeSize: wHint="+wHint+", result="+result); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return result; }
setLayout(new FormTextLayout()); model = new FormTextModel(); addDisposeListener(new DisposeListener() {
setLayout(new FormTextLayout()); model = new FormTextModel(); addDisposeListener(e -> {
/** * Overrides the method by fully trusting the layout manager (computed width * or height may be larger than the provider width or height hints). Callers * should be prepared that the computed width is larger than the provided * wHint. * * @see org.eclipse.swt.widgets.Composite#computeSize(int, int, boolean) */ @Override public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget(); Point size; FormTextLayout layout = (FormTextLayout) getLayout(); if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { size = layout.computeSize(this, wHint, hHint, changed); } else { size = new Point(wHint, hHint); } Rectangle trim = computeTrim(0, 0, size.x, size.y); if (DEBUG_TEXTSIZE) System.out.println("FormText Computed size: "+trim); //$NON-NLS-1$ return new Point(trim.width, trim.height); }
@Override public Point computeSize(Composite composite, int wHint, int hHint, boolean changed) { long start = 0; if (DEBUG_TEXT) start = System.currentTimeMillis(); int innerWidth = wHint; if (innerWidth != SWT.DEFAULT) innerWidth -= marginWidth * 2; Point textSize = computeTextSize(innerWidth); int textWidth = textSize.x + 2 * marginWidth; int textHeight = textSize.y + 2 * marginHeight; Point result = new Point(textWidth, textHeight); if (DEBUG_TEXT) { long stop = System.currentTimeMillis(); System.out.println("FormText computeSize: " + (stop - start) //$NON-NLS-1$ + "ms"); //$NON-NLS-1$ } if (DEBUG_TEXTSIZE) { System.out.println("FormText ("+model.getAccessibleText()+"), computeSize: wHint="+wHint+", result="+result); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return result; }
@Override public int computeMinimumWidth(Composite parent, boolean changed) { return computeSize(parent, 5, SWT.DEFAULT, true).x; }
@Override public int computeMaximumWidth(Composite parent, boolean changed) { return computeSize(parent, SWT.DEFAULT, SWT.DEFAULT, changed).x; }
@Override public int computeMaximumWidth(Composite parent, boolean changed) { return computeSize(parent, SWT.DEFAULT, SWT.DEFAULT, changed).x; }
@Override public int computeMinimumWidth(Composite parent, boolean changed) { return computeSize(parent, 5, SWT.DEFAULT, true).x; }