using System; using System.Windows.Forms; namespace Netron.Diagramming.Core { // ---------------------------------------------------------------------- /// /// Interface of a controller /// // ---------------------------------------------------------------------- public interface IController : IUndoSupport { #region Events // ------------------------------------------------------------------ /// /// Occurs when a page's ambience has changed. /// // ------------------------------------------------------------------ event EventHandler OnAmbienceChanged; // ------------------------------------------------------------------ /// /// Occurs when the undo/redo history has changed /// // ------------------------------------------------------------------ event EventHandler OnHistoryChange; // ------------------------------------------------------------------ /// /// Occurs when a tool is activated /// // ------------------------------------------------------------------ event EventHandler OnToolActivate; // ------------------------------------------------------------------ /// /// Occurs when a tool is deactivated /// // ------------------------------------------------------------------ event EventHandler OnToolDeactivate; // ------------------------------------------------------------------ /// /// Occurs when the something got selected and the properties of it /// can/should be shown. /// // ------------------------------------------------------------------ event EventHandler OnShowSelectionProperties; // ------------------------------------------------------------------ /// /// Occurs when an entity is added. /// This event usually is bubbled from one of the /// layers /// // ------------------------------------------------------------------ event EventHandler OnEntityAdded; // ------------------------------------------------------------------ /// /// Occurs when an entity is removed. /// This event usually is bubbled from one of the /// layers /// // ------------------------------------------------------------------ event EventHandler OnEntityRemoved; // ------------------------------------------------------------------ /// /// Occurs when the controller receives a mouse-down notification of /// the surface. This event is raised before the event is broadcasted /// down to the tools. /// // ------------------------------------------------------------------ event EventHandler OnMouseDown; // ------------------------------------------------------------------ /// /// Occurs when the diagram control is aksed to show the context menu /// // ------------------------------------------------------------------ event EventHandler OnShowContextMenu; #endregion #region Properties // ------------------------------------------------------------------ /// /// Gets or sets the model /// // ------------------------------------------------------------------ IModel Model { get; set; } // ------------------------------------------------------------------ /// /// Gets or sets the view. /// /// The view. // ------------------------------------------------------------------ IView View { get; set; } // ------------------------------------------------------------------ /// /// Gets the currently active tool. This can be 'null'!!! /// // ------------------------------------------------------------------ ITool ActiveTool { get; } // ------------------------------------------------------------------ /// /// Gets the tools. /// /// The tools. // ------------------------------------------------------------------ CollectionBase Tools { get; } // ------------------------------------------------------------------ /// /// Gets the undo manager. /// /// The undo manager. // ------------------------------------------------------------------ UndoManager UndoManager { get; } // ------------------------------------------------------------------ /// /// Gets the parent control. /// /// The parent control. // ------------------------------------------------------------------ IDiagramControl ParentControl { get; } // ------------------------------------------------------------------ /// /// Gets or sets a value indicating whether this /// is enabled. /// /// true if enabled; otherwise, false. // ------------------------------------------------------------------ bool Enabled { get; set; } #endregion #region Methods // ------------------------------------------------------------------ /// /// Activates the text editor for the given text provider. /// /// ITextProvider /// bool: True if sucessful, false if not. // ------------------------------------------------------------------ bool ActivateTextEditor(ITextProvider textProvider); // ------------------------------------------------------------------ /// /// Activates the tool. /// /// Name of the tool. // ------------------------------------------------------------------ void ActivateTool(string toolName); // ------------------------------------------------------------------ /// /// Adds the tool. /// /// The tool. // ------------------------------------------------------------------ void AddTool(ITool tool); // ------------------------------------------------------------------ /// /// Deactivates the tool. /// /// The tool. /// bool: True if successful. // ------------------------------------------------------------------ bool DeactivateTool(ITool tool); // ------------------------------------------------------------------ /// /// Deactivates all tools. /// /// bool: True if successful. // ------------------------------------------------------------------ bool DeactivateAllTools(); // ------------------------------------------------------------------ /// /// Raises the OnShowSelectionProperties event. /// /// The /// /// instance containing the event data. // ------------------------------------------------------------------ void RaiseOnShowSelectionProperties(SelectionEventArgs e); // ------------------------------------------------------------------ /// /// Suspends all tools /// // ------------------------------------------------------------------ void SuspendAllTools(); // ------------------------------------------------------------------ /// /// Unsuspends all tools. /// // ------------------------------------------------------------------ void UnsuspendAllTools(); // ------------------------------------------------------------------ /// /// Raises the OnShowContextMenu event /// /// EntityMenuEventArgs // ------------------------------------------------------------------ void RaiseOnShowContextMenu(EntityMenuEventArgs e); // ------------------------------------------------------------------ /// /// Changes the paint style of the selected entities. /// /// IPaintStyle // ------------------------------------------------------------------ void ChangeStyle(IPaintStyle paintStyle); // ------------------------------------------------------------------ /// /// Changes the pen style of the selected entities. /// /// IPenStyle // ------------------------------------------------------------------ void ChangeStyle(IPenStyle penStyle); // ------------------------------------------------------------------ /// /// Runs the specified activity. If no activity exists with the name /// specified, then an exception is thrown. /// /// string: The name of the activity to run. // ------------------------------------------------------------------ void RunActivity(string name); // ------------------------------------------------------------------ /// /// Selects all entities on the current page. The selection is /// cleared first. /// // ------------------------------------------------------------------ void SelectAll(); // ------------------------------------------------------------------ /// /// Navigates to the next page. Nothing is performed if the last page /// is currently selected and 'wrap' is false. If 'wrap' is true, /// then the first page is selected. /// /// bool: Specifies if the collection is wrapped /// when the end is reached. // ------------------------------------------------------------------ void GoForward(bool wrap); // ------------------------------------------------------------------ /// /// Navigates to the previous page. Nothing is performed if the first /// page is currently selected and 'wrap' is false. If 'wrap' is /// true, then the last page is selected if the current page is the /// first page. /// /// bool: Specifies if the collection is wrapped /// when the start is reached. // ------------------------------------------------------------------ void GoBack(bool wrap); #endregion } }