/// <summary>
 /// Default ctor
 /// </summary>
 public ContainerEventArgs(ContainerMessage message, VCItem sender, Matrix tx)
     : base(null)
 {
     this.message = message;
     this.sender  = sender;
     Transform    = tx;
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 public ContainerEventArgs(ContainerMessage message, VCItem sender, Point pt)
     : base(null)
 {
     this.message = message;
     this.sender  = sender;
     this.point   = pt;
 }
 /// <summary>
 /// Find the first item that contains the given item
 /// </summary>
 /// <param name="pt"></param>
 /// <returns>The first item that contains the given item or null if no item contains the given item.</returns>
 public VCItemPlacement Find(VCItem item)
 {
     for (int i = items.Count - 1; i >= 0; i--)
     {
         VCItemPlacement placement = items[i];
         if (placement.Item == item)
         {
             return(placement);
         }
     }
     return(null);
 }
        /// <summary>
        /// Insert an item at the given index.
        /// </summary>
        /// <param name="item"></param>
        public VCItemPlacement Insert(int index, VCItem item, Layout.LayoutConstraints constraints)
        {
            VCItemPlacement placement = new VCItemPlacement(item, constraints);

            items.Insert(index, placement);
            item.ContainerEvent += new EventHandler <ContainerEventArgs>(item_ContainerEvent);

            if (Added != null)
            {
                Added(this, new VCItemPlacementEventArgs(placement));
            }

            return(placement);
        }
        /// <summary>
        /// Remove all placements of the given item.
        /// </summary>
        /// <param name="placement"></param>
        public void Remove(VCItem item)
        {
            int i = 0;

            while (i < items.Count)
            {
                if (items[i].Item == item)
                {
                    Remove(items[i]);
                }
                else
                {
                    i++;
                }
            }
        }
        /// <summary>
        /// Remove the given placement.
        /// </summary>
        /// <param name="placement"></param>
        public bool Remove(VCItemPlacement placement)
        {
            if (items.Remove(placement))
            {
                VCItem item = placement.Item;
                item.ContainerEvent -= new EventHandler <ContainerEventArgs>(item_ContainerEvent);

                if (Removed != null)
                {
                    Removed(this, new VCItemPlacementEventArgs(placement));
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Draw selection
        /// </summary>
        public void Paint(VCItem sender, ItemPaintEventArgs e)
        {
            if (selecting)
            {
                var rect = SelectionBounds;
                if (!rect.IsEmpty)
                {
                    using (var pen = new Pen(Color.Black))
                    {
                        pen.DashStyle = DashStyle.Dot;
                        e.Graphics.DrawRectangle(pen, SelectionBounds.Round());
                    }
                }
            }

            // Draw selection boxes (if any)
            if (container.SelectedItems.Count > 0)
            {
                container.DrawItems(e, DrawSelectionBoxes);
            }
        }
        /// <summary>
        /// Replace the item at given index with given item
        /// </summary>
        /// <param name="item"></param>
        public VCItemPlacement Replace(int index, VCItem item, Layout.LayoutConstraints constraints)
        {
            VCItemPlacement oldPlacement = items[index];

            oldPlacement.Item.ContainerEvent -= new EventHandler <ContainerEventArgs>(item_ContainerEvent);

            VCItemPlacement placement = new VCItemPlacement(item, constraints);

            item.ContainerEvent += new EventHandler <ContainerEventArgs>(item_ContainerEvent);
            items[index]         = placement;

            if (Removed != null)
            {
                Removed(this, new VCItemPlacementEventArgs(oldPlacement));
            }

            if (Added != null)
            {
                Added(this, new VCItemPlacementEventArgs(placement));
            }

            return(placement);
        }
 /// <summary>
 /// Default ctor
 /// </summary>
 /// <param name="item"></param>
 internal VCItemPlacement(VCItem item, Layout.LayoutConstraints constraints)
 {
     this.item        = item;
     this.constraints = constraints;
     transform        = Identity;
 }
Esempio n. 10
0
 /// <summary>
 /// Default ctor
 /// </summary>
 /// <param name="item"></param>
 internal Update(VCItem item)
 {
     this.item = item;
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 public ContainerEventArgs(ContainerMessage message, VCItem sender, RectangleF rectangle) : base(null)
 {
     this.message   = message;
     this.sender    = sender;
     this.rectangle = rectangle;
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 /// <param name="argument"></param>
 public ContainerEventArgs(ContainerMessage message, VCItem sender, object argument)
     : base(argument)
 {
     this.sender  = sender;
     this.message = message;
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 public ContainerEventArgs(ContainerMessage message, VCItem sender) : base(null)
 {
     this.sender  = sender;
     this.message = message;
 }