Mercurial > projects > dwt2
annotate org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TypedEvent.d @ 125:c43718956f21 default tip
Updated the snippets status.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Thu, 11 Aug 2011 19:55:14 +0200 |
parents | 536e43f63c81 |
children |
rev | line source |
---|---|
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.TypedEvent; | |
14 | |
15 | |
16 import org.eclipse.swt.widgets.Event; | |
17 import org.eclipse.swt.widgets.Display; | |
18 import org.eclipse.swt.widgets.Widget; | |
19 import org.eclipse.swt.internal.SWTEventObject; | |
20 | |
48 | 21 import java.lang.all; |
25 | 22 |
23 /** | |
24 * This is the super class for all typed event classes provided | |
25 * by SWT. Typed events contain particular information which is | |
26 * applicable to the event occurrence. | |
27 * | |
28 * @see org.eclipse.swt.widgets.Event | |
29 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
30 */ | |
31 public class TypedEvent : SWTEventObject { | |
32 | |
33 /** | |
34 * the display where the event occurred | |
35 * | |
36 * @since 2.0 | |
37 */ | |
38 public Display display; | |
39 | |
40 /** | |
41 * the widget that issued the event | |
42 */ | |
43 public Widget widget; | |
44 | |
45 /** | |
46 * the time that the event occurred. | |
47 * | |
48 * NOTE: This field is an unsigned integer and should | |
49 * be AND'ed with 0xFFFFFFFFL so that it can be treated | |
50 * as a signed long. | |
51 */ | |
52 public int time; | |
53 | |
54 /** | |
55 * a field for application use | |
56 */ | |
57 public Object data; | |
58 | |
49
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
59 //static const long serialVersionUID = 3257285846578377524L; |
25 | 60 |
61 /** | |
62 * Constructs a new instance of this class. | |
63 * | |
64 * @param object the object that fired the event | |
65 */ | |
66 public this(Object object) { | |
67 super(object); | |
68 } | |
69 | |
70 /** | |
71 * Constructs a new instance of this class based on the | |
72 * information in the argument. | |
73 * | |
74 * @param e the low level event to initialize the receiver with | |
75 */ | |
76 public this(Event e) { | |
77 super(e.widget); | |
78 this.display = e.display; | |
79 this.widget = e.widget; | |
80 this.time = e.time; | |
81 this.data = e.data; | |
82 } | |
83 | |
84 /** | |
85 * Returns the name of the event. This is the name of | |
86 * the class without the module name. | |
87 * | |
88 * @return the name of the event | |
89 */ | |
90 String getName () { | |
51 | 91 String string = this.classinfo.name; |
92 int index = string.lastIndexOf ('.'); | |
93 if (index is -1) return string; | |
94 return string.substring (index + 1, string.length ()); | |
25 | 95 } |
96 | |
97 /** | |
98 * Returns a string containing a concise, human-readable | |
99 * description of the receiver. | |
100 * | |
101 * @return a string representation of the event | |
102 */ | |
103 public override String toString() { | |
104 String str_widget = widget is null ? "null" : widget.toString; | |
105 String str_data = data is null ? "null" : data.toString; | |
120
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
51
diff
changeset
|
106 return Format( "{}{{{} time={} data={}}", getName(), str_widget, time, str_data ); |
25 | 107 } |
108 } |