Mercurial > projects > dwt-addons
annotate dwtx/jface/viewers/ColumnViewerEditorActivationEvent.d @ 90:7ffeace6c47f
Update 3.4M7 to 3.4
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 06 Jul 2008 23:30:07 +0200 |
parents | 46a6e0e6ccd4 |
children |
rev | line source |
---|---|
10 | 1 /******************************************************************************* |
90 | 2 * Copyright (c) 2007, 2008 IBM Corporation and others. |
10 | 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> | |
90 | 12 *******************************************************************************/ |
10 | 13 |
14 module dwtx.jface.viewers.ColumnViewerEditorActivationEvent; | |
15 | |
16 import dwtx.jface.viewers.ViewerCell; | |
17 // import java.util.EventObject; | |
18 | |
19 import dwt.events.KeyEvent; | |
20 import dwt.events.MouseEvent; | |
21 import dwt.events.TraverseEvent; | |
22 | |
23 import dwt.dwthelper.utils; | |
24 | |
25 /** | |
26 * This event is passed on when a cell-editor is going to be activated | |
27 * | |
28 * @since 3.3 | |
29 * | |
30 */ | |
31 public class ColumnViewerEditorActivationEvent : EventObject { | |
32 /** | |
33 * | |
34 */ | |
35 private static const long serialVersionUID = 1L; | |
36 | |
37 /** | |
38 * if a key is pressed on a selected cell | |
39 */ | |
40 public static const int KEY_PRESSED = 1; | |
41 | |
42 /** | |
43 * if a cell is selected using a single click of the mouse | |
44 */ | |
45 public static const int MOUSE_CLICK_SELECTION = 2; | |
46 | |
47 /** | |
48 * if a cell is selected using double clicking of the mouse | |
49 */ | |
50 public static const int MOUSE_DOUBLE_CLICK_SELECTION = 3; | |
51 | |
52 /** | |
53 * if a cell is activated using code like e.g | |
54 * {@link ColumnViewer#editElement(Object, int)} | |
55 */ | |
56 public static const int PROGRAMMATIC = 4; | |
57 | |
58 /** | |
59 * is a cell is activated by traversing | |
60 */ | |
61 public static const int TRAVERSAL = 5; | |
62 | |
63 /** | |
64 * the original event triggered | |
65 */ | |
66 public EventObject sourceEvent; | |
67 | |
68 /** | |
69 * The time the event is triggered | |
70 */ | |
71 public int time; | |
72 | |
73 /** | |
74 * The event type triggered: | |
75 * <ul> | |
76 * <li>{@link #KEY_PRESSED} if a key is pressed on a selected cell</li> | |
77 * <li>{@link #MOUSE_CLICK_SELECTION} if a cell is selected using a single | |
78 * click of the mouse</li> | |
79 * <li>{@link #MOUSE_DOUBLE_CLICK_SELECTION} if a cell is selected using | |
80 * double clicking of the mouse</li> | |
81 * </ul> | |
82 */ | |
83 public int eventType; | |
84 | |
85 /** | |
86 * <b>Only set for {@link #KEY_PRESSED}</b> | |
87 */ | |
88 public int keyCode; | |
89 | |
90 /** | |
91 * <b>Only set for {@link #KEY_PRESSED}</b> | |
92 */ | |
93 public char character; | |
94 | |
95 /** | |
96 * The statemask | |
97 */ | |
98 public int stateMask; | |
99 | |
100 /** | |
101 * Cancel the event (=> editor is not activated) | |
102 */ | |
103 public bool cancel = false; | |
104 | |
105 /** | |
106 * This constructor can be used when no event exists. The type set is | |
107 * {@link #PROGRAMMATIC} | |
108 * | |
109 * @param cell | |
110 * the cell | |
111 */ | |
112 public this(ViewerCell cell) { | |
113 super(cell); | |
114 eventType = PROGRAMMATIC; | |
115 } | |
116 | |
117 /** | |
118 * This constructor is used for all types of mouse events. Currently the | |
119 * type is can be {@link #MOUSE_CLICK_SELECTION} and | |
120 * {@link #MOUSE_DOUBLE_CLICK_SELECTION} | |
121 * | |
122 * @param cell | |
123 * the cell source of the event | |
124 * @param event | |
125 * the event | |
126 */ | |
127 public this(ViewerCell cell, MouseEvent event) { | |
128 super(cell); | |
129 | |
130 if (event.count >= 2) { | |
131 eventType = MOUSE_DOUBLE_CLICK_SELECTION; | |
132 } else { | |
133 eventType = MOUSE_CLICK_SELECTION; | |
134 } | |
135 | |
136 this.sourceEvent = event; | |
137 this.time = event.time; | |
138 } | |
139 | |
140 /** | |
141 * @param cell | |
142 * the cell source of the event | |
143 * @param event | |
144 * the event | |
145 */ | |
146 public this(ViewerCell cell, KeyEvent event) { | |
147 super(cell); | |
148 this.eventType = KEY_PRESSED; | |
149 this.sourceEvent = event; | |
70
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
150 this.time = event.time; |
10 | 151 this.keyCode = event.keyCode; |
152 this.character = event.character; | |
153 this.stateMask = event.stateMask; | |
154 } | |
155 | |
156 /** | |
157 * This constructor is used to mark the activation triggered by a traversal | |
158 * | |
159 * @param cell | |
160 * the cell source of the event | |
161 * @param event | |
162 * the event | |
163 */ | |
164 public this(ViewerCell cell, TraverseEvent event) { | |
165 super(cell); | |
166 this.eventType = TRAVERSAL; | |
167 this.sourceEvent = event; | |
168 } | |
169 } |