1 11 package org.eclipse.ui.forms; 12 import org.eclipse.jface.resource.JFaceColors; 13 import org.eclipse.swt.SWT; 14 import org.eclipse.swt.graphics.*; 15 import org.eclipse.swt.widgets.Display; 16 import org.eclipse.ui.internal.forms.widgets.*; 17 24 public class HyperlinkSettings { 25 28 public static final int UNDERLINE_NEVER = 1; 29 33 public static final int UNDERLINE_HOVER = 2; 34 37 public static final int UNDERLINE_ALWAYS = 3; 38 private int hyperlinkUnderlineMode = UNDERLINE_ALWAYS; 39 private Color background; 40 private Color foreground; 41 private Color activeBackground; 42 private Color activeForeground; 43 49 public HyperlinkSettings(Display display) { 50 initializeDefaultForegrounds(display); 51 } 52 60 public void initializeDefaultForegrounds(Display display) { 61 Color fg = JFaceColors.getHyperlinkText(display); 62 Color afg = JFaceColors.getActiveHyperlinkText(display); 63 if (fg==null) 64 fg = display.getSystemColor(SWT.COLOR_BLUE); 65 setForeground(fg); 66 setActiveForeground(afg); 67 } 68 73 public Color getActiveBackground() { 74 return activeBackground; 75 } 76 81 public Color getActiveForeground() { 82 return activeForeground; 83 } 84 89 public Color getBackground() { 90 return background; 91 } 92 99 public Cursor getBusyCursor() { 100 return FormsResources.getBusyCursor(); 101 } 102 107 public Cursor getTextCursor() { 108 return FormsResources.getTextCursor(); 109 } 110 115 public Color getForeground() { 116 return foreground; 117 } 118 123 public Cursor getHyperlinkCursor() { 124 return FormsResources.getHandCursor(); 125 } 126 132 public int getHyperlinkUnderlineMode() { 133 return hyperlinkUnderlineMode; 134 } 135 141 public void setActiveBackground(Color newActiveBackground) { 142 activeBackground = newActiveBackground; 143 } 144 150 public void setActiveForeground(Color newActiveForeground) { 151 activeForeground = newActiveForeground; 152 } 153 159 public void setBackground(Color newBackground) { 160 background = newBackground; 161 } 162 168 public void setForeground(Color newForeground) { 169 foreground = newForeground; 170 } 171 179 public void setHyperlinkUnderlineMode(int mode) { 180 hyperlinkUnderlineMode = mode; 181 } 182 } 183 | Popular Tags |