Class MaskField
MaskField UI element.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class MaskField : Dropdown, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, IInputElement<IEnumerable<int>>, IValidatableElement<IEnumerable<int>>, INotifyValueChanged<IEnumerable<int>>, ISizeableElement, IPressable, IInputElement<int>, IValidatableElement<int>, INotifyValueChanged<int>
Constructors
MaskField()
Default constructor.
Declaration
public MaskField()
MaskField(IList, int, GetDisplayNameDelegate, GetMaskValueDelegate, BindItemFunc, BindTitleFunc)
Constructor with a default mask value.
Declaration
public MaskField(IList sourceItems, int defaultMaskValue = 0, MaskField.GetDisplayNameDelegate getDisplayNameFunc = null, MaskField.GetMaskValueDelegate getMaskValueFunc = null, Picker<DropdownItem, DropdownItem>.BindItemFunc bindItemFunc = null, Picker<DropdownItem, DropdownItem>.BindTitleFunc bindTitleFunc = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IList | sourceItems | The source items collection. |
| int | defaultMaskValue | The default value for the field. |
| MaskField.GetDisplayNameDelegate | getDisplayNameFunc | An optional function to get the display name. |
| MaskField.GetMaskValueDelegate | getMaskValueFunc | An optional function to get the mask value. |
| Picker<DropdownItem, DropdownItem>.BindItemFunc | bindItemFunc | An optional function to bind the item. |
| Picker<DropdownItem, DropdownItem>.BindTitleFunc | bindTitleFunc | An optional function to bind the title. |
Fields
ussClassName
The main styling class for the MaskField.
Declaration
public const string ussClassName = "appui-mask-field"
Field Value
| Type | Description |
|---|---|
| string |
Properties
everythingLabel
The text for a value with every bit set, on the field and its Everything row. Null uses the default "Everything".
Declaration
[UxmlAttribute]
[CreateProperty]
public string everythingLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
everythingValue
The value that means every bit. The Everything row writes it and the field reads it back as Everything. When 0 (the default), it is the OR of the item values. Set it when the mask has a sentinel wider than its items, such as -1 for a layer mask whose every bit is set, including bits no item names yet.
Declaration
[UxmlAttribute("everything-value")]
[CreateProperty]
public int everythingValue { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
getDisplayName
Get the display name for a specific index in the source items collection.
Declaration
[CreateProperty]
public MaskField.GetDisplayNameDelegate getDisplayName { get; set; }
Property Value
| Type | Description |
|---|---|
| MaskField.GetDisplayNameDelegate |
getMaskValue
Get the mask value for a specific index in the source items collection.
Declaration
[CreateProperty]
public MaskField.GetMaskValueDelegate getMaskValue { get; set; }
Property Value
| Type | Description |
|---|---|
| MaskField.GetMaskValueDelegate |
mixedLabel
The text for a value with several bits set when summary is Mixed, or with a bit no item names. Null uses the default "Mixed...".
Declaration
[UxmlAttribute]
[CreateProperty]
public string mixedLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
nothingLabel
The text for a value with no bits set, on the field and its Nothing row. Null uses the default "Nothing".
Declaration
[UxmlAttribute]
[CreateProperty]
public string nothingLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
summary
How the field describes several set bits: Mixed (the default) shows the mixed label, List lists the display names. Either way, a set bit no item names reads as mixed.
Declaration
[UxmlAttribute]
[CreateProperty]
public MaskFieldSummary summary { get; set; }
Property Value
| Type | Description |
|---|---|
| MaskFieldSummary |
validateValue
An optional function to validate the value.
Declaration
public Func<int, bool> validateValue { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<int, bool> |
value
The current value of the field.
Declaration
public int value { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
OnPickerItemRemoved(PickerItem, int)
Called when a Picker item is removed.
Declaration
protected override void OnPickerItemRemoved(PickerItem item, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| PickerItem | item | The item to remove. |
| int | index | The index of the item to remove. |
Overrides
OnPickerItemsCreated()
Called when the Picker items are created.
Declaration
protected override void OnPickerItemsCreated()
Overrides
OnValueSet()
Called when the Picker value is set with or without notifying listeners.
Declaration
protected override void OnValueSet()
Overrides
SetValueWithoutNotify(int)
Set the value of the field without notifying the change.
Declaration
public void SetValueWithoutNotify(int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | newValue | The new value to set. |