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

public Class ViewForm

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

Instances of this class implement a Composite that positions and sizes children and allows programmatic control of layout and border parameters. ViewForm is used in the workbench to lay out a view's label/menu/toolbar local bar.

Note that although this class is a subclass of Composite, it does not make sense to set a layout on it.

Styles:
BORDER, FLAT
Events:
(None)

Important Note

This class is not intended to be subclassed.

See Also
Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv int
public static RGB
borderInsideRGB

Color of innermost line of drop shadow border.

pack-priv int
public static RGB
borderMiddleRGB

Color of middle line of drop shadow border.

public static RGB
borderOutsideRGB

Color of outermost line of drop shadow border.

pack-priv int
pack-priv int
pack-priv Control
pack-priv int
public int
horizontalSpacing

horizontalSpacing specifies the number of points between the right edge of one cell and the left edge of its neighbouring cell to the right.

pack-priv Listener
public int
marginHeight

marginHeight specifies the number of points of vertical margin that will be placed along the top and bottom edges of the form.

public int
marginWidth

marginWidth specifies the number of points of horizontal margin that will be placed along the left and right edges of the form.

pack-priv static final int
pack-priv Point
pack-priv static final int
pack-priv Color
pack-priv boolean
pack-priv int
pack-priv boolean
pack-priv Control
pack-priv Control
pack-priv Control
public int
verticalSpacing

verticalSpacing specifies the number of points between the bottom edge of one cell and the top edge of its neighbouring cell underneath.

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

Constructor Summary

AccessConstructor and Description
public
ViewForm(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
public Rectangle
computeTrim(int
the desired x coordinate of the client area
x
,
int
the desired y coordinate of the client area
y
,
int
the desired width of the client area
width
,
int
the desired height of the client area
height
)

Overrides org.eclipse.swt.widgets.Scrollable.computeTrim.

Given a desired client area for the receiver (as described by the arguments), returns the bounding rectangle which would be required to produce that client area.
public Rectangle
getClientArea()

Overrides org.eclipse.swt.widgets.Scrollable.getClientArea.

Returns a rectangle which describes the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings").
public Control

Returns:

the control in the content area of the pane or null
getContent
()

Returns the content area.

public Control

Returns:

the control in the top center of the pane or null
getTopCenter
()

Returns Control that appears in the top center of the pane.

public Control

Returns:

the control in the top left corner of the pane or null
getTopLeft
()

Returns the Control that appears in the top left corner of the pane.

public Control

Returns:

the control in the top right corner of the pane or null
getTopRight
()

Returns the control in the top right corner of the pane.

pack-priv void
pack-priv void
onPaint(GC gc)

pack-priv void
public void
setBorderVisible(boolean
true if the border should be displayed
show
)

Specify whether the border should be displayed or not.

public void
setContent(Control
the control to be displayed in the content area or null
content
)

Sets the content.

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.
pack-priv void
public void
setTopCenter(Control
the control to be displayed in the top center or null
topCenter
)

Set the control that appears in the top center of the pane.

public void
setTopCenterSeparate(boolean
true if the topCenter will always appear on a separate line by itself
show
)

If true, the topCenter will always appear on a separate line by itself, otherwise the topCenter will appear in the top row if there is room and will be moved to the second row if required.

public void
setTopLeft(Control
the control to be displayed in the top left corner or null
c
)

Set the control that appears in the top left corner of the pane.

public void
setTopRight(Control
the control to be displayed in the top right corner or null
c
)

Set the control that appears in the top right corner of the pane.

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

Field Detail

BORDER1_COLORback to summary
pack-priv static final int BORDER1_COLOR
borderBottomback to summary
pack-priv int borderBottom
borderInsideRGBback to summary
public static RGB borderInsideRGB

Deprecated

Color of innermost line of drop shadow border. NOTE This field is badly named and can not be fixed for backwards compatibility. It should be capitalized.

Annotations
@Deprecated
borderLeftback to summary
pack-priv int borderLeft
borderMiddleRGBback to summary
public static RGB borderMiddleRGB

Deprecated

Color of middle line of drop shadow border. NOTE This field is badly named and can not be fixed for backwards compatibility. It should be capitalized.

Annotations
@Deprecated
borderOutsideRGBback to summary
public static RGB borderOutsideRGB

Deprecated

Color of outermost line of drop shadow border. NOTE This field is badly named and can not be fixed for backwards compatibility. It should be capitalized.

Annotations
@Deprecated
borderRightback to summary
pack-priv int borderRight
borderTopback to summary
pack-priv int borderTop
contentback to summary
pack-priv Control content
highlightback to summary
pack-priv int highlight
horizontalSpacingback to summary
public int horizontalSpacing

horizontalSpacing specifies the number of points between the right edge of one cell and the left edge of its neighbouring cell to the right. The default value is 1.

listenerback to summary
pack-priv Listener listener
marginHeightback to summary
public int marginHeight

marginHeight specifies the number of points of vertical margin that will be placed along the top and bottom edges of the form. The default value is 0.

marginWidthback to summary
public int marginWidth

marginWidth specifies the number of points of horizontal margin that will be placed along the left and right edges of the form. The default value is 0.

OFFSCREENback to summary
pack-priv static final int OFFSCREEN
oldSizeback to summary
pack-priv Point oldSize
SELECTION_BACKGROUNDback to summary
pack-priv static final int SELECTION_BACKGROUND
selectionBackgroundback to summary
pack-priv Color selectionBackground
separateTopCenterback to summary
pack-priv boolean separateTopCenter
separatorback to summary
pack-priv int separator
showBorderback to summary
pack-priv boolean showBorder
topCenterback to summary
pack-priv Control topCenter
topLeftback to summary
pack-priv Control topLeft
topRightback to summary
pack-priv Control topRight
verticalSpacingback to summary
public int verticalSpacing

verticalSpacing specifies the number of points between the bottom edge of one cell and the top edge of its neighbouring cell underneath. The default value is 1.

Constructor Detail

ViewFormback to summary
public ViewForm(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#BORDER, SWT#FLAT, getStyle()

Method Detail

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

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

computeTrimback to summary
public Rectangle computeTrim(int x, int y, int width, int height)

Overrides org.eclipse.swt.widgets.Scrollable.computeTrim.

Doc from org.eclipse.swt.widgets.Scrollable.computeTrim.

Given a desired client area for the receiver (as described by the arguments), returns the bounding rectangle which would be required to produce that client area.

In other words, it returns a rectangle such that, if the receiver's bounds were set to that rectangle, the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings") would be the rectangle described by the arguments (relative to the receiver's parent).

Parameters
x:int

the desired x coordinate of the client area

y:int

the desired y coordinate of the client area

width:int

the desired width of the client area

height:int

the desired height of the client area

Returns:Rectangle

the required bounds to produce the given client area

Annotations
@Override
getClientAreaback to summary
public Rectangle getClientArea()

Overrides org.eclipse.swt.widgets.Scrollable.getClientArea.

Doc from org.eclipse.swt.widgets.Scrollable.getClientArea.

Returns a rectangle which describes the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings").

Returns:Rectangle

the client area

Annotations
@Override
getContentback to summary
public Control getContent()

Returns the content area.

Returns:Control

the control in the content area of the pane or null

getTopCenterback to summary
public Control getTopCenter()

Returns Control that appears in the top center of the pane. Typically this is a toolbar.

Returns:Control

the control in the top center of the pane or null

getTopLeftback to summary
public Control getTopLeft()

Returns the Control that appears in the top left corner of the pane. Typically this is a label such as CLabel.

Returns:Control

the control in the top left corner of the pane or null

getTopRightback to summary
public Control getTopRight()

Returns the control in the top right corner of the pane. Typically this is a Close button or a composite with a Menu and Close button.

Returns:Control

the control in the top right corner of the pane or null

onDisposeback to summary
pack-priv void onDispose(Event event)
onPaintback to summary
pack-priv void onPaint(GC gc)
onResizeback to summary
pack-priv void onResize()
setBorderVisibleback to summary
public void setBorderVisible(boolean show)

Specify whether the border should be displayed or not.

Parameters
show:boolean

true if the border should be displayed

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
setContentback to summary
public void setContent(Control content)

Sets the content. Setting the content to null will remove it from the pane - however, the creator of the content must dispose of the content.

Parameters
content:Control

the control to be displayed in the content area 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
  • ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm
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
setSelectionBackgroundback to summary
pack-priv void setSelectionBackground(Color color)
setTopCenterback to summary
public void setTopCenter(Control topCenter)

Set the control that appears in the top center of the pane. Typically this is a toolbar. The topCenter is optional. Setting the topCenter to null will remove it from the pane - however, the creator of the topCenter must dispose of the topCenter.

Parameters
topCenter:Control

the control to be displayed in the top center 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
  • ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm
setTopCenterSeparateback to summary
public void setTopCenterSeparate(boolean show)

If true, the topCenter will always appear on a separate line by itself, otherwise the topCenter will appear in the top row if there is room and will be moved to the second row if required.

Parameters
show:boolean

true if the topCenter will always appear on a separate line by itself

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
setTopLeftback to summary
public void setTopLeft(Control c)

Set the control that appears in the top left corner of the pane. Typically this is a label such as CLabel. The topLeft is optional. Setting the top left control to null will remove it from the pane - however, the creator of the control must dispose of the control.

Parameters
c:Control

the control to be displayed in the top left corner 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
  • ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm
setTopRightback to summary
public void setTopRight(Control c)

Set the control that appears in the top right corner of the pane. Typically this is a Close button or a composite with a Menu and Close button. The topRight is optional. Setting the top right control to null will remove it from the pane - however, the creator of the control must dispose of the control.

Parameters
c:Control

the control to be displayed in the top right corner 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
  • ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm