コード例 #1
0
ファイル: ViewDockGrid.cs プロジェクト: oqewok/gitter
 private void RemoveAllSides()
 {
     SuspendLayout();
     if (_left != null)
     {
         _left.Parent = null;
         _left.Dispose();
         _left = null;
     }
     if (_top != null)
     {
         _top.Parent = null;
         _top.Dispose();
         _top = null;
     }
     if (_right != null)
     {
         _right.Parent = null;
         _right.Dispose();
         _right = null;
     }
     if (_bottom != null)
     {
         _bottom.Parent = null;
         _bottom.Dispose();
         _bottom = null;
     }
     RootControl.SetBounds(
         ViewConstants.Spacing, ViewConstants.Spacing,
         Width - ViewConstants.Spacing * 2, Height - ViewConstants.Spacing * 2,
         BoundsSpecified.All);
     ResumeLayout(true);
 }
コード例 #2
0
 public override void RenderViewDockSide(ViewDockSide side, PaintEventArgs e)
 {
     using (var brush = new SolidBrush(ColorTable.ViewDockSideBackground))
     {
         e.Graphics.FillRectangle(brush, e.ClipRectangle);
     }
 }
コード例 #3
0
ファイル: ViewDockSideTab.cs プロジェクト: oqewok/gitter
        public ViewDockSideTab(ViewDockSide side, ViewHost viewHost, ViewBase view)
            : base(view, Utility.InvertAnchor(side.Side))
        {
            Verify.Argument.IsNotNull(side, "side");
            Verify.Argument.IsNotNull(viewHost, "viewHost");

            _side     = side;
            _viewHost = viewHost;
        }
コード例 #4
0
ファイル: ViewDockGrid.cs プロジェクト: oqewok/gitter
        private void RemoveTopSide()
        {
            if (_top != null)
            {
                _top.Parent = null;
                _top.Dispose();
                _top = null;

                var bounds = _rootControl.Bounds;
                bounds.Y           -= Renderer.SideTabHeight;
                bounds.Height      += Renderer.SideTabHeight;
                _rootControl.Bounds = bounds;
                var vcs = Height - Renderer.SideTabHeight * 2;
                if (_bottom != null)
                {
                    vcs -= Renderer.SideTabHeight;
                }
                if (_left != null)
                {
                    var h   = _left.Height;
                    var len = _left.OptimalLength;
                    if (h >= len)
                    {
                        _left.Top = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > vcs)
                        {
                            len = vcs;
                        }
                        _left.SetBounds(
                            0, ViewConstants.Spacing, Renderer.SideTabHeight, len,
                            BoundsSpecified.Y | BoundsSpecified.Height);
                    }
                }
                if (_right != null)
                {
                    var h   = _right.Height;
                    var len = _right.OptimalLength;
                    if (h >= len)
                    {
                        _right.Top = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > vcs)
                        {
                            len = vcs;
                        }
                        _right.SetBounds(
                            0, ViewConstants.Spacing, Renderer.SideTabHeight, len,
                            BoundsSpecified.Y | BoundsSpecified.Height);
                    }
                }
            }
        }
コード例 #5
0
ファイル: ViewDockGrid.cs プロジェクト: oqewok/gitter
        private void RemoveLeftSide()
        {
            if (_left != null)
            {
                _left.Parent = null;
                _left.Dispose();
                _left = null;

                var bounds = _rootControl.Bounds;
                bounds.X           -= Renderer.SideTabHeight;
                bounds.Width       += Renderer.SideTabHeight;
                _rootControl.Bounds = bounds;
                var hcs = Width - ViewConstants.Spacing * 2;
                if (_right != null)
                {
                    hcs -= Renderer.SideTabHeight;
                }
                if (_top != null)
                {
                    var w   = _top.Width;
                    var len = _top.OptimalLength;
                    if (w >= len)
                    {
                        _top.Left = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > hcs)
                        {
                            len = hcs;
                        }
                        _top.SetBounds(
                            ViewConstants.Spacing, 0, len, Renderer.SideTabHeight,
                            BoundsSpecified.X | BoundsSpecified.Width);
                    }
                }
                if (_bottom != null)
                {
                    var w   = _bottom.Height;
                    var len = _bottom.OptimalLength;
                    if (w >= len)
                    {
                        _bottom.Left = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > hcs)
                        {
                            len = hcs;
                        }
                        _bottom.SetBounds(
                            ViewConstants.Spacing, 0, len, Renderer.SideTabHeight,
                            BoundsSpecified.X | BoundsSpecified.Width);
                    }
                }
            }
        }
コード例 #6
0
ファイル: ViewDockSideTab.cs プロジェクト: kiple/gitter
        public ViewDockSideTab(ViewDockSide side, ViewHost viewHost, ViewBase view)
            : base(view, Utility.InvertAnchor(side.Side))
        {
            Verify.Argument.IsNotNull(side, nameof(side));
            Verify.Argument.IsNotNull(viewHost, nameof(viewHost));

            Side     = side;
            ViewHost = viewHost;
        }
コード例 #7
0
ファイル: ViewDockGrid.cs プロジェクト: kiple/gitter
        private void SpawnLeftSide()
        {
            Verify.State.IsTrue(LeftSide == null);

            var size   = Size;
            var bounds = new Rectangle(
                0, ViewConstants.Spacing,
                Renderer.SideTabHeight, 0);

            int hspace = size.Width - (Renderer.SideTabHeight + ViewConstants.Spacing * 2);

            if (RightSide != null)
            {
                hspace -= Renderer.SideTabHeight;
            }

            if (TopSide != null)
            {
                if (TopSide.Width > hspace)
                {
                    TopSide.Bounds = new Rectangle(
                        Renderer.SideTabHeight + ViewConstants.Spacing, 0,
                        hspace, Renderer.SideTabHeight);
                }
                else
                {
                    TopSide.Left += Renderer.SideTabHeight;
                }
                bounds.Y += Renderer.SideTabHeight;
            }
            if (BottomSide != null)
            {
                if (BottomSide.Width > hspace)
                {
                    BottomSide.Bounds = new Rectangle(
                        Renderer.SideTabHeight + ViewConstants.Spacing, size.Height - Renderer.SideTabHeight,
                        hspace, Renderer.SideTabHeight);
                }
                else
                {
                    BottomSide.Left += Renderer.SideTabHeight;
                }
            }
            RootControl.SetBounds(
                RootControl.Left + Renderer.SideTabHeight, 0,
                RootControl.Width - Renderer.SideTabHeight, 0,
                BoundsSpecified.X | BoundsSpecified.Width);
            LeftSide = new ViewDockSide(this, AnchorStyles.Left)
            {
                Anchor = AnchorStyles.Left | AnchorStyles.Top,
                Bounds = bounds,
                Parent = this,
            };
        }
コード例 #8
0
ファイル: ViewDockGrid.cs プロジェクト: oqewok/gitter
        private void SpawnLeftSide()
        {
            Verify.State.IsTrue(_left == null);

            var size   = Size;
            var bounds = new Rectangle(
                0, ViewConstants.Spacing,
                Renderer.SideTabHeight, 0);

            int hspace = size.Width - (Renderer.SideTabHeight + ViewConstants.Spacing * 2);

            if (_right != null)
            {
                hspace -= Renderer.SideTabHeight;
            }

            if (_top != null)
            {
                if (_top.Width > hspace)
                {
                    _top.Bounds = new Rectangle(
                        Renderer.SideTabHeight + ViewConstants.Spacing, 0,
                        hspace, Renderer.SideTabHeight);
                }
                else
                {
                    _top.Left += Renderer.SideTabHeight;
                }
                bounds.Y += Renderer.SideTabHeight;
            }
            if (_bottom != null)
            {
                if (_bottom.Width > hspace)
                {
                    _bottom.Bounds = new Rectangle(
                        Renderer.SideTabHeight + ViewConstants.Spacing, size.Height - Renderer.SideTabHeight,
                        hspace, Renderer.SideTabHeight);
                }
                else
                {
                    _bottom.Left += Renderer.SideTabHeight;
                }
            }
            _rootControl.SetBounds(
                _rootControl.Left + Renderer.SideTabHeight, 0,
                _rootControl.Width - Renderer.SideTabHeight, 0,
                BoundsSpecified.X | BoundsSpecified.Width);
            _left = new ViewDockSide(this, AnchorStyles.Left)
            {
                Anchor = AnchorStyles.Left | AnchorStyles.Top,
                Bounds = bounds,
                Parent = this,
            };
        }
コード例 #9
0
            public SideEntry(ViewDockSide side)
                : this()
            {
                Verify.Argument.IsNotNull(side, nameof(side));

                _side = side.Side;
                foreach (var host in side)
                {
                    _hosts.Add(new HostEntry(host));
                }
            }
コード例 #10
0
ファイル: ViewDockGrid.cs プロジェクト: kiple/gitter
        private void SpawnTopSide()
        {
            Verify.State.IsTrue(TopSide == null);

            var size   = Size;
            var bounds = new Rectangle(
                ViewConstants.Spacing, 0,
                0, Renderer.SideTabHeight);

            int vspace = size.Height - Renderer.SideTabHeight - ViewConstants.Spacing * 2;

            if (BottomSide != null)
            {
                vspace -= Renderer.SideTabHeight;
            }

            if (LeftSide != null)
            {
                if (LeftSide.Height > vspace)
                {
                    LeftSide.Bounds = new Rectangle(
                        0, Renderer.SideTabHeight + ViewConstants.Spacing,
                        Renderer.SideTabHeight, vspace);
                }
                else
                {
                    LeftSide.Top += Renderer.SideTabHeight;
                }
                bounds.X += Renderer.SideTabHeight;
            }
            if (RightSide != null)
            {
                if (RightSide.Height > vspace)
                {
                    RightSide.Bounds = new Rectangle(
                        size.Width - Renderer.SideTabHeight, Renderer.SideTabHeight + ViewConstants.Spacing,
                        Renderer.SideTabHeight, vspace);
                }
                else
                {
                    RightSide.Top += Renderer.SideTabHeight;
                }
            }
            RootControl.SetBounds(
                0, RootControl.Top + Renderer.SideTabHeight,
                0, RootControl.Height - Renderer.SideTabHeight,
                BoundsSpecified.Y | BoundsSpecified.Height);
            TopSide = new ViewDockSide(this, AnchorStyles.Top)
            {
                Anchor = AnchorStyles.Left | AnchorStyles.Top,
                Bounds = bounds,
                Parent = this,
            };
        }
コード例 #11
0
ファイル: ViewDockGrid.cs プロジェクト: oqewok/gitter
        private void RemoveRightSide()
        {
            if (_right != null)
            {
                _right.Parent = null;
                _right.Dispose();
                _right              = null;
                _rootControl.Width += Renderer.SideTabHeight;

                var hcs = Width - ViewConstants.Spacing * 2;
                if (_left != null)
                {
                    hcs -= Renderer.SideTabHeight;
                }
                if (_top != null)
                {
                    var w   = _top.Width;
                    var len = _top.OptimalLength;
                    if (w < len)
                    {
                        if (len > hcs)
                        {
                            len = hcs;
                        }
                        _top.Width = len;
                    }
                }
                if (_bottom != null)
                {
                    var w   = _bottom.Height;
                    var len = _bottom.OptimalLength;
                    if (w < len)
                    {
                        if (len > hcs)
                        {
                            len = hcs;
                        }
                        _bottom.Width = len;
                    }
                }
            }
        }
コード例 #12
0
ファイル: ViewDockGrid.cs プロジェクト: oqewok/gitter
        private void KillBottomSide()
        {
            if (_bottom != null)
            {
                _bottom.Parent = null;
                _bottom.Dispose();
                _bottom              = null;
                _rootControl.Height += Renderer.SideTabHeight;

                var vcs = Height - Renderer.SideTabHeight * 2;
                if (_bottom != null)
                {
                    vcs -= Renderer.SideTabHeight;
                }
                if (_left != null)
                {
                    var h   = _left.Height;
                    var len = _left.OptimalLength;
                    if (h < len)
                    {
                        if (len > vcs)
                        {
                            len = vcs;
                        }
                        _left.Height = len;
                    }
                }
                if (_right != null)
                {
                    var h   = _right.Height;
                    var len = _right.OptimalLength;
                    if (h < len)
                    {
                        if (len > vcs)
                        {
                            len = vcs;
                        }
                        _right.Height = len;
                    }
                }
            }
        }
コード例 #13
0
ファイル: ViewDockGrid.cs プロジェクト: oqewok/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 (_left != null)
         {
             _left.Dispose();
             _left = null;
         }
         if (_top != null)
         {
             _top.Dispose();
             _top = null;
         }
         if (_right != null)
         {
             _right.Dispose();
             _right = null;
         }
         if (_bottom != null)
         {
             _bottom.Dispose();
             _bottom = null;
         }
         if (_popupsStack != null)
         {
             _popupsStack.Dispose();
             _popupsStack = null;
         }
         _rootControl = null;
         _floatingViewForms.Clear();
     }
     base.Dispose(disposing);
 }
コード例 #14
0
ファイル: ViewDockGrid.cs プロジェクト: kiple/gitter
        private void SpawnBottomSide()
        {
            Verify.State.IsTrue(BottomSide == null);

            var size   = Size;
            var bounds = new Rectangle(
                ViewConstants.Spacing, size.Height - Renderer.SideTabHeight,
                0, Renderer.SideTabHeight);

            int vspace = size.Height - Renderer.SideTabHeight - ViewConstants.Spacing * 2;

            if (TopSide != null)
            {
                vspace -= Renderer.SideTabHeight;
            }

            if (LeftSide != null)
            {
                if (LeftSide.Height > vspace)
                {
                    LeftSide.Height = vspace;
                }
                bounds.X += Renderer.SideTabHeight;
            }
            if (RightSide != null)
            {
                if (RightSide.Height > vspace)
                {
                    RightSide.Height = vspace;
                }
            }
            RootControl.Height -= Renderer.SideTabHeight;
            BottomSide          = new ViewDockSide(this, AnchorStyles.Bottom)
            {
                Anchor = AnchorStyles.Left | AnchorStyles.Bottom,
                Bounds = bounds,
                Parent = this,
            };
        }
コード例 #15
0
ファイル: ViewDockGrid.cs プロジェクト: kiple/gitter
        private void SpawnRightSide()
        {
            Verify.State.IsTrue(RightSide == null);

            var size   = Size;
            var bounds = new Rectangle(
                size.Width - Renderer.SideTabHeight, ViewConstants.Spacing,
                Renderer.SideTabHeight, 0);

            int hspace = size.Width - Renderer.SideTabHeight - ViewConstants.Spacing * 2;

            if (LeftSide != null)
            {
                hspace -= Renderer.SideTabHeight;
            }

            if (TopSide != null)
            {
                if (TopSide.Width > hspace)
                {
                    TopSide.Width = hspace;
                }
                bounds.Y += Renderer.SideTabHeight;
            }
            if (BottomSide != null)
            {
                if (BottomSide.Width > hspace)
                {
                    BottomSide.Width = hspace;
                }
            }
            RootControl.Width -= Renderer.SideTabHeight;
            RightSide          = new ViewDockSide(this, AnchorStyles.Right)
            {
                Anchor = AnchorStyles.Right | AnchorStyles.Top,
                Bounds = bounds,
                Parent = this,
            };
        }
コード例 #16
0
ファイル: ViewDockGrid.cs プロジェクト: oqewok/gitter
        private void SpawnRightSide()
        {
            Verify.State.IsTrue(_right == null);

            var size   = Size;
            var bounds = new Rectangle(
                size.Width - Renderer.SideTabHeight, ViewConstants.Spacing,
                Renderer.SideTabHeight, 0);

            int hspace = size.Width - Renderer.SideTabHeight - ViewConstants.Spacing * 2;

            if (_left != null)
            {
                hspace -= Renderer.SideTabHeight;
            }

            if (_top != null)
            {
                if (_top.Width > hspace)
                {
                    _top.Width = hspace;
                }
                bounds.Y += Renderer.SideTabHeight;
            }
            if (_bottom != null)
            {
                if (_bottom.Width > hspace)
                {
                    _bottom.Width = hspace;
                }
            }
            _rootControl.Width -= Renderer.SideTabHeight;
            _right              = new ViewDockSide(this, AnchorStyles.Right)
            {
                Anchor = AnchorStyles.Right | AnchorStyles.Top,
                Bounds = bounds,
                Parent = this,
            };
        }
コード例 #17
0
ファイル: ViewRenderer.cs プロジェクト: oqewok/gitter
 public abstract void RenderViewDockSide(ViewDockSide side, PaintEventArgs e);