1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Text;
|
---|
4 |
|
---|
5 | namespace Netron.Diagramming.Core
|
---|
6 | {
|
---|
7 | /*
|
---|
8 | http://www.theserverside.net/blogs/showblog.tss?id=pluginArchitectures
|
---|
9 | http://www.martinfowler.com/articles/injection.html
|
---|
10 | http://www.codeproject.com/csharp/components.asp
|
---|
11 | */
|
---|
12 | /// <summary>
|
---|
13 | /// Describes a tool's members. <seealso cref="AbstractTool"/>
|
---|
14 | /// </summary>
|
---|
15 | public interface ITool : IServiceProvider
|
---|
16 | {
|
---|
17 | #region Events
|
---|
18 |
|
---|
19 | // ------------------------------------------------------------------
|
---|
20 | /// <summary>
|
---|
21 | /// Occurs when this tool is deactivated.
|
---|
22 | /// </summary>
|
---|
23 | // ------------------------------------------------------------------
|
---|
24 | event EventHandler<ToolEventArgs> OnToolDeactivate;
|
---|
25 |
|
---|
26 | // ------------------------------------------------------------------
|
---|
27 | /// <summary>
|
---|
28 | /// Occurs when this tool is activated.
|
---|
29 | /// </summary>
|
---|
30 | // ------------------------------------------------------------------
|
---|
31 | event EventHandler<ToolEventArgs> OnToolActivate;
|
---|
32 |
|
---|
33 | #endregion
|
---|
34 |
|
---|
35 | #region Properties
|
---|
36 |
|
---|
37 | // ------------------------------------------------------------------
|
---|
38 | /// <summary>
|
---|
39 | /// Gets or sets a value indicating whether this <see cref="T:ITool"/>
|
---|
40 | /// is enabled.
|
---|
41 | /// </summary>
|
---|
42 | /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
|
---|
43 | // ------------------------------------------------------------------
|
---|
44 | bool Enabled { get; set; }
|
---|
45 |
|
---|
46 | // ------------------------------------------------------------------
|
---|
47 | /// <summary>
|
---|
48 | /// Gets or sets the name of the tool.
|
---|
49 | /// </summary>
|
---|
50 | /// <value>The name.</value>
|
---|
51 | // ------------------------------------------------------------------
|
---|
52 | string Name { get; set; }
|
---|
53 |
|
---|
54 | // ------------------------------------------------------------------
|
---|
55 | /// <summary>
|
---|
56 | /// Gets or sets a value indicating whether this tool is active. If
|
---|
57 | /// true the tool is actually performing work via the various mouse
|
---|
58 | /// or keyboard event handlers.
|
---|
59 | /// If <see cref="Enabled"/> is false the tool can never be active.
|
---|
60 | /// Furthermore, if the tool <see cref="IsSuspended"/> it means
|
---|
61 | /// another tool has suspended the activity of this tool.
|
---|
62 | /// </summary>
|
---|
63 | /// <value><c>true</c> if this instance is active; otherwise,
|
---|
64 | /// <c>false</c>.</value>
|
---|
65 | // ------------------------------------------------------------------
|
---|
66 | bool IsActive { get; set;}
|
---|
67 |
|
---|
68 | // ------------------------------------------------------------------
|
---|
69 | /// <summary>
|
---|
70 | /// Gets or sets a value indicating whether this tool can activated.
|
---|
71 | /// </summary>
|
---|
72 | /// <value>
|
---|
73 | /// <c>true</c> if this instance can activate; otherwise, <c>false</c>.
|
---|
74 | /// </value>
|
---|
75 | // ------------------------------------------------------------------
|
---|
76 | bool CanActivate { get; }
|
---|
77 |
|
---|
78 | // ------------------------------------------------------------------
|
---|
79 | /// <summary>
|
---|
80 | /// Gets or sets the controller.
|
---|
81 | /// </summary>
|
---|
82 | /// <value>The controller.</value>
|
---|
83 | // ------------------------------------------------------------------
|
---|
84 | IController Controller { get; set;}
|
---|
85 |
|
---|
86 | // ------------------------------------------------------------------
|
---|
87 | /// <summary>
|
---|
88 | /// Gets or sets a value indicating whether this instance is suspended.
|
---|
89 | /// A tool enters in a suspended mode when another tool has been
|
---|
90 | /// activated and disallows another to continue its normal activity.
|
---|
91 | /// For example, the <see cref="MoveTool"/> and
|
---|
92 | /// <see cref="SelectionTool"/> are utually exclusive and similarly
|
---|
93 | /// for the drawing tools and the selection tool.
|
---|
94 | /// <para>This suspended state is independent of the
|
---|
95 | /// <see cref="IsActive"/> and the <see cref="Enabled"/> states.</para>
|
---|
96 | /// </summary>
|
---|
97 | /// <value>
|
---|
98 | /// <c>true</c> if this instance is suspended; otherwise, <c>false</c>.
|
---|
99 | /// </value>
|
---|
100 | // ------------------------------------------------------------------
|
---|
101 | bool IsSuspended { get; set;}
|
---|
102 |
|
---|
103 | #endregion
|
---|
104 |
|
---|
105 | #region Methods
|
---|
106 |
|
---|
107 | /// <summary>
|
---|
108 | /// Deactivates the tool.
|
---|
109 | /// </summary>
|
---|
110 | /// <returns></returns>
|
---|
111 | bool DeactivateTool();
|
---|
112 |
|
---|
113 | /// <summary>
|
---|
114 | /// Activates the tool.
|
---|
115 | /// </summary>
|
---|
116 | /// <returns></returns>
|
---|
117 | bool ActivateTool();
|
---|
118 |
|
---|
119 | #endregion
|
---|
120 | }
|
---|
121 |
|
---|
122 |
|
---|
123 | }
|
---|