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

public Class Composite

extends Scrollable
Class Inheritance
Known Direct Subclasses
org.eclipse.swt.widgets.CoolBar, org.eclipse.swt.widgets.DateTime, org.eclipse.swt.widgets.ExpandBar, org.eclipse.swt.widgets.Group, org.eclipse.swt.widgets.Spinner, org.eclipse.swt.widgets.TabFolder, org.eclipse.swt.widgets.ToolBar, org.eclipse.swt.widgets.Tree, org.eclipse.swt.browser.Browser, org.eclipse.swt.custom.CBanner, org.eclipse.swt.custom.CCombo, org.eclipse.swt.custom.CTabFolder, org.eclipse.swt.custom.SashForm, org.eclipse.swt.custom.ScrolledComposite, org.eclipse.swt.custom.ViewForm, org.eclipse.swt.widgets.Table, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.widgets.Combo
Imports
java.util.*, org.eclipse.swt.*, org.eclipse.swt.graphics.*, org.eclipse.swt.internal.*, org.eclipse.swt.internal.cairo.*, org.eclipse.swt.internal.gtk.*, org.eclipse.swt.internal.gtk3.*, org.eclipse.swt.internal.gtk4.*

Instances of this class are controls which are capable of containing other controls.
Styles:
NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE, NO_RADIO_GROUP, EMBEDDED, DOUBLE_BUFFERED
Events:
(none)

Note

The NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, and NO_REDRAW_RESIZE styles are intended for use with Canvas. They can be used with Composite if you are drawing your own, but their behavior is undefined if they are used with subclasses of Composite other than Canvas.

Note

The CENTER style, although undefined for composites, has the same value as EMBEDDED which is used to embed widgets from other widget toolkits into SWT. On some operating systems (GTK), this may cause the children of this composite to be obscured.

This class may be subclassed by custom control implementors who are building controls that are constructed from aggregates of other controls.

See Also
Canvas, Composite snippets, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv HashMap<Widget, Boolean>
childrenLowered

A HashMap of child widgets that keeps track of which child has had their GdkWindow lowered/raised.

public long
embeddedHandle

the handle to the OS resource (Warning: This field is platform dependent)

Important Note

This field is not part of the SWT public API.

pack-priv long
fixClipHandle

When this field is set, it indicates that a child widget of this Composite needs to have its clip set to its allocation.

pack-priv Map<Control, long[]>
fixClipMap

If fixClipHandle is set, then the fixClipMap HashMap contains children of fixClipHandle that also need to have their clips adjusted.

pack-priv long
pack-priv Layout
pack-priv int
pack-priv static final String
pack-priv boolean
noChildDrawing

If set to true, child widgets with negative y coordinate GTK allocation will not be drawn.

pack-priv Shell
pack-priv long
pack-priv Control[]
Inherited from org.eclipse.swt.widgets.Scrollable:
horizontalBarRESIZE_ON_GETCLIENTAREAscrolledHandleverticalBar

Constructor Summary

AccessConstructor and Description
pack-priv
public
Composite(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 Control[]
pack-priv Control[]
pack-priv void
adjustChildClipping(long
the handle to the widget
widget
)

Overrides org.eclipse.swt.widgets.Control.adjustChildClipping.

Allows Controls to adjust the clipping of themselves or their children.
pack-priv int
public void
changed(Control[]
an array of controls that changed state and require a recalculation of size
changed
)

Deprecated use Composite#layout(Control[], int) instead
Clears any data that has been cached by a Layout for all widgets that are in the parent hierarchy of the changed control up to and including the receiver.
pack-priv void
pack-priv static int
checkStyle(int style)

protected void
checkSubclass()

Overrides org.eclipse.swt.widgets.Widget.checkSubclass.

Checks that this class can be subclassed.
pack-priv boolean
pack-priv Point
computeSizeInPixels(int wHint, int hHint, boolean changed)

Overrides org.eclipse.swt.widgets.Control.computeSizeInPixels.

pack-priv Widget[]
pack-priv void
connectFixedHandleDraw()

Connects this widget's fixedHandle to the "draw" signal.

pack-priv void
pack-priv void
createHandle(int index, boolean fixed, boolean scrolled)

pack-priv void
public void
drawBackground(GC
the gc where the rectangle is to be filled
gc
,
int
the x coordinate of the rectangle to be filled
x
,
int
the y coordinate of the rectangle to be filled
y
,
int
the width of the rectangle to be filled
width
,
int
the height of the rectangle to be filled
height
,
int
the image background x offset
offsetX
,
int
the image background y offset
offsetY
)

Fills the interior of the rectangle specified by the arguments, with the receiver's background.

pack-priv void
drawBackgroundInPixels(GC gc, int x, int y, int width, int height, int offsetX, int offsetY)

pack-priv void
pack-priv Composite
pack-priv Menu[]
pack-priv void
fixChildren(Shell newShell, Shell oldShell, Decorations newDecorations, Decorations oldDecorations, Menu[] menus)

Overrides org.eclipse.swt.widgets.Control.fixChildren.

pack-priv void
fixClippings()

Iterates though the array of child widgets that need to have their clips adjusted, and calls Control.adjustChildClipping() on it.

pack-priv void
fixModal(long group, long modalGroup)

Overrides org.eclipse.swt.widgets.Control.fixModal.

pack-priv void
fixParentGdkResource()

Overrides org.eclipse.swt.widgets.Control.fixParentGdkResource.

In some situations, a control has a non-standard parent GdkWindow (Note gDk, not gTk).
pack-priv void
pack-priv void
pack-priv void
pack-priv long
pack-priv boolean
public int

Returns:

the background mode
getBackgroundMode
()

Returns the receiver's background drawing mode.

public Control[]

Returns:

an array of children
getChildren
()

Returns a (possibly empty) array containing the receiver's children.

pack-priv int
pack-priv Rectangle
public Layout

Returns:

the receiver's layout or null
getLayout
()

Returns layout which is associated with the receiver, or null if one has not been set.

public boolean

Returns:

the receiver's deferred layout state
getLayoutDeferred
()

Returns true if the receiver has deferred the performing of layout, and false otherwise.

public Control[]

Returns:

tabList the ordered list of controls representing the tab order
getTabList
()

Gets the (possibly empty) tabbing order for the control.

pack-priv boolean
gtk4_key_press_event(long
the corresponding controller responsible for capturing the event
controller
,
int
the pressed key
keyval
,
int
raw code of the pressed key
keycode
,
int
the bitmask, representing the state of the modifier keys and pointer buttons
state
,
long
the GdkEvent captured
event
)

Overrides org.eclipse.swt.widgets.Control.gtk4_key_press_event.

pack-priv long
pack-priv long
gtk_draw(long widget, long cairo)

Overrides org.eclipse.swt.widgets.Scrollable.gtk_draw.

pack-priv long
gtk_focus(long widget, long directionType)

Overrides org.eclipse.swt.widgets.Control.gtk_focus.

pack-priv long
pack-priv long
pack-priv long
pack-priv long
pack-priv long
pack-priv long
gtk_scroll_child(long widget, long scrollType, long horizontal)

Overrides org.eclipse.swt.widgets.Widget.gtk_scroll_child.

pack-priv long
pack-priv boolean
pack-priv void
pack-priv boolean
pack-priv long
public boolean

Returns:

the receiver's deferred layout state
isLayoutDeferred
()

Returns true if the receiver or any ancestor up to and including the receiver's nearest ancestor shell has deferred the performing of layouts.

pack-priv boolean
public void
layout()

If the receiver has a layout, asks the layout to lay out (that is, set the size and location of) the receiver's children.

public void
layout(boolean
true if the layout must flush its caches, and false otherwise
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.

public void
layout(boolean
true if the layout must flush its caches, and false otherwise
changed
,
boolean
true if all children in the receiver's widget tree should be laid out, and false otherwise
all
)

If the receiver has a layout, asks the layout to lay out (that is, set the size and location of) the receiver's children.

public void
layout(Control[]
a control that has had a state change which requires a recalculation of its size
changed
)

Forces a lay out (that is, sets the size and location) of all widgets that are in the parent hierarchy of the changed control up to and including the receiver.

public void
layout(Control[]
a control that has had a state change which requires a recalculation of its size
changed
,
int
the flags specifying how the layout should happen
flags
)

Forces a lay out (that is, sets the size and location) of all widgets that are in the parent hierarchy of the changed control up to and including the receiver.

pack-priv void
markLayout(boolean changed, boolean all)

Overrides org.eclipse.swt.widgets.Control.markLayout.

pack-priv Point
minimumSize(int wHint, int hHint, boolean changed)

pack-priv void
moveAbove(long child, long sibling)

pack-priv void
moveBelow(long child, long sibling)

pack-priv void
pack-priv boolean
mustBeVisibleOnInitBounds()

Overrides org.eclipse.swt.widgets.Control.mustBeVisibleOnInitBounds.

Widgets with unusual bounds calculation behavior can override this method to return true if the widget must be visible during call to setInitialBounds().
pack-priv long
pack-priv void
printWidget(GC gc, long drawable, int depth, int x, int y)

Overrides org.eclipse.swt.widgets.Control.printWidget.

pack-priv void
propagateDraw(long
the parent container, i.e. fixedHandle
container
,
long
the cairo context provided by GTK
cairo
)

Propagates draw events from a parent container to its children using gtk_container_propagate_draw().

pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
public void
setBackgroundMode(int
the new background mode
mode
)

Sets the background drawing mode to the argument which should be one of the following constants defined in class SWT: INHERIT_NONE, INHERIT_DEFAULT, INHERIT_FORCE.

pack-priv int
setBounds(int x, int y, int width, int height, boolean move, boolean resize)

Overrides org.eclipse.swt.widgets.Control.setBounds.

public boolean
setFocus()

Overrides org.eclipse.swt.widgets.Control.setFocus.

Causes the receiver to have the keyboard focus, such that all keyboard events will be delivered to it.
public void
setLayout(Layout
the receiver's new layout or null
layout
)

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

public void
setLayoutDeferred(boolean
the new defer state
defer
)

If the argument is true, causes subsequent layout operations in the receiver or any of its children to be ignored.

pack-priv void
pack-priv boolean
pack-priv boolean
pack-priv boolean
public void
setTabList(Control[]
the ordered list of controls representing the tab order or null
tabList
)

Sets the tabbing order for the specified controls to match the order that they occur in the argument list.

pack-priv void
public String
toString()

Overrides org.eclipse.swt.widgets.Widget.toString.

Returns a string containing a concise, human-readable description of the receiver.
pack-priv boolean
pack-priv boolean
pack-priv int
pack-priv void
pack-priv void
Inherited from org.eclipse.swt.widgets.Scrollable:
clientHandlecomputeTrimcomputeTrimInPixelscreateScrollBarcreateWidgetdestroyScrollBargetBorderWidthInPixelsgetClientAreagetHorizontalBargetScrollbarsModegetVerticalBargtk_scroll_eventhScrollBarWidthredrawBackgroundImageredrawWidgetsendLeaveNotifytopHandleupdateScrollBarValuevScrollBarWidth