OptionListModal class
Namespace: Arlecchino.Modals.Choosing · Assembly: Arlecchino
What the single- and multi-choice dialogs share: the options, what has been typed to narrow them, and the cursor. What is typed is edited the way any other line is, so a symbol goes in one press.
public abstract class OptionListModal : Modal, ITextEntry
Inherits from Modal
Implements ITextEntry
Derived types ChoiceModal, MultiChoiceModal
Constructors
| Member | Summary |
|---|---|
OptionListModal() |
Properties
| Member | Summary |
|---|---|
Anchor | Where a selection would start from, on the caret since none is drawn here. |
Caret | Where the caret sits in what has been typed, which is at the end of it. |
FirstVisible | Index of the first option drawn, since a long list only shows a window of it. |
Index | Cursor position within the options that match. |
Options | Everything that can be chosen from. |
Rows | Where the rows were drawn last frame, used to turn a click into a row. |
Text | Whatever has been typed to narrow the list. Editing it resets the cursor to the top. |
Typing | The line being typed into, which here is what narrows the list. |
Methods
| Member | Summary |
|---|---|
HandleMouse(ModalFrame, MouseEvent) | The wheel walks the list, and a click picks the row it landed on. A row is taken only when it was already the one under the cursor. |
HandlePaste(ModalFrame, string) | Takes pasted text into the filter and puts the cursor back on the first row, since what is showing after the paste is a different set of rows. |
MatchingOptions() | The options that pass the filter, in their original order. |
Take(ModalFrame, string) | Acts on the row that was picked, which is what tells one kind of list from the other. |
Constructors in detail
OptionListModal()
Constructors of types with required members are not supported in this version of your compiler.
public OptionListModal();
Properties in detail
Anchor
public int Anchor { get; set; }
Where a selection would start from, on the caret since none is drawn here.
Type int
Caret
public int Caret { get; set; }
Where the caret sits in what has been typed, which is at the end of it.
Type int
FirstVisible
public int FirstVisible { get; set; }
Index of the first option drawn, since a long list only shows a window of it.
Type int
Index
public int Index { get; set; }
Cursor position within the options that match.
Type int
Options
public IReadOnlyList<string> Options { get; init; }
Everything that can be chosen from.
Type IReadOnlyList<T><string>
Rows
public SurfaceRegion Rows { get; set; }
Where the rows were drawn last frame, used to turn a click into a row.
Type SurfaceRegion
Text
public string Text { get; set; }
Whatever has been typed to narrow the list. Editing it resets the cursor to the top.
Type string
Typing
public override ITextEntry Typing { get; }
The line being typed into, which here is what narrows the list.
Type ITextEntry
Methods in detail
HandleMouse(ModalFrame, MouseEvent)
public override void HandleMouse(ModalFrame frame, MouseEvent mouse);
The wheel walks the list, and a click picks the row it landed on. A row is taken only when it was already the one under the cursor.
Parameters
| Name | Type | Description |
|---|---|---|
frame | ModalFrame | How to close. |
mouse | MouseEvent | The event that arrived. |
HandlePaste(ModalFrame, string)
public override void HandlePaste(ModalFrame frame, string text);
Takes pasted text into the filter and puts the cursor back on the first row, since what is showing after the paste is a different set of rows.
Parameters
| Name | Type | Description |
|---|---|---|
frame | ModalFrame | The keys to obey, and how to close. |
text | string | What was pasted. |
MatchingOptions()
public List<string> MatchingOptions();
The options that pass the filter, in their original order.
Returns List<T><string> — Matching options; all of them when nothing is typed.
Take(ModalFrame, string)
public abstract void Take(ModalFrame frame, string choice);
Acts on the row that was picked, which is what tells one kind of list from the other.
Parameters
| Name | Type | Description |
|---|---|---|
frame | ModalFrame | How to close, when picking closes. |
choice | string | The option. |