PopupMenu: allow insertion of items at any point
Add a "position" argument to addMenuItem, and pass it to the underlying box layout. If undefined or null, it adds at the end.
This commit is contained in:
parent
c224e019fe
commit
0c5d87d79b
@ -679,8 +679,11 @@ PopupMenu.prototype = {
|
||||
}));
|
||||
},
|
||||
|
||||
addMenuItem: function(menuItem) {
|
||||
this._box.add(menuItem.actor);
|
||||
addMenuItem: function(menuItem, position) {
|
||||
if (position == undefined)
|
||||
this._box.add(menuItem.actor);
|
||||
else
|
||||
this._box.insert_actor(menuItem.actor, position);
|
||||
menuItem._activeChangeId = menuItem.connect('active-changed', Lang.bind(this, function (menuItem, active) {
|
||||
if (active && this._activeMenuItem != menuItem) {
|
||||
if (this._activeMenuItem)
|
||||
|
Loading…
Reference in New Issue
Block a user