Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Core/Interfaces/IView.cs @ 2768

Last change on this file since 2768 was 2768, checked in by mkommend, 14 years ago

added solution folders and sources for the netron library (ticket #867)

File size: 13.3 KB
Line 
1using System;
2using System.Drawing;
3using System.Drawing.Drawing2D;
4using System.Windows.Forms;
5using System.Drawing.Printing;
6namespace Netron.Diagramming.Core
7{
8    // ----------------------------------------------------------------------
9    /// <summary>
10    /// The interface of the "View" in the Model - View - Controller
11    /// framework.  The drawing of the diagram is handled by the View.
12    /// </summary>
13    // ----------------------------------------------------------------------
14    public interface IView
15    {
16        #region Events
17        /// <summary>
18        /// Occurs when the cursor is changed and the surface is supposed to set the cursor accordingly.
19        /// </summary>
20        event EventHandler<CursorEventArgs> OnCursorChange;
21
22        event EventHandler<ColorEventArgs> OnBackColorChange;
23        #endregion
24
25        #region Properties
26
27        // ------------------------------------------------------------------
28        /// <summary>
29        /// Gets or sets if the grid is to be drawn.
30        /// </summary>
31        // ------------------------------------------------------------------
32        bool ShowGrid
33        {
34            get;
35            set;
36        }
37
38        // ------------------------------------------------------------------
39        /// <summary>
40        /// Gets or sets if all shape's connectors should be shown.
41        /// </summary>
42        // ------------------------------------------------------------------
43        bool ShowConnectors
44        {
45            get;
46            set;
47        }
48
49        Rectangle HorizontalRulerBounds { get;}
50        Rectangle VerticalRulerBounds { get;}
51        MeasurementsUnit RulerUnits { get;}
52        /// <summary>
53        /// Get the transformation matrix of the view
54        /// </summary>
55        Matrix ViewMatrix { get;}
56
57        // ------------------------------------------------------------------
58        /// <summary>
59        /// Gets or sets the current cursor.
60        /// </summary>
61        /// <value>The current cursor.</value>
62        // ------------------------------------------------------------------
63        Cursor CurrentCursor { get; set;}
64
65        /// <summary>
66        /// Gets the ghost.
67        /// </summary>
68        /// <value>The ghost.</value>
69        IGhost Ghost { get;}
70
71        /// <summary>
72        /// Gets the ants.
73        /// </summary>
74        /// <value>The ants.</value>
75        IAnts Ants
76        {
77            get;
78        }
79
80        /// <summary>
81        /// Gets or sets the model.
82        /// </summary>
83        /// <value>The model.</value>
84        IModel Model { get; set; }
85
86        /// <summary>
87        /// Gets or sets the tracker.
88        /// </summary>
89        /// <value>The tracker.</value>
90        ITracker Tracker { get; set;}
91
92        /// <summary>
93        /// Scales the diagram.
94        /// </summary>
95        /// <value>The scale.</value>
96        SizeF Magnification { get; set;}
97
98        /// <summary>
99        /// Pans the view with the given shift.
100        /// </summary>
101        /// <value>The pan.</value>
102        Point Origin {get;set;}
103
104        /// <summary>
105        /// Gets or sets whether the rulers are visible.
106        /// </summary>
107        bool ShowRulers { get;set;}
108
109        // ------------------------------------------------------------------
110        /// <summary>
111        /// Gets or sets if the page's title is drawn when 'ShowPage' is set
112        /// to true.
113        /// </summary>
114        // ------------------------------------------------------------------
115        bool ShowPageTitle
116        {
117            get;
118            set;
119        }
120
121        // ------------------------------------------------------------------
122        /// <summary>
123        /// Gets or sets the size of the page in thousandths of an inch.
124        /// </summary>
125        // ------------------------------------------------------------------
126        Size PageSize
127        {
128            get;
129            set;
130        }
131
132        // ------------------------------------------------------------------
133        /// <summary>
134        /// Gets or sets if each page is rendered and printed in landscape
135        /// orientation.
136        /// </summary>
137        // ------------------------------------------------------------------
138        bool Landscape
139        {
140            get;
141            set;
142        }
143
144        /// <summary>
145        /// Gets the graphics object of the surface.
146        /// </summary>
147        /// <value>The graphics.</value>
148        Graphics Graphics
149        {
150            get;
151        }
152
153        #endregion
154
155        #region Methods
156
157        #region View to device
158        Point ViewToDevice(PointF point);
159        Size ViewToDevice(SizeF szView);
160        PointF ViewToDeviceF(PointF ptView);
161        Rectangle ViewToDevice(RectangleF rcView);
162        void ViewToDevice(PointF[] viewPts, out Point[] devicePts);
163        SizeF ViewToDeviceF(SizeF szView);
164        RectangleF ViewToDeviceF(RectangleF rcView);
165        #endregion
166
167        #region World to view
168        PointF WorldToView(PointF ptWorld);
169        RectangleF WorldToView(RectangleF rectangle);
170        void WorldToView(PointF[] worldPts, out PointF[] viewPts);
171        SizeF WorldToView(SizeF szWorld);
172        #endregion
173
174        #region Device to view
175        PointF DeviceToView(Point ptDevice);
176        void DeviceToView(Point[] devicePts, out PointF[] viewPts);
177        RectangleF DeviceToView(Rectangle rcDevice);
178        SizeF DeviceToView(Size szDevice);
179        #endregion
180
181        #region View to world
182        PointF ViewToWorld(PointF ptView);
183        RectangleF ViewToWorld(RectangleF rcView);
184        Rectangle ViewToWorld(Rectangle rcView);
185        SizeF ViewToWorld(SizeF szView);
186        void ViewToWorld(PointF[] viewPts, out PointF[] worldPts);
187        #endregion
188
189        // ------------------------------------------------------------------
190        /// <summary>
191        /// Sets the magnification and origin of the diagram such that
192        /// all entities in the current page are in view.
193        /// </summary>
194        // ------------------------------------------------------------------
195        void ZoomFit();
196
197        // ------------------------------------------------------------------
198        /// <summary>
199        /// Zooms the diagram control to the area specified.
200        /// </summary>
201        /// <param name="area">Rectangle: The area to zoom.</param>
202        // ------------------------------------------------------------------
203        void ZoomArea(Rectangle area);
204
205        // ------------------------------------------------------------------
206        /// <summary>
207        /// Invalidates this instance.
208        /// </summary>
209        // ------------------------------------------------------------------
210        void Invalidate();
211
212        // ------------------------------------------------------------------
213        /// <summary>
214        /// Invalidates the specified rectangle.
215        /// </summary>
216        /// <param name="rectangle">The rectangle.</param>
217        // ------------------------------------------------------------------
218        void Invalidate(System.Drawing.Rectangle rectangle);
219
220        // ------------------------------------------------------------------
221        /// <summary>
222        /// Paints the specified g.
223        /// </summary>
224        /// <param name="g">The g.</param>
225        // ------------------------------------------------------------------
226        void Paint(System.Drawing.Graphics g);
227
228        // ------------------------------------------------------------------
229        /// <summary>
230        /// Paints the background.
231        /// </summary>
232        /// <param name="g">The g.</param>
233        // ------------------------------------------------------------------
234        void PaintBackground(System.Drawing.Graphics g);
235
236        // ------------------------------------------------------------------
237        /// <summary>
238        /// Sets the type of the background.
239        /// </summary>
240        /// <param name="type">The type.</param>
241        // ------------------------------------------------------------------
242        void SetBackgroundType(CanvasBackgroundTypes type);
243
244        // ------------------------------------------------------------------
245        /// <summary>
246        /// Resets the ghost.
247        /// </summary>
248        // ------------------------------------------------------------------
249        void ResetGhost();
250
251        // ------------------------------------------------------------------
252        /// <summary>
253        /// Resets the ants.
254        /// </summary>
255        // ------------------------------------------------------------------
256        void ResetAnts();
257
258        // ------------------------------------------------------------------
259        /// <summary>
260        /// Resets the tracker.  The tracker is the selection frame drawn
261        /// around selected entities and allows then to be moved and/or
262        /// resized.
263        /// </summary>
264        // ------------------------------------------------------------------
265        void ResetTracker();
266
267        // ------------------------------------------------------------------
268        /// <summary>
269        /// Hides the tracker.  The tracker is the selection frame drawn
270        /// around selected entities and allows then to be moved and/or
271        /// resized.
272        /// </summary>
273        // ------------------------------------------------------------------
274        void HideTracker();
275
276        // ------------------------------------------------------------------
277        /// <summary>
278        /// Paints the ghost rectangle.
279        /// </summary>
280        /// <param name="start">The start.</param>
281        /// <param name="end">The end.</param>
282        // ------------------------------------------------------------------
283        void PaintGhostRectangle(Point start, Point end);
284
285        // ------------------------------------------------------------------
286        /// <summary>
287        /// Paints a ghost line.
288        /// </summary>
289        /// <param name="start">The start.</param>
290        /// <param name="end">The end.</param>
291        // ------------------------------------------------------------------
292        void PaintGhostLine(Point start, Point end);
293
294        // ------------------------------------------------------------------
295        /// <summary>
296        /// Paints a ghost multi-line
297        /// </summary>
298        /// <param name="cureveType">Type of the cureve.</param>
299        /// <param name="points">The points.</param>
300        // ------------------------------------------------------------------
301        void PaintGhostLine(MultiPointType cureveType, Point[] points);
302
303        // ------------------------------------------------------------------
304        /// <summary>
305        /// Paints the ghost ellipse.
306        /// </summary>
307        /// <param name="start">The start.</param>
308        /// <param name="end">The end.</param>
309        // ------------------------------------------------------------------
310        void PaintGhostEllipse(Point start, Point end);
311
312        // ------------------------------------------------------------------
313        /// <summary>
314        /// Paints the ants rectangle.
315        /// </summary>
316        /// <param name="ltPoint">The lt point.</param>
317        /// <param name="rbPoint">The rb point.</param>
318        // ------------------------------------------------------------------
319        void PaintAntsRectangle(Point ltPoint, Point rbPoint);
320
321        // ------------------------------------------------------------------
322        /// <summary>
323        /// Paints the tracker.
324        /// </summary>
325        /// <param name="rectangle">The rectangle.</param>
326        /// <param name="showHandles">if set to <c>true</c> shows the
327        /// handles.</param>
328        // ------------------------------------------------------------------
329        void PaintTracker(Rectangle rectangle, bool showHandles);
330
331        // ------------------------------------------------------------------
332        /// <summary>
333        /// Attaches to model.
334        /// </summary>
335        /// <param name="model">The model.</param>
336        // ------------------------------------------------------------------
337        void AttachToModel(IModel model);
338
339        // ------------------------------------------------------------------
340        /// <summary>
341        /// Shows the tracker.
342        /// </summary>
343        // ------------------------------------------------------------------
344        void ShowTracker();
345
346        // ------------------------------------------------------------------
347        /// <summary>
348        /// Suspends the invalidation of the view, which means that the
349        /// Invalidate() method calls from any entity will be discarded until
350        /// Resume() has been called.
351        /// </summary>
352        // ------------------------------------------------------------------
353        void Suspend();
354
355        // ------------------------------------------------------------------
356        /// <summary>
357        /// Resumes the invalidation of the view.
358        /// </summary>
359        // ------------------------------------------------------------------
360        void Resume();
361
362        #endregion
363
364    }
365}
Note: See TracBrowser for help on using the repository browser.