using FastReport.Controls; using FastReport.DevComponents.DotNetBar; using FastReport.Forms; using FastReport.Utils; using System.ComponentModel; namespace FastReport.Design.Toolbars { /// /// Base class for all designer toolbars. /// /// /// Use this class to write own designer's toolbar. To do this: /// - in the constructor, set the Name property and create toolbar buttons. /// The Name will be used to restore toolbar's state; /// - override the SelectionChanged method. This method is called when current selection /// is changed. In this method, you should update buttons state to reflect the current selection. /// Selected objects can be accessed via Designer.SelectedObjects property; /// - override the UpdateContent method. This method is called when the report /// content was changed. Typically you need to do the same actions in SelectionChanged and /// UpdateContent methods; /// - to register a toolbar, add its type to the global collection: /// /// DesignerPlugins.Add(typeof(MyToolbar)); /// /// /// [ToolboxItem(false)] public class DesignerToolbarBase : ToolbarBase, IDesignerPlugin { #region Properties /// public string PluginName => Name; private ControlStorageService storage; public ControlStorageService Storage => storage ?? new ControlStorageService(this, "Designer," + Name); #endregion #region IDesignerPlugin /// public virtual void SaveState() { } /// public virtual void RestoreState() { } /// public virtual void SelectionChanged() { } /// public virtual void UpdateContent() { } /// public void Lock() { } /// public void Unlock() { UpdateContent(); } /// public virtual void Localize() { CustomizeItem.Text = Res.Get("Designer,Toolbar,AddOrRemove"); } /// public virtual DesignerOptionsPage GetOptionsPage() { return null; } #endregion /// /// Initializes a new instance of the class with default settings. /// /// The report designer. /// /// You don't need to call this constructor. The designer will do this automatically. /// public DesignerToolbarBase(Designer designer) : base(designer) { } } }