Mercurial > projects > dwt-mac
comparison dwt/browser/LocationEvent.d @ 125:5583f8eeee6c
Synced mozilla with dwt-linux
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Fri, 16 Jan 2009 12:49:08 +0100 |
parents | d8635bb48c7c |
children |
comparison
equal
deleted
inserted
replaced
124:540fa4e9974a | 125:5583f8eeee6c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2003, 2008 IBM Corporation and others. | 2 * Copyright (c) 2003, 2004 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | |
11 * Port to the D programming language: | 10 * Port to the D programming language: |
12 * Jacob Carlborg <doob@me.com> | 11 * John Reimer <terminal.node@gmail.com> |
13 *******************************************************************************/ | 12 *******************************************************************************/ |
14 module dwt.browser.LocationEvent; | 13 module dwt.browser.LocationEvent; |
15 | 14 |
15 import tango.text.convert.Format; | |
16 | |
16 import dwt.events.TypedEvent; | 17 import dwt.events.TypedEvent; |
17 import dwt.widgets.Widget; | 18 import dwt.widgets.Widget; |
18 | 19 import dwt.dwthelper.utils; |
19 import dwt.dwthelper.string; | |
20 | 20 |
21 /** | 21 /** |
22 * A <code>LocationEvent</code> is sent by a {@link Browser} to | 22 * A <code>LocationEvent</code> is sent by a {@link Browser} to |
23 * {@link LocationListener}'s when the <code>Browser</code> | 23 * {@link LocationListener}'s when the <code>Browser</code> |
24 * navigates to a different URL. This notification typically | 24 * navigates to a different URL. This notification typically |
25 * occurs when the application navigates to a new location with | 25 * occurs when the application navigates to a new location with |
26 * {@link Browser#setUrl(String)} or when the user activates a | 26 * {@link Browser#setUrl(String)} or when the user activates a |
27 * hyperlink. | 27 * hyperlink. |
28 * | 28 * |
29 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
30 * | |
31 * @since 3.0 | 29 * @since 3.0 |
32 */ | 30 */ |
33 public class LocationEvent : TypedEvent { | 31 public class LocationEvent : TypedEvent { |
34 /** current location */ | 32 /** current location */ |
35 public String location; | 33 public String location; |
36 | 34 |
37 /** | 35 /** |
38 * A flag indicating whether the location opens in the top frame | 36 * A flag indicating whether the location opens in the top frame |
39 * or not. | 37 * or not. |
40 */ | 38 */ |
41 public bool top; | 39 public bool top; |
42 | 40 |
43 /** | 41 /** |
44 * A flag indicating whether the location loading should be allowed. | 42 * A flag indicating whether the location loading should be allowed. |
45 * Setting this field to <code>false</code> will cancel the operation. | 43 * Setting this field to <code>false</code> will cancel the operation. |
46 */ | 44 */ |
47 public bool doit; | 45 public bool doit; |
48 | 46 |
49 static final long serialVersionUID = 3906644198244299574L; | 47 static final long serialVersionUID = 3906644198244299574L; |
50 | 48 |
51 this (Widget w) { | 49 this(Widget w) { |
52 super(w); | 50 super(w); |
53 } | 51 } |
54 | 52 |
55 /** | 53 /** |
56 * Returns a String containing a concise, human-readable | 54 * Returns a string containing a concise, human-readable |
57 * description of the receiver. | 55 * description of the receiver. |
58 * | 56 * |
59 * @return a String representation of the event | 57 * @return a string representation of the event |
60 */ | 58 */ |
61 public String toString () { | 59 public override String toString() { |
62 String str = super.toString(); | 60 return Format( "{} {location = {}, top = {}, doit = {}}", |
63 return str.substring(0, str.length() - 1) // remove trailing '}' | 61 super.toString[1 .. $-2], location, top, doit ); |
64 + " location=" + location + " top=" + top + " doit=" + doit + "}"; | |
65 } | 62 } |
66 } | 63 } |