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.elements.content.CompactKeyModel');
16 goog.require('i18n.input.chrome.inputview.MoreKeysShiftOperation');
19 goog.scope(function() {
20 var MoreKeysShiftOperation = i18n.input.chrome.inputview.MoreKeysShiftOperation;
24 * The model of compact key.
26 * @param {number} marginLeftPercent The left margin.
27 * @param {number} marginRightPercent The right margin.
28 * @param {boolean} isGrey Whether it is grey.
29 * @param {!Array.<string>} moreKeys The more keys.
30 * @param {MoreKeysShiftOperation} moreKeysShiftOperation
31 * The type of opearation when the shift key is down.
32 * @param {string} textOnShift The text to display on shift.
33 * @param {Object.<string, !Object>} textOnContext Map for changing the key
34 * based on the current input context.
35 * @param {string=} textCssClass The css class for the text.
36 * @param {string=} title Overrides the displayed text on the key.
38 * @extends {i18n.input.chrome.inputview.elements.content.FunctionalKey}
40 i18n.input.chrome.inputview.elements.content.CompactKeyModel =
41 function(marginLeftPercent, marginRightPercent, isGrey, moreKeys,
42 moreKeysShiftOperation, textOnShift, textOnContext, textCssClass, title) {
49 this.marginLeftPercent = marginLeftPercent || 0;
56 this.marginRightPercent = marginRightPercent || 0;
63 this.isGrey = !!isGrey;
66 * The more keys array.
68 * @type {!Array.<string>}
70 this.moreKeys = moreKeys || [];
73 * The type of shift operation of moreKeys.
75 * @type {MoreKeysShiftOperation}
77 this.moreKeysShiftOperation = moreKeysShiftOperation ?
78 moreKeysShiftOperation : MoreKeysShiftOperation.TO_UPPER_CASE;
81 * The text when shift is pressed down.
85 this.textOnShift = textOnShift;
88 * The css class for the text.
92 this.textCssClass = textCssClass || '';
95 * Map for changing the key based on the current input context.
97 * @type {Object.<string, !Object>}
99 this.textOnContext = textOnContext || {};
102 * Alternate title for the key. Title is displayed, whereas text is
103 * what is actually committed.
105 this.title = title || '';