/// <summary> /// Retruns a copy of the the canvas items list as an array. /// </summary> public CanvasItem[] GetCanvasItems() { CanvasItem[] items = new CanvasItem[itemsList.Count]; int i = 0; foreach (CanvasItemData item in itemsList) { items[i++] = item.Item; } return(items); }
public CanvasItemData(CanvasItem item, EventHandler <SizeGripEventArgs> SizeGripMouseEntered, EventHandler <SizeGripEventArgs> SizeGripMouseLeft) { this.item = item; focusDecorator = new FocusDecorator(item); sizeGripDecorator = new SizeGripDecorator(item); sizeGripDecorator.SizeGripMouseEnter += SizeGripMouseEntered; sizeGripDecorator.SizeGripMouseLeave += SizeGripMouseLeft; item.AddDecorator(focusDecorator); item.AddDecorator(sizeGripDecorator); }
public void AddCanvasItem(CanvasItem item) { diagramRouter.AddItem(item); CanvasItemData itemData = new CanvasItemData(item, SizeGripMouseEntered, SizeGripMouseLeft); itemsData[item] = itemData; ClassCanvasItem classItem = item as ClassCanvasItem; if (classItem != null) { classesToData.Add(classItem.RepresentedClassType, itemData); foreach (CanvasItemData ci in itemsList) { ClassCanvasItem cci = ci.Item as ClassCanvasItem; if (cci != null) { Route r = null; if (cci.RepresentedClassType == classItem.RepresentedClassType.BaseClass) { r = diagramRouter.AddRoute(item, cci); } else if (classItem.RepresentedClassType == cci.RepresentedClassType.BaseClass) { r = diagramRouter.AddRoute(cci, classItem); } if (r != null) { r.EndShape = new RouteInheritanceShape(); } } } } itemsList.AddLast(itemData); item.RedrawNeeded += HandleRedraw; item.LayoutChanged += HandleItemLayoutChange; item.PositionChanging += HandleItemPositionChange; item.SizeChanging += HandleItemSizeChange; }
public CanvasItemEventArgs(CanvasItem canvasItem) { this.canvasItem = canvasItem; }