blob: 2ca07313a2770f7d31fc85f743a8527b6c9f1574 [file] [log] [blame]
Nils Diewald0e6992a2015-04-14 20:13:52 +00001 /**
2 * Menu to choose from for tree views.
3 */
4define(['menu', 'match/treeitem'], function (menuClass, itemClass) {
5 "use strict";
6
7 return {
Nils Diewald7148c6f2015-05-04 15:07:53 +00008
9 /**
10 * Create new menu object.
11 * Pass the match information object
12 * and the item parameters.
13 *
14 * @param info The match info object
15 * @param params The match menu items
16 * as an array of arrays.
17 */
Nils Diewald0e6992a2015-04-14 20:13:52 +000018 create : function (info, params) {
19 var obj = Object.create(menuClass)
Akrond67d45b2017-05-18 21:47:38 +020020 .upgradeTo(this)
21 ._init(params, {itemClass : itemClass});
Nils Diewald0e6992a2015-04-14 20:13:52 +000022 obj.limit(6);
23 obj._info = info;
24
25 // This is only domspecific
26 obj.element().addEventListener('blur', function (e) {
Akrond67d45b2017-05-18 21:47:38 +020027 this.menu.hide();
Nils Diewald0e6992a2015-04-14 20:13:52 +000028 });
29
30 return obj;
31 },
Nils Diewald7148c6f2015-05-04 15:07:53 +000032
33 /**
34 * The match information object of the menu.
35 */
Nils Diewald0e6992a2015-04-14 20:13:52 +000036 info :function () {
37 return this._info;
38 }
39 };
40});