using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using BansheeEngine; namespace BansheeEditor { /// /// Adds an entry to the main tool. Clicking on that entry will trigger the method the attribute is attached to. /// The method must be static, have no parameters or return values otherwise the attribute will be ignored. /// [AttributeUsage(AttributeTargets.Method)] class ToolbarItem : Attribute { /// /// Creates a new toolbar item attribute. Selecting the item in the toolbar will trigger the callback. /// /// Path that determines where in the menu to add the element. All path elements must be /// separated by /, e.g. "View/Toolbars/Find" /// Path to the sprite texture to display on the toolbar entry. Relative to project library /// resources folder. /// Optional tooltip to display when the user hovers over the toolbar entry. /// Priority determines the position of the toolbar item relative to its siblings. /// Higher priority means it will be placed earlier. /// Determines should a separator be inserted just before this element. public ToolbarItem(string name, string icon, string tooltip = "", int priority = 0, bool separator = false) { this.name = name; this.icon = icon; this.tooltip = tooltip; this.priority = priority; this.separator = separator; this.builtinIcon = -1; } /// /// Creates a new toolbar item attribute. Selecting the item in the toolbar will trigger the callback. /// /// Path that determines where in the menu to add the element. All path elements must be /// separated by /, e.g. "View/Toolbars/Find" /// Type of builtin icon to display on the toolbar entry. /// Optional tooltip to display when the user hovers over the toolbar entry. /// Priority determines the position of the toolbar item relative to its siblings. /// Higher priority means it will be placed earlier. /// Determines should a separator be inserted just before this element. internal ToolbarItem(string name, ToolbarIcon icon, string tooltip = "", int priority = 0, bool separator = false) { this.name = name; this.icon = null; this.tooltip = tooltip; this.priority = priority; this.separator = separator; this.builtinIcon = (int)icon; } private string name; private string icon; private int builtinIcon; private string tooltip; private int priority; private bool separator; } }