Browse Source

recent changes to ToolBarDropDownButton are now compatible with previous usage, notably in the SearchAndReplace toolbar.

AddIn schema now updated to reflect recent addition to ToolbarItemDoozer; new ToolbarItem types are now available via code-completion in AddIn.xsd

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1338 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Alpert 20 years ago
parent
commit
32abd834aa
  1. 19
      data/schemas/AddIn.xsd
  2. 22
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/ToolBarItem/Gui/ToolBarDropDownButton.cs

19
data/schemas/AddIn.xsd

@ -610,13 +610,13 @@ @@ -610,13 +610,13 @@
<xs:enumeration value="Item" />
<xs:enumeration value="Command" />
<xs:enumeration value="Menu" />
<xs:enumeration value="Builder" />
<xs:enumeration value="Builder"/>
</xs:restriction>
</xs:simpleType>
<xs:annotation>
<xs:documentation>
This attribute must be one of these values:
Separator, CheckBox, Item=Command, Menu (=with subitems),
Separator, CheckBox, Item (=Command), Menu (=with subitems),
Builder (=class implementing ISubmenuBuilder).
Default: Command.
</xs:documentation>
@ -864,13 +864,19 @@ @@ -864,13 +864,19 @@
<xs:enumeration value="CheckBox" />
<xs:enumeration value="Item" />
<xs:enumeration value="ComboBox" />
<xs:enumeration value="TextBox" />
<xs:enumeration value="Label" />
<xs:enumeration value="DropDownButton" />
<xs:enumeration value="SplitButton" />
<xs:enumeration value="Builder" />
</xs:restriction>
</xs:simpleType>
<xs:annotation>
<xs:documentation>
This attribute must be one of these values:
Separator, CheckBox, Item, ComboBox, DropDownButton
Separator, CheckBox, Item, ComboBox, DropDownButton,
ComboBox, TextBox, Label, DropDownButton,
SplitButton (=Command with MenuItem subitems)
</xs:documentation>
</xs:annotation>
</xs:attribute>
@ -879,6 +885,13 @@ @@ -879,6 +885,13 @@
<xs:documentation>
Only for the type "Item". When set to false, the command class is loaded
immediately instead of the usual lazy-loading.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="label" use="optional" type="xs:string">
<xs:annotation>
<xs:documentation>
Label of the tool bar item.
</xs:documentation>
</xs:annotation>
</xs:attribute>

22
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/ToolBarItem/Gui/ToolBarDropDownButton.cs

@ -15,6 +15,7 @@ namespace ICSharpCode.Core @@ -15,6 +15,7 @@ namespace ICSharpCode.Core
{
object caller;
Codon codon;
ICommand menuBuilder = null;
ArrayList subItems;
public ToolBarDropDownButton(Codon codon, object caller, ArrayList subItems)
@ -22,7 +23,7 @@ namespace ICSharpCode.Core @@ -22,7 +23,7 @@ namespace ICSharpCode.Core
this.RightToLeft = RightToLeft.Inherit;
this.caller = caller;
this.codon = codon;
this.subItems = subItems;
this.subItems = subItems;
if (codon.Properties.Contains("label")){
Text = StringParser.Parse(codon.Properties["label"]);
@ -30,13 +31,30 @@ namespace ICSharpCode.Core @@ -30,13 +31,30 @@ namespace ICSharpCode.Core
if (Image == null && codon.Properties.Contains("icon")) {
Image = ResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
}
if (menuBuilder == null && codon.Properties.Contains("class")) {
menuBuilder = codon.AddIn.CreateObject(StringParser.Parse(codon.Properties["class"])) as ICommand;
menuBuilder.Owner = this;
}
UpdateStatus();
UpdateText();
}
void CreateDropDownItems()
{
// let's assume that if a menuBuilder exists,
// as in the Search Results panel or the Class
// Browser toolbar, it will handle this step.
if (menuBuilder != null) {
return;
}
// also, let's prevent a null exception
// in the event that there are no subitems
if (subItems == null || subItems.Count==0) {
return;
}
DropDownItems.Clear();
foreach (object item in subItems)
{

Loading…
Cancel
Save