Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/ui.window.js
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,8 @@ pkg.Menu = Class(pkg.CompList, [

function () {
this.menus = {};

this.functions = {};

/**
* Dictionary to keep decorative components
* @attribute decoratives
Expand Down Expand Up @@ -1363,7 +1364,10 @@ pkg.Menu = Class(pkg.CompList, [
var sub = d[k];
this.add(k);
if (sub != null) {
this.setMenuAt(this.kids.length-1, zebra.instanceOf(sub, pkg.Menu) ? sub : new pkg.Menu(sub));
if (typeof(sub) == "function")
this.functions[this.kids.length - 1] = sub;
else
this.setMenuAt(this.kids.length-1, zebra.instanceOf(sub, pkg.Menu) ? sub : new pkg.Menu(sub));
}
}
}
Expand Down Expand Up @@ -1479,6 +1483,10 @@ pkg.Menu = Class(pkg.CompList, [
if (k.itemSelected != null) {
k.itemSelected();
}

var func = this.functions[this.selectedIndex];
if ( func )
func();

// an atomic menu, what means a menu item has been selected
// remove this menu an all parents menus
Expand Down Expand Up @@ -2141,4 +2149,4 @@ pkg.WindowTitleView = Class(pkg.View, [
* @for
*/

})(zebra("ui"), zebra.Class);
})(zebra("ui"), zebra.Class);