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