Mercurial > projects > dwt-mac
comparison dwt/events/SelectionEvent.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 649b8e223d5a |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 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 *******************************************************************************/ | |
11 module dwt.events.SelectionEvent; | |
12 | |
13 import dwt.dwthelper.utils; | |
14 | |
15 | |
16 import dwt.widgets.Event; | |
17 import dwt.widgets.Widget; | |
18 | |
19 /** | |
20 * Instances of this class are sent as a result of | |
21 * widgets being selected. | |
22 * <p> | |
23 * Note: The fields that are filled in depend on the widget. | |
24 * </p> | |
25 * | |
26 * @see SelectionListener | |
27 */ | |
28 | |
29 public class SelectionEvent extends TypedEvent { | |
30 | |
31 /** | |
32 * The item that was selected. | |
33 */ | |
34 public Widget item; | |
35 | |
36 /** | |
37 * Extra detail information about the selection, depending on the widget. | |
38 * | |
39 * <p><b>Sash</b><ul> | |
40 * <li>{@link dwt.DWT#DRAG}</li> | |
41 * </ul></p><p><b>ScrollBar and Slider</b><ul> | |
42 * <li>{@link dwt.DWT#DRAG}</li> | |
43 * <li>{@link dwt.DWT#HOME}</li> | |
44 * <li>{@link dwt.DWT#END}</li> | |
45 * <li>{@link dwt.DWT#ARROW_DOWN}</li> | |
46 * <li>{@link dwt.DWT#ARROW_UP}</li> | |
47 * <li>{@link dwt.DWT#PAGE_DOWN}</li> | |
48 * <li>{@link dwt.DWT#PAGE_UP}</li> | |
49 * </ul></p><p><b>Table and Tree</b><ul> | |
50 * <li>{@link dwt.DWT#CHECK}</li> | |
51 * </ul></p><p><b>Text</b><ul> | |
52 * <li>{@link dwt.DWT#CANCEL}</li> | |
53 * </ul></p><p><b>CoolItem and ToolItem</b><ul> | |
54 * <li>{@link dwt.DWT#ARROW}</li> | |
55 * </ul></p> | |
56 */ | |
57 public int detail; | |
58 | |
59 /** | |
60 * The x location of the selected area. | |
61 */ | |
62 public int x; | |
63 | |
64 /** | |
65 * The y location of selected area. | |
66 */ | |
67 public int y; | |
68 | |
69 /** | |
70 * The width of selected area. | |
71 */ | |
72 public int width; | |
73 | |
74 /** | |
75 * The height of selected area. | |
76 */ | |
77 public int height; | |
78 | |
79 /** | |
80 * The state of the keyboard modifier keys at the time | |
81 * the event was generated. | |
82 */ | |
83 public int stateMask; | |
84 | |
85 /** | |
86 * The text of the hyperlink that was selected. | |
87 * This will be either the text of the hyperlink or the value of its HREF, | |
88 * if one was specified. | |
89 * | |
90 * @see dwt.widgets.Link#setText(String) | |
91 * @since 3.1 | |
92 */ | |
93 public String text; | |
94 | |
95 /** | |
96 * A flag indicating whether the operation should be allowed. | |
97 * Setting this field to <code>false</code> will cancel the | |
98 * operation, depending on the widget. | |
99 */ | |
100 public bool doit; | |
101 | |
102 static final long serialVersionUID = 3976735856884987953L; | |
103 | |
104 /** | |
105 * Constructs a new instance of this class based on the | |
106 * information in the given untyped event. | |
107 * | |
108 * @param e the untyped event containing the information | |
109 */ | |
110 public SelectionEvent(Event e) { | |
111 super(e); | |
112 this.item = e.item; | |
113 this.x = e.x; | |
114 this.y = e.y; | |
115 this.width = e.width; | |
116 this.height = e.height; | |
117 this.detail = e.detail; | |
118 this.stateMask = e.stateMask; | |
119 this.text = e.text; | |
120 this.doit = e.doit; | |
121 } | |
122 | |
123 /** | |
124 * Returns a string containing a concise, human-readable | |
125 * description of the receiver. | |
126 * | |
127 * @return a string representation of the event | |
128 */ | |
129 public String toString() { | |
130 String string = super.toString (); | |
131 return string.substring (0, string.length() - 1) // remove trailing '}' | |
132 + " item=" + item | |
133 + " detail=" + detail | |
134 + " x=" + x | |
135 + " y=" + y | |
136 + " width=" + width | |
137 + " height=" + height | |
138 + " stateMask=" + stateMask | |
139 + " text=" + text | |
140 + " doit=" + doit | |
141 + "}"; | |
142 } | |
143 } | |
144 |