MultiChoiceModal class
Namespace: Arlecchino.Modals.Choosing · Assembly: Arlecchino
Any number of options out of a filterable list. Marks survive a change of filter.
public sealed class MultiChoiceModal : OptionListModal, ITextEntry
Inherits from OptionListModal
Implements ITextEntry
Constructors
| Member | Summary |
|---|---|
MultiChoiceModal() |
Properties
| Member | Summary |
|---|---|
OnSubmit | Called with everything marked, in the order of the options. |
SelectedKeys | Options marked so far. |
Methods
| Member | Summary |
|---|---|
Draw(ModalFrame) | |
Handle(ModalFrame, KeyPress) | |
IsSelected(string) | Whether an option is marked. |
SelectedInOptionOrder() | What is marked, in the order of the options rather than the order it was clicked in, so the result does not depend on how the user got there. |
Take(ModalFrame, string) | |
Toggle(string) | Marks an option, or unmarks it when it already was. |
Constructors in detail
MultiChoiceModal()
Constructors of types with required members are not supported in this version of your compiler.
public MultiChoiceModal();
Properties in detail
OnSubmit
public Action<IReadOnlyList<string>> OnSubmit { get; init; }
Called with everything marked, in the order of the options.
Type Action<T><IReadOnlyList<T><string>>
SelectedKeys
public HashSet<string> SelectedKeys { get; init; }
Options marked so far.
Type HashSet<T><string>
Methods in detail
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 |
IsSelected(string)
public bool IsSelected(string choice);
Whether an option is marked.
Parameters
| Name | Type | Description |
|---|---|---|
choice | string | The option to check. |
Returns bool — true when it is marked.
SelectedInOptionOrder()
public List<string> SelectedInOptionOrder();
What is marked, in the order of the options rather than the order it was clicked in, so the result does not depend on how the user got there.
Returns List<T><string> — The marked options.
Take(ModalFrame, string)
public virtual void Take(ModalFrame frame, string choice);
Parameters
| Name | Type | Description |
|---|---|---|
frame | ModalFrame | |
choice | string |
Toggle(string)
public void Toggle(string choice);
Marks an option, or unmarks it when it already was.
Parameters
| Name | Type | Description |
|---|---|---|
choice | string | The option to flip. |