Beispiel #1
0
 public Surface(SurfaceLayout layout) : base()
 {
     Layout = layout;
     Model  = new SurfaceModel(this);
     Model.PropertyChanged += Model_PropertyChanged;
     BoundsChanged         += Surface_BoundsChanged;
 }
Beispiel #2
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);
        }