using Mindmagma.Curses; namespace SCI.CursesWrapper; public class ContentWindow : Window { public ContentWindow (nint rootScreen, InputHandler inputHandler) : base ( 0, 1, CursesWrapper.GetWidth (rootScreen), CursesWrapper.GetHeight (rootScreen) - 2, inputHandler ) { } /// /// Removes current children and creates a new /// nested child window without inner padding /// /// New child window public Window CreateInnerWindow () { Clean (); if (TargetInputHandler is not null) { return new Window (-1, -1, -2, -2, TargetInputHandler, this) { BorderEnabled = false }; } else { return new Window (-1, -1, -2, -2, this) { BorderEnabled = false }; } } /// /// Removes current children and creates a new /// nested scrollable child window without inner padding /// /// New scrollable child window /// Throws when TargetInputHandler is null public ScrollWindow CreateInnerScrollWindow () { if (TargetInputHandler is null) throw new NullReferenceException ( "Input handler of Content Window cannot be null when creating child ScrollWindow" ); return new ScrollWindow (-1, -1, -2, -2, TargetInputHandler, this) { BorderEnabled = false }; } /// /// Removes all children elements and redraws the window /// public void Clean () { foreach (var window in ChildWindows.ToList ()) { window.Destroy (true); } // Clear window and redraw NCurses.ClearWindow (WindowId); SetBorder (true); Draw (); } }