/* public Gtk.Toolbar CreateToolbar (CommandEntrySet entrySet) { return CreateToolbar ("", entrySet); } */ public Gtk.Menu CreateMenu(CommandEntrySet entrySet) { CommandMenu menu = new CommandMenu (this); foreach (CommandEntry entry in entrySet) menu.Append (entry.CreateMenuItem (this)); return menu; }
protected internal virtual Gtk.ToolItem CreateToolItem(CommandManager manager) { if (cmdId == Command.Separator) return new Gtk.SeparatorToolItem (); Command cmd = manager.GetCommand (cmdId); if (cmd is CustomCommand) { Gtk.Widget child = (Gtk.Widget) Activator.CreateInstance (((CustomCommand)cmd).WidgetType); Gtk.ToolItem ti = new Gtk.ToolItem (); ti.Child = child; if (cmd.Text != null && cmd.Text.Length > 0) { Gtk.Tooltips tips = new Gtk.Tooltips (); ti.SetTooltip (tips, cmd.Text, cmd.Text); tips.Enable (); } return ti; } ActionCommand acmd = cmd as ActionCommand; if (acmd == null) throw new InvalidOperationException ("Unknown cmd type."); if (acmd.CommandArray) { CommandMenu menu = new CommandMenu (manager); menu.Append (CreateMenuItem (manager)); return new MenuToolButton (menu, acmd.Icon); } else if (acmd.ActionType == ActionType.Normal) return new CommandToolButton (cmdId, manager); else return new CommandToggleToolButton (cmdId, manager); }