Package org.eclipse.ui.forms.widgets
Class SizeCache
java.lang.Object
org.eclipse.ui.forms.widgets.SizeCache
Caches the preferred size of an SWT control
- Since:
- 3.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputeAdjustedSize
(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
int
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) Returns the control whose size is being cachedvoid
void
setBounds
(int x, int y, int width, int height) void
void
setControl
(Control newControl) Sets the control whose size is being cached.void
setSize
(int width, int height) void
-
Constructor Details
-
SizeCache
public SizeCache() -
SizeCache
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 Details
-
setControl
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
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
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
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
-
setSize
-
setSize
public void setSize(int width, int height) -
setBounds
public void setBounds(int x, int y, int width, int height) -
setBounds
-
layoutIfNecessary
public void layoutIfNecessary()
-