1 11 package org.eclipse.ui.internal.forms.widgets; 12 13 import java.util.Hashtable ; 14 15 import org.eclipse.swt.graphics.*; 16 17 public class ImageHyperlinkSegment extends ImageSegment implements 18 IHyperlinkSegment { 19 private String href; 20 private String text; 21 22 private String tooltipText; 23 24 public ImageHyperlinkSegment() { 25 } 26 27 32 public void setHref(String href) { 33 this.href = href; 34 } 35 36 41 public String getHref() { 42 return href; 43 } 44 45 public void paintFocus(GC gc, Color bg, Color fg, boolean selected, 46 Rectangle repaintRegion) { 47 Rectangle bounds = getBounds(); 48 if (bounds == null) 49 return; 50 if (selected) { 51 gc.setBackground(bg); 52 gc.setForeground(fg); 53 gc.drawFocus(bounds.x, bounds.y, bounds.width, bounds.height); 54 } else { 55 gc.setForeground(bg); 56 gc.drawRectangle(bounds.x, bounds.y, bounds.width - 1, 57 bounds.height - 1); 58 } 59 } 60 61 66 public boolean isWordWrapAllowed() { 67 return !isNowrap(); 68 } 69 70 75 public void setWordWrapAllowed(boolean value) { 76 setNowrap(!value); 77 } 78 79 84 public String getText() { 85 return text!=null?text:""; } 87 88 public void setText(String text) { 89 this.text = text; 90 } 91 92 95 public String getTooltipText() { 96 return tooltipText; 97 } 98 99 103 public void setTooltipText(String tooltipText) { 104 this.tooltipText = tooltipText; 105 } 106 107 public boolean isSelectable() { 108 return true; 109 } 110 111 public boolean isFocusSelectable(Hashtable resourceTable) { 112 return true; 113 } 114 115 public boolean setFocus(Hashtable resourceTable, boolean direction) { 116 return true; 117 } 118 } 119 | Popular Tags |