Beispiel #1
0
        DocumentsPane FindDocumentsPane(DockablePaneGroup group)
        {
            if (group == null)
            {
                return(null);
            }

            if (group.AttachedPane is DocumentsPane)
            {
                return(group.AttachedPane as DocumentsPane);
            }
            else
            {
                DocumentsPane docsPane = FindDocumentsPane(group.FirstChildGroup);
                if (docsPane != null)
                {
                    return(docsPane);
                }

                docsPane = FindDocumentsPane(group.SecondChildGroup);
                if (docsPane != null)
                {
                    return(docsPane);
                }
            }

            return(null);
        }
        public void Deserialize(DockManager managerToAttach, System.Xml.XmlNode node, GetContentFromTypeString getObjectHandler)
        {
            _dock = (Dock)Enum.Parse(typeof(Dock), node.Attributes["Dock"].Value);

            if (node.ChildNodes[0].Name == "DockablePane")
            {
                DockablePane pane = new DockablePane(managerToAttach);
                pane.Deserialize(managerToAttach, node.ChildNodes[0], getObjectHandler);
                _attachedPane = pane;
            }
            else if (node.ChildNodes[0].Name == "DocumentsPane")
            {
                DocumentsPane pane = managerToAttach.GetDocumentsPane();
                pane.Deserialize(managerToAttach, node.ChildNodes[0], getObjectHandler);
                _attachedPane = pane;
            }
            else
            {
                _firstChildGroup = new DockablePaneGroup();
                _firstChildGroup._parentGroup = this;
                _firstChildGroup.Deserialize(managerToAttach, node.ChildNodes[0].ChildNodes[0], getObjectHandler);

                _secondChildGroup = new DockablePaneGroup();
                _secondChildGroup._parentGroup = this;
                _secondChildGroup.Deserialize(managerToAttach, node.ChildNodes[0].ChildNodes[1], getObjectHandler);
            }
        }
Beispiel #3
0
 void Dump(DockablePaneGroup group, int indent)
 {
     if (indent == 0)
     {
         Console.WriteLine("Dump()");
     }
     for (int i = 0; i < indent; i++)
     {
         Console.Write("-");
     }
     Console.Write(">");
     if (group.AttachedPane == null)
     {
         Console.WriteLine(group.Dock);
         Dump(group.FirstChildGroup, indent + 4);
         Console.WriteLine();
         Dump(group.SecondChildGroup, indent + 4);
     }
     else if (group.AttachedPane.ActiveContent != null)
     {
         Console.WriteLine(group.AttachedPane.ActiveContent.Title);
     }
     else
     {
         Console.WriteLine(group.AttachedPane.ToString() + " {null}");
     }
 }
        public DockablePaneGroup GetPaneGroup(Pane pane)
        {
            if (AttachedPane == pane)
            {
                return(this);
            }

            if (FirstChildGroup != null)
            {
                DockablePaneGroup paneGroup = FirstChildGroup.GetPaneGroup(pane);
                if (paneGroup != null)
                {
                    return(paneGroup);
                }
            }
            if (SecondChildGroup != null)
            {
                DockablePaneGroup paneGroup = SecondChildGroup.GetPaneGroup(pane);
                if (paneGroup != null)
                {
                    return(paneGroup);
                }
            }

            return(null);
        }
Beispiel #5
0
        public void Deserialize(DockManager managerToAttach, XmlNode node, GetContentFromTypeString getObjectHandler)
        {
            _rootGroup = new DockablePaneGroup();
            _rootGroup.Deserialize(managerToAttach, node, getObjectHandler);

            //_docsPane = FindDocumentsPane(_rootGroup);

            ArrangeLayout();
        }
Beispiel #6
0
        public void Remove(DockablePane pane)
        {
            DockablePaneGroup groupToAttach = _rootGroup.RemovePane(pane);

            if (groupToAttach != null)
            {
                _rootGroup             = groupToAttach;
                _rootGroup.ParentGroup = null;
            }

            ArrangeLayout();
        }
        ///// <summary>
        ///// Arrange passed grid layout
        ///// </summary>
        ///// <param name="grid">Grid to arrange</param>
        ///// <param name="addPaneToGrid">If true add atteched panes to the grid</param>
        ///// <remarks>Setting <paramref name="addToPaneToGrid"/> to false, this functions only arrange grids layout, without
        ///// appending attached pane to grid children collection. This is useful for dragging operations.</remarks>
        //public void Arrange(Grid grid, bool addPaneToGrid)
        //{
        //    if (AttachedPane != null)
        //    {
        //        if (addPaneToGrid)
        //            grid.Children.Add(AttachedPane);
        //    }
        //    else
        //    {
        //        if (Group1.IsHidden && !Group2.IsHidden)
        //            Group2.Arrange(grid, addPaneToGrid);
        //        else if (!Group1.IsHidden && Group2.IsHidden)
        //            Group1.Arrange(grid, addPaneToGrid);
        //        else
        //        {
        //                //first child grid
        //                Grid grid1 = new Grid();
        //                //..and second one
        //                Grid grid2 = new Grid();

        //            #region Vertical orientation
        //            if (SplitOrientation == SplitOrientation.Vertical)
        //            {
        //                 //only one row
        //                grid.RowDefinitions.Add(new RowDefinition());
        //                //two cols
        //                grid.ColumnDefinitions.Add(new ColumnDefinition());
        //                grid.ColumnDefinitions.Add(new ColumnDefinition());

        //                //setup widths
        //                grid.ColumnDefinitions[0].MinWidth = 50;
        //                grid.ColumnDefinitions[0].Width = Group1.GridWidth;
        //                grid.ColumnDefinitions[1].MinWidth = 50;
        //                grid.ColumnDefinitions[1].Width = Group2.GridWidth;

        //                //ensure that at least one col has star length
        //                if (!grid.ColumnDefinitions[0].Width.IsStar &&
        //                    !grid.ColumnDefinitions[1].Width.IsStar)
        //                    grid.ColumnDefinitions[1].Width = new GridLength(1, GridUnitType.Star);

        //                grid1.SetValue(Grid.ColumnProperty, 0);
        //                grid2.SetValue(Grid.ColumnProperty, 1);

        //                GridSplitter splitter = new GridSplitter();
        //                splitter.VerticalAlignment = VerticalAlignment.Stretch;
        //                splitter.HorizontalAlignment = HorizontalAlignment.Left;
        //                splitter.SetValue(Grid.ColumnProperty, 1);
        //                splitter.SetValue(Grid.RowProperty, 0);
        //                splitter.Width = 5;
        //                //make room for the splitter
        //                grid2.Margin = new Thickness(5,0,0,0);

        //                //ok, now add child grids and a splitter between them to current grid
        //                grid.Children.Add(grid1);
        //                grid.Children.Add(splitter);
        //                grid.Children.Add(grid2);

        //                //finally arrange child grids
        //                Group1.Arrange(grid1, addPaneToGrid);
        //                Group2.Arrange(grid2, addPaneToGrid);
        //            }
        //            #endregion

        //            #region Horizontal Orientation
        //            else //if (SplitOrientation == SplitOrientation.Horizontal)
        //            {
        //            }
        //            #endregion
        //        }
        //    }

        //}

        //DockPanel GetChildElement(DockablePaneGroup group, Dock dock)
        //{
        //    DockPanel childPanel = new DockPanel();
        //    childPanel.SetValue(DockPanel.DockProperty, dock);

        //    if (SplitOrientation == SplitOrientation.Vertical)
        //        childPanel.Width = group.DockPanelWidth;
        //    else
        //        childPanel.Height = group.DockPanelHeight;

        //    group.Arrange(childPanel);

        //    //childPanels.Add(childPanel);
        //    return childPanel;
        //}

        //internal void Arrange(DockPanel panel)
        //{

        //    if (AttachedPane != null)
        //    {
        //        AttachedPane.AttachPanel(panel);
        //        panel.Children.Add(AttachedPane);
        //    }
        //    else
        //    {
        //        #region Vertical split
        //        if (SplitOrientation == SplitOrientation.Vertical)
        //        {
        //            DockPanel lastPanel = null;

        //            foreach (DockablePaneGroup group in ChildGroups)
        //            {
        //                if (group.IsHidden)
        //                    continue;

        //                if (double.IsNaN(group.DockPanelWidth))
        //                {
        //                    lastPanel = GetChildElement(group, Dock.Left);
        //                }
        //                else
        //                {
        //                    DockPanel panelToAdd = GetChildElement(group, lastPanel == null ? Dock.Left : Dock.Right);
        //                    panel.Children.Add(panelToAdd);
        //                }
        //            }

        //            if (lastPanel != null)
        //                panel.Children.Add(lastPanel);

        //            Dock currentDock = Dock.Left;

        //            for (int i = 0; i < panel.Children.Count-1; i++)
        //            {
        //                currentDock = (Dock)panel.Children[i].GetValue(DockPanel.DockProperty);
        //                DockPanel prevPanel = panel.Children[i] as DockPanel;
        //                DockPanel nextPanel = null;
        //                for (int j = i+1; j < panel.Children.Count; j++)
        //                    if ((Dock)panel.Children[j].GetValue(DockPanel.DockProperty) ==
        //                        currentDock)
        //                    {
        //                        nextPanel = panel.Children[j] as DockPanel;
        //                        break;
        //                    }
        //                if (nextPanel == null)
        //                    nextPanel = panel.Children[panel.Children.Count - 1] as DockPanel;

        //                DockPanelSplitter splitter = null;

        //                if (currentDock == Dock.Left)
        //                    splitter = new DockPanelSplitter(prevPanel, nextPanel, SplitOrientation.Vertical);
        //                else
        //                    splitter = new DockPanelSplitter(nextPanel, prevPanel, SplitOrientation.Vertical);
        //                splitter.SetValue(DockPanel.DockProperty, currentDock);

        //                i++;
        //                panel.Children.Insert(i, splitter);
        //            }
        //        }
        //        #endregion
        //        #region Horizontal split
        //        else //if (SplitOrientation == SplitOrientation.Vertical)
        //        {
        //            DockPanel lastPanel = null;

        //            foreach (DockablePaneGroup group in ChildGroups)
        //            {
        //                if (group.IsHidden)
        //                    continue;

        //                if (double.IsNaN(group.DockPanelWidth))
        //                {
        //                    lastPanel = GetChildElement(group, Dock.Top);
        //                }
        //                else
        //                {
        //                    DockPanel panelToAdd = GetChildElement(group, lastPanel == null ? Dock.Top : Dock.Bottom);
        //                    panel.Children.Add(panelToAdd);
        //                }
        //            }

        //            if (lastPanel != null)
        //                panel.Children.Add(lastPanel);

        //            Dock currentDock = Dock.Top;

        //            for (int i = 0; i < panel.Children.Count - 1; i++)
        //            {
        //                currentDock = (Dock)panel.Children[i].GetValue(DockPanel.DockProperty);
        //                DockPanel prevPanel = panel.Children[i] as DockPanel;
        //                DockPanel nextPanel = null;
        //                for (int j = i + 1; j < panel.Children.Count; j++)
        //                    if ((Dock)panel.Children[j].GetValue(DockPanel.DockProperty) ==
        //                        currentDock)
        //                    {
        //                        nextPanel = panel.Children[j] as DockPanel;
        //                        break;
        //                    }
        //                if (nextPanel == null)
        //                    nextPanel = panel.Children[panel.Children.Count - 1] as DockPanel;

        //                DockPanelSplitter splitter = null;

        //                if (currentDock == Dock.Top)
        //                    splitter = new DockPanelSplitter(prevPanel, nextPanel, SplitOrientation.Horizontal);
        //                else
        //                    splitter = new DockPanelSplitter(nextPanel, prevPanel, SplitOrientation.Horizontal);
        //                splitter.SetValue(DockPanel.DockProperty, currentDock);

        //                i++;
        //                panel.Children.Insert(i, splitter);
        //            }
        //        }
        //        #endregion
        //    }

        //}

        public void ReplaceChildGroup(DockablePaneGroup groupToFind, DockablePaneGroup groupToReplace)
        {
            if (FirstChildGroup == groupToFind)
            {
                FirstChildGroup = groupToReplace;
            }
            else if (SecondChildGroup == groupToFind)
            {
                SecondChildGroup = groupToReplace;
            }
            else
            {
                System.Diagnostics.Debug.Assert(false);
            }
        }
Beispiel #8
0
        public void Add(DockablePane pane, Pane relativePane, Dock relativeDock)
        {
            Console.WriteLine("Add(...)");
            AttachPaneEvents(pane);
            DockablePaneGroup group = GetPaneGroup(relativePane);

            //group.ParentGroup.ReplaceChildGroup(group, new DockablePaneGroup(group, new DockablePaneGroup(relativePane), relativeDock));

            switch (relativeDock)
            {
            case Dock.Right:
            case Dock.Bottom:
            {
                if (group == _rootGroup)
                {
                    _rootGroup = new DockablePaneGroup(group, new DockablePaneGroup(pane), relativeDock);
                }
                else
                {
                    DockablePaneGroup parentGroup   = group.ParentGroup;
                    DockablePaneGroup newChildGroup = new DockablePaneGroup(group, new DockablePaneGroup(pane), relativeDock);
                    parentGroup.ReplaceChildGroup(group, newChildGroup);
                }
            }
            break;

            case Dock.Left:
            case Dock.Top:
            {
                if (group == _rootGroup)
                {
                    _rootGroup = new DockablePaneGroup(new DockablePaneGroup(pane), group, relativeDock);
                }
                else
                {
                    DockablePaneGroup parentGroup   = group.ParentGroup;
                    DockablePaneGroup newChildGroup = new DockablePaneGroup(new DockablePaneGroup(pane), group, relativeDock);
                    parentGroup.ReplaceChildGroup(group, newChildGroup);
                }
            }
            break;
                //return new DockablePaneGroup(new DockablePaneGroup(pane), this, pane.Dock);
            }


            //group.ChildGroup = new DockablePaneGroup(group.ChildGroup, pane, relativeDock);
            ArrangeLayout();
        }
Beispiel #9
0
        public void Add(DockablePane pane, Pane relativePane, Dock relativeDock)
        {
            Console.WriteLine("Add(...)");
            AttachPaneEvents(pane);
            DockablePaneGroup group = GetPaneGroup(relativePane);
            //group.ParentGroup.ReplaceChildGroup(group, new DockablePaneGroup(group, new DockablePaneGroup(relativePane), relativeDock));

            switch (relativeDock)
            {
                case Dock.Right:
                case Dock.Bottom:
                    {
                        if (group == _rootGroup)
                        {
                            _rootGroup = new DockablePaneGroup(group, new DockablePaneGroup(pane), relativeDock);
                        }
                        else
                        {
                            DockablePaneGroup parentGroup = group.ParentGroup;
                            DockablePaneGroup newChildGroup = new DockablePaneGroup(group, new DockablePaneGroup(pane), relativeDock);
                            parentGroup.ReplaceChildGroup(group, newChildGroup);
                        }
                    }
                    break;
                case Dock.Left:
                case Dock.Top:
                    {
                        if (group == _rootGroup)
                        {
                            _rootGroup = new DockablePaneGroup(new DockablePaneGroup(pane), group, relativeDock);
                        }
                        else
                        {
                            DockablePaneGroup parentGroup = group.ParentGroup;
                            DockablePaneGroup newChildGroup = new DockablePaneGroup(new DockablePaneGroup(pane), group, relativeDock);
                            parentGroup.ReplaceChildGroup(group, newChildGroup);
                        }
                    }
                    break;
                    //return new DockablePaneGroup(new DockablePaneGroup(pane), this, pane.Dock);
            }

            //group.ChildGroup = new DockablePaneGroup(group.ChildGroup, pane, relativeDock);
            ArrangeLayout();
        }
        public DockablePaneGroup RemovePane(DockablePane pane)
        {
            if (AttachedPane != null)
            {
                return(null);
            }

            if (FirstChildGroup.AttachedPane == pane)
            {
                return(SecondChildGroup);
            }
            else if (SecondChildGroup.AttachedPane == pane)
            {
                return(FirstChildGroup);
            }
            else
            {
                DockablePaneGroup group = FirstChildGroup.RemovePane(pane);

                if (group != null)
                {
                    FirstChildGroup    = group;
                    group._parentGroup = this;
                    return(null);
                }


                group = SecondChildGroup.RemovePane(pane);

                if (group != null)
                {
                    SecondChildGroup   = group;
                    group._parentGroup = this;
                    return(null);
                }
            }

            return(null);
        }
 /// <summary>
 /// Create a group with no panes
 /// </summary>
 public DockablePaneGroup(DockablePaneGroup firstGroup, DockablePaneGroup secondGroup, Dock groupDock)
 {
     FirstChildGroup  = firstGroup;
     SecondChildGroup = secondGroup;
     _dock            = groupDock;
 }
Beispiel #12
0
 /// <summary>
 /// Create a group with no panes
 /// </summary>
 public DockablePaneGroup(DockablePaneGroup firstGroup, DockablePaneGroup secondGroup, Dock groupDock)
 {
     FirstChildGroup = firstGroup;
     SecondChildGroup = secondGroup;
     _dock = groupDock;
 }
Beispiel #13
0
 ///// <summary>
 ///// Arrange passed grid layout
 ///// </summary>
 ///// <param name="grid">Grid to arrange</param>
 ///// <param name="addPaneToGrid">If true add atteched panes to the grid</param>
 ///// <remarks>Setting <paramref name="addToPaneToGrid"/> to false, this functions only arrange grids layout, without 
 ///// appending attached pane to grid children collection. This is useful for dragging operations.</remarks>
 //public void Arrange(Grid grid, bool addPaneToGrid)
 //{
 //    if (AttachedPane != null)
 //    {
 //        if (addPaneToGrid)
 //            grid.Children.Add(AttachedPane);
 //    }
 //    else
 //    {
 //        if (Group1.IsHidden && !Group2.IsHidden)
 //            Group2.Arrange(grid, addPaneToGrid);
 //        else if (!Group1.IsHidden && Group2.IsHidden)
 //            Group1.Arrange(grid, addPaneToGrid);
 //        else
 //        {
 //                //first child grid
 //                Grid grid1 = new Grid();
 //                //..and second one
 //                Grid grid2 = new Grid();
 //            #region Vertical orientation
 //            if (SplitOrientation == SplitOrientation.Vertical)
 //            {
 //                 //only one row
 //                grid.RowDefinitions.Add(new RowDefinition());
 //                //two cols
 //                grid.ColumnDefinitions.Add(new ColumnDefinition());
 //                grid.ColumnDefinitions.Add(new ColumnDefinition());
 //                //setup widths
 //                grid.ColumnDefinitions[0].MinWidth = 50;
 //                grid.ColumnDefinitions[0].Width = Group1.GridWidth;
 //                grid.ColumnDefinitions[1].MinWidth = 50;
 //                grid.ColumnDefinitions[1].Width = Group2.GridWidth;
 //                //ensure that at least one col has star length
 //                if (!grid.ColumnDefinitions[0].Width.IsStar &&
 //                    !grid.ColumnDefinitions[1].Width.IsStar)
 //                    grid.ColumnDefinitions[1].Width = new GridLength(1, GridUnitType.Star);
 //                grid1.SetValue(Grid.ColumnProperty, 0);
 //                grid2.SetValue(Grid.ColumnProperty, 1);
 //                GridSplitter splitter = new GridSplitter();
 //                splitter.VerticalAlignment = VerticalAlignment.Stretch;
 //                splitter.HorizontalAlignment = HorizontalAlignment.Left;
 //                splitter.SetValue(Grid.ColumnProperty, 1);
 //                splitter.SetValue(Grid.RowProperty, 0);
 //                splitter.Width = 5;
 //                //make room for the splitter
 //                grid2.Margin = new Thickness(5,0,0,0);
 //                //ok, now add child grids and a splitter between them to current grid
 //                grid.Children.Add(grid1);
 //                grid.Children.Add(splitter);
 //                grid.Children.Add(grid2);
 //                //finally arrange child grids
 //                Group1.Arrange(grid1, addPaneToGrid);
 //                Group2.Arrange(grid2, addPaneToGrid);
 //            }
 //            #endregion
 //            #region Horizontal Orientation
 //            else //if (SplitOrientation == SplitOrientation.Horizontal)
 //            {
 //            }
 //            #endregion
 //        }
 //    }
 //}
 //DockPanel GetChildElement(DockablePaneGroup group, Dock dock)
 //{
 //    DockPanel childPanel = new DockPanel();
 //    childPanel.SetValue(DockPanel.DockProperty, dock);
 //    if (SplitOrientation == SplitOrientation.Vertical)
 //        childPanel.Width = group.DockPanelWidth;
 //    else
 //        childPanel.Height = group.DockPanelHeight;
 //    group.Arrange(childPanel);
 //    //childPanels.Add(childPanel);
 //    return childPanel;
 //}
 //internal void Arrange(DockPanel panel)
 //{
 //    if (AttachedPane != null)
 //    {
 //        AttachedPane.AttachPanel(panel);
 //        panel.Children.Add(AttachedPane);
 //    }
 //    else
 //    {
 //        #region Vertical split
 //        if (SplitOrientation == SplitOrientation.Vertical)
 //        {
 //            DockPanel lastPanel = null;
 //            foreach (DockablePaneGroup group in ChildGroups)
 //            {
 //                if (group.IsHidden)
 //                    continue;
 //                if (double.IsNaN(group.DockPanelWidth))
 //                {
 //                    lastPanel = GetChildElement(group, Dock.Left);
 //                }
 //                else
 //                {
 //                    DockPanel panelToAdd = GetChildElement(group, lastPanel == null ? Dock.Left : Dock.Right);
 //                    panel.Children.Add(panelToAdd);
 //                }
 //            }
 //            if (lastPanel != null)
 //                panel.Children.Add(lastPanel);
 //            Dock currentDock = Dock.Left;
 //            for (int i = 0; i < panel.Children.Count-1; i++)
 //            {
 //                currentDock = (Dock)panel.Children[i].GetValue(DockPanel.DockProperty);
 //                DockPanel prevPanel = panel.Children[i] as DockPanel;
 //                DockPanel nextPanel = null;
 //                for (int j = i+1; j < panel.Children.Count; j++)
 //                    if ((Dock)panel.Children[j].GetValue(DockPanel.DockProperty) ==
 //                        currentDock)
 //                    {
 //                        nextPanel = panel.Children[j] as DockPanel;
 //                        break;
 //                    }
 //                if (nextPanel == null)
 //                    nextPanel = panel.Children[panel.Children.Count - 1] as DockPanel;
 //                DockPanelSplitter splitter = null;
 //                if (currentDock == Dock.Left)
 //                    splitter = new DockPanelSplitter(prevPanel, nextPanel, SplitOrientation.Vertical);
 //                else
 //                    splitter = new DockPanelSplitter(nextPanel, prevPanel, SplitOrientation.Vertical);
 //                splitter.SetValue(DockPanel.DockProperty, currentDock);
 //                i++;
 //                panel.Children.Insert(i, splitter);
 //            }
 //        }
 //        #endregion
 //        #region Horizontal split
 //        else //if (SplitOrientation == SplitOrientation.Vertical)
 //        {
 //            DockPanel lastPanel = null;
 //            foreach (DockablePaneGroup group in ChildGroups)
 //            {
 //                if (group.IsHidden)
 //                    continue;
 //                if (double.IsNaN(group.DockPanelWidth))
 //                {
 //                    lastPanel = GetChildElement(group, Dock.Top);
 //                }
 //                else
 //                {
 //                    DockPanel panelToAdd = GetChildElement(group, lastPanel == null ? Dock.Top : Dock.Bottom);
 //                    panel.Children.Add(panelToAdd);
 //                }
 //            }
 //            if (lastPanel != null)
 //                panel.Children.Add(lastPanel);
 //            Dock currentDock = Dock.Top;
 //            for (int i = 0; i < panel.Children.Count - 1; i++)
 //            {
 //                currentDock = (Dock)panel.Children[i].GetValue(DockPanel.DockProperty);
 //                DockPanel prevPanel = panel.Children[i] as DockPanel;
 //                DockPanel nextPanel = null;
 //                for (int j = i + 1; j < panel.Children.Count; j++)
 //                    if ((Dock)panel.Children[j].GetValue(DockPanel.DockProperty) ==
 //                        currentDock)
 //                    {
 //                        nextPanel = panel.Children[j] as DockPanel;
 //                        break;
 //                    }
 //                if (nextPanel == null)
 //                    nextPanel = panel.Children[panel.Children.Count - 1] as DockPanel;
 //                DockPanelSplitter splitter = null;
 //                if (currentDock == Dock.Top)
 //                    splitter = new DockPanelSplitter(prevPanel, nextPanel, SplitOrientation.Horizontal);
 //                else
 //                    splitter = new DockPanelSplitter(nextPanel, prevPanel, SplitOrientation.Horizontal);
 //                splitter.SetValue(DockPanel.DockProperty, currentDock);
 //                i++;
 //                panel.Children.Insert(i, splitter);
 //            }
 //        }
 //        #endregion
 //    }
 //}
 public void ReplaceChildGroup(DockablePaneGroup groupToFind, DockablePaneGroup groupToReplace)
 {
     if (FirstChildGroup == groupToFind)
         FirstChildGroup = groupToReplace;
     else if (SecondChildGroup == groupToFind)
         SecondChildGroup = groupToReplace;
     else
     {
         System.Diagnostics.Debug.Assert(false);
     }
 }
Beispiel #14
0
        public void Deserialize(DockManager managerToAttach, System.Xml.XmlNode node, GetContentFromTypeString getObjectHandler)
        {
            _dock = (Dock)Enum.Parse(typeof(Dock), node.Attributes["Dock"].Value);

            if (node.ChildNodes[0].Name == "DockablePane")
            {
                DockablePane pane = new DockablePane(managerToAttach);
                pane.Deserialize(managerToAttach, node.ChildNodes[0], getObjectHandler);
                _attachedPane = pane;
            }
            else if (node.ChildNodes[0].Name == "DocumentsPane")
            {
                DocumentsPane pane = managerToAttach.GetDocumentsPane();
                pane.Deserialize(managerToAttach, node.ChildNodes[0], getObjectHandler);
                _attachedPane = pane;
            }
            else
            {
                _firstChildGroup = new DockablePaneGroup();
                _firstChildGroup._parentGroup = this;
                _firstChildGroup.Deserialize(managerToAttach, node.ChildNodes[0].ChildNodes[0], getObjectHandler);

                _secondChildGroup = new DockablePaneGroup();
                _secondChildGroup._parentGroup = this;
                _secondChildGroup.Deserialize(managerToAttach, node.ChildNodes[0].ChildNodes[1], getObjectHandler);

            }
        }
Beispiel #15
0
 public void Add(DockablePane pane)
 {
     _rootGroup = _rootGroup.AddPane(pane);
     ArrangeLayout();
 }
Beispiel #16
0
 void Dump(DockablePaneGroup group, int indent)
 {
     if (indent == 0)
         Console.WriteLine("Dump()");
     for (int i = 0; i < indent; i++)
         Console.Write("-");
     Console.Write(">");
     if (group.AttachedPane == null)
     {
         Console.WriteLine(group.Dock);
         Dump(group.FirstChildGroup, indent + 4);
         Console.WriteLine();
         Dump(group.SecondChildGroup, indent + 4);
     }
     else if (group.AttachedPane.ActiveContent!=null)
         Console.WriteLine(group.AttachedPane.ActiveContent.Title);
     else
         Console.WriteLine(group.AttachedPane.ToString() + " {null}");
 }
Beispiel #17
0
 public void Add(DockablePane pane)
 {
     _rootGroup = _rootGroup.AddPane(pane);
     ArrangeLayout();
 }
Beispiel #18
0
        DocumentsPane FindDocumentsPane(DockablePaneGroup group)
        {
            if (group == null)
                return null;

            if (group.AttachedPane is DocumentsPane)
                return group.AttachedPane as DocumentsPane;
            else
            {
                DocumentsPane docsPane = FindDocumentsPane(group.FirstChildGroup);
                if (docsPane != null)
                    return docsPane;

                docsPane = FindDocumentsPane(group.SecondChildGroup);
                if (docsPane != null)
                    return docsPane;
            }

            return null;
        }
Beispiel #19
0
        public void Remove(DockablePane pane)
        {
            DockablePaneGroup groupToAttach = _rootGroup.RemovePane(pane);
            if (groupToAttach != null)
            {
                _rootGroup = groupToAttach;
                _rootGroup.ParentGroup = null;
            }

            ArrangeLayout();
        }
Beispiel #20
0
 internal void AttachDockManager(DockManager dockManager)
 {
     _docsPane = new DocumentsPane(dockManager);
     _rootGroup = new DockablePaneGroup(DocumentsPane);
     ArrangeLayout();
 }
Beispiel #21
0
 internal void AttachDockManager(DockManager dockManager)
 {
     _docsPane  = new DocumentsPane(dockManager);
     _rootGroup = new DockablePaneGroup(DocumentsPane);
     ArrangeLayout();
 }
Beispiel #22
0
        public void Deserialize(DockManager managerToAttach, XmlNode node, GetContentFromTypeString getObjectHandler)
        {
            _rootGroup = new DockablePaneGroup();
            _rootGroup.Deserialize(managerToAttach, node, getObjectHandler);

            //_docsPane = FindDocumentsPane(_rootGroup);

            ArrangeLayout();
        }