# Class ToggleHyperlink

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.widgets.Canvas
org.eclipse.ui.forms.widgets.AbstractHyperlink
org.eclipse.ui.forms.widgets.ToggleHyperlink

All Implemented Interfaces:
  `Drawable`

Direct Known Subclasses:
  `TreeNode, Twistie`

public abstract class ToggleHyperlink extends AbstractHyperlink
A custom selectable control that can be used to control areas that can be expanded or collapsed.

This is an abstract class. Subclasses are responsible for rendering the control using decoration and hover decoration color. Control should be rendered based on the current expansion state.

Styles:
  None

Since:
  3.0

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`hover`
`protected int`
`innerHeight`
`protected int`
`innerWidth`

### Fields inherited from class AbstractHyperlink

`marginHeight, marginWidth`

### Fields inherited from class Control

`handle`

### Fields inherited from class Widget

`nativeZoom`

## Constructor Summary

Constructors
Constructor
Description
`ToggleHyperlink(Composite parent, int style)`
Creates a control in a provided composite.

## Method Summary

Modifier and Type
Method
Description
`Point`
`computeSize(int wHint, int hHint, boolean changed)`
Computes the size of the control.
`Color`
`geHoverDecorationColor()`
Deprecated.
use `getHoverDecorationColor`
`Color`
`getDecorationColor()`
Returns the color of the decoration.
`Color`
`getHoverDecorationColor()`
Returns the hover color of the decoration.
`boolean`
`isExpanded()`
Returns the expansion state of the toggle control.
`void`
`setDecorationColor(Color decorationColor)`
Sets the color of the decoration.
`void`
`setExpanded(boolean expanded)`
Sets the expansion state of the twistie control
`void`
`setHoverDecorationColor(Color hoverColor)`
Sets the hover color of decoration.

### Methods inherited from class AbstractHyperlink

`addHyperlinkListener, getHref, getSelection, getText, handleActivate, handleEnter, handleExit, paint, paintHyperlink, removeHyperlinkListener, setEnabled, setHref`

### Methods inherited from class Canvas

`drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME`

### Methods inherited from class Composite

`changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString`

### Methods inherited from class Scrollable

`computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsMode`

### Methods inherited from class Control

`addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getData, 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, requestLayout, setAutoscalingMode, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setData, setDragDetect, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update`

### Methods inherited from class Widget

`addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface Drawable

`isAutoScalable`

## Field Details

### innerWidth

protected int innerWidth

### innerHeight

protected int innerHeight

### hover

protected boolean hover

## Constructor Details

### ToggleHyperlink

public ToggleHyperlink(Composite parent, int style)
Creates a control in a provided composite.

Parameters:
  `parent` - the parent
  `style` - the style

## Method Details

### setDecorationColor

public void setDecorationColor(Color decorationColor)
Sets the color of the decoration.

Parameters:
  `decorationColor` - color to set

### getDecorationColor

public Color getDecorationColor()
Returns the color of the decoration.

Returns:
  decoration color

### setHoverDecorationColor

public void setHoverDecorationColor(Color hoverColor)
Sets the hover color of decoration. Hover color will be used when mouse enters the decoration area.

Parameters:
  `hoverColor` - the hover color to use

### getHoverDecorationColor

public Color getHoverDecorationColor()
Returns the hover color of the decoration.

Returns:
  the hover color of the decoration.
Since:
  3.1

### geHoverDecorationColor

@Deprecated public Color geHoverDecorationColor()
Deprecated.
use `getHoverDecorationColor`
Returns the hover color of the decoration.

Returns:
  the hover color of the decoration.
See Also:
  - `getHoverDecorationColor()`

### computeSize

public Point computeSize(int wHint, int hHint, boolean changed)
Computes the size of the control.

Overrides:
  `computeSize` in class `Control`
Parameters:
  `wHint` - width hint
  `hHint` - height hint
  `changed` - if true, flush any saved layout state
Returns:
  the preferred size of the control.
See Also:
  - `Layout`
  - `Control.getBorderWidth()`
  - `Control.getBounds()`
  - `Control.getSize()`
  - `Control.pack(boolean)`
  - "computeTrim, getClientArea for controls that implement them"

### isExpanded

public boolean isExpanded()
Returns the expansion state of the toggle control. When toggle is in the normal (downward) state, the value is `true` . Collapsed control will return `false` .

Returns:
  `false` if collapsed, `true` otherwise.

### setExpanded

public void setExpanded(boolean expanded)
Sets the expansion state of the twistie control

Parameters:
  `expanded` - the expansion state