]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/gallery/ILabelProvider.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / gallery / ILabelProvider.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.g2d.gallery;\r
13 \r
14 import org.eclipse.jface.viewers.IBaseLabelProvider;\r
15 import org.eclipse.swt.SWT;\r
16 import org.eclipse.swt.graphics.Color;\r
17 import org.simantics.g2d.image.Image;\r
18 \r
19 public interface ILabelProvider extends IBaseLabelProvider {\r
20     /**\r
21      * Returns the image for the label of the given element.  The image\r
22      * is owned by the label provider and must not be disposed directly.\r
23      * Instead, dispose the label provider when no longer needed.\r
24      *\r
25      * @param element the element for which to provide the label image\r
26      * @return the image used to label the element, or <code>null</code>\r
27      *   if there is no image for the given object\r
28      */\r
29     public Image getImage(Object element);\r
30 \r
31     /**\r
32      * Returns the text for the label of the given element.\r
33      *\r
34      * @param element the element for which to provide the label text\r
35      * @return the text string used to label the element, or <code>null</code>\r
36      *   if there is no text label for the given object\r
37      */\r
38     public String getText(Object element);\r
39     \r
40     /**\r
41          * Get the image displayed in the tool tip for object.\r
42          * \r
43          * <p>\r
44          * <b>If {@link #getToolTipText(Object)} and\r
45          * {@link #getToolTipImage(Object)} both return <code>null</code> the\r
46          * control is set back to standard behavior</b>\r
47          * </p>\r
48          * \r
49          * @param object\r
50          *            the element for which the tool tip is shown\r
51          * @return {@link Image} or <code>null</code> if there is not image.\r
52          */\r
53 \r
54         public java.awt.Image getToolTipImage(Object object);\r
55         \r
56         /**\r
57          * Get the text displayed in the tool tip for object.\r
58          * \r
59          * <p>\r
60          * <b>If {@link #getToolTipText(Object)} and\r
61          * {@link #getToolTipImage(Object)} both return <code>null</code> the\r
62          * control is set back to standard behavior</b>\r
63          * </p>\r
64          * \r
65          * @param element\r
66          *            the element for which the tool tip is shown\r
67          * @return the {@link String} or <code>null</code> if there is not text to\r
68          *         display\r
69          */\r
70         public String getToolTipText(Object element);\r
71         \r
72         /**\r
73          * Return the background color used for the tool tip\r
74          * \r
75          * @param object\r
76          *            the {@link Object} for which the tool tip is shown\r
77          * \r
78          * @return the {@link Color} used or <code>null</code> if you want to use\r
79          *         the default color {@link SWT#COLOR_INFO_BACKGROUND}\r
80          * @see SWT#COLOR_INFO_BACKGROUND\r
81          */\r
82         public Color getToolTipBackgroundColor(Object object);\r
83         \r
84         /**\r
85          * The foreground color used to display the the text in the tool tip\r
86          * \r
87          * @param object\r
88          *            the {@link Object} for which the tool tip is shown\r
89          * @return the {@link Color} used or <code>null</code> if you want to use\r
90          *         the default color {@link SWT#COLOR_INFO_FOREGROUND}\r
91          * @see SWT#COLOR_INFO_FOREGROUND\r
92          */\r
93         public Color getToolTipForegroundColor(Object object);\r
94 \r
95 }\r