Mercurial > projects > dwt-addons
view dwtx/jface/viewers/LabelDecorator.d @ 10:b6c35faf97c8
Viewers
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 31 Mar 2008 00:47:19 +0200 |
parents | |
children |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2006 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.jface.viewers.LabelDecorator; import dwtx.jface.viewers.ILabelDecorator; import dwtx.jface.viewers.IDecorationContext; import dwt.graphics.Image; import dwt.dwthelper.utils; /** * The LabelDecorator is an abstract superclass of ILabelDecorators * that support IDecorationContext. * @see IDecorationContext * @since 3.2 * */ public abstract class LabelDecorator : ILabelDecorator { /** * Returns an image that is based on the given image, * but decorated with additional information relating to the state * of the provided element taking into account the provided context. * * Text and image decoration updates can occur as a result of other updates * within the workbench including deferred decoration by background processes. * Clients should handle labelProviderChangedEvents for the given element to get * the complete decoration. * @see LabelProviderChangedEvent * @see IBaseLabelProvider#addListener * * @param image the input image to decorate, or <code>null</code> if the element has no image * @param element the element whose image is being decorated * @param context additional context information about the element being decorated * @return the decorated image, or <code>null</code> if no decoration is to be applied * * @see dwtx.jface.resource.CompositeImageDescriptor */ public abstract Image decorateImage(Image image, Object element, IDecorationContext context); /** * Returns a text label that is based on the given text label, * but decorated with additional information relating to the state * of the provided element taking into account the provided context. * * Text and image decoration updates can occur as a result of other updates * within the workbench including deferred decoration by background processes. * Clients should handle labelProviderChangedEvents for the given element to get * the complete decoration. * @see LabelProviderChangedEvent * @see IBaseLabelProvider#addListener * * @param text the input text label to decorate * @param element the element whose image is being decorated * @param context additional context information about the element being decorated * @return the decorated text label, or <code>null</code> if no decoration is to be applied */ public abstract String decorateText(String text, Object element, IDecorationContext context); /** * Prepare the element for decoration. If it is already decorated and ready for update * return true. If decoration is pending return false. * @param element The element to be decorated * @param originalText The starting text. * @param context The decoration context * @return bool <code>true</code> if the decoration is ready for this element */ public abstract bool prepareDecoration(Object element, String originalText, IDecorationContext context); }