|
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 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
|
int
|
SASH_WIDTH
The width of all sashes in the form. |
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
|
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
|
getSashWidth
()
Returns the width of the sashes when the controls in the SashForm are
laid out. |
int
|
getStyle
()
Returns the receiver's style information. |
int[]
|
getWeights
()
Answer the relative weight of each child in the SashForm. |
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
|
setSashWidth
(int width)
Specify the width of the sashes when the controls in the SashForm are
laid out. |
void
|
setToolTipText
(
String string)
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. |
void
|
setWeights
(int[] weights)
Specify the relative weight of each child in the SashForm. |
Methods inherited from class org.eclipse.swt.widgets.
Composite
|
changed,
checkSubclass,
computeSize,
getBackgroundMode,
getChildren,
getLayout,
getLayoutDeferred,
getTabList,
isLayoutDeferred,
layout,
layout,
layout,
layout,
setBackgroundMode,
setFocus,
setLayoutDeferred,
setTabList
|
Methods inherited from class org.eclipse.swt.widgets.
Control
|
addControlListener,
addDragDetectListener,
addFocusListener,
addHelpListener,
addKeyListener,
addMenuDetectListener,
addMouseListener,
addMouseMoveListener,
addMouseTrackListener,
addMouseWheelListener,
addPaintListener,
addTraverseListener,
computeSize,
dragDetect,
dragDetect,
forceFocus,
getAccessible,
getBackground,
getBackgroundImage,
getBorderWidth,
getBounds,
getCursor,
getDragDetect,
getEnabled,
getFont,
getForeground,
getLayoutData,
getLocation,
getMenu,
getMonitor,
getParent,
getRegion,
getShell,
getSize,
getToolTipText,
getVisible,
internal_dispose_GC,
internal_new_GC,
isEnabled,
isFocusControl,
isReparentable,
isVisible,
moveAbove,
moveBelow,
pack,
pack,
print,
redraw,
redraw,
removeControlListener,
removeDragDetectListener,
removeFocusListener,
removeHelpListener,
removeKeyListener,
removeMenuDetectListener,
removeMouseListener,
removeMouseMoveListener,
removeMouseTrackListener,
removeMouseWheelListener,
removePaintListener,
removeTraverseListener,
setBackgroundImage,
setBounds,
setBounds,
setCapture,
setCursor,
setDragDetect,
setEnabled,
setFont,
setLayoutData,
setLocation,
setLocation,
setMenu,
setParent,
setRedraw,
setRegion,
setSize,
setSize,
setVisible,
toControl,
toControl,
toDisplay,
toDisplay,
traverse,
update
|
Methods inherited from class org.eclipse.swt.widgets.
Widget
|
addDisposeListener,
addListener,
checkWidget,
dispose,
getData,
getData,
getDisplay,
getListeners,
isDisposed,
isListening,
notifyListeners,
removeDisposeListener,
removeListener,
removeListener,
setData,
setData,
toString
|
SASH_WIDTH
public int SASH_WIDTH
- The width of all sashes in the form.
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 ,
getStyle()
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
getSashWidth
public int getSashWidth()
- Returns the width of the sashes when the controls in the SashForm are
laid out.
-
-
Returns:
- the width of the sashes
-
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
-
Since:
- 3.4
getStyle
public int getStyle()
-
Description copied from class:
Widget
- 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.
-
-
Overrides:
-
getStyle
in class
Widget
-
-
Returns:
- the style bits
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
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.
Note: This operation is a hint and may be overridden by the platform.
For example, on Windows the background of a Button cannot be changed.
-
-
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.
Note: This operation is a hint and may be overridden by the platform.
-
-
Overrides:
-
setForeground
in class
Control
-
-
Parameters:
-
color - the new color (or null)
setLayout
public void setLayout(
Layout layout)
- 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.
-
-
Overrides:
-
setLayout
in class
Composite
-
-
Parameters:
-
layout - the receiver's new layout 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
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
setSashWidth
public void setSashWidth(int width)
- Specify the width of the sashes when the controls in the SashForm are
laid out.
-
-
Parameters:
-
width - the width of the sashes
-
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
-
Since:
- 3.4
setToolTipText
public void setToolTipText(
String string)
-
Description copied from class:
Control
- 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.
-
-
Overrides:
-
setToolTipText
in class
Control
-
-
Parameters:
-
string - the new tool tip text (or null)
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)
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.
|
|