using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Reflection; using System.Resources; using System.Windows.Forms; using Core.Common.BaseDelftTools; using Core.Common.Controls; using Core.Common.Gui.Forms; namespace Core.Common.Gui { public abstract class GuiPlugin : IPlugin, IDisposable { /// /// Reference to the the gui (set by framework) /// public virtual IGui Gui { get; set; } /// /// Extends ribbon control of the main window. /// Override this property to add tabs, groups, buttons or other controls to the ribbon. /// public virtual IRibbonCommandHandler RibbonCommandHandler { get { return null; } } /// /// /// public virtual IEnumerable OptionsControls { get { yield break; } } /// /// Provides custom object map layers. /// public virtual IMapLayerProvider MapLayerProvider { get { return null; } } /// /// Gets the name of the plugin. (used for plugin versioning (backwards compatibility)) /// The name. public abstract string Name { get; } /// /// Gets the name of the plugin as displayed in the Gui. /// The name. public abstract string DisplayName { get; } /// /// Gets the description. /// The description. public abstract string Description { get; } /// /// Gets the version of the plugin. /// The version. public abstract string Version { get; } /// /// ResourceManger of plugin. Default Properties.Resources. /// public virtual ResourceManager Resources { get; set; } /// /// Image for displaying in gui. Default format 32x32 bitmap or scalable. /// public virtual Image Image { get { return null; } } /// /// Gets a value indicating whether the plugin is active. /// true if this instance is active; otherwise, false. public virtual bool IsActive { get; protected set; } /// /// Returns all property information objects supported by the plugin /// public virtual IEnumerable GetPropertyInfos() { return Enumerable.Empty(); } /// /// Provides views info objects for creating views. /// public virtual IEnumerable GetViewInfoObjects() { yield break; } public virtual void OnViewAdded(IView view) {} public virtual void OnViewRemoved(IView view) {} public virtual void OnActiveViewChanged(IView view) {} /// /// Returns a context menu which is used for this object. /// /// /// /// public virtual ContextMenuStrip GetContextMenu(object sender, object data) { return null; } public virtual IEnumerable GetProjectTreeViewNodePresenters() { yield break; } /// /// TODO: is it not part of IView? /// /// /// public virtual void OnDragDrop(object source, object target) {} /// /// TODO: is it not part of IView? /// /// /// public virtual bool CanDrop(object source, object target) { return false; } /// /// Returns false if plugin does not allow to paste into . /// /// Return true in default implementation. /// public virtual bool CanPaste(IProjectItem item, IProjectItem container) { return true; } /// /// Returns false if plugin does not allow to copy for copy/paste action. /// /// Return true in default implementation. /// public virtual bool CanCopy(IProjectItem item) { return true; } /// /// Returns false if plugin does not allow to cut for copy/paste action. /// /// Return true in default implementation. /// public virtual bool CanCut(IProjectItem item) { return true; } /// /// Returns false when data item can not be deleted by the user. /// public virtual bool CanDelete(IProjectItem item) { return true; } public virtual void Dispose() { Gui = null; } /// /// Activates the plugin. /// public virtual void Activate() { IsActive = true; } /// /// Deactivates the plugin. /// public virtual void Deactivate() { IsActive = false; } public virtual IEnumerable GetPersistentAssemblies() { yield break; } } }