Mercurial > projects > dwt-mac
diff dwt/events/TypedEvent.d @ 34:5123b17c98ef
Ported dwt.events.*, dwt.graphics.GC, Region, dwt.internal.image.*
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sun, 14 Sep 2008 01:45:57 +0200 |
parents | 1a8b3cb347e0 |
children | 43be986a1372 |
line wrap: on
line diff
--- a/dwt/events/TypedEvent.d Fri Sep 12 13:53:21 2008 +0200 +++ b/dwt/events/TypedEvent.d Sun Sep 14 01:45:57 2008 +0200 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,16 +7,21 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * Frank Benoit <benoit@tionex.de> *******************************************************************************/ module dwt.events.TypedEvent; import dwt.dwthelper.utils; -import dwt.internal.DWTEventObject; +import dwt.widgets.Event; import dwt.widgets.Display; -import dwt.widgets.Event; import dwt.widgets.Widget; +import dwt.internal.DWTEventObject; + +import tango.text.convert.Format; +import tango.text.Util : split; /** * This is the super class for all typed event classes provided @@ -24,37 +29,38 @@ * applicable to the event occurrence. * * @see dwt.widgets.Event + * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class TypedEvent : DWTEventObject { - + /** * the display where the event occurred - * - * @since 2.0 - */ + * + * @since 2.0 + */ public Display display; - + /** * the widget that issued the event */ public Widget widget; - + /** * the time that the event occurred. - * + * * NOTE: This field is an unsigned integer and should * be AND'ed with 0xFFFFFFFFL so that it can be treated * as a signed long. - */ + */ public int time; - + /** * a field for application use */ public Object data; - static final long serialVersionUID = 3257285846578377524L; - + //static final long serialVersionUID = 3257285846578377524L; + /** * Constructs a new instance of this class. * @@ -80,15 +86,13 @@ /** * Returns the name of the event. This is the name of - * the class without the package name. + * the class without the module name. * * @return the name of the event */ String getName () { - String string = getClass ().getName (); - int index = string.lastIndexOf ('.'); - if (index is -1) return string; - return string.substring (index + 1, string.length ()); + String str = this.classinfo.name; + return split( str, "." )[$-1]; } /** @@ -97,11 +101,9 @@ * * @return a string representation of the event */ -public String toString() { - return getName () - + "{" + widget - + " time=" + time - + " data=" + data - + "}"; +public override String toString() { + String str_widget = widget is null ? "null" : widget.toString; + String str_data = data is null ? "null" : data.toString; + return Format( "{}{{time={} data={}}", str_widget, time, str_data ); } }