最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

cinnamon - How to show menu on St.Button? - Stack Overflow

programmeradmin1浏览0评论

I want to create a button in applet popup menu, that shows a popup menu when clicked. My current attemt does show nothing:

const powerIcon = new St.Icon({style_class: 'footer-icon', y_align: St.Align.END, style: 'margin-right: 0', icon_name: 'system-shutdown'});
const powerIconButton = new St.Button({style_class: 'footer-button', x_align: St.Align.MIDDLE});
powerIconButton.add_actor(powerIcon);
powerIconButton.connect('clicked', Lang.bind(this, this._on_power_icon_clicked));

this.powerMenuManager = new PopupMenu.PopupMenuManager(powerIconButton);
this.powerMenu = new PopupMenu.PopupComboMenu(powerIconButton, {style_class: 'power-menu-box'});
this.powerMenu.addMenuItem(new PopupMenu.PopupComboBoxMenuItem({}));
this.powerMenuManager.addMenu(this.powerMenu);

... later in class

_on_power_icon_clicked() {
  this.powerMenu.toggle();
}

is it possible, to impement a popup menu in a menu like this?

发布评论

评论列表(0)

  1. 暂无评论