Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: third_party/google_input_tools/src/chrome/os/inputview/events.js

Issue 674153004: Add third_party/google-input-tools: Take 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@google_input_tools
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved.
2 // limitations under the License.
3 // See the License for the specific language governing permissions and
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5 // distributed under the License is distributed on an "AS-IS" BASIS,
6 // Unless required by applicable law or agreed to in writing, software
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // You may obtain a copy of the License at
11 // you may not use this file except in compliance with the License.
12 // Licensed under the Apache License, Version 2.0 (the "License");
13 //
14 goog.provide('i18n.input.chrome.inputview.events.ConfigLoadedEvent');
15 goog.provide('i18n.input.chrome.inputview.events.ContextUpdateEvent');
16 goog.provide('i18n.input.chrome.inputview.events.DragEvent');
17 goog.provide('i18n.input.chrome.inputview.events.EventType');
18 goog.provide('i18n.input.chrome.inputview.events.LayoutLoadedEvent');
19 goog.provide('i18n.input.chrome.inputview.events.PointerEvent');
20 goog.provide('i18n.input.chrome.inputview.events.SurroundingTextChangedEvent');
21 goog.provide('i18n.input.chrome.inputview.events.SwipeEvent');
22
23 goog.require('goog.events');
24 goog.require('goog.events.Event');
25
26
27 goog.scope(function() {
28 var events = i18n.input.chrome.inputview.events;
29
30
31 /**
32 * Event types in input view keyboard.
33 *
34 * @enum {string}
35 */
36 events.EventType = {
37 CLICK: goog.events.getUniqueId('c'),
38 CONFIG_LOADED: goog.events.getUniqueId('cl'),
39 DOUBLE_CLICK: goog.events.getUniqueId('dc'),
40 DOUBLE_CLICK_END: goog.events.getUniqueId('dce'),
41 DRAG: goog.events.getUniqueId('dg'),
42 LAYOUT_LOADED: goog.events.getUniqueId('ll'),
43 LONG_PRESS: goog.events.getUniqueId('lp'),
44 LONG_PRESS_END: goog.events.getUniqueId('lpe'),
45 POINTER_DOWN: goog.events.getUniqueId('pd'),
46 POINTER_UP: goog.events.getUniqueId('pu'),
47 POINTER_OVER: goog.events.getUniqueId('po'),
48 POINTER_OUT: goog.events.getUniqueId('po'),
49 SETTINGS_READY: goog.events.getUniqueId('sr'),
50 SURROUNDING_TEXT_CHANGED: goog.events.getUniqueId('stc'),
51 SWIPE: goog.events.getUniqueId('s'),
52 CONTEXT_UPDATE: goog.events.getUniqueId('cu'),
53 CONTEXT_FOCUS: goog.events.getUniqueId('cf'),
54 CONTEXT_BLUR: goog.events.getUniqueId('cb'),
55 VISIBILITY_CHANGE: goog.events.getUniqueId('vc'),
56 MODEL_UPDATE: goog.events.getUniqueId('mu')
57 };
58
59
60
61 /**
62 * The event when the data is loaded complete.
63 *
64 * @param {!Object} data The layout data.
65 * @constructor
66 * @extends {goog.events.Event}
67 */
68 events.LayoutLoadedEvent = function(data) {
69 goog.base(this, events.EventType.LAYOUT_LOADED);
70
71 /**
72 * The layout data.
73 *
74 * @type {!Object}
75 */
76 this.data = data;
77 };
78 goog.inherits(events.LayoutLoadedEvent, goog.events.Event);
79
80
81
82 /**
83 * The event when the configuration is loaded complete.
84 *
85 * @param {!Object} data The configuration data.
86 * @constructor
87 * @extends {goog.events.Event}
88 */
89 events.ConfigLoadedEvent = function(data) {
90 goog.base(this, events.EventType.CONFIG_LOADED);
91
92 /**
93 * The configuration data.
94 *
95 * @type {!Object}
96 */
97 this.data = data;
98 };
99 goog.inherits(events.ConfigLoadedEvent, goog.events.Event);
100
101
102
103 /**
104 * The pointer event.
105 *
106 * @param {i18n.input.chrome.inputview.elements.Element} view .
107 * @param {events.EventType} type .
108 * @param {Node} target The event target.
109 * @param {number} x .
110 * @param {number} y .
111 * @param {number=} opt_timestamp The timestamp of a pointer event.
112 * @constructor
113 * @extends {goog.events.Event}
114 */
115 events.PointerEvent = function(view, type, target, x, y, opt_timestamp) {
116 goog.base(this, type, target);
117
118 /**
119 * The view.
120 *
121 * @type {i18n.input.chrome.inputview.elements.Element}
122 */
123 this.view = view;
124
125 /**
126 * The x-coordinate.
127 *
128 * @type {number}
129 */
130 this.x = x;
131
132 /**
133 * The y-coordinate.
134 *
135 * @type {number}
136 */
137 this.y = y;
138
139 /**
140 * The timestamp.
141 *
142 * @type {number}
143 */
144 this.timestamp = opt_timestamp || 0;
145 };
146 goog.inherits(events.PointerEvent, goog.events.Event);
147
148
149
150 /**
151 * The swipe event.
152 *
153 * @param {i18n.input.chrome.inputview.elements.Element} view .
154 * @param {number} direction See SwipeDirection in pointer handler.
155 * @param {Node} target The event target.
156 * @param {number} x .
157 * @param {number} y .
158 * @constructor
159 * @extends {events.PointerEvent}
160 */
161 events.SwipeEvent = function(view, direction, target, x, y) {
162 goog.base(this, view, events.EventType.SWIPE,
163 target, x, y);
164
165 /**
166 * The direction.
167 *
168 * @type {number}
169 */
170 this.direction = direction;
171 };
172 goog.inherits(events.SwipeEvent, events.PointerEvent);
173
174
175
176 /**
177 * The drag event.
178 *
179 * @param {i18n.input.chrome.inputview.elements.Element} view .
180 * @param {number} direction See SwipeDirection in pointer handler.
181 * @param {Node} target The event target.
182 * @param {number} x .
183 * @param {number} y .
184 * @param {number} deltaX The drag distance of x-coordinate.
185 * @param {number} deltaY The drag distance of y-coordinate.
186 * @constructor
187 * @extends {events.PointerEvent}
188 */
189 events.DragEvent = function(view, direction, target, x, y, deltaX, deltaY) {
190 goog.base(this, view, events.EventType.DRAG,
191 target, x, y);
192 /**
193 * The direction
194 *
195 * @type {number}
196 */
197 this.direction = direction;
198
199 /**
200 * The value of deltaX
201 *
202 * @type {number}
203 */
204 this.deltaX = deltaX;
205
206 /**
207 * The value of deltaY
208 *
209 * @type {number}
210 */
211 this.deltaY = deltaY;
212 };
213 goog.inherits(events.DragEvent, events.PointerEvent);
214
215
216
217 /**
218 * The event when the surrounding text is changed.
219 *
220 * @param {string} text The surrounding text.
221 * @constructor
222 * @extends {goog.events.Event}
223 */
224 events.SurroundingTextChangedEvent = function(text) {
225 goog.base(this, events.EventType.SURROUNDING_TEXT_CHANGED);
226
227 /** @type {string} */
228 this.text = text;
229 };
230 goog.inherits(events.SurroundingTextChangedEvent, goog.events.Event);
231
232
233
234 /**
235 * The event when context is updated.
236 *
237 * @param {string} compositionText .
238 * @param {string} committedText .
239 * @constructor
240 * @extends {goog.events.Event}
241 */
242 events.ContextUpdateEvent = function(compositionText, committedText) {
243 goog.base(this, events.EventType.CONTEXT_UPDATE);
244
245 /** @type {string} */
246 this.compositionText = compositionText;
247
248 /** @type {string} */
249 this.committedText = committedText;
250 };
251 goog.inherits(events.ContextUpdateEvent, goog.events.Event);
252
253 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698