Eclipse Platform
Release 3.0

org.eclipse.ui.forms.widgets
Class ToggleHyperlink

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended byorg.eclipse.swt.widgets.Canvas
                      extended byorg.eclipse.ui.forms.widgets.AbstractHyperlink
                          extended byorg.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.

Since:
3.0

Field Summary
protected  boolean hover
           
protected  int innerHeight
           
protected  int innerWidth
           
 
Fields inherited from class org.eclipse.ui.forms.widgets.AbstractHyperlink
marginHeight, marginWidth
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
ToggleHyperlink(Composite parent, int style)
          Creates a control in a provided composite.
 
Method Summary
 Point computeSize(int wHint, int hHint, boolean changed)
          Computes the size of the control.
 Color geHoverDecorationColor()
          Returns the hover color of the decoration.
 Color getDecorationColor()
          Returns the 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 org.eclipse.ui.forms.widgets.AbstractHyperlink
addHyperlinkListener, getHref, getSelection, getText, handleActivate, handleEnter, handleExit, paint, paintHyperlink, removeHyperlinkListener, setHref
 
Methods inherited from class org.eclipse.swt.widgets.Canvas
getCaret, scroll, setCaret, setFont
 
Methods inherited from class org.eclipse.swt.widgets.Composite
checkSubclass, getChildren, getLayout, getTabList, layout, layout, setFocus, setLayout, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

innerWidth

protected int innerWidth

innerHeight

protected int innerHeight

hover

protected boolean hover
Constructor Detail

ToggleHyperlink

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

Parameters:
parent - the parent
style - the style
Method Detail

setDecorationColor

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

Parameters:
decorationColor -

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

geHoverDecorationColor

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

Returns:
the hover color of the decoration.

computeSize

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

Overrides:
computeSize in class Composite
Parameters:
wHint - width hint
hHint - height hint
changed - if true, flush any saved layout state

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


Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.