|
Eclipse Platform Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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.Hyperlink
org.eclipse.ui.forms.widgets.ImageHyperlink
This class extends hyperlink widget by adding the capability to render an image relative to the text. If no text has been set, only image will be shown. Images for hover and active states can be set in addition to the normal state image.
When image is taller than the text, additional style can be provided to control vertical alignment (supported values are SWT.TOP, SWT.BOTTOM and SWT.CENTER).
The class does not need to be sublassed but it is allowed to do so if some aspect of the image hyperlink needs to be modified.
Field Summary | |
int |
textSpacing
Amount of pixels between the image and the text (default is 5). |
Fields inherited from class org.eclipse.ui.forms.widgets.AbstractHyperlink |
marginHeight, marginWidth |
Fields inherited from class org.eclipse.swt.widgets.Control |
handle |
Constructor Summary | |
ImageHyperlink(Composite parent,
int style)
Creates the image hyperlink instance. |
Method Summary | |
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Computes the control size by reserving space for images in addition to text. |
Image |
getActiveImage()
Returns active image. |
Image |
getHoverImage()
Returns the hover image. |
Image |
getImage()
Returns the image to show in the normal state. |
protected void |
handleActivate(Event e)
Called when hyperlink has been activated. |
protected void |
handleEnter(Event e)
Called when hyperlink is entered. |
protected void |
handleExit(Event e)
Called when hyperlink is exited. |
protected void |
paintHyperlink(GC gc)
Paints the hyperlink text. |
void |
setActiveImage(Image activeImage)
Sets the image to show when link is activated. |
void |
setHoverImage(Image hoverImage)
Sets the image to show when link is hover state (on mouse over). |
void |
setImage(Image image)
Sets the image to show when link is in the normal state. |
Methods inherited from class org.eclipse.ui.forms.widgets.Hyperlink |
computeTextSize, getText, initAccessible, isUnderlined, paintText, setText, setUnderlined |
Methods inherited from class org.eclipse.ui.forms.widgets.AbstractHyperlink |
addHyperlinkListener, getHref, getSelection, paint, 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.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 |
public int textSpacing
Constructor Detail |
public ImageHyperlink(Composite parent, int style)
parent
- the control parentstyle
- the control style (SWT.WRAP, BOTTOM, TOP, MIDDLE)Method Detail |
protected void paintHyperlink(GC gc)
Hyperlink
paintHyperlink
in class Hyperlink
public Point computeSize(int wHint, int hHint, boolean changed)
computeSize
in class Hyperlink
wHint
- width hinthHint
- height hintchanged
- if true
, any cached layout data should be
computed anewprotected void handleEnter(Event e)
AbstractHyperlink
handleEnter
in class AbstractHyperlink
protected void handleExit(Event e)
AbstractHyperlink
handleExit
in class AbstractHyperlink
protected void handleActivate(Event e)
AbstractHyperlink
handleActivate
in class AbstractHyperlink
public Image getActiveImage()
null
if not set.public void setActiveImage(Image activeImage)
activeImage
- public Image getHoverImage()
null
if not set.public void setHoverImage(Image hoverImage)
hoverImage
- public Image getImage()
null
if not set.public void setImage(Image image)
image
-
|
Eclipse Platform Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.