1 | using System;
|
---|
2 | using System.Drawing;
|
---|
3 |
|
---|
4 | namespace Netron.Diagramming.Core {
|
---|
5 | // ----------------------------------------------------------------------
|
---|
6 | /// <summary>
|
---|
7 | /// The interface of a page
|
---|
8 | /// </summary>
|
---|
9 | // ----------------------------------------------------------------------
|
---|
10 | public interface IPage {
|
---|
11 | #region Events
|
---|
12 |
|
---|
13 | // ------------------------------------------------------------------
|
---|
14 | /// <summary>
|
---|
15 | /// Occurs when an entity is added.
|
---|
16 | /// <remarks>This event usually is bubbled from one of the
|
---|
17 | /// layers</remarks>
|
---|
18 | /// </summary>
|
---|
19 | // ------------------------------------------------------------------
|
---|
20 | event EventHandler<EntityEventArgs> OnEntityAdded;
|
---|
21 |
|
---|
22 | // ------------------------------------------------------------------
|
---|
23 | /// <summary>
|
---|
24 | /// Occurs when an entity is removed.
|
---|
25 | /// <remarks>This event usually is bubbled from one of the
|
---|
26 | /// layers</remarks>
|
---|
27 | /// </summary>
|
---|
28 | // ------------------------------------------------------------------
|
---|
29 | event EventHandler<EntityEventArgs> OnEntityRemoved;
|
---|
30 |
|
---|
31 | // ------------------------------------------------------------------
|
---|
32 | /// <summary>
|
---|
33 | /// Occurs when the page is cleared
|
---|
34 | /// </summary>
|
---|
35 | // ------------------------------------------------------------------
|
---|
36 | event EventHandler OnClear;
|
---|
37 |
|
---|
38 | // ------------------------------------------------------------------
|
---|
39 | /// <summary>
|
---|
40 | /// Occurs when the Ambience has changed
|
---|
41 | /// </summary>
|
---|
42 | // ------------------------------------------------------------------
|
---|
43 | event EventHandler<AmbienceEventArgs> OnAmbienceChanged;
|
---|
44 |
|
---|
45 | #endregion
|
---|
46 |
|
---|
47 | #region Properties
|
---|
48 |
|
---|
49 | // ------------------------------------------------------------------
|
---|
50 | /// <summary>
|
---|
51 | /// Gets or sets the Name of this page.
|
---|
52 | /// </summary>
|
---|
53 | // ------------------------------------------------------------------
|
---|
54 | string Name {
|
---|
55 | get;
|
---|
56 | set;
|
---|
57 | }
|
---|
58 |
|
---|
59 | // ------------------------------------------------------------------
|
---|
60 | /// <summary>
|
---|
61 | /// Gets all the connections in the page.
|
---|
62 | /// </summary>
|
---|
63 | // ------------------------------------------------------------------
|
---|
64 | CollectionBase<IConnection> Connections {
|
---|
65 | get;
|
---|
66 | }
|
---|
67 |
|
---|
68 | // ------------------------------------------------------------------
|
---|
69 | /// <summary>
|
---|
70 | /// Gets all entities in this page.
|
---|
71 | /// </summary>
|
---|
72 | // ------------------------------------------------------------------
|
---|
73 | CollectionBase<IDiagramEntity> Entities {
|
---|
74 | get;
|
---|
75 | }
|
---|
76 |
|
---|
77 | // ------------------------------------------------------------------
|
---|
78 | /// <summary>
|
---|
79 | /// Gets all shapes in this page.
|
---|
80 | /// </summary>
|
---|
81 | // ------------------------------------------------------------------
|
---|
82 | CollectionBase<IShape> Shapes {
|
---|
83 | get;
|
---|
84 | }
|
---|
85 |
|
---|
86 | // ------------------------------------------------------------------
|
---|
87 | /// <summary>
|
---|
88 | /// Gets the layers.
|
---|
89 | /// </summary>
|
---|
90 | /// <value>The layers.</value>
|
---|
91 | // ------------------------------------------------------------------
|
---|
92 | CollectionBase<ILayer> Layers {
|
---|
93 | get;
|
---|
94 | }
|
---|
95 |
|
---|
96 | // ------------------------------------------------------------------
|
---|
97 | /// <summary>
|
---|
98 | /// Gets the default layer.
|
---|
99 | /// </summary>
|
---|
100 | /// <value>The default layer.</value>
|
---|
101 | // ------------------------------------------------------------------
|
---|
102 | ILayer DefaultLayer {
|
---|
103 | get;
|
---|
104 | }
|
---|
105 |
|
---|
106 | // ------------------------------------------------------------------
|
---|
107 | /// <summary>
|
---|
108 | /// Gets the ambience.
|
---|
109 | /// </summary>
|
---|
110 | /// <value>The ambience.</value>
|
---|
111 | // ------------------------------------------------------------------
|
---|
112 | Ambience Ambience {
|
---|
113 | get;
|
---|
114 | }
|
---|
115 |
|
---|
116 | // ------------------------------------------------------------------
|
---|
117 | /// <summary>
|
---|
118 | /// Gets a reference to the model
|
---|
119 | /// </summary>
|
---|
120 | // ------------------------------------------------------------------
|
---|
121 | IModel Model {
|
---|
122 | get;
|
---|
123 | set;
|
---|
124 | }
|
---|
125 |
|
---|
126 | // ------------------------------------------------------------------
|
---|
127 | /// <summary>
|
---|
128 | /// Gets or sets the scaling factor of this page.
|
---|
129 | /// </summary>
|
---|
130 | // ------------------------------------------------------------------
|
---|
131 | SizeF Magnification {
|
---|
132 | get;
|
---|
133 | set;
|
---|
134 | }
|
---|
135 |
|
---|
136 | // ------------------------------------------------------------------
|
---|
137 | /// <summary>
|
---|
138 | /// Gets or sets the origin of this page.
|
---|
139 | /// </summary>
|
---|
140 | // ------------------------------------------------------------------
|
---|
141 | Point Origin {
|
---|
142 | get;
|
---|
143 | set;
|
---|
144 | }
|
---|
145 |
|
---|
146 | // ------------------------------------------------------------------
|
---|
147 | /// <summary>
|
---|
148 | /// Gets the page bounds, taking into account landscape and page
|
---|
149 | /// settings (for printing).
|
---|
150 | /// </summary>
|
---|
151 | // ------------------------------------------------------------------
|
---|
152 | RectangleF Bounds {
|
---|
153 | get;
|
---|
154 | }
|
---|
155 |
|
---|
156 | #endregion
|
---|
157 |
|
---|
158 | // ------------------------------------------------------------------
|
---|
159 | /// <summary>
|
---|
160 | /// Gets the layer that has the entity specified. If the entity
|
---|
161 | /// specified could not be found, 'null' is returned.
|
---|
162 | /// </summary>
|
---|
163 | /// <param name="entity">IDiagramEntity</param>
|
---|
164 | /// <returns>ILayer</returns>
|
---|
165 | // ------------------------------------------------------------------
|
---|
166 | ILayer GetLayer(IDiagramEntity entity);
|
---|
167 |
|
---|
168 | // ------------------------------------------------------------------
|
---|
169 | /// <summary>
|
---|
170 | /// Paints the page to the drawing surface specified.
|
---|
171 | /// </summary>
|
---|
172 | /// <param name="g">Graphics</param>
|
---|
173 | /// <param name="showGrid">bool</param>
|
---|
174 | // ------------------------------------------------------------------
|
---|
175 | void Paint(Graphics g, bool showGrid);
|
---|
176 |
|
---|
177 | }
|
---|
178 | }
|
---|