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