|
UsoUIElements 0.1.0
Data Centric implimentation of Unity's UI Elements (UI Toolkit)
|
UsoButton is a custom button implementation, extending the Unity Button class, and is part of the GWG.UsoUIElements namespace. It provides additional functionality to the standard Button with the core Unity UI Elements framework. More...
Public Member Functions | |
| UsoButton () | |
| Default constructor. | |
| UsoButton (Action btnAction) | |
| Default UI Toolkit Constructor that only needs an event handler. | |
| UsoButton (Background iconImage, Action clickEvent=null) | |
| Creates a new element with the specified icon image and click event handler. | |
| UsoButton (string fieldName) | |
| Creates an element with an assigned name. | |
| UsoButton (string fieldName, Action btnAction) | |
| Creates a element with an assigned name and event handler. | |
| UsoButton (string fieldName, Action btnAction, out UsoButton newField) | |
| Creates a element with an assigned name and event handler and an output field containing the new element. | |
| UsoButton (string fieldName, out UsoButton newField) | |
| Creates an element with an assigned name and an output field containing the new button. | |
| UsoButton (string fieldName, string fieldLabelText) | |
| Creates a element with an assigned name and label text. | |
| UsoButton (string fieldName, string fieldLabelText, Action btnAction) | |
| Creates a element with an assigned name, label text, and event handler. | |
| UsoButton (string fieldName, string fieldLabelText, Action btnAction, out UsoButton newField) | |
| Creates a element with an assigned name, label text, and event handler and an output field containing the new element. | |
| UsoButton (string fieldName, string fieldLabelText, Background iconImage) | |
| Creates a element with an assigned name, label text, and icon image. | |
| UsoButton (string fieldName, string fieldLabelText, Background iconImage, Action btnAction) | |
| Creates a element with an assigned name, label text, icon image, and event handler. | |
| UsoButton (string fieldName, string fieldLabelText, Background iconImage, Action btnAction, out UsoButton newFieldName) | |
| Creates a element with an assigned name, label text, icon image, and event handler and an output field containing the new element. | |
| UsoButton (string fieldName, string fieldLabelText, Background iconImage, out UsoButton newField) | |
| Creates a element with an assigned name, label text, and icon image and an output field containing the new element. | |
| UsoButton (string fieldName, string fieldLabelText, out UsoButton newField) | |
| Creates a element with an assigned name and label text and an output field containing the new element. | |
| void | ApplyBinding (string fieldBindingProp, string fieldBindingPath, BindingMode fieldBindingMode) |
| ApplyBinding is a helper method that allows for more flexibility in applying the data binding. | |
| UsoLineItem | GetParentLineItem () |
| GetParentLineItem is a helper method that returns the parent UsoLineItem. | |
| void | InitElement (string fieldName=null) |
| InitElement is a helper method that initializes the element in a standard way for all constructors using an optional field name. | |
| void | SetFieldStatus (FieldStatusTypes fieldStatus) |
| SetFieldStatus is a helper method that sets the FieldStatus property. | |
| void | ShowFieldStatus (bool status) |
| ShowFieldStatus is a helper method that sets the FieldStatusEnabled property. | |
| 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] |
| FieldStatus is the validation feedback for the field and muct be one of the values in the FieldStatusTypes enum. | |
| bool | FieldStatusEnabled [get, private set] |
| FieldStatusEnabled is a boolean value that determines whether the validation feedback is displayed. The default value is true. | |
Private Member Functions | |
| void | InitElement (string fieldName, string fieldLabelText) |
| InitElement is a helper method that initializes the element in a standard way for all constructors using an optional field name and label text. | |
Private Attributes | |
| FieldStatusTypes | _fieldStatus |
| bool | _fieldStatusEnabled = true |
Static Private Attributes | |
| const string | DefaultBindProp = "value" |
| Default Binding Property for this element, used when setting the data binding in the constructor. Can be overriden by using the ApplyBinding method which allows for more flexibility. | |
| const string | ElementClass = "uso-button" |
| Default USS Style Class name for the element. | |
| const string | ElementValidationClass = "uso-field-validation" |
| Default USS Field Validation Style Class name for the UsoUIElements Framework. | |
UsoButton is a custom button implementation, extending the Unity Button class, and is part of the GWG.UsoUIElements namespace. It provides additional functionality to the standard Button with the core Unity UI Elements framework.
Additional functionality includes a standardized signature, support for field status management / validation response, and simplified data binding capabilities.
| GWG.UsoUIElements.UsoButton.UsoButton | ( | ) |
Default constructor.
| GWG.UsoUIElements.UsoButton.UsoButton | ( | Background | iconImage, |
| Action | clickEvent = null ) |
Creates a new element with the specified icon image and click event handler.
| iconImage | Image to apply to the button |
| clickEvent | Event handler when a click event happens |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | Action | btnAction | ) |
Default UI Toolkit Constructor that only needs an event handler.
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName | ) |
Creates an element with an assigned name.
| fieldName | name of the new button |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| out UsoButton | newField ) |
Creates an element with an assigned name and an output field containing the new button.
| fieldName | Name of the new button |
| newField | Out field containing the button |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| Action | btnAction ) |
Creates a element with an assigned name and event handler.
| fieldName | Name for the new button |
| btnAction | Click event handler |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| Action | btnAction, | ||
| out UsoButton | newField ) |
Creates a element with an assigned name and event handler and an output field containing the new element.
| fieldName | Name for the new button |
| btnAction | Click event handler |
| newField | Out field containing the new button |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| string | fieldLabelText ) |
Creates a element with an assigned name and label text.
| fieldName | Name of the new element |
| fieldLabelText | Text to display in the element |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| string | fieldLabelText, | ||
| out UsoButton | newField ) |
Creates a element with an assigned name and label text and an output field containing the new element.
| fieldName | Name of the new element |
| fieldLabelText | Text to display in the element |
| newField | Out field containing the new element |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| string | fieldLabelText, | ||
| Action | btnAction ) |
Creates a element with an assigned name, label text, and event handler.
| fieldName | Name of the new element |
| fieldLabelText | Text to display in the new element |
| btnAction | Click event handler for the new element |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| string | fieldLabelText, | ||
| Action | btnAction, | ||
| out UsoButton | newField ) |
Creates a element with an assigned name, label text, and event handler and an output field containing the new element.
| fieldName | Name of the new element |
| fieldLabelText | Text to display in the new element |
| btnAction | Click event handler for the new element |
| newField | Out field containing the new element |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| string | fieldLabelText, | ||
| Background | iconImage ) |
Creates a element with an assigned name, label text, and icon image.
| fieldName | Name of the new element |
| fieldLabelText | Text to display in the new element |
| iconImage | Image to display in the new element |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| string | fieldLabelText, | ||
| Background | iconImage, | ||
| out UsoButton | newField ) |
Creates a element with an assigned name, label text, and icon image and an output field containing the new element.
| fieldName | Name of the new element |
| fieldLabelText | Text to display in the new element |
| iconImage | Image to display in the new element |
| newField | Out field containing the new element |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| string | fieldLabelText, | ||
| Background | iconImage, | ||
| Action | btnAction ) |
Creates a element with an assigned name, label text, icon image, and event handler.
| fieldName | Name of the new element |
| fieldLabelText | Text to display in the new element |
| iconImage | Image to display in the new element |
| btnAction | Click event handler for the new element |
| GWG.UsoUIElements.UsoButton.UsoButton | ( | string | fieldName, |
| string | fieldLabelText, | ||
| Background | iconImage, | ||
| Action | btnAction, | ||
| out UsoButton | newFieldName ) |
Creates a element with an assigned name, label text, icon image, and event handler and an output field containing the new element.
| fieldName | Name of the new element |
| fieldLabelText | Text to display in the new element |
| iconImage | Image to display in the new element |
| btnAction | Click event handler for the new element |
| newFieldName | Out field containing the new element |
| void GWG.UsoUIElements.UsoButton.ApplyBinding | ( | string | fieldBindingProp, |
| string | fieldBindingPath, | ||
| BindingMode | fieldBindingMode ) |
ApplyBinding is a helper method that allows for more flexibility in applying the data binding.
This method is used to apply a data binding to the element.
Any of the element properties can be bound to a data source using this method.
example uses a button but can apply to all Uso UI Elements
The Example above will bind the 'text' property of the UsoButton to the 'myField' property path within the 'myData' object in readonly mode causing the value stores in the data source to be displayed in the button.
| fieldBindingProp | Property of the button you want to bind to as a string value |
| fieldBindingPath | Data path within the assigned datasource that you wish to bind the property to. |
| fieldBindingMode | Binding mode to use, can be read-only, write-only, or read/write |
Implements GWG.UsoUIElements.IUsoUiElement.
| UsoLineItem GWG.UsoUIElements.UsoButton.GetParentLineItem | ( | ) |
GetParentLineItem is a helper method that returns the parent UsoLineItem.
This method is used to get the parent UsoLineItem of the UsoButton.
When fully implementing this framework, the hierarchy would be similar to:
|
private |
InitElement is a helper method that initializes the element in a standard way for all constructors using an optional field name and label text.
| fieldName | |
| fieldLabelText |
| void GWG.UsoUIElements.UsoButton.InitElement | ( | string | fieldName = null | ) |
InitElement is a helper method that initializes the element in a standard way for all constructors using an optional field name.
| fieldName |
Implements GWG.UsoUIElements.IUsoUiElement.
| void GWG.UsoUIElements.UsoButton.SetFieldStatus | ( | FieldStatusTypes | fieldStatus | ) |
SetFieldStatus is a helper method that sets the FieldStatus property.
| fieldStatus |
Implements GWG.UsoUIElements.IUsoUiElement.
| void GWG.UsoUIElements.UsoButton.ShowFieldStatus | ( | bool | status | ) |
ShowFieldStatus is a helper method that sets the FieldStatusEnabled property.
| status |
Implements GWG.UsoUIElements.IUsoUiElement.
|
private |
|
private |
|
staticprivate |
Default Binding Property for this element, used when setting the data binding in the constructor. Can be overriden by using the ApplyBinding method which allows for more flexibility.
|
staticprivate |
Default USS Style Class name for the element.
|
staticprivate |
Default USS Field Validation Style Class name for the UsoUIElements Framework.
|
getprivate set |
FieldStatus is the validation feedback for the field and muct be one of the values in the FieldStatusTypes enum.
This property is used to display the validation feedback for the field. The default value is FieldStatusTypes.None. The FieldStatusTypes enum provides the following values:
The
must be true for the validation to be displayed.
Implements GWG.UsoUIElements.IUsoUiElement.
|
getprivate set |
FieldStatusEnabled is a boolean value that determines whether the validation feedback is displayed. The default value is true.
The FieldStatusEnabled property is used to determine whether the validation feedback is displayed. The default value is true.
Implements GWG.UsoUIElements.IUsoUiElement.