//-------------------------------------------------------------------
        public void AfterAdd(ControlContainerSplitter _split)
        {
            if (_split == null)
            {
                return;
            }

            if (SplitterDistance >= _split.Panel1MinSize && SplitterDistance <= _split.Width - _split.Panel2MinSize)
            {
                _split.SplitterDistance = SplitterDistance;
            }

            if (_split.Panel1.Controls.Count == 1)
            {
                if (Panel1SplitterDesc != null)
                {
                    ControlContainerSplitter split = _split.Panel1.Controls[0] as ControlContainerSplitter;
                    Panel1SplitterDesc.AfterAdd(split);
                }
            }

            if (_split.Panel2.Controls.Count == 1)
            {
                if (Panel2SplitterDesc != null)
                {
                    ControlContainerSplitter split = _split.Panel2.Controls[0] as ControlContainerSplitter;
                    Panel2SplitterDesc.AfterAdd(split);
                }
            }
        }
        //-------------------------------------------------------------------
        public ControlContainerSplitter Rebuild()
        {
            ControlContainerSplitter split = new ControlContainerSplitter
            {
                Dock        = DockStyle.Fill,
                Orientation = Orientation
            };

            if (Panel1SplitterDesc != null)
            {
                split.Panel1.Controls.Add(Panel1SplitterDesc.Rebuild());
            }
            else if (Panel1TabDesc != null)
            {
                split.Panel1.Controls.Add(Panel1TabDesc.Rebuild());
            }

            if (Panel2SplitterDesc != null)
            {
                split.Panel2.Controls.Add(Panel2SplitterDesc.Rebuild());
            }
            else if (Panel2TabDesc != null)
            {
                split.Panel2.Controls.Add(Panel2TabDesc.Rebuild());
            }

            split.SplitterDistance = SplitterDistance;

            return(split);
        }
        //-------------------------------------------------------------------
        public static ControlContainerSplitterDesc FromTaxonSplitterContainer(ControlContainerSplitter _split)
        {
            ControlContainerSplitterDesc desc = new ControlContainerSplitterDesc
            {
                Orientation      = _split.Orientation,
                SplitterDistance = _split.SplitterDistance
            };

            if (_split.Panel1.Controls[0] is ControlContainerTabs)
            {
                desc.Panel1TabDesc = ControlContainerTabsDesc.FromTaxonTabControls(_split.Panel1.Controls[0] as ControlContainerTabs);
            }
            else if (_split.Panel1.Controls[0] is ControlContainerSplitter)
            {
                desc.Panel1SplitterDesc = FromTaxonSplitterContainer(_split.Panel1.Controls[0] as ControlContainerSplitter);
            }

            if (_split.Panel2.Controls[0] is ControlContainerTabs)
            {
                desc.Panel2TabDesc = ControlContainerTabsDesc.FromTaxonTabControls(_split.Panel2.Controls[0] as ControlContainerTabs);
            }
            else if (_split.Panel2.Controls[0] is ControlContainerSplitter)
            {
                desc.Panel2SplitterDesc = FromTaxonSplitterContainer(_split.Panel2.Controls[0] as ControlContainerSplitter);
            }
            return(desc);
        }
Ejemplo n.º 4
0
 //---------------------------------------------------------------------------------
 public void SetSplitterContainer(ControlContainerSplitter _splitter = null)
 {
     if (_splitter == null)
     {
         _splitter = new ControlContainerSplitter();
     }
     Controls.Clear();
     Controls.Add(_splitter);
 }
Ejemplo n.º 5
0
        //-----------------------------------------------------------------------------------------
        void MainWindowContentToUI()
        {
            Panel mainPanel = TaxonUtils.MainWindow.GetMainPanel();

            if (_SplitterContainerDescriptor != null)
            {
                GUI.ControlContainerSplitter split = _SplitterContainerDescriptor.Rebuild();
                mainPanel.Controls.Add(split);
                _SplitterContainerDescriptor.AfterAdd(split);
            }
            else if (_TaxonTabControlsDescriptor != null)
            {
                GUI.ControlContainerTabs tabControl = _TaxonTabControlsDescriptor.Rebuild();
                mainPanel.Controls.Add(tabControl);
            }
        }
Ejemplo n.º 6
0
        //-------------------------------------------------------------------
        public ControlContainerInterface Split(DockStyle _dock)
        {
            if (_dock == DockStyle.None || _dock == DockStyle.Fill)
            {
                return(null);
            }
            if (Parent == null)
            {
                return(null);
            }

            ControlContainerSplitter split = new ControlContainerSplitter();
            Orientation orientation        = Orientation.Horizontal;
            int         distance           = ClientRectangle.Height / 2;

            if ((_dock == DockStyle.Left) || (_dock == DockStyle.Right))
            {
                orientation = Orientation.Vertical;
                distance    = ClientRectangle.Width / 2;
            }

            ShowHeaderWhenOnlyOne = true;
            ControlContainerTabs newTabs = new ControlContainerTabs();

            split.Orientation = orientation;
            split.Dock        = DockStyle.Fill;
            split.Location    = new Point(0, 0);

            Control parent = Parent;

            parent.Controls.Remove(this);
            if ((_dock == DockStyle.Left) || (_dock == DockStyle.Top))
            {
                split.Panel1.Controls.Add(newTabs);
                split.Panel2.Controls.Add(this);
            }
            else
            {
                split.Panel1.Controls.Add(this);
                split.Panel2.Controls.Add(newTabs);
            }
            parent.Controls.Add(split);

            split.SplitterDistance = distance;

            return(newTabs);
        }
Ejemplo n.º 7
0
        //-------------------------------------------------------------------
        void CloseIfEmpty()
        {
            if (Children.Count == 0 && Parent is SplitterPanel && Parent.Parent is ControlContainerSplitter && Parent.Parent.Parent != null)
            {
                ControlContainerSplitter split = Parent.Parent as ControlContainerSplitter;
                Control parent = split.Parent;

                parent.SuspendLayout();
                ControlCollection toRemove = null;
                if (split.Panel1.Controls.Contains(this))
                {
                    toRemove = split.Panel2.Controls;
                }
                else
                {
                    toRemove = split.Panel1.Controls;
                }

                List <Control> toKeep = new List <Control>();

                foreach (Control c in toRemove)
                {
                    toKeep.Add(c);
                }
                toRemove.Clear();
                parent.Controls.Remove(split);
                split.Dispose();

                foreach (Control c in toKeep)
                {
                    parent.Controls.Add(c);
                }
                parent.ResumeLayout();
                parent.Invalidate();
            }
        }
Ejemplo n.º 8
0
 //---------------------------------------------------------------------------------
 public FormContainer(ControlContainerSplitter _split) : this()
 {
     SetSplitterContainer(_split);
     UpdateName();
 }