Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / third_party / google_input_tools / src / chrome / os / inputview / layouts / jpkbd_layout.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 goog.require('i18n.input.chrome.inputview.ConditionName');
15 goog.require('i18n.input.chrome.inputview.layouts.RowsOfJP');
16 goog.require('i18n.input.chrome.inputview.layouts.util');
17
18
19 (function() {
20   var ConditionName = i18n.input.chrome.inputview.ConditionName;
21   var util = i18n.input.chrome.inputview.layouts.util;
22   i18n.input.chrome.inputview.layouts.util.setPrefix('jpkbd-k-');
23
24   var topFourRows = i18n.input.chrome.inputview.layouts.RowsOfJP.create();
25
26   // Creates the space row.
27   var globeKey = util.createKey({
28     'condition': ConditionName.SHOW_GLOBE_OR_SYMBOL,
29     'widthInWeight': 1
30   });
31   var menuKey = util.createKey({
32     'condition': ConditionName.SHOW_MENU,
33     'widthInWeight': 1
34   });
35   var ctrlKey = util.createKey({
36     'widthInWeight': 1
37   });
38   var altKey = util.createKey({
39     'widthInWeight': 1
40   });
41
42   var leftIMEKey = util.createKey({'widthInWeight': 1});
43   var spaceKey = util.createKey({'widthInWeight': 6});
44   var rightIMEKey = util.createKey({'widthInWeight': 1});
45
46   // If globeKey or altGrKey is not shown, give its weight to space key.
47   globeKey['spec']['giveWeightTo'] = spaceKey['spec']['id'];
48   menuKey['spec']['giveWeightTo'] = spaceKey['spec']['id'];
49
50   var leftKey = util.createKey({
51     'widthInWeight': 1
52   });
53   var rightKey = util.createKey({
54     'widthInWeight': 1
55   });
56   var hideKeyboardKey = util.createKey({
57     'widthInWeight': 1
58   });
59
60   var keys = [
61     globeKey,
62     menuKey,
63     ctrlKey,
64     altKey,
65     leftIMEKey,
66     spaceKey,
67     rightIMEKey,
68     leftKey,
69     rightKey,
70     hideKeyboardKey
71   ];
72
73   var spaceRow = util.createLinearLayout({
74     'id': 'spaceKeyrow',
75     'children': keys
76   });
77
78
79   // Keyboard view.
80   var keyboardView = i18n.input.chrome.inputview.layouts.util.createLayoutView({
81     'id': 'keyboardView',
82     'children': [topFourRows, spaceRow],
83     'widthPercent': 100,
84     'heightPercent': 100
85   });
86
87   var keyboardContainer = i18n.input.chrome.inputview.layouts.util.
88       createLinearLayout({
89         'id': 'keyboardContainer',
90         'children': [keyboardView]
91       });
92
93   var data = {
94     'layoutID': 'jpkbd',
95     'widthInWeight': 15,
96     'children': [keyboardContainer]
97   };
98
99   google.ime.chrome.inputview.onLayoutLoaded(data);
100
101 }) ();