Mercurial > projects > dwt-addons
view dwtx/ui/internal/forms/widgets/TextHyperlinkSegment.d @ 76:e193036d82c9
Fix continue porting
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 24 May 2008 06:18:55 +0200 |
parents | 5d489b9f966c |
children | 26c6c9dfd13c |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Port to the D programming language: * Frank Benoit <benoit@tionex.de> *******************************************************************************/ module dwtx.ui.internal.forms.widgets.TextHyperlinkSegment; import dwtx.ui.internal.forms.widgets.TextSegment; import dwtx.ui.internal.forms.widgets.IHyperlinkSegment; import dwtx.ui.internal.forms.widgets.SelectionData; import dwt.graphics.Color; import dwt.graphics.GC; import dwt.graphics.Rectangle; import dwtx.ui.forms.HyperlinkSettings; import dwt.dwthelper.utils; //import tango.util.collection.HashMap; /** * @version 1.0 * @author */ public class TextHyperlinkSegment : TextSegment, IHyperlinkSegment { private String href; private String tooltipText; //private static final String LINK_FG = "c.___link_fg"; private HyperlinkSettings settings; public this(String text, HyperlinkSettings settings, String fontId) { super(text, fontId); this.settings = settings; underline = settings.getHyperlinkUnderlineMode() is HyperlinkSettings.UNDERLINE_ALWAYS; } /* * @see IObjectReference#getObjectId() */ public String getHref() { return href; } public void setHref(String href) { this.href = href; } /* * public void paint(GC gc, int width, Locator locator, Hashtable * resourceTable, bool selected, SelectionData selData) { * resourceTable.put(LINK_FG, settings.getForeground()); * setColorId(LINK_FG); super.paint(gc, width, locator, resourceTable, * selected, selData); } */ public void paint(GC gc, bool hover, Hashtable resourceTable, bool selected, SelectionData selData, Rectangle repaintRegion) { bool rolloverMode = settings.getHyperlinkUnderlineMode() is HyperlinkSettings.UNDERLINE_HOVER; Color savedFg = gc.getForeground(); Color newFg = hover ? settings.getActiveForeground() : settings .getForeground(); if (newFg !is null) gc.setForeground(newFg); super.paint(gc, hover, resourceTable, selected, rolloverMode, selData, repaintRegion); gc.setForeground(savedFg); } public String getTooltipText() { return tooltipText; } public void setTooltipText(String tooltip) { this.tooltipText = tooltip; } public bool isSelectable() { return true; } public bool isFocusSelectable(Hashtable resourceTable) { return true; } public bool setFocus(Hashtable resourceTable, bool direction) { return true; } }