本文整理汇总了C#中Gtk.Menu.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Menu.Insert方法的具体用法?C# Gtk.Menu.Insert怎么用?C# Gtk.Menu.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Menu
的用法示例。
在下文中一共展示了Gtk.Menu.Insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSubmenu
public Gtk.Menu GetSubmenu (object parent)
{
Gtk.Menu submenu = new Gtk.Menu ();
foreach (MenuNode node in ChildNodes)
submenu.Insert (node.GetMenuItem (parent), -1);
return submenu;
}
示例2: GetMenuItem
public override Gtk.MenuItem GetMenuItem ()
{
Gtk.MenuItem it = new Gtk.MenuItem (label);
Gtk.Menu submenu = new Gtk.Menu ();
foreach (MenuNode node in ChildNodes)
submenu.Insert (node.GetMenuItem (), -1);
it.Submenu = submenu;
return it;
}
示例3: GetMenuItem
public override Gtk.MenuItem GetMenuItem ()
{
lock (this) {
if (item == null || changed) {
changed = false;
item = new Gtk.MenuItem (_label != null ? Catalog.GetString (_label) : Id);
Gtk.Menu submenu = new Gtk.Menu ();
foreach (MenuNode node in ChildNodes)
submenu.Insert (node.GetMenuItem (), -1);
item.Submenu = submenu;
}
}
return item;
}
示例4: OnSelectIcon
void OnSelectIcon (object s, Gtk.ButtonPressEventArgs args)
{
Gtk.Menu menu = new Gtk.Menu ();
Gtk.CheckMenuItem item = new Gtk.CheckMenuItem (Catalog.GetString ("Action"));
item.DrawAsRadio = true;
item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Action);
item.Activated += OnSetActionType;
menu.Insert (item, -1);
item = new Gtk.CheckMenuItem (Catalog.GetString ("Radio Action"));
item.DrawAsRadio = true;
item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Radio);
item.Activated += OnSetRadioType;
menu.Insert (item, -1);
item = new Gtk.CheckMenuItem (Catalog.GetString ("Toggle Action"));
item.DrawAsRadio = true;
item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Toggle);
item.Activated += OnSetToggleType;
menu.Insert (item, -1);
menu.Insert (new Gtk.SeparatorMenuItem (), -1);
Gtk.MenuItem itIcons = new Gtk.MenuItem (Catalog.GetString ("Select Icon"));
menu.Insert (itIcons, -1);
IconSelectorMenu menuIcons = new IconSelectorMenu (GetProject ());
menuIcons.IconSelected += OnStockSelected;
itIcons.Submenu = menuIcons;
Gtk.MenuItem it = new Gtk.MenuItem (Catalog.GetString ("Clear Icon"));
it.Sensitive = (node.Action.GtkAction.StockId != null);
it.Activated += OnClearIcon;
menu.Insert (it, -1);
menu.ShowAll ();
uint but = args != null ? args.Event.Button : 1;
menu.Popup (null, null, new Gtk.MenuPositionFunc (OnDropMenuPosition), but, Gtk.Global.CurrentEventTime);
// Make sure we get the focus after closing the menu, so we can keep browsing buttons
// using the keyboard.
menu.Hidden += delegate (object sender, EventArgs a) {
GrabFocus ();
};
if (args != null)
args.RetVal = false;
}
示例5: OnSelectIcon
void OnSelectIcon (object sender, Gtk.ButtonPressEventArgs e)
{
Gtk.Menu menu = new Gtk.Menu ();
Gtk.CheckMenuItem item = new Gtk.CheckMenuItem (Catalog.GetString ("Action"));
item.DrawAsRadio = true;
item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Action);
item.Activated += OnSetActionType;
menu.Insert (item, -1);
item = new Gtk.CheckMenuItem (Catalog.GetString ("Radio Action"));
item.DrawAsRadio = true;
item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Radio);
item.Activated += OnSetRadioType;
menu.Insert (item, -1);
item = new Gtk.CheckMenuItem (Catalog.GetString ("Toggle Action"));
item.DrawAsRadio = true;
item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Toggle);
item.Activated += OnSetToggleType;
menu.Insert (item, -1);
menu.Insert (new Gtk.SeparatorMenuItem (), -1);
Gtk.MenuItem itIcons = new Gtk.MenuItem (Catalog.GetString ("Select Icon"));
menu.Insert (itIcons, -1);
IconSelectorMenu menuIcons = new IconSelectorMenu (GetProject ());
menuIcons.IconSelected += OnStockSelected;
itIcons.Submenu = menuIcons;
Gtk.MenuItem it = new Gtk.MenuItem (Catalog.GetString ("Clear Icon"));
it.Sensitive = (node.Action.GtkAction.StockId != null);
it.Activated += OnClearIcon;
menu.Insert (it, -1);
menu.ShowAll ();
menu.Popup (null, null, new Gtk.MenuPositionFunc (OnDropMenuPosition), 3, Gtk.Global.CurrentEventTime);
e.RetVal = false;
}