Codota Logo
Composite.computeTrim
Code IndexAdd Codota to your IDE (free)

How to use
computeTrim
method
in
org.eclipse.swt.widgets.Composite

Best Java code snippets using org.eclipse.swt.widgets.Composite.computeTrim (Showing top 20 results out of 315)

  • Common ways to obtain Composite
private void myMethod () {
Composite c =
  • Codota IconControl control;control.getParent()
  • Codota IconStatusDialog zuper;(Composite) zuper.createDialogArea(parent)
  • Codota IconTitleAreaDialog zuper;(Composite) zuper.createDialogArea(parent)
  • Smart code suggestions by Codota
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

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;
}
origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * 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;
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

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;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

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;
}
origin: org.eclipse/org.eclipse.ajdt.ui

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;
}
origin: org.eclipse.swt.cocoa.macosx/x86_64

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);
}

origin: BiglySoftware/BiglyBT

  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;
  }
}
origin: BiglySoftware/BiglyBT

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;
}
origin: org.eclipse.rap/org.eclipse.rap.rwt

@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 );
}
origin: pentaho/big-data-plugin

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;
}
origin: pentaho/big-data-plugin

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;
}
origin: org.eclipse.swt.cocoa.macosx/x86_64

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);
}

origin: pentaho/big-data-plugin

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;
}
origin: org.eclipse.swt.cocoa.macosx/x86_64

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);
}

origin: org.eclipse.rap/org.eclipse.rap.rwt

 size.y = hHint;
Rectangle trim = computeTrim( 0, 0, size.x, size.y );
return new Point( trim.width, trim.height );
origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

@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);
}

origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

@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);
}

origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

@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);
}

origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

@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);
}

origin: org.eclipse.platform/org.eclipse.ui.workbench

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);
org.eclipse.swt.widgetsCompositecomputeTrim

Popular methods of Composite

  • setLayout
    Sets the layout which is associated with the receiver to be the argument which may be null.
  • <init>
    Constructs a new instance of this class given its parent and a style value describing its behavior a
  • setLayoutData
  • layout
    Forces a lay out (that is, sets the size and location) of all widgets that are in the parent hierarc
  • getDisplay
  • getChildren
    Returns a (possibly empty) array containing the receiver's children. Children are returned in the or
  • getShell
  • getFont
  • getLayout
    Returns layout which is associated with the receiver, or null if one has not been set.
  • setFont
  • getParent
  • computeSize
  • getParent,
  • computeSize,
  • dispose,
  • setBackground,
  • getClientArea,
  • isDisposed,
  • getBackground,
  • setVisible,
  • setSize,
  • setData

Popular in Java

  • Updating database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • findViewById (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now