SliderModal class
Namespace: Arlecchino.Modals.Setting · Assembly: Arlecchino
A value inside a range, adjusted by arrows or by dragging the track. There is nothing to type, so the value is always valid, and the dialog never reports an error.
public sealed class SliderModal : NumericModal, IAffixedModal, IBoundedModal
Inherits from NumericModal
Implements IAffixedModal, IBoundedModal
Constructors
| Member | Summary |
|---|---|
SliderModal() |
Properties
| Member | Summary |
|---|---|
Fraction | How far along the track the handle sits, as 0 to 1. An empty range reads as 0. |
Maximum | Value at the right end of the track. |
Minimum | Value at the left end of the track. |
OnSubmit | Called with the value the handle was left at. |
Track | Where the track was drawn last frame, used to turn a click into a value. |
Value | Where the handle sits. |
Methods
| Member | Summary |
|---|---|
Add(decimal) | Moves the handle, stopping at the ends of the range. |
Draw(ModalFrame) | |
Handle(ModalFrame, KeyPress) | |
HandleMouse(ModalFrame, MouseEvent) | |
MoveToMaximum() | Jumps to the right end. |
MoveToMinimum() | Jumps to the left end. |
SetFromFraction(decimal) | Places the handle at a position along the track. |
Constructors in detail
SliderModal()
Constructors of types with required members are not supported in this version of your compiler.
public SliderModal();
Properties in detail
Fraction
public decimal Fraction { get; }
How far along the track the handle sits, as 0 to 1. An empty range reads as 0.
Type decimal
Maximum
public decimal Maximum { get; init; }
Value at the right end of the track.
Type decimal
Minimum
public decimal Minimum { get; init; }
Value at the left end of the track.
Type decimal
OnSubmit
public Action<decimal> OnSubmit { get; init; }
Called with the value the handle was left at.
Type Action<T><decimal>
Track
public SurfaceRegion Track { get; set; }
Where the track was drawn last frame, used to turn a click into a value.
Type SurfaceRegion
Value
public decimal Value { get; set; }
Where the handle sits.
Type decimal
Methods in detail
Add(decimal)
public void Add(decimal delta);
Moves the handle, stopping at the ends of the range.
Parameters
| Name | Type | Description |
|---|---|---|
delta | decimal | How far to move; negative goes left. |
Draw(ModalFrame)
public override void Draw(ModalFrame frame);
Parameters
| Name | Type | Description |
|---|---|---|
frame | ModalFrame |
Handle(ModalFrame, KeyPress)
public override void Handle(ModalFrame frame, KeyPress key);
Parameters
| Name | Type | Description |
|---|---|---|
frame | ModalFrame | |
key | KeyPress |
HandleMouse(ModalFrame, MouseEvent)
public override void HandleMouse(ModalFrame frame, MouseEvent mouse);
Parameters
| Name | Type | Description |
|---|---|---|
frame | ModalFrame | |
mouse | MouseEvent |
MoveToMaximum()
public void MoveToMaximum();
Jumps to the right end.
MoveToMinimum()
public void MoveToMinimum();
Jumps to the left end.
SetFromFraction(decimal)
public void SetFromFraction(decimal fraction);
Places the handle at a position along the track.
Parameters
| Name | Type | Description |
|---|---|---|
fraction | decimal | Position from 0 at the left end to 1 at the right; anything outside is pulled in. |