internal static (IConsole left, IConsole right) _SplitLeftRight(IConsole c, string leftTitle, string rightTitle, LineThickNess thickness, BorderCollapse border, ConsoleColor foreground, ConsoleColor background)
        {
            if (border == None)
            {
                var left  = LayoutExtensions._LeftRight(c, leftTitle, false, false, thickness, foreground);
                var right = LayoutExtensions._LeftRight(c, rightTitle, true, false, thickness, foreground);
                return(left, right);
            }
            if (border == Separate)
            {
                var left  = LayoutExtensions._LeftRight(c, leftTitle, false, true, thickness, foreground);
                var right = LayoutExtensions._LeftRight(c, rightTitle, true, true, thickness, foreground);
                return(left, right);
            }

            lock (Window._staticLocker)
            {
                int h          = c.WindowHeight;
                int w          = c.WindowWidth - 3;
                int leftWidth  = w / 2;
                int rightWidth = (w - leftWidth);

                c.DoCommand(c, () =>
                {
                    //todo need unit test for merging two boxes :D for now, lets print them twice so we get true overlap to start with
                    new Draw(c)
                    .Box(0, 0, leftWidth + 1, h - 1, leftTitle, thickness);
                    new Draw(c)
                    .Box(leftWidth + 1, 0, rightWidth + leftWidth + 2, h - 1, rightTitle, thickness);
                    // print the corners
                    c.PrintAt(leftWidth + 1, 0, '┬');
                    c.PrintAt(leftWidth + 1, h - 1, '┴');
                });

                var leftWin  = Window._CreateFloatingWindow(1, 1, leftWidth, h - 2, foreground, background, true, c, null);
                var rightWin = Window._CreateFloatingWindow(leftWidth + 2, 1, rightWidth, h - 2, foreground, background, true, c, null);
                return(leftWin, rightWin);
            }
        }
Exemple #2
0
 public static IConsole SplitLeft(this Window c)
 {
     return(LayoutExtensions._LeftRight(c, null, false, false, null, c.ForegroundColor));
 }
Exemple #3
0
 public static IConsole SplitLeft(this Window c, string title)
 {
     return(LayoutExtensions._LeftRight(c, title, false, true, LineThickNess.Single, c.ForegroundColor));
 }
Exemple #4
0
 public static IConsole SplitLeft(this Window c, string title, LineThickNess thickness, ConsoleColor foreground)
 {
     return(LayoutExtensions._LeftRight(c, title, false, true, thickness, foreground));
 }
Exemple #5
0
 public static IConsole SplitRight(this Window c, ConsoleColor foreground)
 {
     return(LayoutExtensions._LeftRight(c, null, true, false, null, foreground));
 }