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