예제 #1
0
        protected void LayoutInternal()
        {
            this.SuspendLayout();

            if (this.Controls.Count > 0 && this.layoutStrategy != null)
            {
                int splitterCount = this.VisiblePanelCount - 1;
                if (this.splitContainerElement.Count != splitterCount)
                {
                    this.splitContainerElement.DisposeChildren();
                    while (this.splitContainerElement.Count < splitterCount)
                    {
                        SplitterElement splitter = new SplitterElement();
                        this.splitContainerElement.Children.Add(splitter);
                        splitter.AutoSize = false;
                        splitter.Dock     = (this.orientation == Orientation.Horizontal) ? DockStyle.Top : DockStyle.Left;
                        splitter.PrevNavigationButton.Visibility = ElementVisibility.Collapsed;
                        splitter.NextNavigationButton.Visibility = ElementVisibility.Collapsed;
                        splitter.SplitterWidth = this.SplitterWidth;
                    }
                }

                this.layoutStrategy.PerformLayout(this);
            }

            this.ResumeLayout(false);
        }
예제 #2
0
        /// <summary>
        /// Updates the splitter, associated with the specified index of a child SplitPanel.
        /// </summary>
        /// <param name="info">The layout info, containing information about the operation.</param>
        /// <param name="panelIndex">The index of the panel for which the splitter should be updated.</param>
        /// <param name="bounds">The bounding rectangle of the splitter.</param>
        protected internal virtual void UpdateSplitter(SplitContainerLayoutInfo info, int panelIndex, Rectangle bounds)
        {
            SplitterElement splitter = this.splitContainerElement[panelIndex - 1];

            splitter.LeftNode  = info.LayoutTargets[panelIndex - 1];
            splitter.RightNode = info.LayoutTargets[panelIndex];
            splitter.Bounds    = bounds;
        }
예제 #3
0
 protected override void CreateChildItems(RadElement parent)
 {
     base.CreateChildItems(parent);
     this.splitterElement = new SplitterElement();
     this.splitterElement.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
     parent.Children.Add((RadElement)this.splitterElement);
     this.RestoreArrows();
 }
예제 #4
0
        private void UpdateCursor(Point mouse)
        {
            SplitterElement splitter = this.GetSplitterElementAtPoint(mouse);

            if (splitter != null)
            {
                this.Cursor = this.orientation == Orientation.Vertical ? Cursors.VSplit : Cursors.HSplit;
            }
            else
            {
                Cursor = null;
            }
        }
예제 #5
0
        private Padding SplitterBounds(SplitterElement splitter)
        {
            Padding    bounds     = new Padding();
            SplitPanel leftPanel  = (SplitPanel)splitter.LeftNode;
            SplitPanel rightPanel = (SplitPanel)splitter.RightNode;

            Size leftMinSize  = this.layoutStrategy == null ? leftPanel.SizeInfo.MinimumSize : this.layoutStrategy.GetMinimumSize(leftPanel);
            Size rightMinSize = this.layoutStrategy == null ? rightPanel.SizeInfo.MinimumSize : this.layoutStrategy.GetMinimumSize(rightPanel);

            if (this.Orientation == Orientation.Vertical)
            {
                bounds.Left = leftPanel.Width - leftMinSize.Width;

                int diff = rightPanel.SizeInfo.MaximumSize.Width - rightPanel.Width;
                if (rightPanel.SizeInfo.MaximumSize.Width > 0 && diff >= 0)
                {
                    bounds.Left = Math.Min(bounds.Left, diff);
                }

                bounds.Right = rightPanel.Width - rightMinSize.Width;
                diff         = leftPanel.SizeInfo.MaximumSize.Width - leftPanel.Width;
                if (leftPanel.SizeInfo.MaximumSize.Width > 0 && diff >= 0)
                {
                    bounds.Right = Math.Min(bounds.Right, diff);
                }
            }
            else
            {
                bounds.Top = leftPanel.Height - leftMinSize.Height;
                int diff = rightPanel.SizeInfo.MaximumSize.Height - leftPanel.Height;
                if (rightPanel.SizeInfo.MaximumSize.Height > 0 && diff >= 0)
                {
                    bounds.Top = Math.Min(bounds.Top, diff);
                }

                bounds.Bottom = rightPanel.Height - rightMinSize.Height;
                diff          = leftPanel.SizeInfo.MaximumSize.Height - leftPanel.Height;
                if (leftPanel.SizeInfo.MaximumSize.Height > 0 && diff >= 0)
                {
                    bounds.Bottom = Math.Min(bounds.Bottom, diff);
                }
            }

            return(bounds);
        }
예제 #6
0
 protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (e.Property == SplitContainerElement.SplitterWidthProperty && this.ElementState == ElementState.Loaded)
     {
         (this.ElementTree.Control as RadSplitContainer)?.ApplySplitterWidth((int)e.NewValue);
     }
     if (e.Property != SplitContainerElement.IsVerticalProperty)
     {
         return;
     }
     for (int index = 0; index < this.Children.Count; ++index)
     {
         SplitterElement child = this.Children[index] as SplitterElement;
         if (child != null)
         {
             int num = (int)child.SetValue(SplitterElement.IsVerticalProperty, e.NewValue);
         }
     }
 }
예제 #7
0
        private void ClearSplitterReferences(Control control)
        {
            //int count = this.splitters.Length;
            for (int i = 0; i < this.splitContainerElement.Count; i++)
            {
                SplitterElement splitter = this.splitContainerElement[i];
                if (splitter == null)
                {
                    continue;
                }

                if (splitter.LeftNode == control)
                {
                    splitter.LeftNode = null;
                }
                if (splitter.RightNode == control)
                {
                    splitter.RightNode = null;
                }
            }
        }
예제 #8
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.Button == MouseButtons.Left && this.ContentRectangle.Contains(e.Location))
            {
                this.currentSplitter = GetSplitterElementAtPoint(e.Location);

                if (this.currentSplitter != null && !this.currentSplitter.Fixed)
                {
                    resizing = true;
                    if (Cursor == Cursors.VSplit)
                    {
                        beginSplitterDistance = e.X;
                        splitterDistance      = e.X;
                    }
                    else if (Cursor == Cursors.HSplit)
                    {
                        beginSplitterDistance = e.Y;
                        splitterDistance      = e.Y;
                    }
                }
            }
        }
예제 #9
0
 public SplitterLayout(SplitterElement owner)
 {
     this.owner = owner;
 }
예제 #10
0
 public SplitterElementLayout(SplitterElement owner)
 {
     this.owner = owner;
     this.StretchHorizontally = true;
     this.StretchVertically   = true;
 }