|
|
@ -7,22 +7,37 @@ using System.Windows.Controls; |
|
|
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.Core.Presentation |
|
|
|
namespace ICSharpCode.Core.Presentation |
|
|
|
{ |
|
|
|
{ |
|
|
|
sealed class ToolBarComboBox : ComboBox |
|
|
|
sealed class ToolBarComboBox : ComboBox, IStatusUpdate |
|
|
|
{ |
|
|
|
{ |
|
|
|
IComboBoxCommand menuCommand; |
|
|
|
IComboBoxCommand menuCommand; |
|
|
|
|
|
|
|
readonly Codon codon; |
|
|
|
|
|
|
|
|
|
|
|
public ToolBarComboBox(Codon codon, object caller) |
|
|
|
public ToolBarComboBox(Codon codon, object caller) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (codon == null) |
|
|
|
if (codon == null) |
|
|
|
throw new ArgumentNullException("codon"); |
|
|
|
throw new ArgumentNullException("codon"); |
|
|
|
|
|
|
|
this.codon = codon; |
|
|
|
|
|
|
|
ToolTipService.SetShowOnDisabled(this, true); |
|
|
|
this.IsEditable = false; |
|
|
|
this.IsEditable = false; |
|
|
|
menuCommand = (IComboBoxCommand)codon.AddIn.CreateObject(codon.Properties["class"]); |
|
|
|
menuCommand = (IComboBoxCommand)codon.AddIn.CreateObject(codon.Properties["class"]); |
|
|
|
menuCommand.ComboBox = this; |
|
|
|
menuCommand.ComboBox = this; |
|
|
|
menuCommand.Owner = caller; |
|
|
|
menuCommand.Owner = caller; |
|
|
|
|
|
|
|
UpdateText(); |
|
|
|
|
|
|
|
|
|
|
|
SetResourceReference(FrameworkElement.StyleProperty, ToolBar.ComboBoxStyleKey); |
|
|
|
SetResourceReference(FrameworkElement.StyleProperty, ToolBar.ComboBoxStyleKey); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdateText() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (codon.Properties.Contains("tooltip")) { |
|
|
|
|
|
|
|
this.ToolTip = StringParser.Parse(codon.Properties["tooltip"]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdateStatus() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected override void OnSelectionChanged(SelectionChangedEventArgs e) |
|
|
|
protected override void OnSelectionChanged(SelectionChangedEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
base.OnSelectionChanged(e); |
|
|
|
base.OnSelectionChanged(e); |
|
|
|