コード例 #1
0
ファイル: ViewDockGrid.cs プロジェクト: kiple/gitter
 private void RemoveAllSides()
 {
     SuspendLayout();
     if (LeftSide != null)
     {
         LeftSide.Parent = null;
         LeftSide.Dispose();
         LeftSide = null;
     }
     if (TopSide != null)
     {
         TopSide.Parent = null;
         TopSide.Dispose();
         TopSide = null;
     }
     if (RightSide != null)
     {
         RightSide.Parent = null;
         RightSide.Dispose();
         RightSide = null;
     }
     if (BottomSide != null)
     {
         BottomSide.Parent = null;
         BottomSide.Dispose();
         BottomSide = null;
     }
     RootControl.SetBounds(
         ViewConstants.Spacing, ViewConstants.Spacing,
         Width - ViewConstants.Spacing * 2, Height - ViewConstants.Spacing * 2,
         BoundsSpecified.All);
     ResumeLayout(true);
 }
コード例 #2
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement("RootPanel");
            if (RootPanel != null)
            {
                RootPanel.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("TopSide");
            if (TopSide != null)
            {
                TopSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("RightSide");
            if (RightSide != null)
            {
                RightSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("LeftSide");
            if (LeftSide != null)
            {
                LeftSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("BottomSide");
            if (BottomSide != null)
            {
                BottomSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            // Write all floating windows (can be LayoutDocumentFloatingWindow or LayoutAnchorableFloatingWindow).
            // To prevent "can not create instance of abstract type", the type is retrieved with GetType().Name
            writer.WriteStartElement("FloatingWindows");
            foreach (var layoutFloatingWindow in FloatingWindows)
            {
                writer.WriteStartElement(layoutFloatingWindow.GetType().Name);
                layoutFloatingWindow.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteStartElement("Hidden");
            foreach (var layoutAnchorable in Hidden)
            {
                writer.WriteStartElement(layoutAnchorable.GetType().Name);
                layoutAnchorable.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }
コード例 #3
0
ファイル: ViewDockGrid.cs プロジェクト: kiple/gitter
        private void RemoveLeftSide()
        {
            if (LeftSide != null)
            {
                LeftSide.Parent = null;
                LeftSide.Dispose();
                LeftSide = null;

                var bounds = RootControl.Bounds;
                bounds.X          -= Renderer.SideTabHeight;
                bounds.Width      += Renderer.SideTabHeight;
                RootControl.Bounds = bounds;
                var hcs = Width - ViewConstants.Spacing * 2;
                if (RightSide != null)
                {
                    hcs -= Renderer.SideTabHeight;
                }
                if (TopSide != null)
                {
                    var w   = TopSide.Width;
                    var len = TopSide.OptimalLength;
                    if (w >= len)
                    {
                        TopSide.Left = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > hcs)
                        {
                            len = hcs;
                        }
                        TopSide.SetBounds(
                            ViewConstants.Spacing, 0, len, Renderer.SideTabHeight,
                            BoundsSpecified.X | BoundsSpecified.Width);
                    }
                }
                if (BottomSide != null)
                {
                    var w   = BottomSide.Height;
                    var len = BottomSide.OptimalLength;
                    if (w >= len)
                    {
                        BottomSide.Left = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > hcs)
                        {
                            len = hcs;
                        }
                        BottomSide.SetBounds(
                            ViewConstants.Spacing, 0, len, Renderer.SideTabHeight,
                            BoundsSpecified.X | BoundsSpecified.Width);
                    }
                }
            }
        }
コード例 #4
0
 public Tile(long id, char[][] content)
 {
     Id      = id;
     Content = content;
     Sides   = new[] {
         TopSide,
         RightSide,
         BottomSide,
         LeftSide,
         string.Join("", TopSide.Reverse()),
         string.Join("", RightSide.Reverse()),
         string.Join("", BottomSide.Reverse()),
         string.Join("", LeftSide.Reverse())
     };
 }
コード例 #5
0
ファイル: ViewDockGrid.cs プロジェクト: kiple/gitter
        private void KillBottomSide()
        {
            if (BottomSide != null)
            {
                BottomSide.Parent = null;
                BottomSide.Dispose();
                BottomSide          = null;
                RootControl.Height += Renderer.SideTabHeight;

                var vcs = Height - Renderer.SideTabHeight * 2;
                if (BottomSide != null)
                {
                    vcs -= Renderer.SideTabHeight;
                }
                if (LeftSide != null)
                {
                    var h   = LeftSide.Height;
                    var len = LeftSide.OptimalLength;
                    if (h < len)
                    {
                        if (len > vcs)
                        {
                            len = vcs;
                        }
                        LeftSide.Height = len;
                    }
                }
                if (RightSide != null)
                {
                    var h   = RightSide.Height;
                    var len = RightSide.OptimalLength;
                    if (h < len)
                    {
                        if (len > vcs)
                        {
                            len = vcs;
                        }
                        RightSide.Height = len;
                    }
                }
            }
        }
コード例 #6
0
        internal void AddSideChild(IDockElement ele, DockSide side)
        {
            switch (side)
            {
            case DockSide.Left:
                LeftSide.Attach(ele);
                break;

            case DockSide.Right:
                RightSide.Attach(ele);
                break;

            case DockSide.Top:
                TopSide.Attach(ele);
                break;

            case DockSide.Bottom:
                BottomSide.Attach(ele);
                break;
            }
        }
コード例 #7
0
ファイル: ViewDockGrid.cs プロジェクト: kiple/gitter
 /// <summary>
 /// Releases the unmanaged resources used by the <see cref="T:System.Windows.Forms.Control"/> and its child controls and optionally releases the managed resources.
 /// </summary>
 /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     lock (_grids)
     {
         _grids.Remove(this);
     }
     if (disposing)
     {
         _dockMarkers.Dispose();
         if (LeftSide != null)
         {
             LeftSide.Dispose();
             LeftSide = null;
         }
         if (TopSide != null)
         {
             TopSide.Dispose();
             TopSide = null;
         }
         if (RightSide != null)
         {
             RightSide.Dispose();
             RightSide = null;
         }
         if (BottomSide != null)
         {
             BottomSide.Dispose();
             BottomSide = null;
         }
         if (PopupsStack != null)
         {
             PopupsStack.Dispose();
             PopupsStack = null;
         }
         RootControl = null;
         _floatingViewForms.Clear();
     }
     base.Dispose(disposing);
 }