|
UsoUIElements 0.1.0
Data Centric implimentation of Unity's UI Elements (UI Toolkit)
|
A custom toggle control that extends Unity's Toggle with USO UI framework functionality. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system. More...
Public Member Functions | |
| UsoToggle () | |
| Initializes a new instance of the UsoToggle class with default settings. Creates a toggle with USO framework integration enabled and no initial label text. | |
| UsoToggle (string fieldName) | |
| Initializes a new instance of the UsoToggle class with the specified field name. Creates a toggle with custom identification for binding and reference purposes. | |
| UsoToggle (string fieldName, string fieldLabelText) | |
| Initializes a new instance of the UsoToggle class with field name and label text. Creates a toggle with custom identification and display label for user interface clarity. | |
| UsoToggle (string fieldName, string fieldLabelText, out UsoToggle newField) | |
| Initializes a new instance of the UsoToggle class with field name, label text, and returns a reference. Creates a toggle with custom identification, display label, and provides an out parameter for immediate access. | |
| UsoToggle (string fieldName, string fieldLabelText, string fieldBindingPath, BindingMode fieldBindingMode) | |
| Initializes a new instance of the UsoToggle class with field name, label text, and data binding configuration. Creates a fully configured toggle with custom identification, display label, and automatic data binding for boolean value synchronization. | |
| UsoToggle (string fieldName, string fieldLabelText, string fieldBindingPath, BindingMode fieldBindingMode, out UsoToggle newField) | |
| Initializes a new instance of the UsoToggle class with complete configuration and returns a reference. Creates a fully configured toggle with custom identification, display label, automatic data binding, and immediate access to the created instance. | |
| void | ApplyBinding (string fieldBindingProp, string fieldBindingPath, BindingMode fieldBindingMode) |
| Applies data binding to the specified property of this control using Unity's data binding system. Configures the binding with the provided path and mode for automatic data synchronization. | |
| UsoLineItem | GetParentLineItem () |
| Retrieves the first ancestor UsoLineItem control in the visual tree hierarchy. This is useful for accessing parent container functionality and maintaining proper UI structure. | |
| void | InitElement (string fieldName=null) |
| Initializes the USO UI element with the specified field name and applies necessary styling classes. This method sets up the basic USO framework integration for the control. | |
| void | SetFieldStatus (FieldStatusTypes fieldStatus) |
| Updates the field's status type, which affects its visual appearance and validation state. The status change is automatically reflected in the UI through the FieldStatus property. | |
| void | ShowFieldStatus (bool status) |
| Controls the visibility and functionality of the field status/validation system. When disabled, removes validation-related styling from the control. | |
| Public Member Functions inherited from GWG.UsoUIElements.IUsoUiElement | |
| void | AddToClassList (string className) |
| Adds the specified CSS class name to this element's class list. This method is inherited from Unity's VisualElement and enables dynamic styling modifications. | |
| void | ClearBindings () |
| Removes all data binding configurations from this element. This method is inherited from Unity's VisualElement and provides cleanup functionality for data bindings. | |
| void | RemoveFromClassList (string className) |
| Removes the specified CSS class name from this element's class list. This method is inherited from Unity's VisualElement and provides dynamic styling capabilities. | |
Properties | |
| FieldStatusTypes | FieldStatus [get, private set] |
| Gets the current field status type, which determines the visual state and validation feedback. This property is automatically reflected in the UI through CSS class modifications. | |
| bool | FieldStatusEnabled [get, private set] |
| Gets or sets whether field status/validation functionality is enabled for this control. When enabled, adds validation CSS class for styling. When disabled, removes validation styling. | |
Private Attributes | |
| FieldStatusTypes | _fieldStatus |
| bool | _fieldStatusEnabled = true |
Static Private Attributes | |
| const string | DefaultBindProp = "value" |
| Default binding property used when applying data bindings to this field. Binds to the 'value' property which controls the toggle's checked/unchecked state. | |
| const string | ElementClass = "uso-toggle" |
| CSS class name applied to all UsoToggle instances for styling purposes. | |
| const string | ElementValidationClass = "uso-field-validation" |
| CSS class name applied when field validation/status functionality is enabled. | |
A custom toggle control that extends Unity's Toggle with USO UI framework functionality. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system.
This control implements the IUsoUiElement interface to provide consistent behavior across the USO UI framework. It supports field status indicators, automatic data binding for boolean values, and custom styling through CSS classes. The control is commonly used for checkbox-like functionality and boolean input scenarios throughout the application. The control supports various constructor overloads for different initialization scenarios including labeling and data binding configuration.
| GWG.UsoUIElements.UsoToggle.UsoToggle | ( | ) |
Initializes a new instance of the UsoToggle class with default settings. Creates a toggle with USO framework integration enabled and no initial label text.
| GWG.UsoUIElements.UsoToggle.UsoToggle | ( | string | fieldName | ) |
Initializes a new instance of the UsoToggle class with the specified field name. Creates a toggle with custom identification for binding and reference purposes.
| fieldName | The name to assign to this toggle element. |
| GWG.UsoUIElements.UsoToggle.UsoToggle | ( | string | fieldName, |
| string | fieldLabelText ) |
Initializes a new instance of the UsoToggle class with field name and label text. Creates a toggle with custom identification and display label for user interface clarity.
| fieldName | The name to assign to this toggle element. |
| fieldLabelText | The label text to display alongside the toggle control. |
| GWG.UsoUIElements.UsoToggle.UsoToggle | ( | string | fieldName, |
| string | fieldLabelText, | ||
| out UsoToggle | newField ) |
Initializes a new instance of the UsoToggle class with field name, label text, and returns a reference. Creates a toggle with custom identification, display label, and provides an out parameter for immediate access.
| fieldName | The name to assign to this toggle element. |
| fieldLabelText | The label text to display alongside the toggle control. |
| newField | Output parameter that receives a reference to the newly created toggle. |
| GWG.UsoUIElements.UsoToggle.UsoToggle | ( | string | fieldName, |
| string | fieldLabelText, | ||
| string | fieldBindingPath, | ||
| BindingMode | fieldBindingMode ) |
Initializes a new instance of the UsoToggle class with field name, label text, and data binding configuration. Creates a fully configured toggle with custom identification, display label, and automatic data binding for boolean value synchronization.
| fieldName | The name to assign to this toggle element. |
| fieldLabelText | The label text to display alongside the toggle control. |
| fieldBindingPath | The path to the data source property for automatic value binding. |
| fieldBindingMode | The binding mode that controls data flow between source and target. |
| GWG.UsoUIElements.UsoToggle.UsoToggle | ( | string | fieldName, |
| string | fieldLabelText, | ||
| string | fieldBindingPath, | ||
| BindingMode | fieldBindingMode, | ||
| out UsoToggle | newField ) |
Initializes a new instance of the UsoToggle class with complete configuration and returns a reference. Creates a fully configured toggle with custom identification, display label, automatic data binding, and immediate access to the created instance.
| fieldName | The name to assign to this toggle element. |
| fieldLabelText | The label text to display alongside the toggle control. |
| fieldBindingPath | The path to the data source property for automatic value binding. |
| fieldBindingMode | The binding mode that controls data flow between source and target. |
| newField | Output parameter that receives a reference to the newly created toggle. |
| void GWG.UsoUIElements.UsoToggle.ApplyBinding | ( | string | fieldBindingProp, |
| string | fieldBindingPath, | ||
| BindingMode | fieldBindingMode ) |
Applies data binding to the specified property of this control using Unity's data binding system. Configures the binding with the provided path and mode for automatic data synchronization.
| fieldBindingProp | The property name on this control to bind to. |
| fieldBindingPath | The path to the data source property to bind from. |
| fieldBindingMode | The binding mode that determines how data flows between source and target. |
| Exception | Thrown when binding setup fails. Original exception is preserved and re-thrown. |
Implements GWG.UsoUIElements.IUsoUiElement.
| UsoLineItem GWG.UsoUIElements.UsoToggle.GetParentLineItem | ( | ) |
Retrieves the first ancestor UsoLineItem control in the visual tree hierarchy. This is useful for accessing parent container functionality and maintaining proper UI structure.
| void GWG.UsoUIElements.UsoToggle.InitElement | ( | string | fieldName = null | ) |
Initializes the USO UI element with the specified field name and applies necessary styling classes. This method sets up the basic USO framework integration for the control.
| fieldName | Optional name to assign to the element. If null, no name is set. |
Implements GWG.UsoUIElements.IUsoUiElement.
| void GWG.UsoUIElements.UsoToggle.SetFieldStatus | ( | FieldStatusTypes | fieldStatus | ) |
Updates the field's status type, which affects its visual appearance and validation state. The status change is automatically reflected in the UI through the FieldStatus property.
| fieldStatus | The new field status type to apply. |
Implements GWG.UsoUIElements.IUsoUiElement.
| void GWG.UsoUIElements.UsoToggle.ShowFieldStatus | ( | bool | status | ) |
Controls the visibility and functionality of the field status/validation system. When disabled, removes validation-related styling from the control.
| status | True to enable field status functionality; false to disable it. |
Implements GWG.UsoUIElements.IUsoUiElement.
|
private |
|
private |
|
staticprivate |
Default binding property used when applying data bindings to this field. Binds to the 'value' property which controls the toggle's checked/unchecked state.
|
staticprivate |
CSS class name applied to all UsoToggle instances for styling purposes.
|
staticprivate |
CSS class name applied when field validation/status functionality is enabled.
|
getprivate set |
Gets the current field status type, which determines the visual state and validation feedback. This property is automatically reflected in the UI through CSS class modifications.
The current FieldStatusTypes value indicating the field's validation state.
Implements GWG.UsoUIElements.IUsoUiElement.
|
getprivate set |
Gets or sets whether field status/validation functionality is enabled for this control. When enabled, adds validation CSS class for styling. When disabled, removes validation styling.
True if field status functionality is enabled; otherwise, false. Default is true.
Implements GWG.UsoUIElements.IUsoUiElement.