Changeset 4068 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Core/Interfaces/IDiagramControl.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Core/Interfaces/IDiagramControl.cs
r2768 r4068 1 1 using System; 2 using System.Collections.Generic;3 using System.Text;4 2 using System.Drawing; 5 3 using System.Windows.Forms; 6 namespace Netron.Diagramming.Core 7 { 8 // ---------------------------------------------------------------------- 9 /// <summary> 10 /// Interface of the surface or diagram control. 11 /// </summary> 12 // ---------------------------------------------------------------------- 13 public interface IDiagramControl 14 { 15 #region Events 16 /// <summary> 17 /// Occurs when a drag-and-drop operation is completed. 18 /// </summary> 19 event DragEventHandler DragDrop; 20 /// <summary> 21 /// Occurs when an object is dragged into the control's bounds. 22 /// </summary> 23 event DragEventHandler DragEnter; 24 /// <summary> 25 /// Occurs when an object is dragged out of the control's bounds. 26 /// </summary> 27 event EventHandler DragLeave; 28 /// <summary> 29 /// Occurs when an object is dragged over the control's bounds. 30 /// </summary> 31 event DragEventHandler DragOver; 32 33 event GiveFeedbackEventHandler GiveFeedback; 34 /// <summary> 35 /// Occurs when the size of the canvas has changed 36 /// </summary> 37 /// <remarks> 38 /// This event is usually defined already in the Control or ScrollableControl class from which 39 /// the canvas inherits. 40 /// </remarks> 41 event EventHandler SizeChanged; 42 /// <summary> 43 /// Occurs when the mouse is pressed on the canvas 44 /// </summary> 45 /// <remarks> 46 /// This event is usually defined already in the Control or ScrollableControl class from which 47 /// the canvas inherits. 48 /// </remarks> 49 event MouseEventHandler MouseDown; 50 /// <summary> 51 /// Occurs when the mouse is released above the canvas 52 /// </summary> 53 /// <remarks> 54 /// This event is usually defined already in the Control or ScrollableControl class from which 55 /// the canvas inherits. 56 /// </remarks> 57 event MouseEventHandler MouseUp; 58 /// <summary> 59 /// Occurs when the mouse is moved over the canvas 60 /// </summary> 61 /// <remarks> 62 /// This event is usually defined already in the Control or ScrollableControl class from which 63 /// the canvas inherits. 64 /// </remarks> 65 event MouseEventHandler MouseMove; 66 /// <summary> 67 /// Occurs when the mouse pointer rests on the control. 68 /// </summary> 69 event EventHandler MouseHover; 70 71 event MouseEventHandler MouseWheel; 72 /// <summary> 73 /// Occurs when a key is down 74 /// </summary> 75 event KeyEventHandler KeyDown; 76 /// <summary> 77 /// Occurs when a key is released 78 /// </summary> 79 event KeyEventHandler KeyUp; 80 /// <summary> 81 /// Occurs when a key is pressed 82 /// </summary> 83 event KeyPressEventHandler KeyPress; 84 /// <summary> 85 /// Occurs when a new diagram is started. 86 /// </summary> 87 event EventHandler OnNewDiagram; 88 #endregion 89 90 #region Properties 91 92 /// <summary> 93 /// Gets or sets the view. 94 /// </summary> 95 /// <value>The view.</value> 96 IView View 97 { 98 get; 99 set; 100 } 101 102 /// <summary> 103 /// Gets or sets the controller. 104 /// </summary> 105 /// <value>The controller.</value> 106 IController Controller 107 { 108 get; 109 set; 110 111 } 112 113 /// <summary> 114 /// Gets or sets the Document 115 /// </summary> 116 Document Document 117 { 118 get; 119 set; 120 } 121 122 // ------------------------------------------------------------------ 123 /// <summary> 124 /// Gets or sets if all shape's connectors should be shown. 125 /// </summary> 126 // ------------------------------------------------------------------ 127 bool ShowConnectors 128 { 129 get; 130 set; 131 } 132 133 // ------------------------------------------------------------------ 134 /// <summary> 135 /// Gets or sets the scroll position. 136 /// </summary> 137 // ------------------------------------------------------------------ 138 Point AutoScrollPosition 139 { 140 get; 141 set; 142 } 143 144 // ------------------------------------------------------------------ 145 /// <summary> 146 /// Gets the client rectangle. 147 /// </summary> 148 /// <value>The client rectangle.</value> 149 // ------------------------------------------------------------------ 150 Rectangle ClientRectangle 151 { 152 get; 153 } 154 155 // ------------------------------------------------------------------ 156 /// <summary> 157 /// Gets or sets the size of the diagram. 158 /// </summary> 159 /// <value>Size: The height and width.</value> 160 // ------------------------------------------------------------------ 161 Size Size 162 { 163 get; 164 set; 165 } 166 167 // ------------------------------------------------------------------ 168 /// <summary> 169 /// Gets or sets the minimum size of the autoscroll. 170 /// </summary> 171 /// <value>Size: The height and width.</value> 172 // ------------------------------------------------------------------ 173 Size AutoScrollMinSize 174 { 175 get; 176 set; 177 } 178 179 #endregion 180 181 #region Methods 182 183 // ------------------------------------------------------------------ 184 /// <summary> 185 /// Invalidates the specified rectangle. 186 /// </summary> 187 /// <param name="rectangle">The rectangle.</param> 188 // ------------------------------------------------------------------ 189 void Invalidate(Rectangle rectangle); 190 191 // ------------------------------------------------------------------ 192 /// <summary> 193 /// Invalidates this instance. 194 /// </summary> 195 // ------------------------------------------------------------------ 196 void Invalidate(); 197 198 // ------------------------------------------------------------------ 199 /// <summary> 200 /// Focuses this instance. 201 /// </summary> 202 /// <returns></returns> 203 // ------------------------------------------------------------------ 204 bool Focus(); 205 206 // ------------------------------------------------------------------ 207 /// <summary> 208 /// Displays a PageSetupDialog so the user can specify how each 209 /// page is printed. 210 /// </summary> 211 // ------------------------------------------------------------------ 212 void PageSetup(); 213 214 // ------------------------------------------------------------------ 215 /// <summary> 216 /// Prints all pages of the diagram. 217 /// </summary> 218 // ------------------------------------------------------------------ 219 void Print(); 220 221 // ------------------------------------------------------------------ 222 /// <summary> 223 /// Print previews all pages of the diagram. 224 /// </summary> 225 // ------------------------------------------------------------------ 226 void PrintPreview(); 227 228 // ------------------------------------------------------------------ 229 /// <summary> 230 /// Displays an OpenFileDialog for the user to specify the diagram 231 /// to open. 232 /// </summary> 233 // ------------------------------------------------------------------ 234 void Open(); 235 236 // ------------------------------------------------------------------ 237 /// <summary> 238 /// Opens the specified path. 239 /// </summary> 240 /// <param name="path">The path.</param> 241 // ------------------------------------------------------------------ 242 void Open(string path); 243 244 // ------------------------------------------------------------------ 245 /// <summary> 246 /// If the current filename (FileName property) is empty, the a 247 /// SaveFileDialog is displayed for the user to specify what to save 248 /// the diagram as. Otherwise, the current filename is used to save 249 /// the diagram. 250 /// </summary> 251 // ------------------------------------------------------------------ 252 void Save(); 253 254 // ------------------------------------------------------------------ 255 /// <summary> 256 /// Displays a SaveFileDialog regardless if there's an existing 257 /// filename so the user can save the diagram to a new location. 258 /// </summary> 259 // ------------------------------------------------------------------ 260 void SaveAs(); 261 262 // ------------------------------------------------------------------ 263 /// <summary> 264 /// Saves the diagram to the path specified. 265 /// </summary> 266 /// <param name="path">The path.</param> 267 // ------------------------------------------------------------------ 268 void SaveAs(string path); 269 270 // ------------------------------------------------------------------ 271 /// <summary> 272 /// Creates a new document. 273 /// </summary> 274 // ------------------------------------------------------------------ 275 void NewDocument(); 276 277 // ------------------------------------------------------------------ 278 /// <summary> 279 /// Computes the location of the specified screen point into client 280 /// coordinates. 281 /// </summary> 282 /// <param name="p">Point</param> 283 /// <returns>Point</returns> 284 // ------------------------------------------------------------------ 285 Point PointToClient(Point p); 286 287 #endregion 288 289 } 4 namespace Netron.Diagramming.Core { 5 // ---------------------------------------------------------------------- 6 /// <summary> 7 /// Interface of the surface or diagram control. 8 /// </summary> 9 // ---------------------------------------------------------------------- 10 public interface IDiagramControl { 11 #region Events 12 /// <summary> 13 /// Occurs when a drag-and-drop operation is completed. 14 /// </summary> 15 event DragEventHandler DragDrop; 16 /// <summary> 17 /// Occurs when an object is dragged into the control's bounds. 18 /// </summary> 19 event DragEventHandler DragEnter; 20 /// <summary> 21 /// Occurs when an object is dragged out of the control's bounds. 22 /// </summary> 23 event EventHandler DragLeave; 24 /// <summary> 25 /// Occurs when an object is dragged over the control's bounds. 26 /// </summary> 27 event DragEventHandler DragOver; 28 29 event GiveFeedbackEventHandler GiveFeedback; 30 /// <summary> 31 /// Occurs when the size of the canvas has changed 32 /// </summary> 33 /// <remarks> 34 /// This event is usually defined already in the Control or ScrollableControl class from which 35 /// the canvas inherits. 36 /// </remarks> 37 event EventHandler SizeChanged; 38 /// <summary> 39 /// Occurs when the mouse is pressed on the canvas 40 /// </summary> 41 /// <remarks> 42 /// This event is usually defined already in the Control or ScrollableControl class from which 43 /// the canvas inherits. 44 /// </remarks> 45 event MouseEventHandler MouseDown; 46 /// <summary> 47 /// Occurs when the mouse is released above the canvas 48 /// </summary> 49 /// <remarks> 50 /// This event is usually defined already in the Control or ScrollableControl class from which 51 /// the canvas inherits. 52 /// </remarks> 53 event MouseEventHandler MouseUp; 54 /// <summary> 55 /// Occurs when the mouse is moved over the canvas 56 /// </summary> 57 /// <remarks> 58 /// This event is usually defined already in the Control or ScrollableControl class from which 59 /// the canvas inherits. 60 /// </remarks> 61 event MouseEventHandler MouseMove; 62 /// <summary> 63 /// Occurs when the mouse pointer rests on the control. 64 /// </summary> 65 event EventHandler MouseHover; 66 67 event MouseEventHandler MouseWheel; 68 /// <summary> 69 /// Occurs when a key is down 70 /// </summary> 71 event KeyEventHandler KeyDown; 72 /// <summary> 73 /// Occurs when a key is released 74 /// </summary> 75 event KeyEventHandler KeyUp; 76 /// <summary> 77 /// Occurs when a key is pressed 78 /// </summary> 79 event KeyPressEventHandler KeyPress; 80 /// <summary> 81 /// Occurs when a new diagram is started. 82 /// </summary> 83 event EventHandler OnNewDiagram; 84 #endregion 85 86 #region Properties 87 88 /// <summary> 89 /// Gets or sets the view. 90 /// </summary> 91 /// <value>The view.</value> 92 IView View { 93 get; 94 set; 95 } 96 97 /// <summary> 98 /// Gets or sets the controller. 99 /// </summary> 100 /// <value>The controller.</value> 101 IController Controller { 102 get; 103 set; 104 105 } 106 107 /// <summary> 108 /// Gets or sets the Document 109 /// </summary> 110 Document Document { 111 get; 112 set; 113 } 114 115 // ------------------------------------------------------------------ 116 /// <summary> 117 /// Gets or sets if all shape's connectors should be shown. 118 /// </summary> 119 // ------------------------------------------------------------------ 120 bool ShowConnectors { 121 get; 122 set; 123 } 124 125 // ------------------------------------------------------------------ 126 /// <summary> 127 /// Gets or sets the scroll position. 128 /// </summary> 129 // ------------------------------------------------------------------ 130 Point AutoScrollPosition { 131 get; 132 set; 133 } 134 135 // ------------------------------------------------------------------ 136 /// <summary> 137 /// Gets the client rectangle. 138 /// </summary> 139 /// <value>The client rectangle.</value> 140 // ------------------------------------------------------------------ 141 Rectangle ClientRectangle { 142 get; 143 } 144 145 // ------------------------------------------------------------------ 146 /// <summary> 147 /// Gets or sets the size of the diagram. 148 /// </summary> 149 /// <value>Size: The height and width.</value> 150 // ------------------------------------------------------------------ 151 Size Size { 152 get; 153 set; 154 } 155 156 // ------------------------------------------------------------------ 157 /// <summary> 158 /// Gets or sets the minimum size of the autoscroll. 159 /// </summary> 160 /// <value>Size: The height and width.</value> 161 // ------------------------------------------------------------------ 162 Size AutoScrollMinSize { 163 get; 164 set; 165 } 166 167 #endregion 168 169 #region Methods 170 171 // ------------------------------------------------------------------ 172 /// <summary> 173 /// Invalidates the specified rectangle. 174 /// </summary> 175 /// <param name="rectangle">The rectangle.</param> 176 // ------------------------------------------------------------------ 177 void Invalidate(Rectangle rectangle); 178 179 // ------------------------------------------------------------------ 180 /// <summary> 181 /// Invalidates this instance. 182 /// </summary> 183 // ------------------------------------------------------------------ 184 void Invalidate(); 185 186 // ------------------------------------------------------------------ 187 /// <summary> 188 /// Focuses this instance. 189 /// </summary> 190 /// <returns></returns> 191 // ------------------------------------------------------------------ 192 bool Focus(); 193 194 // ------------------------------------------------------------------ 195 /// <summary> 196 /// Displays a PageSetupDialog so the user can specify how each 197 /// page is printed. 198 /// </summary> 199 // ------------------------------------------------------------------ 200 void PageSetup(); 201 202 // ------------------------------------------------------------------ 203 /// <summary> 204 /// Prints all pages of the diagram. 205 /// </summary> 206 // ------------------------------------------------------------------ 207 void Print(); 208 209 // ------------------------------------------------------------------ 210 /// <summary> 211 /// Print previews all pages of the diagram. 212 /// </summary> 213 // ------------------------------------------------------------------ 214 void PrintPreview(); 215 216 // ------------------------------------------------------------------ 217 /// <summary> 218 /// Displays an OpenFileDialog for the user to specify the diagram 219 /// to open. 220 /// </summary> 221 // ------------------------------------------------------------------ 222 void Open(); 223 224 // ------------------------------------------------------------------ 225 /// <summary> 226 /// Opens the specified path. 227 /// </summary> 228 /// <param name="path">The path.</param> 229 // ------------------------------------------------------------------ 230 void Open(string path); 231 232 // ------------------------------------------------------------------ 233 /// <summary> 234 /// If the current filename (FileName property) is empty, the a 235 /// SaveFileDialog is displayed for the user to specify what to save 236 /// the diagram as. Otherwise, the current filename is used to save 237 /// the diagram. 238 /// </summary> 239 // ------------------------------------------------------------------ 240 void Save(); 241 242 // ------------------------------------------------------------------ 243 /// <summary> 244 /// Displays a SaveFileDialog regardless if there's an existing 245 /// filename so the user can save the diagram to a new location. 246 /// </summary> 247 // ------------------------------------------------------------------ 248 void SaveAs(); 249 250 // ------------------------------------------------------------------ 251 /// <summary> 252 /// Saves the diagram to the path specified. 253 /// </summary> 254 /// <param name="path">The path.</param> 255 // ------------------------------------------------------------------ 256 void SaveAs(string path); 257 258 // ------------------------------------------------------------------ 259 /// <summary> 260 /// Creates a new document. 261 /// </summary> 262 // ------------------------------------------------------------------ 263 void NewDocument(); 264 265 // ------------------------------------------------------------------ 266 /// <summary> 267 /// Computes the location of the specified screen point into client 268 /// coordinates. 269 /// </summary> 270 /// <param name="p">Point</param> 271 /// <returns>Point</returns> 272 // ------------------------------------------------------------------ 273 Point PointToClient(Point p); 274 275 #endregion 276 277 } 290 278 }
Note: See TracChangeset
for help on using the changeset viewer.