UISpinBox Class
Definition
Namespace: Brine2D.UI
Numeric spin-box with increment/decrement buttons and optional inline text entry.
Inheritance System.Object → UISpinBox
Implements IUIComponent, IAnchoredUIComponent
| Properties | |
|---|---|
| Anchor | The screen anchor point this component is positioned relative to. |
| AnchorOffset | Pixel offset from the resolved anchor point. |
| BackgroundColor | Background color of the value field. |
| BorderColor | Border color. |
| ButtonColor | Background color of the increment/decrement buttons. |
| ButtonHoverColor | Button background color when hovered. |
| ButtonPressedColor | Button background color when pressed. |
| ButtonSymbolColor | Arrow/symbol color on the buttons. |
| ButtonWidth | Width of each increment/decrement button. Derived from Brine2D.UI.UISpinBox.Size. |
| FocusedBackgroundColor | Background color when focused. |
| FocusedBorderColor | Border color when focused. |
| Font | Optional font \(null = renderer default\). |
| IsEditing | Whether the value text is currently being edited directly via keyboard. |
| IsFocused | Whether this spin box is currently focused. |
| MaxValue | Maximum allowed value. Defaults to 100. |
| MinValue | Minimum allowed value. Defaults to 0. |
| Step | Amount to increment or decrement per button click or arrow key press. Defaults to 1. |
| TextColor | Text color for the displayed value. |
| Value | Current numeric value, clamped between MinValue and MaxValue. |
| ValueFormat | Display format string for the numeric value \(e\.g\. "0", "0\.00"\). Defaults to "0". |
| Methods | |
|---|---|
| BeginEdit() | Begins direct text editing of the value field. |
| CancelEdit() | Cancels the current edit without applying the buffer. |
| CommitEdit() | Commits the edit buffer to Value and exits editing mode. If the buffer cannot be parsed the value is left unchanged. |
| ContainsDecrement\(Vector2\) | Returns whether the given screen position is within the decrement \(left\) button. |
| ContainsField\(Vector2\) | Returns whether the given screen position is within the text field \(not the buttons\). |
| ContainsIncrement\(Vector2\) | Returns whether the given screen position is within the increment \(right\) button. |
| Decrement() | Decrements the value by Step. |
| HandleEditBackspace() | Handles Backspace while editing. |
| HandleEditChar\(char\) | Handles a character typed while editing. Called by UICanvas keyboard routing. |
| Increment() | Increments the value by Step. |
| NudgeValue\(float\) | Nudges the value in a given direction \(positive = increment, negative = decrement\). Called by UICanvas arrow-key handling. |
| SetFocused\(bool\) | Called by UICanvas to set keyboard focus. |
| SetHoveredDecrement\(bool\) | Called by UICanvas to set hover state on the decrement button. |
| SetHoveredIncrement\(bool\) | Called by UICanvas to set hover state on the increment button. |
| SetPressedDecrement\(bool\) | Called by UICanvas when the decrement button is pressed. |
| SetPressedIncrement\(bool\) | Called by UICanvas when the increment button is pressed. |
| Events | |
|---|---|
| OnFocusGained | Fired when this spin box gains keyboard focus. |
| OnFocusLost | Fired when this spin box loses keyboard focus. |
| OnValueChanged | Fired when the value changes. |