Пример #1
0
        /// <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);
        }
Пример #2
0
            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);
            }
Пример #3
0
        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;
        }
Пример #4
0
 public CanvasItemEventArgs(CanvasItem canvasItem)
 {
     this.canvasItem = canvasItem;
 }