comparison org.eclipse.jface/src/org/eclipse/jface/fieldassist/FieldDecoration.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
1 /*******************************************************************************
2 * Copyright (c) 2005, 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module org.eclipse.jface.fieldassist.FieldDecoration;
14
15 import org.eclipse.swt.graphics.Image;
16
17 import java.lang.all;
18 import java.util.Set;
19
20 /**
21 * FieldDecoration is a simple data structure class for specifying a decoration
22 * for a field. A decoration may be rendered in different ways depending on the
23 * type of field it is used with.
24 *
25 * @see FieldDecorationRegistry
26 *
27 * @since 3.2
28 */
29 public class FieldDecoration {
30
31 /*
32 * The image to be shown in the decoration.
33 */
34 private Image image;
35
36 /*
37 * The description to show in the decoration's hover.
38 */
39 private String description;
40
41 /**
42 * Create a decoration for a field with the specified image and description
43 * text.
44 *
45 * @param image
46 * the image shown in the decoration. A <code>null</code> image
47 * will result in a blank decoration, which may be used to
48 * reserve space near the field.
49 * @param description
50 * the description shown when the user hovers over the
51 * decoration. A <code>null</code> description indicates that
52 * there will be no hover for the decoration.
53 */
54 public this(Image image, String description) {
55 this.image = image;
56 this.description = description;
57 }
58
59 /**
60 * Return the image shown in the decoration, or <code>null</code> if no
61 * image is specified.
62 *
63 * @return the image shown in the decoration. A return value of
64 * <code>null</code> signifies a blank decoration.
65 */
66 public Image getImage() {
67 return image;
68 }
69
70 /**
71 * Set the image shown in the decoration, or <code>null</code> if no image
72 * is specified. It is up to the caller to update any decorated fields that
73 * are showing the description in order to display the new image.
74 *
75 * @param image
76 * the image shown in the decoration. A value of
77 * <code>null</code> signifies a blank decoration.
78 */
79 public void setImage(Image image) {
80 this.image = image;
81 }
82
83 /**
84 * Return the description for the decoration shown when the user hovers over
85 * the decoration.
86 *
87 * @return the String description of the decoration. A return value of
88 * <code>null</code> indicates that no description will be shown.
89 */
90 public String getDescription() {
91 return description;
92 }
93
94 /**
95 * Set the description for the decoration shown when the user hovers over
96 * the decoration. It is up to the caller to update any decorated fields
97 * showing the description.
98 *
99 * @param description
100 * the String description of the decoration. A value of
101 * <code>null</code> indicates that no description will be
102 * shown.
103 */
104 public void setDescription(String description) {
105 this.description = description;
106 }
107 }