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
8 // http://www.apache.org/licenses/LICENSE-2.0
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");
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');
23 goog
.require('goog.events');
24 goog
.require('goog.events.Event');
27 goog
.scope(function() {
28 var events
= i18n
.input
.chrome
.inputview
.events
;
32 * Event types in input view keyboard.
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('pv'),
48 POINTER_OUT
: goog
.events
.getUniqueId('po'),
49 REFRESH
: goog
.events
.getUniqueId('rf'),
50 SETTINGS_READY
: goog
.events
.getUniqueId('sr'),
51 SURROUNDING_TEXT_CHANGED
: goog
.events
.getUniqueId('stc'),
52 SWIPE
: goog
.events
.getUniqueId('s'),
53 CONTEXT_UPDATE
: goog
.events
.getUniqueId('cu'),
54 CONTEXT_FOCUS
: goog
.events
.getUniqueId('cf'),
55 CONTEXT_BLUR
: goog
.events
.getUniqueId('cb'),
56 VISIBILITY_CHANGE
: goog
.events
.getUniqueId('vc'),
57 MODEL_UPDATE
: goog
.events
.getUniqueId('mu'),
58 URL_CHANGED
: goog
.events
.getUniqueId('uc')
64 * The event when the data is loaded complete.
66 * @param {!Object} data The layout data.
68 * @extends {goog.events.Event}
70 events
.LayoutLoadedEvent = function(data
) {
71 goog
.base(this, events
.EventType
.LAYOUT_LOADED
);
80 goog
.inherits(events
.LayoutLoadedEvent
, goog
.events
.Event
);
85 * The event when the configuration is loaded complete.
87 * @param {!Object} data The configuration data.
89 * @extends {goog.events.Event}
91 events
.ConfigLoadedEvent = function(data
) {
92 goog
.base(this, events
.EventType
.CONFIG_LOADED
);
95 * The configuration data.
101 goog
.inherits(events
.ConfigLoadedEvent
, goog
.events
.Event
);
108 * @param {i18n.input.chrome.inputview.elements.Element} view .
109 * @param {events.EventType} type .
110 * @param {Node} target The event target.
111 * @param {number} x .
112 * @param {number} y .
113 * @param {number} identifier .
114 * @param {number=} opt_timestamp The timestamp of a pointer event.
116 * @extends {goog.events.Event}
118 events
.PointerEvent = function(view
, type
, target
, x
, y
, identifier
,
120 goog
.base(this, type
, target
);
125 * @type {i18n.input.chrome.inputview.elements.Element}
144 * The event identifier.
148 this.identifier
= identifier
;
155 this.timestamp
= opt_timestamp
|| 0;
157 goog
.inherits(events
.PointerEvent
, goog
.events
.Event
);
164 * @param {i18n.input.chrome.inputview.elements.Element} view .
165 * @param {number} direction See SwipeDirection in pointer handler.
166 * @param {Node} target The event target.
167 * @param {number} x .
168 * @param {number} y .
169 * @param {number} identifier .
171 * @extends {events.PointerEvent}
173 events
.SwipeEvent = function(view
, direction
, target
, x
, y
, identifier
) {
174 goog
.base(this, view
, events
.EventType
.SWIPE
,
175 target
, x
, y
, identifier
);
182 this.direction
= direction
;
184 goog
.inherits(events
.SwipeEvent
, events
.PointerEvent
);
191 * @param {i18n.input.chrome.inputview.elements.Element} view .
192 * @param {number} direction See SwipeDirection in pointer handler.
193 * @param {Node} target The event target.
194 * @param {number} x .
195 * @param {number} y .
196 * @param {number} deltaX The drag distance of x-coordinate.
197 * @param {number} deltaY The drag distance of y-coordinate.
198 * @param {number} identifier .
200 * @extends {events.PointerEvent}
202 events
.DragEvent = function(view
, direction
, target
, x
, y
, deltaX
, deltaY
,
204 goog
.base(this, view
, events
.EventType
.DRAG
,
205 target
, x
, y
, identifier
);
211 this.direction
= direction
;
214 * The value of deltaX
218 this.deltaX
= deltaX
;
221 * The value of deltaY
225 this.deltaY
= deltaY
;
227 goog
.inherits(events
.DragEvent
, events
.PointerEvent
);
232 * The event when the surrounding text is changed.
234 * @param {string} text The surrounding text.
235 * @param {number} anchor .
236 * @param {number} focus .
238 * @extends {goog.events.Event}
240 events
.SurroundingTextChangedEvent = function(text
, anchor
, focus
) {
241 goog
.base(this, events
.EventType
.SURROUNDING_TEXT_CHANGED
);
243 /** @type {string} */
245 /** @type {number} */
246 this.anchor
= anchor
;
247 /** @type {number} */
250 goog
.inherits(events
.SurroundingTextChangedEvent
, goog
.events
.Event
);
255 * The event when context is updated.
257 * @param {string} compositionText .
258 * @param {string} committedText .
260 * @extends {goog.events.Event}
262 events
.ContextUpdateEvent = function(compositionText
, committedText
) {
263 goog
.base(this, events
.EventType
.CONTEXT_UPDATE
);
265 /** @type {string} */
266 this.compositionText
= compositionText
;
268 /** @type {string} */
269 this.committedText
= committedText
;
271 goog
.inherits(events
.ContextUpdateEvent
, goog
.events
.Event
);