Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 1 | /** |
| 2 | * Menu to choose from for tree views. |
| 3 | */ |
| 4 | define(['menu', 'match/treeitem'], function (menuClass, itemClass) { |
| 5 | "use strict"; |
| 6 | |
| 7 | return { |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 8 | |
| 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 Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 18 | create : function (info, params) { |
| 19 | var obj = Object.create(menuClass) |
| 20 | .upgradeTo(this) |
Akron | 7524be1 | 2016-06-01 17:31:33 +0200 | [diff] [blame^] | 21 | ._init(params, {itemClass : itemClass}); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 22 | 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 Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * The match information object of the menu. |
| 35 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 36 | info :function () { |
| 37 | return this._info; |
| 38 | } |
| 39 | }; |
| 40 | }); |