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) {
|
addMenuItem: function(menuItem, position) {
|
||||||
this._box.add(menuItem.actor);
|
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) {
|
menuItem._activeChangeId = menuItem.connect('active-changed', Lang.bind(this, function (menuItem, active) {
|
||||||
if (active && this._activeMenuItem != menuItem) {
|
if (active && this._activeMenuItem != menuItem) {
|
||||||
if (this._activeMenuItem)
|
if (this._activeMenuItem)
|
||||||
|
Loading…
Reference in New Issue
Block a user