Splitter
ConsoleMonster.Widgets
Two panes with a divider between them. Dragging the divider resizes the panes, and so do Ctrl+Shift+←/→ (Ctrl+Shift+↑/↓ when Splitter.Vertical) when the focused input leaves those keys free. Text editing takes precedence. Inside an app with screens, a splitter with a Splitter.Key remembers its ratio for the screen it is on, also when its layout is rebuilt.
Inheritance
- object
- Splitter
Usage
Explore 23 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 11
- Method Ui.Splitter
- Extension method Splitter.First
- Extension method Splitter.Key
- Extension method Splitter.Ratio
- Extension method Splitter.Second
- Extension method Splitter.Vertical
- Method WidgetsFluent.First
- Method WidgetsFluent.Key
- Method WidgetsFluent.Ratio
- Method WidgetsFluent.Second
- Method WidgetsFluent.Vertical
Accepted by parameters 12
- Method ContentBuilder.Splitter
- Method ContentBuilder.Splitter
- Extension method Splitter.First
- Extension method Splitter.Key
- Extension method Splitter.Ratio
- Extension method Splitter.Second
- Extension method Splitter.Vertical
- Method WidgetsFluent.First
- Method WidgetsFluent.Key
- Method WidgetsFluent.Ratio
- Method WidgetsFluent.Second
- Method WidgetsFluent.Vertical
Constructors
public Splitter(IWidget first, IWidget second) #Creates a splitter.
Parameters
- first ConsoleMonster.Layout.IWidget
- The left pane, or the top pane when Splitter.Vertical.
- second ConsoleMonster.Layout.IWidget
- The right pane, or the bottom pane when Splitter.Vertical.
Methods
public Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public void Render(Region region, RenderContext context) #Renders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
Inherited Methods
Properties
public IWidget First { get; set; } #The left pane, or the top pane when Splitter.Vertical.
public IWidget Second { get; set; } #The right pane, or the bottom pane when Splitter.Vertical.
public bool Vertical { get; set; } #Stacks the panes top and bottom with a horizontal divider instead of side by side.
public double Ratio { get; set; } #The first pane's share of the space, between 0.05 and 0.95 (default 0.5).
public string? Key { get; set; } #The name the ratio is remembered under on each app screen; null keeps it with this instance only.
Extension Methods
public static Splitter First(Splitter splitter, Action<ContentBuilder> content) #Builds the left (or top) pane.
Parameters
- splitter ConsoleMonster.Widgets.Splitter
- The splitter.
- content System.Action<ConsoleMonster.Layout.ContentBuilder>
- The pane's content.
public static Splitter First(Splitter splitter, IWidget value) #Sets Splitter.First: The left pane, or the top pane when Splitter.Vertical.
Parameters
- splitter ConsoleMonster.Widgets.Splitter
- The instance.
- value ConsoleMonster.Layout.IWidget
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Splitter { First = value }; Ui.Splitter().First(value);public static Splitter Key(Splitter splitter, string? value) #Sets Splitter.Key: The name the ratio is remembered under on each app screen; null keeps it with this instance only.
Parameters
- splitter ConsoleMonster.Widgets.Splitter
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Splitter { Key = value }; Ui.Splitter().Key(value);public static Splitter Ratio(Splitter splitter, double value) #Sets Splitter.Ratio: The first pane's share of the space, between 0.05 and 0.95 (default 0.5).
Parameters
- splitter ConsoleMonster.Widgets.Splitter
- The instance.
- value double
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Splitter { Ratio = value }; Ui.Splitter().Ratio(value);public static Splitter Second(Splitter splitter, Action<ContentBuilder> content) #Builds the right (or bottom) pane.
Parameters
- splitter ConsoleMonster.Widgets.Splitter
- The splitter.
- content System.Action<ConsoleMonster.Layout.ContentBuilder>
- The pane's content.
public static Splitter Second(Splitter splitter, IWidget value) #Sets Splitter.Second: The right pane, or the bottom pane when Splitter.Vertical.
Parameters
- splitter ConsoleMonster.Widgets.Splitter
- The instance.
- value ConsoleMonster.Layout.IWidget
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Splitter { Second = value }; Ui.Splitter().Second(value);public static Splitter Vertical(Splitter splitter, bool value) #Sets Splitter.Vertical: Stacks the panes top and bottom with a horizontal divider instead of side by side.
Parameters
- splitter ConsoleMonster.Widgets.Splitter
- The instance.
- value bool
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Splitter { Vertical = value }; Ui.Splitter().Vertical(value);public static Splitter Vertical(Splitter splitter) #Sets Splitter.Vertical to true.
Parameters
- splitter ConsoleMonster.Widgets.Splitter
- The instance to configure.