Mercurial > projects > dwt-linux
annotate dwt/events/TypedEvent.d @ 238:380bad9f6852
reverted char[] to String
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:42:55 +0200 |
parents | f2e04420fd6c |
children | c0d810de7093 |
rev | line source |
---|---|
72 | 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 | |
72 | 10 * Port to the D programming language: |
11 * Frank Benoit <benoit@tionex.de> | |
1 | 12 *******************************************************************************/ |
10
63c023465156
moved from org.eclipse.swt to dwt
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
13 module dwt.events.TypedEvent; |
1 | 14 |
238 | 15 import dwt.dwthelper.utils; |
16 | |
1 | 17 |
10
63c023465156
moved from org.eclipse.swt to dwt
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
18 import dwt.widgets.Event; |
26 | 19 import dwt.widgets.Display; |
20 import dwt.widgets.Widget; | |
71 | 21 import dwt.internal.DWTEventObject; |
1 | 22 |
23 import tango.text.convert.Format; | |
24 import tango.text.Util : split; | |
25 | |
26 /** | |
27 * This is the super class for all typed event classes provided | |
71 | 28 * by DWT. Typed events contain particular information which is |
1 | 29 * applicable to the event occurrence. |
30 * | |
10
63c023465156
moved from org.eclipse.swt to dwt
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
31 * @see dwt.widgets.Event |
1 | 32 */ |
71 | 33 public class TypedEvent : DWTEventObject { |
1 | 34 |
59
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
35 /** |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
36 * the display where the event occurred |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
37 * |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
38 * @since 2.0 |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
39 */ |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
40 public Display display; |
1 | 41 |
59
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
42 /** |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
43 * the widget that issued the event |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
44 */ |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
45 public Widget widget; |
1 | 46 |
59
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
47 /** |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
48 * the time that the event occurred. |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
49 * |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
50 * NOTE: This field is an unsigned integer and should |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
51 * be AND'ed with 0xFFFFFFFFL so that it can be treated |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
52 * as a signed long. |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
53 */ |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
54 public int time; |
1 | 55 |
59
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
56 /** |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
57 * a field for application use |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
58 */ |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
59 public Object data; |
1 | 60 |
59
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
61 //static final long serialVersionUID = 3257285846578377524L; |
1 | 62 |
63 /** | |
64 * Constructs a new instance of this class. | |
65 * | |
66 * @param object the object that fired the event | |
67 */ | |
68 public this(Object object) { | |
59
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
69 super(object); |
1 | 70 } |
71 | |
72 /** | |
73 * Constructs a new instance of this class based on the | |
74 * information in the argument. | |
75 * | |
76 * @param e the low level event to initialize the receiver with | |
77 */ | |
78 public this(Event e) { | |
59
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
79 super(e.widget); |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
80 this.display = e.display; |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
81 this.widget = e.widget; |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
82 this.time = e.time; |
8cec8f536af3
All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
83 this.data = e.data; |
1 | 84 } |
85 | |
86 /** | |
87 * Returns the name of the event. This is the name of | |
88 * the class without the module name. | |
89 * | |
90 * @return the name of the event | |
91 */ | |
238 | 92 String getName () { |
93 String str = this.classinfo.name; | |
1 | 94 return split( str, "." )[$-1]; |
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 */ | |
238 | 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; | |
143 | 106 return Format( "{}{{time={} data={}}", str_widget, time, str_data ); |
1 | 107 } |
108 } |