1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Collections;
7
using System.Windows.Controls;
9
namespace ICSharpCode.Core.Presentation
12
/// A tool bar button based on the AddIn-tree.
14
sealed class ToolBarSplitButton : SplitButton, IStatusUpdate
20
public ToolBarSplitButton(Codon codon, object caller, IList submenu)
22
ToolTipService.SetShowOnDisabled(this, true);
27
this.Content = ToolBarService.CreateToolBarItemContent(codon);
28
if (codon.Properties.Contains("name")) {
29
this.Name = codon.Properties["name"];
32
menuCommand = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]);
33
menuCommand.Owner = this;
35
this.Command = new CommandWrapper(codon, caller, menuCommand);
36
this.DropDownMenu = MenuService.CreateContextMenu(submenu);
41
public void UpdateText()
43
if (codon.Properties.Contains("tooltip")) {
44
this.ToolTip = StringParser.Parse(codon.Properties["tooltip"]);
48
public void UpdateStatus()
50
if (codon.GetFailedAction(caller) == ConditionFailedAction.Exclude)
51
this.Visibility = Visibility.Collapsed;
53
this.Visibility = Visibility.Visible;