// // // // // $Revision: 3287 $ // using System; using System.Collections; namespace ICSharpCode.Core { /// /// Creates menu items from a location in the addin tree. /// /// /// Label of the menu item. /// /// /// This attribute must be one of these values: /// Separator, CheckBox, Item=Command, Menu (=with subitems), /// Builder (=class implementing ISubmenuBuilder). /// Default: Command. /// /// /// Only for the type "Item"/"Command". /// When set to false, the command class is loaded /// immediately instead of the usual lazy-loading. /// /// /// Icon of the menu item. /// /// /// Command class that is run when item is clicked. /// /// /// Only for the type "Item"/"Command". Opens a webpage instead of running a command when /// clicking the item. /// /// /// Shortcut that activates the command (e.g. "Control|S"). /// /// /// If "type" is "Menu", the item can have sub-menuitems. /// /// Any menu strip paths or context menu paths, e.g. /SharpDevelop/Workbench/MainMenu /// /// A MenuItemDescriptor object. /// /// Conditions are handled by the item, "Exclude" maps to "Visible = false", "Disable" to "Enabled = false" public class MenuItemDoozer : IDoozer { /// /// Gets if the doozer handles codon conditions on its own. /// If this property return false, the item is excluded when the condition is not met. /// public bool HandleConditions { get { return true; } } public object BuildItem(object caller, Codon codon, ArrayList subItems) { return new MenuItemDescriptor(caller, codon, subItems); } } /// /// Represents a menu item. These objects are created by the MenuItemDoozer and /// then converted into GUI-toolkit-specific objects by the MenuService. /// public sealed class MenuItemDescriptor { public readonly object Caller; public readonly Codon Codon; public readonly IList SubItems; public MenuItemDescriptor(object caller, Codon codon, IList subItems) { this.Caller = caller; this.Codon = codon; this.SubItems = subItems; } } }