1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| /*!
| * Ext JS Library 3.1.0
| * Copyright(c) 2006-2009 Ext JS, LLC
| * licensing@extjs.com
| * http://www.extjs.com/license
| */
| /**
| * @class Ext.Element
| */
| Ext.Element.addMethods({
| /**
| * Convenience method for constructing a KeyMap
| * @param {Number/Array/Object/String} key Either a string with the keys to listen for, the numeric key code, array of key codes or an object with the following options:
| * <code>{key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}</code>
| * @param {Function} fn The function to call
| * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the specified function is executed. Defaults to this Element.
| * @return {Ext.KeyMap} The KeyMap created
| */
| addKeyListener : function(key, fn, scope){
| var config;
| if(!Ext.isObject(key) || Ext.isArray(key)){
| config = {
| key: key,
| fn: fn,
| scope: scope
| };
| }else{
| config = {
| key : key.key,
| shift : key.shift,
| ctrl : key.ctrl,
| alt : key.alt,
| fn: fn,
| scope: scope
| };
| }
| return new Ext.KeyMap(this, config);
| },
|
| /**
| * Creates a KeyMap for this element
| * @param {Object} config The KeyMap config. See {@link Ext.KeyMap} for more details
| * @return {Ext.KeyMap} The KeyMap created
| */
| addKeyMap : function(config){
| return new Ext.KeyMap(this, config);
| }
| });
|
|