Пример #1
0
 private static DockState Save(IDockSplitter split)
 {
     return(new PaneSave()
     {
         panes = split.Layouts.Select(_p => Save((object)_p)).ToArray(), orientation = split.Orientation, clientsize = split.WidgetSize
     });
 }
Пример #2
0
        public bool HitTest(Point position, out IDockSplitter splitter, out int ind)
        {
            if (position.X >= this.Location.X && position.X < this.Location.X + this.WidgetSize.Width &&
                position.Y >= this.Location.Y && position.Y < this.Location.Y + this.WidgetSize.Height)
            {
                int    cnt = 0, e = 4;
                double v = 0;
                switch (this.Orientation)
                {
                case Orientation.Horizontal: v = this.Location.X; break;

                case Orientation.Vertical: v = this.Location.Y; break;
                }
                foreach (var o in this._dock)
                {
                    if (o.HitTest(position, out splitter, out ind))
                    {
                        if (splitter == null)
                        {
                            return(false);
                        }
                        return(true);
                    }
                    switch (this.Orientation)
                    {
                    case Orientation.Horizontal:
                        v += o.WidgetSize.Width;
                        if (position.X >= v && position.X < v + e)
                        {
                            splitter = this;
                            ind      = cnt;
                            return(true);
                        }
                        break;

                    case Orientation.Vertical:
                        v += o.WidgetSize.Height;
                        if (position.Y >= v && position.Y < v + e)
                        {
                            splitter = this;
                            ind      = cnt;
                            return(true);
                        }
                        break;
                    }
                    v += e;
                    cnt++;
                }
                splitter = null;
                ind      = -1;
                return(true);
            }
            splitter = null;
            ind      = -1;
            return(false);
        }