Package org.eclipse.ui.forms.widgets
Class SizeCache
- java.lang.Object
-
- org.eclipse.ui.forms.widgets.SizeCache
-
public class SizeCache extends Object
Caches the preferred size of an SWT control- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Point
computeAdjustedSize(int widthHint, int heightHint)
Compute the control's size, and ensure that non-default hints are returned verbatim (this tries to compensate for SWT's hints, which aren't really the outer width of the control).int
computeMaximumWidth()
Point
computeMinimumSize()
int
computeMinimumWidth()
Point
computeSize(int widthHint, int heightHint)
Computes the preferred size of the control.void
flush()
Flush the cache (should be called if the control's contents may have changed since the last query)void
flush(boolean recursive)
Control
getControl()
Returns the control whose size is being cachedvoid
layoutIfNecessary()
void
setBounds(int x, int y, int width, int height)
void
setBounds(Rectangle bounds)
void
setControl(Control newControl)
Sets the control whose size is being cached.void
setSize(int width, int height)
void
setSize(Point newSize)
-
-
-
Constructor Detail
-
SizeCache
public SizeCache()
-
SizeCache
public SizeCache(Control control)
Creates a cache for size computations on the given control- Parameters:
control
- the control for which sizes will be calculated, or null to always return (0,0)
-
-
Method Detail
-
setControl
public void setControl(Control newControl)
Sets the control whose size is being cached. Does nothing (will not even flush the cache) if this is the same control as last time or it is already disposed.- Parameters:
newControl
- the control whose size is being cached, or null to always return (0,0)
-
getControl
public Control getControl()
Returns the control whose size is being cached- Returns:
- the control whose size is being cached, or null if this cache always returns (0,0)
-
flush
public void flush()
Flush the cache (should be called if the control's contents may have changed since the last query)
-
flush
public void flush(boolean recursive)
-
computeSize
public Point computeSize(int widthHint, int heightHint)
Computes the preferred size of the control.- Parameters:
widthHint
- the known width of the control (pixels) or SWT.DEFAULT if unknownheightHint
- the known height of the control (pixels) or SWT.DEFAULT if unknown- Returns:
- the preferred size of the control
-
computeAdjustedSize
public Point computeAdjustedSize(int widthHint, int heightHint)
Compute the control's size, and ensure that non-default hints are returned verbatim (this tries to compensate for SWT's hints, which aren't really the outer width of the control).- Parameters:
widthHint
- the horizontal hintheightHint
- the vertical hint- Returns:
- the control's size
-
computeMinimumWidth
public int computeMinimumWidth()
-
computeMaximumWidth
public int computeMaximumWidth()
-
computeMinimumSize
public Point computeMinimumSize()
-
setSize
public void setSize(Point newSize)
-
setSize
public void setSize(int width, int height)
-
setBounds
public void setBounds(int x, int y, int width, int height)
-
setBounds
public void setBounds(Rectangle bounds)
-
layoutIfNecessary
public void layoutIfNecessary()
-
-