Class SplitState
- Namespace
- MiniTui
- Assembly
- MiniTui.dll
The divider position of a split (1.x spec §14.3), drawn with Split(SplitState). The panes are sized by Ratio, so they keep their proportions when the terminal is resized, or with one pane at a fixed size in cells (FixedSize, a sidebar), the other taking the rest. The user drags the divider, or moves it with Alt+Shift and the arrows.
public sealed class SplitState
- Inheritance
-
SplitState
- Inherited Members
Constructors
SplitState(Direction, double)
A split sized by ratio.
public SplitState(Direction direction, double ratio = 0.5)
Parameters
directionDirectionHow the panes are laid out: Horizontal side by side (a │ divider), Vertical one above the other (a ─ divider).
ratiodoubleThe first pane's share of the space, from 0 to 1.
Properties
Direction
How the panes are laid out.
public Direction Direction { get; }
Property Value
FixedPane
public SplitPane FixedPane { get; set; }
Property Value
FixedSize
public int? FixedSize { get; set; }
Property Value
- int?
IsDragging
True from a left press on the divider until the release.
public bool IsDragging { get; }
Property Value
MinFirst
The smallest size, in cells, the user can drag the first pane to. Default 3. If the area is too small for both minimums, they're ignored.
public int MinFirst { get; set; }
Property Value
MinSecond
The smallest size, in cells, the user can drag the second pane to. Default 3.
public int MinSecond { get; set; }
Property Value
Ratio
The first pane's share of the space (the area minus the divider), from 0 to 1, when FixedSize is null. Clamped to 0–1 when set.
public double Ratio { get; set; }
Property Value
Methods
Fixed(Direction, int, SplitPane)
A split with pane fixed at cells.
public static SplitState Fixed(Direction direction, int cells, SplitPane pane = SplitPane.First)
Parameters
Returns
HandleKey(ConsoleKeyInfo)
Alt+Shift+← → (side by side) or Alt+Shift+↑ ↓ (one above the other) move the divider a cell.
public bool HandleKey(ConsoleKeyInfo key)
Parameters
keyConsoleKeyInfo
Returns
- bool
True if the key was one of these.
HandleMouse(MouseEvent)
A left press on the divider from the last draw starts a drag; drags move the divider under the pointer, wherever it is; the release, or a press anywhere else, ends it.
public bool HandleMouse(MouseEvent mouse)
Parameters
mouseMouseEvent
Returns
- bool
True if the event was for the divider.
MoveBy(int)
Move the divider by cells (negative: left or up), within the minimums, using the area from
the last draw. Does nothing before the first draw.
public void MoveBy(int cells)
Parameters
cellsint
Events
Changed
public event EventHandler? Changed