Mercurial > projects > dwt2
annotate org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/events/TraverseEvent.d @ 120:536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
===D2===
* added [Try]Immutable/Const/Shared templates to work with differenses in D1/D2 instead of version statements
used these templates to work with strict type storage rules of dmd-2.053
* com.ibm.icu now also compilable with D2, but not tested yet
* small fixes
Snippet288 - shared data is in TLS
===Phobos===
* fixed critical bugs in Phobos implemention
completely incorrect segfault prone fromStringz (Linux's port ruthless killer)
terrible, incorrect StringBuffer realization (StyledText killer)
* fixed small bugs as well
Snippet72 - misprint in the snippet
* implemented missed functionality for Phobos
ByteArrayOutputStream implemented (image loading available)
formatting correctly works for all DWT's cases
As a result, folowing snippets now works with Phobos (Snippet### - what is fixed):
Snippet24, 42, 111, 115, 130, 235, 276 - bad string formatting
Snippet48, 282 - crash on image loading
Snippet163, 189, 211, 213, 217, 218, 222 - crash on copy/cut in StyledText
Snippet244 - hang-up
===Tango===
* few changes for the latest Tango trunc-r5661
* few small performance improvments
===General===
* implMissing-s for only one version changed to implMissingInTango/InPhobos
* incorrect calls to Format in toString-s fixed
* fixed loading \uXXXX characters in ResourceBundle
* added good UTF-8 support for StyledText, TextLayout (Win32) and friends
UTF functions revised and tested. It is now in java.nonstandard.*Utf modules
StyledText and TextLayout (Win32) modules revised for UTF-8 support
* removed small diferences in most identical files in *.swt.* folders
*.swt.internal.image, *.swt.events and *.swt.custom are identical in Win32/Linux32
now 179 of 576 (~31%) files in *.swt.* folders are fully identical
* Win32: snippets now have right subsystem, pretty icons and native system style controls
* small fixes in snippets
Snippet44 - it's not Snippet44
Snippet212 - functions work with different images and offsets arrays
Win32: Snippet282 - crash on close if the button has an image
Snippet293 - setGrayed is commented
and others
Win32: As a result, folowing snippets now works
Snippet68 - color doesn't change
Snippet163, 189, 211, 213, 217, 218, 222 - UTF-8 issues (see above)
Snippet193 - no tabel headers
author | Denis Shelomovskij <verylonglogin.reg@gmail.com> |
---|---|
date | Sat, 09 Jul 2011 15:50:20 +0300 |
parents | 7a2dd761a8b2 |
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.TraverseEvent; | |
14 | |
15 | |
16 import org.eclipse.swt.widgets.Event; | |
17 import org.eclipse.swt.events.KeyEvent; | |
18 | |
19 import java.lang.all; | |
20 | |
21 /** | |
22 * Instances of this class are sent as a result of | |
23 * widget traversal actions. | |
24 * <p> | |
25 * The traversal event allows fine control over keyboard traversal | |
26 * in a control both to implement traversal and override the default | |
27 * traversal behavior defined by the system. This is achieved using | |
28 * two fields, <code>detail</code> and <code>doit</code>. | |
29 * </p><p> | |
30 * When a control is traversed, a traverse event is sent. The detail | |
31 * describes the type of traversal and the doit field indicates the default | |
32 * behavior of the system. For example, when a right arrow key is pressed | |
33 * in a text control, the detail field is <code>TRAVERSE_ARROW_NEXT</code> | |
34 * and the doit field is <code>false</code>, indicating that the system | |
35 * will not traverse to the next tab item and the arrow key will be | |
36 * delivered to the text control. If the same key is pressed in a radio | |
37 * button, the doit field will be <code>true</code>, indicating that | |
38 * traversal is to proceed to the next tab item, possibly another radio | |
39 * button in the group and that the arrow key is not to be delivered | |
40 * to the radio button. | |
41 * </p><p> | |
42 * How can the traversal event be used to implement traversal? | |
43 * When a tab key is pressed in a canvas, the detail field will be | |
44 * <code>TRAVERSE_TAB_NEXT</code> and the doit field will be | |
45 * <code>false</code>. The default behavior of the system is to | |
46 * provide no traversal for canvas controls. This means that by | |
47 * default in a canvas, a key listener will see every key that the | |
48 * user types, including traversal keys. To understand why this | |
49 * is so, it is important to understand that only the widget implementor | |
50 * can decide which traversal is appropriate for the widget. Returning | |
51 * to the <code>TRAVERSE_TAB_NEXT</code> example, a text widget implemented | |
52 * by a canvas would typically want to use the tab key to insert a | |
53 * tab character into the widget. A list widget implementation, on the | |
54 * other hand, would like the system default traversal behavior. Using | |
55 * only the doit flag, both implementations are possible. The text widget | |
56 * implementor sets doit to <code>false</code>, ensuring that the system | |
57 * will not traverse and that the tab key will be delivered to key listeners. | |
58 * The list widget implementor sets doit to <code>true</code>, indicating | |
59 * that the system should perform tab traversal and that the key should not | |
60 * be delivered to the list widget. | |
61 * </p><p> | |
62 * How can the traversal event be used to override system traversal? | |
63 * When the return key is pressed in a single line text control, the | |
64 * detail field is <code>TRAVERSE_RETURN</code> and the doit field | |
65 * is <code>true</code>. This means that the return key will be processed | |
66 * by the default button, not the text widget. If the text widget has | |
67 * a default selection listener, it will not run because the return key | |
68 * will be processed by the default button. Imagine that the text control | |
69 * is being used as an in-place editor and return is used to dispose the | |
70 * widget. Setting doit to <code>false</code> will stop the system from | |
71 * activating the default button but the key will be delivered to the text | |
72 * control, running the key and selection listeners for the text. How | |
73 * can <code>TRAVERSE_RETURN</code> be implemented so that the default button | |
74 * will not be activated and the text widget will not see the return key? | |
75 * This is achieved by setting doit to <code>true</code>, and the detail | |
76 * to <code>TRAVERSE_NONE</code>. | |
77 * </p><p> | |
78 * Note: A widget implementor will typically implement traversal using | |
79 * only the doit flag to either enable or disable system traversal. | |
80 * </p> | |
81 * | |
82 * @see TraverseListener | |
83 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
84 */ | |
85 | |
86 public final class TraverseEvent : KeyEvent { | |
87 | |
88 /** | |
89 * The traversal type. | |
90 * <p><ul> | |
91 * <li>{@link org.eclipse.swt.SWT#TRAVERSE_NONE}</li> | |
92 * <li>{@link org.eclipse.swt.SWT#TRAVERSE_ESCAPE}</li> | |
93 * <li>{@link org.eclipse.swt.SWT#TRAVERSE_RETURN}</li> | |
94 * <li>{@link org.eclipse.swt.SWT#TRAVERSE_TAB_NEXT}</li> | |
95 * <li>{@link org.eclipse.swt.SWT#TRAVERSE_TAB_PREVIOUS}</li> | |
96 * <li>{@link org.eclipse.swt.SWT#TRAVERSE_ARROW_NEXT}</li> | |
97 * <li>{@link org.eclipse.swt.SWT#TRAVERSE_ARROW_PREVIOUS}</li> | |
98 * <li>{@link org.eclipse.swt.SWT#TRAVERSE_MNEMONIC}</li> | |
99 * <li>{@link org.eclipse.swt.SWT#TRAVERSE_PAGE_NEXT}</li> | |
100 * <li>{@link org.eclipse.swt.SWT#TRAVERSE_PAGE_PREVIOUS}</li> | |
101 * </ul></p> | |
102 * | |
103 * Setting this field will change the type of traversal. | |
104 * For example, setting the detail to <code>TRAVERSE_NONE</code> | |
105 * causes no traversal action to be taken. | |
106 * | |
107 * When used in conjunction with the <code>doit</code> field, the | |
108 * traversal detail field can be useful when overriding the default | |
109 * traversal mechanism for a control. For example, setting the doit | |
110 * field to <code>false</code> will cancel the operation and allow | |
111 * the traversal key stroke to be delivered to the control. Setting | |
112 * the doit field to <code>true</code> indicates that the traversal | |
113 * described by the detail field is to be performed. | |
114 */ | |
115 public int detail; | |
116 | |
49
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
117 //static const long serialVersionUID = 3257565105301239349L; |
25 | 118 |
119 /** | |
120 * Constructs a new instance of this class based on the | |
121 * information in the given untyped event. | |
122 * | |
123 * @param e the untyped event containing the information | |
124 */ | |
125 public this(Event e) { | |
126 super(e); | |
127 this.detail = e.detail; | |
128 } | |
129 | |
130 /** | |
131 * Returns a string containing a concise, human-readable | |
132 * description of the receiver. | |
133 * | |
134 * @return a string representation of the event | |
135 */ | |
136 public override String toString() { | |
120
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
49
diff
changeset
|
137 return Format( "{} detail={}}", super.toString[ 0 .. $-1 ], detail ); |
25 | 138 } |
139 } |