示例#1
0
        /// <summary>
        /// Create a menu toolbar button for a command.
        /// </summary>
        /// <param name="command">The command for which to create a menu tool button.</param>
        /// <param name="useDefaultCommandHandlerForButton">If set to <c>true</c> clicking the button will associate the button's click handler with the given command.</param>
        /// <param name="updateMenuOnShow">If not null, this delegate will execute when displaying the menu button's menu. It is intended to populate the menu when menu contents may be dynamic.</param>
        /// <returns>The menu tool button for the command.</returns>
        public static Gtk.MenuToolButton CreateMenuToolButtonForCommand(this VisualRelayCommand command, bool useDefaultCommandHandlerForButton, System.Action <Gtk.Menu> updateMenuOnShow)
        {
            var menuToolButton = new Gtk.MenuToolButton(new Gtk.Image(command.LargeIcon), command.Name);

            command.InitializeToolbarButtonForCommand(menuToolButton, useDefaultCommandHandlerForButton);
            var menu = new Gtk.Menu(); // { Name = command.UniqueId };

            menuToolButton.Menu = menu;
            if (updateMenuOnShow != null)
            {
                menuToolButton.ShowMenu += (sender, e) => updateMenuOnShow(menu);
            }
            return(menuToolButton);
        }
示例#2
0
		public override void OnNoteOpened ()
		{
			menu = new Gtk.Menu ();
			menu.Hidden += OnMenuHidden;
			menu.ShowAll ();
			
			Gtk.Image tasqueImage = new Gtk.Image (TasqueIcon);
			tasqueImage.Show ();
			menuToolButton =
				new Gtk.MenuToolButton (tasqueImage, Catalog.GetString ("Tasque"));
			menuToolButton.Menu = menu;
			menuToolButton.Clicked += OnMenuToolButtonClicked;
			menuToolButton.ShowMenu += OnMenuItemActivated;
			menuToolButton.Sensitive = false;
			menuToolButton.Show ();
			AddToolItem (menuToolButton, -1);
			
			// Sensitize the Task button on text selection
			markSetTimeout = new InterruptableTimeout();
			markSetTimeout.Timeout += UpdateTaskButtonSensitivity;
			Note.Buffer.MarkSet += OnSelectionMarkSet;
		}
示例#3
0
        public override void OnNoteOpened()
        {
            menu         = new Gtk.Menu();
            menu.Hidden += OnMenuHidden;
            menu.ShowAll();

            Gtk.Image tasqueImage = new Gtk.Image(TasqueIcon);
            tasqueImage.Show();
            menuToolButton =
                new Gtk.MenuToolButton(tasqueImage, Catalog.GetString("Tasque"));
            menuToolButton.Menu      = menu;
            menuToolButton.Clicked  += OnMenuToolButtonClicked;
            menuToolButton.ShowMenu += OnMenuItemActivated;
            menuToolButton.Sensitive = false;
            menuToolButton.Show();
            AddToolItem(menuToolButton, -1);

            // Sensitize the Task button on text selection
            markSetTimeout          = new InterruptableTimeout();
            markSetTimeout.Timeout += UpdateTaskButtonSensitivity;
            Note.Buffer.MarkSet    += OnSelectionMarkSet;
        }
示例#4
0
		public new Gtk.Widget CreateToolItem()
		{
			Gtk.MenuToolButton button = new Gtk.MenuToolButton(this.StockId);
						
			button.TooltipSet += new Gtk.TooltipSetHandler(Tooltip_Set);
			
			return button;
		}