Mercurial > projects > dwt-addons
view dwtx/ui/internal/forms/widgets/ImageHyperlinkSegment.d @ 75:5d489b9f966c
Fix continue porting
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 24 May 2008 05:11:16 +0200 |
parents | |
children | e193036d82c9 |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2003, 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.ImageHyperlinkSegment; import java.util.Hashtable; import dwt.graphics.Color; import dwt.graphics.GC; import dwt.graphics.Rectangle; public class ImageHyperlinkSegment extends ImageSegment implements IHyperlinkSegment { private String href; private String text; private String tooltipText; public ImageHyperlinkSegment() { } /* * (non-Javadoc) * * @see dwtx.ui.internal.forms.widgets.IHyperlinkSegment#setHref(java.lang.String) */ public void setHref(String href) { this.href = href; } /* * (non-Javadoc) * * @see dwtx.ui.internal.forms.widgets.IHyperlinkSegment#getHref() */ public String getHref() { return href; } public void paintFocus(GC gc, Color bg, Color fg, bool selected, Rectangle repaintRegion) { Rectangle bounds = getBounds(); if (bounds is null) return; if (selected) { gc.setBackground(bg); gc.setForeground(fg); gc.drawFocus(bounds.x, bounds.y, bounds.width, bounds.height); } else { gc.setForeground(bg); gc.drawRectangle(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1); } } /* * (non-Javadoc) * * @see dwtx.ui.internal.forms.widgets.IHyperlinkSegment#isWordWrapAllowed() */ public bool isWordWrapAllowed() { return !isNowrap(); } /* * (non-Javadoc) * * @see dwtx.ui.internal.forms.widgets.IHyperlinkSegment#setWordWrapAllowed(bool) */ public void setWordWrapAllowed(bool value) { setNowrap(!value); } /* * (non-Javadoc) * * @see dwtx.ui.internal.forms.widgets.IHyperlinkSegment#getText() */ public String getText() { return text!isnull?text:""; //$NON-NLS-1$ } public void setText(String text) { this.text = text; } /** * @return Returns the tooltipText. */ public String getTooltipText() { return tooltipText; } /** * @param tooltipText * The tooltipText to set. */ public void setTooltipText(String tooltipText) { this.tooltipText = tooltipText; } public bool isSelectable() { return true; } public bool isFocusSelectable(Hashtable resourceTable) { return true; } public bool setFocus(Hashtable resourceTable, bool direction) { return true; } }