Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / third_party / google_input_tools / src / chrome / os / inputview / hwt_eventtype.js
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
15 /**
16  * @fileoverview Handwriting event type.
17  * @author wuyingbing@google.com (Yingbing Wu)
18  */
19
20
21 goog.provide('i18n.input.hwt.CandidateSelectEvent');
22 goog.provide('i18n.input.hwt.CommitEvent');
23 goog.provide('i18n.input.hwt.EventType');
24
25 goog.require('goog.events');
26 goog.require('goog.events.Event');
27
28
29 /**
30  * Handwriting event type to expose to external.
31  *
32  * @enum {string}
33  */
34 i18n.input.hwt.EventType = {
35   BACKSPACE: goog.events.getUniqueId('b'),
36   CANDIDATE_SELECT: goog.events.getUniqueId('cs'),
37   COMMIT: goog.events.getUniqueId('c'),
38   COMMIT_START: goog.events.getUniqueId('hcs'),
39   COMMIT_END: goog.events.getUniqueId('hce'),
40   RECOGNITION_READY: goog.events.getUniqueId('rr'),
41   ENTER: goog.events.getUniqueId('e'),
42   HANDWRITING_CLOSED: goog.events.getUniqueId('hc'),
43   MOUSEUP: goog.events.getUniqueId('m'),
44   SPACE: goog.events.getUniqueId('s')
45 };
46
47
48
49 /**
50  * Candidate select event.
51  *
52  * @param {string} candidate The candidate.
53  * @constructor
54  * @extends {goog.events.Event}
55  */
56 i18n.input.hwt.CandidateSelectEvent = function(candidate) {
57   goog.base(this, i18n.input.hwt.EventType.CANDIDATE_SELECT);
58
59   /**
60    * The candidate.
61    *
62    * @type {string}
63    */
64   this.candidate = candidate;
65 };
66 goog.inherits(i18n.input.hwt.CandidateSelectEvent, goog.events.Event);
67
68
69
70 /**
71  * Commit event.
72  *
73  * @param {string} text The text to commit.
74  * @param {number=} opt_back The number of characters to be deleted.
75  * @constructor
76  * @extends {goog.events.Event}
77  */
78 i18n.input.hwt.CommitEvent = function(text, opt_back) {
79   goog.base(this, i18n.input.hwt.EventType.COMMIT);
80
81   /**
82    * The text.
83    *
84    * @type {string}
85    */
86   this.text = text;
87
88   /**
89    * The number of characters to be deleted.
90    *
91    * @type {number}
92    */
93   this.back = opt_back || 0;
94 };
95 goog.inherits(i18n.input.hwt.CommitEvent, goog.events.Event);
96