コード例 #1
0
 /// <summary>
 /// Removes a Sash reference from this aFrame object
 /// </summary>
 /// <param name="dSash"></param>
 internal void RemoveSash(Sash sash)
 {
     if (sashes.Contains(sash))
     {
         sashes.Remove(sash);
         ChildrenManager.UpdateSashesCode(this);
     }
 }
コード例 #2
0
 /// <summary>
 /// Adds a Sash reference to this aFrame object
 /// </summary>
 /// <param name="dSash"></param>
 internal void AddSash(Sash sash)
 {
     if (!sashes.Contains(sash))
     {
         sashes.Add(sash);
         ChildrenManager.UpdateSashesCode(this);
     }
 }
コード例 #3
0
ファイル: SurfaceModel.cs プロジェクト: alibghz/urcie
 public SurfaceModel(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     surface       = (Surface)info.GetValue("Surface", typeof(Surface));
     code          = (string)info.GetValue("Code", typeof(string));
     bounds        = (RectangleF)info.GetValue("Bounds", typeof(RectangleF));
     surfaceParent = (Surface)info.GetValue("SurfaceParent", typeof(Surface));
     sashParent    = (Sash)info.GetValue("SashParent", typeof(Sash));
     frameParent   = (PVCFrame)info.GetValue("FrameParent", typeof(PVCFrame));
 }
コード例 #4
0
        public static Surface AddChild(Surface parent, PointF position, SurfaceLayout layout, MullionType mullionType)
        {
            if (parent.Frame == null)
            {
                throw new ArgumentException("Illegal surface provided.");
            }

            if (parent.ChildrenCount == 0)
            {
                parent.Layout = layout;
                return(Divide(AddChild(parent), position, mullionType));
            }
            Surface newChild = null;

            foreach (PNode child in parent.ChildrenReference)
            {
                if (child is Mullion)
                {
                    continue;
                }

                if (child.Bounds.Contains(position))
                {
                    if (child is Surface)
                    {
                        Surface surfChild = (Surface)child;
                        if (surfChild.ChildrenCount == 0)
                        {
                            if (layout == parent.Layout)
                            {
                                newChild = Divide(surfChild, position, mullionType);
                            }
                            else
                            {
                                newChild = Divide(AddChild(surfChild), position, mullionType);
                            }
                        }
                        else
                        {
                            newChild = AddChild(surfChild, position, layout, mullionType);
                        }
                    }
                    else if (child is Sash)
                    {
                        Sash sashChild = (Sash)child;
                        newChild = AddChild(sashChild.Surface, position, layout, mullionType);
                    }
                    break;
                }
            }
            return(newChild);
        }
コード例 #5
0
ファイル: PItemRemove.cs プロジェクト: alibghz/urcie
        public static void RemoveItem(PNode item)
        {
            if (item == null || item.Parent == null)
            {
                throw new ArgumentNullException("Null item provided.");
            }


            item.Parent.RemoveChild(item.Parent.IndexOfChild(item));

            if (item is Sash)
            {
                Sash sash = (Sash)item;
                sash.SurfaceParent().Frame.RemoveSash(sash);
            }
            else if (item is Filling)
            {
                Filling filling = (Filling)item;
                filling.SurfaceParent().Frame.RemoveFilling(filling);
            }
        }
コード例 #6
0
 public override void OnClick(object sender, PInputEventArgs e)
 {
     if (e.Button != System.Windows.Forms.MouseButtons.Left)
     {
         return;
     }
     base.OnClick(sender, e);
     e.Handled = true;
     if (e.PickedNode is Surface && e.PickedNode.ChildrenCount == 0 &&
         SashType != null && !(e.PickedNode.Parent is Sash))
     {
         try
         {
             Surface sashParent = (Surface)e.PickedNode;
             Sash    sash       = new Sash(sashParent, SashType);
             sash.Direction = Direction;
             sashParent.Frame.AddSash(sash);
         }
         catch (ArgumentException ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
 }