[2768] | 1 | using System;
|
---|
| 2 | using System.Drawing;
|
---|
| 3 |
|
---|
[4068] | 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 | // ------------------------------------------------------------------
|
---|
[2768] | 14 | /// <summary>
|
---|
[4068] | 15 | /// Occurs when an entity is added.
|
---|
| 16 | /// <remarks>This event usually is bubbled from one of the
|
---|
| 17 | /// layers</remarks>
|
---|
[2768] | 18 | /// </summary>
|
---|
[4068] | 19 | // ------------------------------------------------------------------
|
---|
| 20 | event EventHandler<EntityEventArgs> OnEntityAdded;
|
---|
[2768] | 21 |
|
---|
[4068] | 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;
|
---|
[2768] | 30 |
|
---|
[4068] | 31 | // ------------------------------------------------------------------
|
---|
| 32 | /// <summary>
|
---|
| 33 | /// Occurs when the page is cleared
|
---|
| 34 | /// </summary>
|
---|
| 35 | // ------------------------------------------------------------------
|
---|
| 36 | event EventHandler OnClear;
|
---|
[2768] | 37 |
|
---|
[4068] | 38 | // ------------------------------------------------------------------
|
---|
| 39 | /// <summary>
|
---|
| 40 | /// Occurs when the Ambience has changed
|
---|
| 41 | /// </summary>
|
---|
| 42 | // ------------------------------------------------------------------
|
---|
| 43 | event EventHandler<AmbienceEventArgs> OnAmbienceChanged;
|
---|
[2768] | 44 |
|
---|
[4068] | 45 | #endregion
|
---|
[2768] | 46 |
|
---|
[4068] | 47 | #region Properties
|
---|
[2768] | 48 |
|
---|
[4068] | 49 | // ------------------------------------------------------------------
|
---|
| 50 | /// <summary>
|
---|
| 51 | /// Gets or sets the Name of this page.
|
---|
| 52 | /// </summary>
|
---|
| 53 | // ------------------------------------------------------------------
|
---|
| 54 | string Name {
|
---|
| 55 | get;
|
---|
| 56 | set;
|
---|
| 57 | }
|
---|
[2768] | 58 |
|
---|
[4068] | 59 | // ------------------------------------------------------------------
|
---|
| 60 | /// <summary>
|
---|
| 61 | /// Gets all the connections in the page.
|
---|
| 62 | /// </summary>
|
---|
| 63 | // ------------------------------------------------------------------
|
---|
| 64 | CollectionBase<IConnection> Connections {
|
---|
| 65 | get;
|
---|
| 66 | }
|
---|
[2768] | 67 |
|
---|
[4068] | 68 | // ------------------------------------------------------------------
|
---|
| 69 | /// <summary>
|
---|
| 70 | /// Gets all entities in this page.
|
---|
| 71 | /// </summary>
|
---|
| 72 | // ------------------------------------------------------------------
|
---|
| 73 | CollectionBase<IDiagramEntity> Entities {
|
---|
| 74 | get;
|
---|
| 75 | }
|
---|
[2768] | 76 |
|
---|
[4068] | 77 | // ------------------------------------------------------------------
|
---|
| 78 | /// <summary>
|
---|
| 79 | /// Gets all shapes in this page.
|
---|
| 80 | /// </summary>
|
---|
| 81 | // ------------------------------------------------------------------
|
---|
| 82 | CollectionBase<IShape> Shapes {
|
---|
| 83 | get;
|
---|
| 84 | }
|
---|
[2768] | 85 |
|
---|
[4068] | 86 | // ------------------------------------------------------------------
|
---|
| 87 | /// <summary>
|
---|
| 88 | /// Gets the layers.
|
---|
| 89 | /// </summary>
|
---|
| 90 | /// <value>The layers.</value>
|
---|
| 91 | // ------------------------------------------------------------------
|
---|
| 92 | CollectionBase<ILayer> Layers {
|
---|
| 93 | get;
|
---|
| 94 | }
|
---|
[2768] | 95 |
|
---|
[4068] | 96 | // ------------------------------------------------------------------
|
---|
| 97 | /// <summary>
|
---|
| 98 | /// Gets the default layer.
|
---|
| 99 | /// </summary>
|
---|
| 100 | /// <value>The default layer.</value>
|
---|
| 101 | // ------------------------------------------------------------------
|
---|
| 102 | ILayer DefaultLayer {
|
---|
| 103 | get;
|
---|
| 104 | }
|
---|
[2768] | 105 |
|
---|
[4068] | 106 | // ------------------------------------------------------------------
|
---|
| 107 | /// <summary>
|
---|
| 108 | /// Gets the ambience.
|
---|
| 109 | /// </summary>
|
---|
| 110 | /// <value>The ambience.</value>
|
---|
| 111 | // ------------------------------------------------------------------
|
---|
| 112 | Ambience Ambience {
|
---|
| 113 | get;
|
---|
| 114 | }
|
---|
[2768] | 115 |
|
---|
[4068] | 116 | // ------------------------------------------------------------------
|
---|
| 117 | /// <summary>
|
---|
| 118 | /// Gets a reference to the model
|
---|
| 119 | /// </summary>
|
---|
| 120 | // ------------------------------------------------------------------
|
---|
| 121 | IModel Model {
|
---|
| 122 | get;
|
---|
| 123 | set;
|
---|
| 124 | }
|
---|
[2768] | 125 |
|
---|
[4068] | 126 | // ------------------------------------------------------------------
|
---|
| 127 | /// <summary>
|
---|
| 128 | /// Gets or sets the scaling factor of this page.
|
---|
| 129 | /// </summary>
|
---|
| 130 | // ------------------------------------------------------------------
|
---|
| 131 | SizeF Magnification {
|
---|
| 132 | get;
|
---|
| 133 | set;
|
---|
| 134 | }
|
---|
[2768] | 135 |
|
---|
[4068] | 136 | // ------------------------------------------------------------------
|
---|
| 137 | /// <summary>
|
---|
| 138 | /// Gets or sets the origin of this page.
|
---|
| 139 | /// </summary>
|
---|
| 140 | // ------------------------------------------------------------------
|
---|
| 141 | Point Origin {
|
---|
| 142 | get;
|
---|
| 143 | set;
|
---|
| 144 | }
|
---|
[2768] | 145 |
|
---|
[4068] | 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 | }
|
---|
[2768] | 155 |
|
---|
[4068] | 156 | #endregion
|
---|
[2768] | 157 |
|
---|
[4068] | 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);
|
---|
[2768] | 167 |
|
---|
[4068] | 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);
|
---|
[2768] | 176 |
|
---|
[4068] | 177 | }
|
---|
[2768] | 178 | }
|
---|