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.layouts.RowsOfCompact');
15 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompactAzerty');
16 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompactNordic');
17 goog.provide('i18n.input.chrome.inputview.layouts.RowsOfCompactZhuyin');
19 goog.require('i18n.input.chrome.inputview.layouts.util');
21 goog.scope(function() {
22 var layouts = i18n.input.chrome.inputview.layouts;
23 var util = layouts.util;
27 * Creates the top three rows for compact qwerty keyboard.
29 * @return {!Array.<!Object>} The rows.
31 layouts.RowsOfCompact.create = function() {
38 var keySequenceOf10 = util.createKeySequence(baseKeySpec, 10);
39 var backspaceKey = util.createKey({
40 'widthInWeight': 1.15625
42 var row1 = util.createLinearLayout({
44 'children': [keySequenceOf10, backspaceKey]
49 var leftKeyWithPadding = util.createKey({
52 var keySequenceOf8 = util.createKeySequence(baseKeySpec, 8);
53 var enterKey = util.createKey({
54 'widthInWeight': 1.65625
56 var row2 = util.createLinearLayout({
58 'children': [leftKeyWithPadding, keySequenceOf8, enterKey]
62 var shiftLeftKey = util.createKey({
63 'widthInWeight': 1.078125
65 var keySequenceOf9 = util.createKeySequence(baseKeySpec, 9);
66 var shiftRightKey = util.createKey({
67 'widthInWeight': 1.078125
69 var row3 = util.createLinearLayout({
71 'children': [shiftLeftKey, keySequenceOf9, shiftRightKey]
74 return [row1, row2, row3];
79 * Creates the top three rows for compact azerty keyboard.
81 * @return {!Array.<!Object>} The rows.
83 i18n.input.chrome.inputview.layouts.RowsOfCompactAzerty.create = function() {
90 var keySequenceOf10 = i18n.input.chrome.inputview.layouts.util.
91 createKeySequence(baseKeySpec, 10);
92 var backspaceKey = i18n.input.chrome.inputview.layouts.util.createKey({
95 var row1 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
97 'children': [keySequenceOf10, backspaceKey]
101 keySequenceOf10 = i18n.input.chrome.inputview.layouts.util.
102 createKeySequence(baseKeySpec, 10);
103 var enterKey = i18n.input.chrome.inputview.layouts.util.createKey({
106 var row2 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
108 'children': [keySequenceOf10, enterKey]
112 var shiftLeftKey = i18n.input.chrome.inputview.layouts.util.createKey({
115 var keySequenceOf9 = i18n.input.chrome.inputview.layouts.util.
116 createKeySequence(baseKeySpec, 9);
117 var shiftRightKey = i18n.input.chrome.inputview.layouts.util.createKey({
120 var row3 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
122 'children': [shiftLeftKey, keySequenceOf9, shiftRightKey]
125 return [row1, row2, row3];
130 * Creates the top three rows for compact nordic keyboard.
132 * @return {!Array.<!Object>} The rows.
134 i18n.input.chrome.inputview.layouts.RowsOfCompactNordic.create = function() {
141 var keySequenceOf11 = i18n.input.chrome.inputview.layouts.util.
142 createKeySequence(baseKeySpec, 11);
143 var backspaceKey = i18n.input.chrome.inputview.layouts.util.createKey({
146 var row1 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
148 'children': [keySequenceOf11, backspaceKey]
152 keySequenceOf11 = i18n.input.chrome.inputview.layouts.util.
153 createKeySequence(baseKeySpec, 11);
154 var enterKey = i18n.input.chrome.inputview.layouts.util.createKey({
157 var row2 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
159 'children': [keySequenceOf11, enterKey]
163 var shiftLeftKey = i18n.input.chrome.inputview.layouts.util.createKey({
166 var leftKeyWithPadding = i18n.input.chrome.inputview.layouts.util.createKey({
169 var keySequenceOf7 = i18n.input.chrome.inputview.layouts.util.
170 createKeySequence(baseKeySpec, 7);
171 var rightKeyWithPadding = i18n.input.chrome.inputview.layouts.util.createKey({
174 var shiftRightKey = i18n.input.chrome.inputview.layouts.util.createKey({
177 var row3 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
179 'children': [shiftLeftKey, leftKeyWithPadding, keySequenceOf7,
180 rightKeyWithPadding, shiftRightKey]
182 return [row1, row2, row3];
187 * Creates the top rows of compact zhuyin.
189 * @return {!Array.<!Object>} The rows.
191 i18n.input.chrome.inputview.layouts.RowsOfCompactZhuyin.create = function() {
193 'widthInWeight': 1.01,
198 var keysOfRow1 = i18n.input.chrome.inputview.layouts.util.
199 createKeySequence(baseKeySpec, 10);
200 var row1 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
202 'children': [keysOfRow1]
206 var keysOfRow2 = i18n.input.chrome.inputview.layouts.util.
207 createKeySequence(baseKeySpec, 10);
208 var row2 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
210 'children': [keysOfRow2]
214 var keysOfRow3 = i18n.input.chrome.inputview.layouts.util.
215 createKeySequence(baseKeySpec, 10);
216 var row3 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
218 'children': [keysOfRow3]
222 var keysOfRow4 = i18n.input.chrome.inputview.layouts.util.
223 createKeySequence(baseKeySpec, 10);
224 var row4 = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
226 'children': [keysOfRow4]
230 i18n.input.chrome.inputview.layouts.util.createVerticalLayout({
232 'children': [row1, row2, row3, row4]
236 'widthInWeight': 1.1,
240 i18n.input.chrome.inputview.layouts.util.createKey(sideKeySpec);
242 i18n.input.chrome.inputview.layouts.util.createKey(sideKeySpec);
244 i18n.input.chrome.inputview.layouts.util.createKey(sideKeySpec);
246 var sideKeys = i18n.input.chrome.inputview.layouts.util.createVerticalLayout({
248 'children': [backspaceKey, enterKey, shiftKey]
251 var topRows = i18n.input.chrome.inputview.layouts.util.createLinearLayout({
253 'children': [topFourRows, sideKeys]