Top Description Fields Constructors Methods
org.eclipse.swt.custom

public Class SashForm

extends Composite
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.graphics.*, org.eclipse.swt.widgets.*

The SashForm is a composite control that lays out its children in a row or column arrangement (as specified by the orientation) and places a Sash between each child. One child may be maximized to occupy the entire size of the SashForm. The relative sizes of the children may be specified using weights.
Styles:
HORIZONTAL, VERTICAL, SMOOTH
See Also
SashForm snippets, SWT Example: CustomControlExample, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv Color
pack-priv Control[]
pack-priv static final int
pack-priv Color
pack-priv Control
public int
SASH_WIDTH

The width of all sashes in the form.

pack-priv Sash[]
pack-priv Listener
pack-priv int
Inherited from org.eclipse.swt.widgets.Composite:
embeddedHandle

Constructor Summary

AccessConstructor and Description
public
SashForm(Composite
a widget which will be the parent of the new instance (cannot be null)
parent
,
int
the style of widget to construct
style
)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

Method Summary

Modifier and TypeMethod and Description
pack-priv static int
pack-priv Sash
pack-priv Control[]
getControls(boolean onlyVisible)

public Control

Returns:

the control that currently is maximized or null
getMaximizedControl
()

Answer the control that currently is maximized in the SashForm.

public int

Returns:

SWT.HORIZONTAL or SWT.VERTICAL
getOrientation
()

Overrides org.eclipse.swt.widgets.Control.getOrientation.

Returns SWT.HORIZONTAL if the controls in the SashForm are laid out side by side or SWT.VERTICAL if the controls in the SashForm are laid out top to bottom.
public int

Returns:

the width of the sashes
getSashWidth
()

Returns the width of the sashes when the controls in the SashForm are laid out.

public int
getStyle()

Overrides org.eclipse.swt.widgets.Widget.getStyle.

Returns the receiver's style information.
public int[]

Returns:

the relative weight of each child
getWeights
()

Answer the relative weight of each child in the SashForm.

pack-priv void
public void
setBackground(Color
the new color (or null)
color
)

Overrides org.eclipse.swt.widgets.Control.setBackground.

Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.
public void
setForeground(Color
the new color (or null)
color
)

Overrides org.eclipse.swt.widgets.Control.setForeground.

Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.
public void
setLayout(Layout
the receiver's new layout or null
layout
)

Overrides org.eclipse.swt.widgets.Composite.setLayout.

Sets the layout which is associated with the receiver to be the argument which may be null.
public void
setMaximizedControl(Control
the control to be maximized or null
control
)

Specify the control that should take up the entire client area of the SashForm.

public void
setOrientation(int
SWT.HORIZONTAL or SWT.VERTICAL, SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT
orientation
)

Overrides org.eclipse.swt.widgets.Control.setOrientation.

If orientation is SWT.HORIZONTAL, lay the controls in the SashForm out side by side.
public void
setSashWidth(int
the width of the sashes
width
)

Specify the width of the sashes when the controls in the SashForm are laid out.

public void
setToolTipText(String
the new tool tip text (or null)
string
)

Overrides org.eclipse.swt.widgets.Control.setToolTipText.

Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown.
public void
setWeights(int...
the relative weight of each child
weights
)

Specify the relative weight of each child in the SashForm.

Inherited from org.eclipse.swt.widgets.Composite:
changedcheckSubclassdrawBackgroundgetBackgroundModegetChildrengetLayoutgetLayoutDeferredgetTabListisLayoutDeferredlayoutlayoutlayoutlayoutlayoutsetBackgroundModesetFocussetLayoutDeferredsetTabListtoString

Field Detail

backgroundback to summary
pack-priv Color background
controlsback to summary
pack-priv Control[] controls
DRAG_MINIMUMback to summary
pack-priv static final int DRAG_MINIMUM
foregroundback to summary
pack-priv Color foreground
maxControlback to summary
pack-priv Control maxControl
SASH_WIDTHback to summary
public int SASH_WIDTH

The width of all sashes in the form.

sashesback to summary
pack-priv Sash[] sashes
sashListenerback to summary
pack-priv Listener sashListener
sashStyleback to summary
pack-priv int sashStyle

Constructor Detail

SashFormback to summary
public SashForm(Composite parent, int style)

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

Parameters
parent:Composite

a widget which will be the parent of the new instance (cannot be null)

style:int

the style of widget to construct

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the parent is null
SWTException:
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
See Also
SWT#HORIZONTAL, SWT#VERTICAL, getStyle()

Method Detail

checkStyleback to summary
pack-priv static int checkStyle(int style)

Hides org.eclipse.swt.widgets.Composite.checkStyle.

createSashback to summary
pack-priv Sash createSash()
getControlsback to summary
pack-priv Control[] getControls(boolean onlyVisible)
getMaximizedControlback to summary
public Control getMaximizedControl()

Answer the control that currently is maximized in the SashForm. This value may be null.

Returns:Control

the control that currently is maximized or null

getOrientationback to summary
public int getOrientation()

Overrides org.eclipse.swt.widgets.Control.getOrientation.

Returns SWT.HORIZONTAL if the controls in the SashForm are laid out side by side or SWT.VERTICAL if the controls in the SashForm are laid out top to bottom.

To retrieve the bidi orientation of the SashForm use getStyle() and test if the SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT bits are set.

Returns:int

SWT.HORIZONTAL or SWT.VERTICAL

Annotations
@Override
getSashWidthback to summary
public int getSashWidth()

Returns the width of the sashes when the controls in the SashForm are laid out.

Returns:int

the width of the sashes

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
Since
3.4
getStyleback to summary
public int getStyle()

Overrides org.eclipse.swt.widgets.Widget.getStyle.

Doc from org.eclipse.swt.widgets.Widget.getStyle.

Returns the receiver's style information.

Note that the value which is returned by this method may not match the value which was provided to the constructor when the receiver was created. This can occur when the underlying operating system does not support a particular combination of requested styles. For example, if the platform widget used to implement a particular SWT widget always has scroll bars, the result of calling this method would always have the SWT.H_SCROLL and SWT.V_SCROLL bits set.

Returns:int

the style bits

Annotations
@Override
getWeightsback to summary
public int[] getWeights()

Answer the relative weight of each child in the SashForm. The weight represents the percent of the total width (if SashForm has Horizontal orientation) or total height (if SashForm has Vertical orientation) each control occupies. The weights are returned in order of the creation of the widgets (weight[0] corresponds to the weight of the first child created).

Returns:int[]

the relative weight of each child

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
onDragSashback to summary
pack-priv void onDragSash(Event event)
setBackgroundback to summary
public void setBackground(Color color)

Overrides org.eclipse.swt.widgets.Control.setBackground.

Doc from org.eclipse.swt.widgets.Control.setBackground.

Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.

Note

This operation is a hint and may be overridden by the platform.

Parameters
color:Color

the new color (or null)

Annotations
@Override
setForegroundback to summary
public void setForeground(Color color)

Overrides org.eclipse.swt.widgets.Control.setForeground.

Doc from org.eclipse.swt.widgets.Control.setForeground.

Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.

Note

This operation is a hint and may be overridden by the platform.

Parameters
color:Color

the new color (or null)

Annotations
@Override
setLayoutback to summary
public void setLayout(Layout layout)

Overrides org.eclipse.swt.widgets.Composite.setLayout.

Sets the layout which is associated with the receiver to be the argument which may be null.

Note

No Layout can be set on this Control because it already manages the size and position of its children.

Parameters
layout:Layout

the receiver's new layout or null

Annotations
@Override
Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setMaximizedControlback to summary
public void setMaximizedControl(Control control)

Specify the control that should take up the entire client area of the SashForm. If one control has been maximized, and this method is called with a different control, the previous control will be minimized and the new control will be maximized. If the value of control is null, the SashForm will minimize all controls and return to the default layout where all controls are laid out separated by sashes.

Parameters
control:Control

the control to be maximized or null

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setOrientationback to summary
public void setOrientation(int orientation)

Overrides org.eclipse.swt.widgets.Control.setOrientation.

If orientation is SWT.HORIZONTAL, lay the controls in the SashForm out side by side. If orientation is SWT.VERTICAL, lay the controls in the SashForm out top to bottom.

Since 3.7, this method can also be called with SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT to change the bidi orientation of the SashForm.

Parameters
orientation:int

SWT.HORIZONTAL or SWT.VERTICAL, SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT

Annotations
@Override
Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • ERROR_INVALID_ARGUMENT - if the value of orientation is not SWT.HORIZONTAL or SWT.VERTICAL, SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT
See Also
Control#setOrientation(int)
setSashWidthback to summary
public void setSashWidth(int width)

Specify the width of the sashes when the controls in the SashForm are laid out.

Parameters
width:int

the width of the sashes

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
Since
3.4
setToolTipTextback to summary
public void setToolTipText(String string)

Overrides org.eclipse.swt.widgets.Control.setToolTipText.

Doc from org.eclipse.swt.widgets.Control.setToolTipText.

Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown. For a control that has a default tool tip, such as the Tree control on Windows, setting the tool tip text to an empty string replaces the default, causing no tool tip text to be shown.

The mnemonic indicator (character '&') is not displayed in a tool tip. To display a single '&' in the tool tip, the character '&' can be escaped by doubling it in the string.

Note

This operation is a hint and behavior is platform specific, on Windows for CJK-style mnemonics of the form " (&C)" at the end of the tooltip text are not shown in tooltip.

Parameters
string:String

the new tool tip text (or null)

Annotations
@Override
setWeightsback to summary
public void setWeights(int... weights)

Specify the relative weight of each child in the SashForm. This will determine what percent of the total width (if SashForm has Horizontal orientation) or total height (if SashForm has Vertical orientation) each control will occupy. The weights must be positive values and there must be an entry for each non-sash child of the SashForm.

Parameters
weights:int[]

the relative weight of each child

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • ERROR_INVALID_ARGUMENT - if the weights value is null or of incorrect length (must match the number of children)