|
Eclipse Platform Release 3.6 |
|||||||||
| 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
public class 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. |
protected void |
paintHyperlink(GC gc,
Rectangle bounds)
|
void |
setActiveImage(Image activeImage)
Sets the image to show when link is activated. |
void |
setEnabled(boolean enabled)
Enables the receiver if the argument is true,
and disables it otherwise. |
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, getToolTipText, initAccessible, isUnderlined, paintText, setText, setToolTipText, setUnderlined, shortenText |
| 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 |
|---|
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME |
| Methods inherited from class org.eclipse.swt.widgets.Composite |
|---|
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, 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, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, 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, LEFT, RIGHT)| Method Detail |
|---|
protected void paintHyperlink(GC gc)
Hyperlink
paintHyperlink in class Hyperlinkgc - graphic context
protected void paintHyperlink(GC gc,
Rectangle bounds)
public Point computeSize(int wHint,
int hHint,
boolean changed)
computeSize in class HyperlinkwHint - width hinthHint - height hintchanged - if true, any cached layout data should be
computed anew
Layout,
Control.getBorderWidth(),
Control.getBounds(),
Control.getSize(),
Control.pack(boolean),
"computeTrim, getClientArea for controls that implement them"protected void handleEnter(Event e)
AbstractHyperlink
handleEnter in class AbstractHyperlinkprotected void handleExit(Event e)
AbstractHyperlink
handleExit in class AbstractHyperlinkprotected void handleActivate(Event e)
AbstractHyperlink
handleActivate in class AbstractHyperlinkpublic 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 - public void setEnabled(boolean enabled)
Controltrue,
and disables it otherwise. A disabled control is typically
not selectable from the user interface and draws with an
inactive or "grayed" look.
setEnabled in class AbstractHyperlinkenabled - the new enabled state
|
Eclipse Platform Release 3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.