ComponentFactory.Krypton.Toolkit.ViewDrawDocker.UpdateChildBorders C# (CSharp) Method

UpdateChildBorders() private method

private UpdateChildBorders ( ViewBase child, ViewLayoutContext context, PaletteDrawBorders &leftEdges, PaletteDrawBorders &rightEdges, PaletteDrawBorders &topEdges, PaletteDrawBorders &bottomEdges, PaletteDrawBorders &fillEdges ) : void
child ViewBase
context ViewLayoutContext
leftEdges PaletteDrawBorders
rightEdges PaletteDrawBorders
topEdges PaletteDrawBorders
bottomEdges PaletteDrawBorders
fillEdges PaletteDrawBorders
return void
        private void UpdateChildBorders(ViewBase child,
                                        ViewLayoutContext context,
                                        ref PaletteDrawBorders leftEdges,
                                        ref PaletteDrawBorders rightEdges,
                                        ref PaletteDrawBorders topEdges,
                                        ref PaletteDrawBorders bottomEdges,
                                        ref PaletteDrawBorders fillEdges)
        {
            // Do we need to calculate if the child should remove any borders?
            if (RemoveChildBorders)
            {
                // Check if the view is a canvas
                ViewDrawCanvas childCanvas = child as ViewDrawCanvas;

                // Docking edge determines calculation
                switch (CalculateDock(GetDock(child), context.Control))
                {
                    case ViewDockStyle.Top:
                        if (childCanvas != null)
                            childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(topEdges, childCanvas.Orientation);

                        // Remove top edges from subsequent children
                        leftEdges &= PaletteDrawBorders.BottomLeftRight;
                        rightEdges &= PaletteDrawBorders.BottomLeftRight;
                        topEdges &= PaletteDrawBorders.BottomLeftRight;
                        break;
                    case ViewDockStyle.Bottom:
                        if (childCanvas != null)
                            childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(bottomEdges, childCanvas.Orientation);

                        // Remove bottom edges from subsequent children
                        leftEdges &= PaletteDrawBorders.TopLeftRight;
                        rightEdges &= PaletteDrawBorders.TopLeftRight;
                        bottomEdges &= PaletteDrawBorders.TopLeftRight;
                        break;
                    case ViewDockStyle.Left:
                        if (childCanvas != null)
                            childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(leftEdges, childCanvas.Orientation);

                        // Remove left edges from subsequent children
                        topEdges &= PaletteDrawBorders.TopBottomRight;
                        bottomEdges &= PaletteDrawBorders.TopBottomRight;
                        leftEdges &= PaletteDrawBorders.TopBottomRight;
                        break;
                    case ViewDockStyle.Right:
                        if (childCanvas != null)
                            childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(rightEdges, childCanvas.Orientation);

                        // Remove right edges from subsequent children
                        topEdges &= PaletteDrawBorders.TopBottomLeft;
                        bottomEdges &= PaletteDrawBorders.TopBottomLeft;
                        rightEdges &= PaletteDrawBorders.TopBottomLeft;
                        break;
                }
            }
        }