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