Changeset 4068 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Core/Interfaces/IDiagramEntity.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/IDiagramEntity.cs
r2768 r4068 1 1 using System; 2 2 using System.Drawing; 3 using System.Runtime.Serialization; 3 4 using System.Windows.Forms; 4 using System.Runtime.Serialization; 5 6 namespace Netron.Diagramming.Core 7 { 8 // ---------------------------------------------------------------------- 9 /// <summary> 10 /// The diagram entity is the base entity of all elements of a diagram. 11 /// </summary> 12 // ---------------------------------------------------------------------- 13 public interface IDiagramEntity : 14 IPaintable, 5 6 namespace Netron.Diagramming.Core { 7 // ---------------------------------------------------------------------- 8 /// <summary> 9 /// The diagram entity is the base entity of all elements of a diagram. 10 /// </summary> 11 // ---------------------------------------------------------------------- 12 public interface IDiagramEntity : 13 IPaintable, 15 14 IMouseListener, 16 15 IHoverListener, 17 IServiceProvider, 16 IServiceProvider, 18 17 ISerializable, 19 IVersion 20 { 21 22 #region Events 23 24 // ------------------------------------------------------------------ 25 /// <summary> 26 /// Occurs when the entity's properties have changed 27 /// </summary> 28 // ------------------------------------------------------------------ 29 event EventHandler<EntityEventArgs> OnEntityChange; 30 31 // ------------------------------------------------------------------ 32 /// <summary> 33 /// Occurs when the entity is selected. This can be different than 34 /// the OnClick because the selector can select and entity without 35 /// clicking on it. 36 /// </summary> 37 // ------------------------------------------------------------------ 38 event EventHandler<EntityEventArgs> OnEntitySelect; 39 40 // ------------------------------------------------------------------ 41 /// <summary> 42 /// Occurs when the user clicks on the entity. 43 /// </summary> 44 // ------------------------------------------------------------------ 45 event EventHandler<EntityEventArgs> OnClick; 46 47 // ------------------------------------------------------------------ 48 /// <summary> 49 /// Occurs when a mouse button is pressed while over the entity. 50 /// </summary> 51 // ------------------------------------------------------------------ 52 event EventHandler<EntityMouseEventArgs> OnMouseDown; 53 54 // ------------------------------------------------------------------ 55 /// <summary> 56 /// Occurs when a mouse button is released while over the entity. 57 /// </summary> 58 // ------------------------------------------------------------------ 59 event EventHandler<EntityMouseEventArgs> OnMouseUp; 60 61 // ------------------------------------------------------------------ 62 /// <summary> 63 /// Occurs when the mouse is moved while over the entity. 64 /// </summary> 65 // ------------------------------------------------------------------ 66 event EventHandler<EntityMouseEventArgs> OnMouseMove; 67 68 // ------------------------------------------------------------------ 69 /// <summary> 70 /// Occurs when the mouse enters the entity. 71 /// </summary> 72 // ------------------------------------------------------------------ 73 event EventHandler<EntityMouseEventArgs> OnMouseEnter; 74 75 // ------------------------------------------------------------------ 76 /// <summary> 77 /// Occurs when the mouse hovers over the entity. 78 /// </summary> 79 // ------------------------------------------------------------------ 80 event EventHandler<EntityMouseEventArgs> OnMouseHover; 81 82 // ------------------------------------------------------------------ 83 /// <summary> 84 /// Occurs when the mouse leaves the entity. 85 /// </summary> 86 // ------------------------------------------------------------------ 87 event EventHandler<EntityMouseEventArgs> OnMouseLeave; 88 89 90 #endregion 91 92 #region Properties 93 94 // ------------------------------------------------------------------ 95 /// <summary> 96 /// Gets the center point of the paintable entity (the center of the 97 /// Rectangle). 98 /// </summary> 99 /// <value>Point</value> 100 // ------------------------------------------------------------------ 101 Point Center 102 { 103 get; 104 } 105 106 // ------------------------------------------------------------------ 107 /// <summary> 108 /// Gets the center of the bottom edge of the bounding rectangle. 109 /// </summary> 110 // ------------------------------------------------------------------ 111 Point BottomCenter 112 { 113 get; 114 } 115 116 // ------------------------------------------------------------------ 117 /// <summary> 118 /// Gets the center of the top edge of the bounding rectangle. 119 /// </summary> 120 // ------------------------------------------------------------------ 121 Point TopCenter 122 { 123 get; 124 } 125 126 // ------------------------------------------------------------------ 127 /// <summary> 128 /// Gets the top left corner of this entity, which is the same as 129 /// 'Rectangle.Location'. 130 /// </summary> 131 // ------------------------------------------------------------------ 132 Point TopLeftCorner 133 { 134 get; 135 } 136 137 // ------------------------------------------------------------------ 138 /// <summary> 139 /// Gets the top right corner of this entity. 140 /// </summary> 141 // ------------------------------------------------------------------ 142 Point TopRightCorner 143 { 144 get; 145 } 146 147 // ------------------------------------------------------------------ 148 /// <summary> 149 /// Gets the bottom left corner of this entity. 150 /// </summary> 151 // ------------------------------------------------------------------ 152 Point BottomLeftCorner 153 { 154 get; 155 } 156 157 // ------------------------------------------------------------------ 158 /// <summary> 159 /// Gets the bottom right corner of this entity. 160 /// </summary> 161 // ------------------------------------------------------------------ 162 Point BottomRightCorner 163 { 164 get; 165 } 166 167 // ------------------------------------------------------------------ 168 /// <summary> 169 /// Gets the minimum size of the paintable entity. 170 /// </summary> 171 /// <value>Size</value> 172 // ------------------------------------------------------------------ 173 Size MinSize 174 { 175 get; 176 } 177 178 // ------------------------------------------------------------------ 179 /// <summary> 180 /// Gets the maximum size of the paintable entity. 181 /// </summary> 182 /// <value>Size</value> 183 // ------------------------------------------------------------------ 184 Size MaxSize 185 { 186 get; 187 } 188 189 // ------------------------------------------------------------------ 190 /// <summary> 191 /// Gets or sets the magnification currently used by the view. 192 /// </summary> 193 // ------------------------------------------------------------------ 194 SizeF Magnification 195 { 196 get; 197 set; 198 } 199 200 // ------------------------------------------------------------------ 201 /// <summary> 202 /// Gets or sets a value indicating whether this 203 /// <see cref="T:IDiagramEntity"/> is enabled. 204 /// </summary> 205 /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value> 206 // ------------------------------------------------------------------ 207 bool Enabled 208 { 209 get; 210 set; 211 } 212 213 // ------------------------------------------------------------------ 214 /// <summary> 215 /// Gets or sets whether the entity is selected 216 /// </summary> 217 // ------------------------------------------------------------------ 218 bool IsSelected 219 { 220 get; 221 set; 222 } 223 224 // ------------------------------------------------------------------ 225 /// <summary> 226 /// Gets or sets the canvas to which the entity belongs 227 /// </summary> 228 // ------------------------------------------------------------------ 229 IModel Model 230 { 231 get; 232 set; 233 } 234 235 // ------------------------------------------------------------------ 236 /// <summary> 237 /// Gets or sets the parent of the entity. 238 /// <remarks>If the parent is null the entity is a branch node in the 239 /// scene graph. The layer is never a parent because an entity can 240 /// belong to multiple layers. 241 /// </remarks> 242 /// </summary> 243 // ------------------------------------------------------------------ 244 object Parent 245 { 246 get; 247 set; 248 } 249 250 // ------------------------------------------------------------------ 251 /// <summary> 252 /// Gets or sets the name of the entity 253 /// </summary> 254 // ------------------------------------------------------------------ 255 string Name 256 { 257 get; 258 set; 259 } 260 261 // ------------------------------------------------------------------ 262 /// <summary> 263 /// Gets or sets whether the entity is hovered by the mouse 264 /// </summary> 265 // ------------------------------------------------------------------ 266 bool Hovered 267 { 268 get; 269 set; 270 } 271 272 // ------------------------------------------------------------------ 273 /// <summary> 274 /// General purpose tag 275 /// </summary> 276 // ------------------------------------------------------------------ 277 object Tag 278 { 279 get; 280 set; 281 } 282 283 // ------------------------------------------------------------------ 284 /// <summary> 285 /// Gets the friendly name of the entity to be displayed in the UI 286 /// </summary> 287 // ------------------------------------------------------------------ 288 string EntityName 289 { 290 get; 291 } 292 293 // ------------------------------------------------------------------ 294 /// <summary> 295 /// Gets or sets the index of this entity in the scene-graph. 296 /// </summary> 297 /// <value>The index of the scene.</value> 298 // ------------------------------------------------------------------ 299 int SceneIndex 300 { 301 get; 302 set; 303 } 304 305 // ------------------------------------------------------------------ 306 /// <summary> 307 /// Gets or sets the unique top-group to which this entity belongs. 308 /// </summary> 309 // ------------------------------------------------------------------ 310 IGroup Group 311 { 312 get; 313 set; 314 } 315 316 // ------------------------------------------------------------------ 317 /// <summary> 318 /// Gets or sets a value indicating whether this 319 /// <see cref="IDiagramEntity"/> is movable. 320 /// </summary> 321 /// <value><c>true</c> if movable; otherwise, <c>false</c>.</value> 322 // ------------------------------------------------------------------ 323 bool AllowMove 324 { 325 get; 326 set; 327 } 328 329 // ------------------------------------------------------------------ 330 /// <summary> 331 /// Gets or sets a value indicating whether this 332 /// <see cref="IDiagramEntity"/> can be deleted. 333 /// </summary> 334 /// <value><c>true</c> if deletable; otherwise, <c>false</c>.</value> 335 // ------------------------------------------------------------------ 336 bool AllowDelete 337 { 338 get; 339 set; 340 } 341 342 // ------------------------------------------------------------------ 343 /// <summary> 344 /// Gets or sets a value indicating whether this 345 /// <see cref="IDiagramEntity"/> is resizable. 346 /// </summary> 347 /// <value><c>true</c> if resizable; otherwise, <c>false</c>.</value> 348 // ------------------------------------------------------------------ 349 bool Resizable 350 { 351 get; 352 set; 353 } 354 355 // ------------------------------------------------------------------ 356 /// <summary> 357 /// Gets the globally unique identifier of this entity 358 /// </summary> 359 // ------------------------------------------------------------------ 360 Guid Uid 361 { 362 get; 363 } 364 365 // ------------------------------------------------------------------ 366 /// <summary> 367 /// Gets or sets the paint style. 368 /// </summary> 369 /// <value>The paint style.</value> 370 // ------------------------------------------------------------------ 371 IPaintStyle PaintStyle 372 { 373 get; 374 set; 375 } 376 377 // ------------------------------------------------------------------ 378 /// <summary> 379 /// Gets or sets the pen style. 380 /// </summary> 381 /// <value>The pen style.</value> 382 // ------------------------------------------------------------------ 383 IPenStyle PenStyle 384 { 385 get; 386 set; 387 } 388 389 // ------------------------------------------------------------------ 390 /// <summary> 391 /// Gets or sets the layer this entity is attached to. 392 /// </summary> 393 // ------------------------------------------------------------------ 394 ILayer Layer 395 { 396 get; 397 set; 398 } 399 400 #endregion 401 402 #region Methods 403 404 // ------------------------------------------------------------------ 405 /// <summary> 406 /// Called after an entity is deleted. 407 /// </summary> 408 /// <param name="deleteCommand">DeleteCommand: The un/redoable command 409 /// that's part of the undo/redo mechanism.</param> 410 // ------------------------------------------------------------------ 411 void OnAfterDelete(DeleteCommand deleteCommand); 412 413 // ------------------------------------------------------------------ 414 /// <summary> 415 /// Called before an entity is deleted. 416 /// </summary> 417 /// <param name="deleteCommand">DeleteCommand: The un/redoable command 418 /// that's part of the undo/redo mechanism.</param> 419 // ------------------------------------------------------------------ 420 void OnBeforeDelete(DeleteCommand deleteCommand); 421 422 // ------------------------------------------------------------------ 423 /// <summary> 424 /// Called when the entity is detached from the canvas (temporarily 425 /// deleted but not disposed). 426 /// </summary> 427 // ------------------------------------------------------------------ 428 void Detached(ILayer layer); 429 430 // ------------------------------------------------------------------ 431 /// <summary> 432 /// Called when the entity is attached to the canvas (after being 433 /// temporarily detached, like in a paste operation). 434 /// </summary> 435 // ------------------------------------------------------------------ 436 void Attached(ILayer layer); 437 438 // ------------------------------------------------------------------ 439 /// <summary> 440 /// Generates a new Uid for this entity. 441 /// </summary> 442 /// <param name="recursive">if the Uid has to be changed recursively 443 /// down to the sub-entities, set to true, otherwise false.</param> 444 // ------------------------------------------------------------------ 445 void NewUid(bool recursive); 446 447 // ------------------------------------------------------------------ 448 /// <summary> 449 /// The custom elements to be added to the menu on a per-entity basis 450 /// </summary> 451 /// <returns>ToolStripItem[]</returns> 452 // ------------------------------------------------------------------ 453 ToolStripItem[] Menu(); 454 455 // ------------------------------------------------------------------ 456 /// <summary> 457 /// Raises the onclick event. 458 /// </summary> 459 /// <param name="e"></param> 460 // ------------------------------------------------------------------ 461 void RaiseOnClick(EntityEventArgs e); 462 463 // ------------------------------------------------------------------ 464 /// <summary> 465 /// Raises the OnMouseDown event. 466 /// </summary> 467 /// <param name="e">The 468 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 469 /// instance containing the event data.</param> 470 // ------------------------------------------------------------------ 471 void RaiseOnMouseDown(EntityMouseEventArgs e); 472 473 // ------------------------------------------------------------------ 474 /// <summary> 475 /// Raises the OnMouseUp event. 476 /// </summary> 477 /// <param name="e">The 478 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 479 /// instance containing the event data.</param> 480 // ------------------------------------------------------------------ 481 void RaiseOnMouseUp(EntityMouseEventArgs e); 482 483 // ------------------------------------------------------------------ 484 /// <summary> 485 /// Raises the OnMouseMove event. 486 /// </summary> 487 /// <param name="e">The 488 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 489 /// instance containing the event data.</param> 490 // ------------------------------------------------------------------ 491 void RaiseOnMouseMove(EntityMouseEventArgs e); 492 493 // ------------------------------------------------------------------ 494 /// <summary> 495 /// Raises the OnMouseEnter event. 496 /// </summary> 497 /// <param name="e">The 498 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 499 /// instance containing the event data.</param> 500 // ------------------------------------------------------------------ 501 void RaiseOnMouseEnter(EntityMouseEventArgs e); 502 503 // ------------------------------------------------------------------ 504 /// <summary> 505 /// Raises the OnMouseHover event. 506 /// </summary> 507 /// <param name="e">The 508 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 509 /// instance containing the event data.</param> 510 // ------------------------------------------------------------------ 511 void RaiseOnMouseHover(EntityMouseEventArgs e); 512 513 // ------------------------------------------------------------------ 514 /// <summary> 515 /// Raises the OnMouseLeave event. 516 /// </summary> 517 /// <param name="e">The 518 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 519 /// instance containing the event data.</param> 520 // ------------------------------------------------------------------ 521 void RaiseOnMouseLeave(EntityMouseEventArgs e); 522 523 // ------------------------------------------------------------------ 524 /// <summary> 525 /// Returns whether the entity was hit at the given location 526 /// </summary> 527 /// <param name="p">a Point location</param> 528 /// <returns></returns> 529 // ------------------------------------------------------------------ 530 bool Hit(Point p); 531 532 // ------------------------------------------------------------------ 533 /// <summary> 534 /// Invalidates the entity 535 /// </summary> 536 // ------------------------------------------------------------------ 537 void Invalidate(); 538 539 // ------------------------------------------------------------------ 540 /// <summary> 541 /// Invalidates a certain rectangle of the canvas 542 /// </summary> 543 /// <param name="rectangle"></param> 544 // ------------------------------------------------------------------ 545 void Invalidate(Rectangle rectangle); 546 547 // ------------------------------------------------------------------ 548 /// <summary> 549 /// Moves the entity to the given location 550 /// </summary> 551 /// <param name="p">a Point location</param> 552 // ------------------------------------------------------------------ 553 void MoveBy(Point p); 554 555 #endregion 556 } 18 IVersion { 19 20 #region Events 21 22 // ------------------------------------------------------------------ 23 /// <summary> 24 /// Occurs when the entity's properties have changed 25 /// </summary> 26 // ------------------------------------------------------------------ 27 event EventHandler<EntityEventArgs> OnEntityChange; 28 29 // ------------------------------------------------------------------ 30 /// <summary> 31 /// Occurs when the entity is selected. This can be different than 32 /// the OnClick because the selector can select and entity without 33 /// clicking on it. 34 /// </summary> 35 // ------------------------------------------------------------------ 36 event EventHandler<EntityEventArgs> OnEntitySelect; 37 38 // ------------------------------------------------------------------ 39 /// <summary> 40 /// Occurs when the user clicks on the entity. 41 /// </summary> 42 // ------------------------------------------------------------------ 43 event EventHandler<EntityEventArgs> OnClick; 44 45 // ------------------------------------------------------------------ 46 /// <summary> 47 /// Occurs when a mouse button is pressed while over the entity. 48 /// </summary> 49 // ------------------------------------------------------------------ 50 event EventHandler<EntityMouseEventArgs> OnMouseDown; 51 52 // ------------------------------------------------------------------ 53 /// <summary> 54 /// Occurs when a mouse button is released while over the entity. 55 /// </summary> 56 // ------------------------------------------------------------------ 57 event EventHandler<EntityMouseEventArgs> OnMouseUp; 58 59 // ------------------------------------------------------------------ 60 /// <summary> 61 /// Occurs when the mouse is moved while over the entity. 62 /// </summary> 63 // ------------------------------------------------------------------ 64 event EventHandler<EntityMouseEventArgs> OnMouseMove; 65 66 // ------------------------------------------------------------------ 67 /// <summary> 68 /// Occurs when the mouse enters the entity. 69 /// </summary> 70 // ------------------------------------------------------------------ 71 event EventHandler<EntityMouseEventArgs> OnMouseEnter; 72 73 // ------------------------------------------------------------------ 74 /// <summary> 75 /// Occurs when the mouse hovers over the entity. 76 /// </summary> 77 // ------------------------------------------------------------------ 78 event EventHandler<EntityMouseEventArgs> OnMouseHover; 79 80 // ------------------------------------------------------------------ 81 /// <summary> 82 /// Occurs when the mouse leaves the entity. 83 /// </summary> 84 // ------------------------------------------------------------------ 85 event EventHandler<EntityMouseEventArgs> OnMouseLeave; 86 87 88 #endregion 89 90 #region Properties 91 92 // ------------------------------------------------------------------ 93 /// <summary> 94 /// Gets the center point of the paintable entity (the center of the 95 /// Rectangle). 96 /// </summary> 97 /// <value>Point</value> 98 // ------------------------------------------------------------------ 99 Point Center { 100 get; 101 } 102 103 // ------------------------------------------------------------------ 104 /// <summary> 105 /// Gets the center of the bottom edge of the bounding rectangle. 106 /// </summary> 107 // ------------------------------------------------------------------ 108 Point BottomCenter { 109 get; 110 } 111 112 // ------------------------------------------------------------------ 113 /// <summary> 114 /// Gets the center of the top edge of the bounding rectangle. 115 /// </summary> 116 // ------------------------------------------------------------------ 117 Point TopCenter { 118 get; 119 } 120 121 // ------------------------------------------------------------------ 122 /// <summary> 123 /// Gets the top left corner of this entity, which is the same as 124 /// 'Rectangle.Location'. 125 /// </summary> 126 // ------------------------------------------------------------------ 127 Point TopLeftCorner { 128 get; 129 } 130 131 // ------------------------------------------------------------------ 132 /// <summary> 133 /// Gets the top right corner of this entity. 134 /// </summary> 135 // ------------------------------------------------------------------ 136 Point TopRightCorner { 137 get; 138 } 139 140 // ------------------------------------------------------------------ 141 /// <summary> 142 /// Gets the bottom left corner of this entity. 143 /// </summary> 144 // ------------------------------------------------------------------ 145 Point BottomLeftCorner { 146 get; 147 } 148 149 // ------------------------------------------------------------------ 150 /// <summary> 151 /// Gets the bottom right corner of this entity. 152 /// </summary> 153 // ------------------------------------------------------------------ 154 Point BottomRightCorner { 155 get; 156 } 157 158 // ------------------------------------------------------------------ 159 /// <summary> 160 /// Gets the minimum size of the paintable entity. 161 /// </summary> 162 /// <value>Size</value> 163 // ------------------------------------------------------------------ 164 Size MinSize { 165 get; 166 } 167 168 // ------------------------------------------------------------------ 169 /// <summary> 170 /// Gets the maximum size of the paintable entity. 171 /// </summary> 172 /// <value>Size</value> 173 // ------------------------------------------------------------------ 174 Size MaxSize { 175 get; 176 } 177 178 // ------------------------------------------------------------------ 179 /// <summary> 180 /// Gets or sets the magnification currently used by the view. 181 /// </summary> 182 // ------------------------------------------------------------------ 183 SizeF Magnification { 184 get; 185 set; 186 } 187 188 // ------------------------------------------------------------------ 189 /// <summary> 190 /// Gets or sets a value indicating whether this 191 /// <see cref="T:IDiagramEntity"/> is enabled. 192 /// </summary> 193 /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value> 194 // ------------------------------------------------------------------ 195 bool Enabled { 196 get; 197 set; 198 } 199 200 // ------------------------------------------------------------------ 201 /// <summary> 202 /// Gets or sets whether the entity is selected 203 /// </summary> 204 // ------------------------------------------------------------------ 205 bool IsSelected { 206 get; 207 set; 208 } 209 210 // ------------------------------------------------------------------ 211 /// <summary> 212 /// Gets or sets the canvas to which the entity belongs 213 /// </summary> 214 // ------------------------------------------------------------------ 215 IModel Model { 216 get; 217 set; 218 } 219 220 // ------------------------------------------------------------------ 221 /// <summary> 222 /// Gets or sets the parent of the entity. 223 /// <remarks>If the parent is null the entity is a branch node in the 224 /// scene graph. The layer is never a parent because an entity can 225 /// belong to multiple layers. 226 /// </remarks> 227 /// </summary> 228 // ------------------------------------------------------------------ 229 object Parent { 230 get; 231 set; 232 } 233 234 // ------------------------------------------------------------------ 235 /// <summary> 236 /// Gets or sets the name of the entity 237 /// </summary> 238 // ------------------------------------------------------------------ 239 string Name { 240 get; 241 set; 242 } 243 244 // ------------------------------------------------------------------ 245 /// <summary> 246 /// Gets or sets whether the entity is hovered by the mouse 247 /// </summary> 248 // ------------------------------------------------------------------ 249 bool Hovered { 250 get; 251 set; 252 } 253 254 // ------------------------------------------------------------------ 255 /// <summary> 256 /// General purpose tag 257 /// </summary> 258 // ------------------------------------------------------------------ 259 object Tag { 260 get; 261 set; 262 } 263 264 // ------------------------------------------------------------------ 265 /// <summary> 266 /// Gets the friendly name of the entity to be displayed in the UI 267 /// </summary> 268 // ------------------------------------------------------------------ 269 string EntityName { 270 get; 271 } 272 273 // ------------------------------------------------------------------ 274 /// <summary> 275 /// Gets or sets the index of this entity in the scene-graph. 276 /// </summary> 277 /// <value>The index of the scene.</value> 278 // ------------------------------------------------------------------ 279 int SceneIndex { 280 get; 281 set; 282 } 283 284 // ------------------------------------------------------------------ 285 /// <summary> 286 /// Gets or sets the unique top-group to which this entity belongs. 287 /// </summary> 288 // ------------------------------------------------------------------ 289 IGroup Group { 290 get; 291 set; 292 } 293 294 // ------------------------------------------------------------------ 295 /// <summary> 296 /// Gets or sets a value indicating whether this 297 /// <see cref="IDiagramEntity"/> is movable. 298 /// </summary> 299 /// <value><c>true</c> if movable; otherwise, <c>false</c>.</value> 300 // ------------------------------------------------------------------ 301 bool AllowMove { 302 get; 303 set; 304 } 305 306 // ------------------------------------------------------------------ 307 /// <summary> 308 /// Gets or sets a value indicating whether this 309 /// <see cref="IDiagramEntity"/> can be deleted. 310 /// </summary> 311 /// <value><c>true</c> if deletable; otherwise, <c>false</c>.</value> 312 // ------------------------------------------------------------------ 313 bool AllowDelete { 314 get; 315 set; 316 } 317 318 // ------------------------------------------------------------------ 319 /// <summary> 320 /// Gets or sets a value indicating whether this 321 /// <see cref="IDiagramEntity"/> is resizable. 322 /// </summary> 323 /// <value><c>true</c> if resizable; otherwise, <c>false</c>.</value> 324 // ------------------------------------------------------------------ 325 bool Resizable { 326 get; 327 set; 328 } 329 330 // ------------------------------------------------------------------ 331 /// <summary> 332 /// Gets the globally unique identifier of this entity 333 /// </summary> 334 // ------------------------------------------------------------------ 335 Guid Uid { 336 get; 337 } 338 339 // ------------------------------------------------------------------ 340 /// <summary> 341 /// Gets or sets the paint style. 342 /// </summary> 343 /// <value>The paint style.</value> 344 // ------------------------------------------------------------------ 345 IPaintStyle PaintStyle { 346 get; 347 set; 348 } 349 350 // ------------------------------------------------------------------ 351 /// <summary> 352 /// Gets or sets the pen style. 353 /// </summary> 354 /// <value>The pen style.</value> 355 // ------------------------------------------------------------------ 356 IPenStyle PenStyle { 357 get; 358 set; 359 } 360 361 // ------------------------------------------------------------------ 362 /// <summary> 363 /// Gets or sets the layer this entity is attached to. 364 /// </summary> 365 // ------------------------------------------------------------------ 366 ILayer Layer { 367 get; 368 set; 369 } 370 371 #endregion 372 373 #region Methods 374 375 // ------------------------------------------------------------------ 376 /// <summary> 377 /// Called after an entity is deleted. 378 /// </summary> 379 /// <param name="deleteCommand">DeleteCommand: The un/redoable command 380 /// that's part of the undo/redo mechanism.</param> 381 // ------------------------------------------------------------------ 382 void OnAfterDelete(DeleteCommand deleteCommand); 383 384 // ------------------------------------------------------------------ 385 /// <summary> 386 /// Called before an entity is deleted. 387 /// </summary> 388 /// <param name="deleteCommand">DeleteCommand: The un/redoable command 389 /// that's part of the undo/redo mechanism.</param> 390 // ------------------------------------------------------------------ 391 void OnBeforeDelete(DeleteCommand deleteCommand); 392 393 // ------------------------------------------------------------------ 394 /// <summary> 395 /// Called when the entity is detached from the canvas (temporarily 396 /// deleted but not disposed). 397 /// </summary> 398 // ------------------------------------------------------------------ 399 void Detached(ILayer layer); 400 401 // ------------------------------------------------------------------ 402 /// <summary> 403 /// Called when the entity is attached to the canvas (after being 404 /// temporarily detached, like in a paste operation). 405 /// </summary> 406 // ------------------------------------------------------------------ 407 void Attached(ILayer layer); 408 409 // ------------------------------------------------------------------ 410 /// <summary> 411 /// Generates a new Uid for this entity. 412 /// </summary> 413 /// <param name="recursive">if the Uid has to be changed recursively 414 /// down to the sub-entities, set to true, otherwise false.</param> 415 // ------------------------------------------------------------------ 416 void NewUid(bool recursive); 417 418 // ------------------------------------------------------------------ 419 /// <summary> 420 /// The custom elements to be added to the menu on a per-entity basis 421 /// </summary> 422 /// <returns>ToolStripItem[]</returns> 423 // ------------------------------------------------------------------ 424 ToolStripItem[] Menu(); 425 426 // ------------------------------------------------------------------ 427 /// <summary> 428 /// Raises the onclick event. 429 /// </summary> 430 /// <param name="e"></param> 431 // ------------------------------------------------------------------ 432 void RaiseOnClick(EntityEventArgs e); 433 434 // ------------------------------------------------------------------ 435 /// <summary> 436 /// Raises the OnMouseDown event. 437 /// </summary> 438 /// <param name="e">The 439 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 440 /// instance containing the event data.</param> 441 // ------------------------------------------------------------------ 442 void RaiseOnMouseDown(EntityMouseEventArgs e); 443 444 // ------------------------------------------------------------------ 445 /// <summary> 446 /// Raises the OnMouseUp event. 447 /// </summary> 448 /// <param name="e">The 449 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 450 /// instance containing the event data.</param> 451 // ------------------------------------------------------------------ 452 void RaiseOnMouseUp(EntityMouseEventArgs e); 453 454 // ------------------------------------------------------------------ 455 /// <summary> 456 /// Raises the OnMouseMove event. 457 /// </summary> 458 /// <param name="e">The 459 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 460 /// instance containing the event data.</param> 461 // ------------------------------------------------------------------ 462 void RaiseOnMouseMove(EntityMouseEventArgs e); 463 464 // ------------------------------------------------------------------ 465 /// <summary> 466 /// Raises the OnMouseEnter event. 467 /// </summary> 468 /// <param name="e">The 469 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 470 /// instance containing the event data.</param> 471 // ------------------------------------------------------------------ 472 void RaiseOnMouseEnter(EntityMouseEventArgs e); 473 474 // ------------------------------------------------------------------ 475 /// <summary> 476 /// Raises the OnMouseHover event. 477 /// </summary> 478 /// <param name="e">The 479 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 480 /// instance containing the event data.</param> 481 // ------------------------------------------------------------------ 482 void RaiseOnMouseHover(EntityMouseEventArgs e); 483 484 // ------------------------------------------------------------------ 485 /// <summary> 486 /// Raises the OnMouseLeave event. 487 /// </summary> 488 /// <param name="e">The 489 /// <see cref="T:Netron.Diagramming.Core.EntityMouseEventArgs"/> 490 /// instance containing the event data.</param> 491 // ------------------------------------------------------------------ 492 void RaiseOnMouseLeave(EntityMouseEventArgs e); 493 494 // ------------------------------------------------------------------ 495 /// <summary> 496 /// Returns whether the entity was hit at the given location 497 /// </summary> 498 /// <param name="p">a Point location</param> 499 /// <returns></returns> 500 // ------------------------------------------------------------------ 501 bool Hit(Point p); 502 503 // ------------------------------------------------------------------ 504 /// <summary> 505 /// Invalidates the entity 506 /// </summary> 507 // ------------------------------------------------------------------ 508 void Invalidate(); 509 510 // ------------------------------------------------------------------ 511 /// <summary> 512 /// Invalidates a certain rectangle of the canvas 513 /// </summary> 514 /// <param name="rectangle"></param> 515 // ------------------------------------------------------------------ 516 void Invalidate(Rectangle rectangle); 517 518 // ------------------------------------------------------------------ 519 /// <summary> 520 /// Moves the entity to the given location 521 /// </summary> 522 /// <param name="p">a Point location</param> 523 // ------------------------------------------------------------------ 524 void MoveBy(Point p); 525 526 #endregion 527 } 557 528 }
Note: See TracChangeset
for help on using the changeset viewer.