Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.swt.custom
Class SashForm

    java.lang.Object
      org.eclipse.swt.widgets.Widget
          org.eclipse.swt.widgets.Control
              org.eclipse.swt.widgets.Scrollable
                  org.eclipse.swt.widgets.Composite
                      org.eclipse.swt.custom.SashForm

All Implemented Interfaces:
  Drawable

Direct Known Subclasses:
  Splitter

public class SashForm
extends Composite

The SashForm lays out its children in a Row or Column arrangement (as specified by the orientation) and places a Sash between the children. One child may be maximized to occupy the entire size of the SashForm. The relative sizes of the children may be specfied using weights.

Styles:
  HORIZONTAL, VERTICAL

Field Summary
`int` | `SASH_WIDTH`

Fields inherited from class org.eclipse.swt.widgets.Control
`handle`

Constructor Summary
`SashForm(Composite parent, int style)` Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

Method Summary
`Point` | `computeSize(int wHint, int hHint, boolean changed)` Returns the preferred size of the receiver.
`Control` | `getMaximizedControl()` Answer the control that currently is maximized in the SashForm.
`int` | `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.
`int[]` | `getWeights()` Answer the relative weight of each child in the SashForm.
`void` | `layout(boolean changed)` If the receiver has a layout, asks the layout to lay out (that is, set the size and location of) the receiver's children.
`void` | `setBackground(Color color)` 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.
`void` | `setForeground(Color color)` 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.
`void` | `setLayout(Layout layout)` Sets the layout which is associated with the receiver to be the argument which may be null.
`void` | `setMaximizedControl(Control control)` Specify the control that should take up the entire client area of the SashForm.
`void` | `setOrientation(int orientation)` If orientation is SWT.HORIZONTAL, lay the controls in the SashForm out side by side.
`void` | `setWeights(int[] weights)` Specify the relative weight of each child in the SashForm.

Methods inherited from class org.eclipse.swt.widgets.Composite
`checkSubclass, getChildren, getLayout, getTabList, layout, setFocus, setTabList`

Methods inherited from class org.eclipse.swt.widgets.Scrollable
`computeTrim, getClientArea, getHorizontalBar, getVerticalBar`

Methods inherited from class org.eclipse.swt.widgets.Control
`addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update`

Methods inherited from class org.eclipse.swt.widgets.Widget
`addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### SASH_WIDTH

    public int SASH_WIDTH

Constructor Detail

### SashForm

    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` - a widget which will be the parent of the new instance (cannot be null)
  `style` - the style of widget to construct
Throws:
  `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`, `Widget.getStyle()`

Method Detail

### computeSize

    public Point computeSize(int wHint,
                             int hHint,
                             boolean changed)

  Description copied from class: `Control`
  Returns the preferred size of the receiver.

  The preferred size of a control is the size that it would best be displayed at. The width hint and height hint arguments allow the caller to ask a control questions such as "Given a particular width, how high does the control need to be to show all of the contents?" To indicate that the caller does not wish to constrain a particular dimension, the constant `SWT.DEFAULT` is passed for the hint.

  If the changed flag is `true`, it indicates that the receiver's contents have changed, therefore any caches that a layout manager containing the control may have been keeping need to be flushed. When the control is resized, the changed flag will be `false`, so layout manager caches can be retained.

  Overrides:
    `computeSize` in class `Composite`

### getOrientation

    public int 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.

  Returns:
    SWT.HORIZONTAL or SWT.VERTICAL

### getMaximizedControl

    public Control getMaximizedControl()

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

  Returns:
    the control that currently is maximized or null

### getWeights

    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:
    the relative weight of each child
  Throws:
    `SWTException` -
    - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

### layout

    public void layout(boolean changed)

  Description copied from class: `Composite`
  If the receiver has a layout, asks the layout to lay out (that is, set the size and location of) the receiver's children. If the the argument is `true` the layout must not rely on any cached information it is keeping about the children. If it is `false` the layout may (potentially) simplify the work it is doing by assuming that the state of the none of the receiver's children has changed since the last layout. If the receiver does not have a layout, do nothing.

  Overrides:
    `layout` in class `Composite`
  Parameters:
    `changed` - `true` if the layout must flush its caches, and `false` otherwise

### setOrientation

    public void setOrientation(int orientation)

  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.

  Parameters:
    `orientation` - SWT.HORIZONTAL or SWT.VERTICAL
  Throws:
    `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

### setBackground

    public void setBackground(Color color)

  Description copied from class: `Control`
  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.

  Overrides:
    `setBackground` in class `Control`
  Parameters:
    `color` - the new color (or null)

### setForeground

    public void setForeground(Color color)

  Description copied from class: `Control`
  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.

  Overrides:
    `setForeground` in class `Control`
  Parameters:
    `color` - the new color (or null)

### setLayout

    public void setLayout(Layout layout)

  Description copied from class: `Composite`
  Sets the layout which is associated with the receiver to be the argument which may be null.

  Overrides:
    `setLayout` in class `Composite`
  Parameters:
    `layout` - the receiver's new layout or null

### setMaximizedControl

    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` - the control to be maximized or null
  Throws:
    `SWTException` -
    - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

### setWeights

    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` - the relative weight of each child
  Throws:
    `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)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.