public class Section extends ExpandableComposite
In case of the TITLE_BAR style, Section renders the title bar in a way compatible with the rest of the workbench. Since it is a widget, all the colors must be supplied directly. When created by the form toolkit, these colors are supplied by the toolkit. The toolkit initializes these colors based on the system colors. For this reason, it is recommended to create the section by the toolkit instead of through its own constructor.
Since 3.1, it is possible to set a control to be used for section
description. If used, DESCRIPTION
style should not be set. A
typical way to take advantage of the new method is to set an instance of
FormText
to provide for hyperlinks and images in the
description area.
Modifier and Type | Field and Description |
---|---|
static int |
DESCRIPTION
Description style.
|
CLIENT_INDENT, clientVerticalSpacing, COMPACT, descriptionVerticalSpacing, EXPANDED, FOCUS_TITLE, GAP, LEFT_TEXT_CLIENT_ALIGNMENT, marginHeight, marginWidth, NO_TITLE, NO_TITLE_FOCUS_BOX, SHORT_TITLE_BAR, textLabel, TITLE_BAR, titleBarTextMarginWidth, toggle, TREE_NODE, TWISTIE, VGAP
Constructor and Description |
---|
Section(Composite parent,
int style)
Creates a new section instance in the provided parent.
|
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
Returns the current description text.
|
Control |
getDescriptionControl()
Returns the control used to render the description.
|
Control |
getSeparatorControl()
Returns the control that is used as a separator betweeen the title and
the client, or null if not set.
|
Color |
getTitleBarBackground()
Returns the title bar background when TITLE_BAR style is used.
|
Color |
getTitleBarBorderColor()
Returns the title bar border color when TITLE_BAR style is used.
|
Color |
getTitleBarGradientBackground()
Returns the title bar gradient background color when TITLE_BAR style is
used.
|
protected void |
internalSetExpanded(boolean expanded)
Performs the expansion state change for the expandable control.
|
protected void |
onPaint(PaintEvent e)
If TITLE_BAR or SHORT_TITLE_BAR style is used, title bar decoration will
be painted behind the text in this method.
|
protected void |
reflow()
Reflows this section and all the parents up the hierarchy until a
SharedScrolledComposite is reached.
|
void |
setBackground(Color bg)
Sets the background of the section.
|
void |
setBackgroundImage(Image image)
Background image is used for the title gradient - does nothing.
|
void |
setDescription(String description)
Sets the description text.
|
void |
setDescriptionControl(Control descriptionControl)
Sets the description control of this section.
|
void |
setForeground(Color fg)
Sets the foreground of the section.
|
void |
setSeparatorControl(Control separator)
Sets the separator control of this section.
|
void |
setTitleBarBackground(Color color)
Sets the color of the title bar background when TITLE_BAR style is used.
|
void |
setTitleBarBorderColor(Color color)
Sets the color of the title bar border when TITLE_BAR style is used.
|
void |
setTitleBarGradientBackground(Color color)
Sets the color of the title bar gradient background when TITLE_BAR style
is used.
|
addExpansionListener, computeSize, forceFocus, getClient, getExpansionStyle, getText, getTextClient, getTextClientHeightDifference, getTitleBarForeground, hasTitleBar, isExpanded, isFixedStyle, removeExpansionListener, setActiveToggleColor, setClient, setEnabled, setExpanded, setFont, setLayout, setMenu, setText, setTextClient, setTitleBarForeground, setToggleColor, setToolTipText
drawBackground, getCaret, getIME, scroll, setCaret, setIME
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBounds, setBounds, setCapture, setCursor, setDragDetect, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public static final int DESCRIPTION
public Section(Composite parent, int style)
parent
- the parent compositestyle
- the style to useprotected void internalSetExpanded(boolean expanded)
ExpandableComposite
internalSetExpanded
in class ExpandableComposite
expanded
- the expansion stateprotected void reflow()
public void setDescription(String description)
description
- public String getDescription()
null
if DESCRIPTION style was
not used to create the control.public void setSeparatorControl(Control separator)
separator
- the separator that will be placed below the title text.public Control getSeparatorControl()
getSeparatorControl
in class ExpandableComposite
public void setBackground(Color bg)
setBackground
in class ExpandableComposite
bg
- the new backgroundpublic void setForeground(Color fg)
setForeground
in class ExpandableComposite
fg
- the new foreground.public Control getDescriptionControl()
getDescriptionControl
in class ExpandableComposite
null
if DESCRIPTION style
was not used to create the control and description control was
not set by the client.setDescriptionControl(org.eclipse.swt.widgets.Control)
public void setDescriptionControl(Control descriptionControl)
This method and DESCRIPTION
style are mutually exclusive.
Use the method only if you want to create the description control
yourself.
descriptionControl
- the control that will be placed below the title text.public void setTitleBarBorderColor(Color color)
color
- the title bar border colorpublic void setTitleBarBackground(Color color)
color
- the title bar border backgroundpublic void setTitleBarGradientBackground(Color color)
color
- the title bar gradient backgroundpublic Color getTitleBarBorderColor()
public Color getTitleBarGradientBackground()
public Color getTitleBarBackground()
protected void onPaint(PaintEvent e)
ExpandableComposite
onPaint
in class ExpandableComposite
e
- the paint eventpublic final void setBackgroundImage(Image image)
setBackgroundImage
in class Control
image
- the new image (or null)
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.