blob: fec7703c1e6f486568aca29830f0375c7aab0897 [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)
20 .upgradeTo(this)
Akron1ff3ac22016-04-28 16:30:45 +020021 ._init(itemClass, undefined, undefined, params);
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) {
27 this.menu.hide();
28 });
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});