| java.lang.Object org.eclipse.ui.internal.layout.SizeCache
SizeCache | public class SizeCache (Code) | | Caches the preferred size of an SWT control
since: 3.0 |
Method Summary | |
public Point | computeSize(int widthHint, int heightHint) Computes the preferred size of the control. | public void | flush() | public void | flush(boolean recursive) | public Control | getControl() | static boolean | independentLengthAndWidth(Control control) Returns true if the preferred length of the given control is
independent of the width and visa-versa. | public void | setControl(Control newControl) Sets the control whose size is being cached. |
SizeCache | public SizeCache()(Code) | | |
SizeCache | public SizeCache(Control control)(Code) | | 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) |
computeSize | public Point computeSize(int widthHint, int heightHint)(Code) | | Computes the preferred size of the control.
Parameters: widthHint - the known width of the control (pixels) or SWT.DEFAULT if unknown Parameters: heightHint - the known height of the control (pixels) or SWT.DEFAULT if unknown the preferred size of the control |
flush | public void flush()(Code) | | Flush the cache (should be called if the control's contents may have changed since the
last query)
|
flush | public void flush(boolean recursive)(Code) | | |
getControl | public Control getControl()(Code) | | Returns the control whose size is being cached
the control whose size is being cached, or null if this cache always returns (0,0) |
independentLengthAndWidth | static boolean independentLengthAndWidth(Control control)(Code) | | Returns true if the preferred length of the given control is
independent of the width and visa-versa. If this returns true,
then changing the widthHint argument to control.computeSize will
never change the resulting height and changing the heightHint
will never change the resulting width. Returns false if unknown.
This information can be used to improve caching. Incorrectly returning
a value of false may decrease performance, but incorrectly returning
a value of true will generate incorrect layouts... so always return
false if unsure.
Parameters: control - |
setControl | public void setControl(Control newControl)(Code) | | 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.
Parameters: newControl - the control whose size is being cached, or null to always return (0,0) |
|
|