Table of Contents

Class LinearRange<T>

Namespace
Terminal.Gui.Views
Assembly
Terminal.Gui.dll

Provides a type-safe linear range control letting the user navigate from a set of typed options in a linear manner using the keyboard or mouse.

public class LinearRange<T> : View, IDisposable, ISupportInitializeNotification, ISupportInitialize, IOrientation

Type Parameters

T
Inheritance
LinearRange<T>
Implements
Derived
Inherited Members
Extension Methods

Constructors

LinearRange()

Initializes a new instance of the LinearRange<T> class.

LinearRange(List<T>?, Orientation)

Initializes a new instance of the LinearRange<T> class.

Properties

AllowEmpty

Allow no selection.

FocusedOption

The focused option (has the cursor).

LegendsOrientation

Legends Orientation. Orientation

MinimumInnerSpacing

Gets or sets the minimum number of rows/columns between Options. The default is 1.

Options

Set the linear range options.

Orientation

Gets or sets the Orientation. The default is Horizontal.

RangeAllowSingle

Allow range start and end be in the same option, as a single option.

ShowEndSpacing

Show/Hide spacing before and after the first and last option.

ShowLegends

Show/Hide the options legends.

Style

LinearRange styles. LinearRangeStyle

Text

Setting the Text of a linear range is a shortcut to setting options. The text is a CSV string of the options.

Type

LinearRange Type. LinearRangeType

UseMinimumSize

Gets or sets whether the minimum or ideal size will be used when calculating the size of the linear range.

Methods

ChangeOption(int, bool)

Sets or unsets optionIndex based on set.

GetIdealHeight()

Gets the ideal height of the linear range. The ideal height is the minimum height required to display all options and inner spacing.

GetIdealWidth()

Gets the ideal width of the linear range. The ideal width is the minimum width required to display all options and inner spacing.

GetSetOptions()

Get the indexes of the set options.

OnDrawingContent(DrawContext?)

Called when the View's content is to be drawn. The default implementation does nothing.

OnLegendsOrientationChanged(ValueChangedEventArgs<Orientation>)

Called after LegendsOrientation has changed.

OnLegendsOrientationChanging(ValueChangingEventArgs<Orientation>)

Called before LegendsOrientation changes. Return true to cancel the change.

OnMinimumInnerSpacingChanged(ValueChangedEventArgs<int>)

Called after MinimumInnerSpacing has changed.

OnMinimumInnerSpacingChanging(ValueChangingEventArgs<int>)

Called before MinimumInnerSpacing changes. Return true to cancel the change.

OnMouseEvent(Mouse)

Called when a mouse event occurs within the view's Viewport.

OnOptionFocused(int, LinearRangeEventArgs<T>)

Overridable function that fires the OptionFocused event.

OnOptionsChanged()

Overridable method called when the linear range options have changed. Raises the OptionsChanged event.

OnOrientationChanged(Orientation)

Called when Orientation has been changed.

OnShowEndSpacingChanged(ValueChangedEventArgs<bool>)

Called after ShowEndSpacing has changed.

OnShowEndSpacingChanging(ValueChangingEventArgs<bool>)

Called before ShowEndSpacing changes. Return true to cancel the change.

OnShowLegendsChanged(ValueChangedEventArgs<bool>)

Called after ShowLegends has changed.

OnShowLegendsChanging(ValueChangingEventArgs<bool>)

Called before ShowLegends changes. Return true to cancel the change.

OnTypeChanged(ValueChangedEventArgs<LinearRangeType>)

Called after Type has changed.

OnTypeChanging(ValueChangingEventArgs<LinearRangeType>)

Called before Type changes. Return true to cancel the change.

OnUseMinimumSizeChanged(ValueChangedEventArgs<bool>)

Called after UseMinimumSize has changed.

OnUseMinimumSizeChanging(ValueChangingEventArgs<bool>)

Called before UseMinimumSize changes. Return true to cancel the change.

PositionCursor()

Positions the cursor in the right position based on the currently focused view in the chain.

SetOption(int)

Causes the specified option to be set and be focused.

UnSetOption(int)

Causes the specified option to be un-set and be focused.

Events

LegendsOrientationChanged

Event raised after the LegendsOrientation property has changed.

LegendsOrientationChanging

Event raised before the LegendsOrientation property changes. Can be cancelled.

MinimumInnerSpacingChanged

Event raised after the MinimumInnerSpacing property has changed.

MinimumInnerSpacingChanging

Event raised before the MinimumInnerSpacing property changes. Can be cancelled.

OptionFocused

Event raised When the option is hovered with the keys or the mouse.

OptionsChanged

Event raised when the linear range option/s changed. The dictionary contains: key = option index, value = T

OrientationChanged

Raised when Orientation has changed.

OrientationChanging

Raised when Orientation is changing. Can be cancelled.

ShowEndSpacingChanged

Event raised after the ShowEndSpacing property has changed.

ShowEndSpacingChanging

Event raised before the ShowEndSpacing property changes. Can be cancelled.

ShowLegendsChanged

Event raised after the ShowLegends property has changed.

ShowLegendsChanging

Event raised before the ShowLegends property changes. Can be cancelled.

TypeChanged

Event raised after the Type property has changed.

TypeChanging

Event raised before the Type property changes. Can be cancelled.

UseMinimumSizeChanged

Event raised after the UseMinimumSize property has changed.

UseMinimumSizeChanging

Event raised before the UseMinimumSize property changes. Can be cancelled.