UIDropdown Class
Definition
Namespace: Brine2D.UI
Dropdown/ComboBox UI component for selecting from a list of options.
Inheritance System.Object → UIDropdown
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. |
| BorderColor | Border color. |
| DisabledItemColor | Color used to render item text for items that have been disabled via SetItemEnabled\(int, bool\). |
| FocusColor | Color of the focus ring drawn around the header when the dropdown has keyboard focus. |
| Font | Optional font for rendering text \(null = renderer default\). |
| HoverColor | Hover color for items. |
| IsExpanded | Whether the dropdown list is currently expanded. |
| IsFlipped | Returns true when the expanded list should render above the header to avoid overflowing the screen. |
| IsFocused | Whether this dropdown currently has keyboard focus. |
| Items | List of items in the dropdown. |
| MaxVisibleItems | Maximum number of visible items before scrolling \(0 = show all\). |
| Placeholder | Text displayed in the header when no item is selected. Defaults to "\(Select\)". |
| ScreenHeight | Screen height in pixels. Used to flip the list above the header when it would overflow the bottom of the screen. Set by UICanvas. Defaults to 720. |
| ScrollbarColor | Scrollbar thumb color. |
| ScrollbarWidth | Scrollbar width in pixels. |
| SelectedColor | Selected item color. |
| SelectedIndex | Currently selected item index \(\-1 = none selected\). |
| SelectedText | Currently selected item text \(null if none selected\). |
| SuppressListRender | When true, the expanded list is not rendered inside Brine2D.UI.UIDropdown.Render\(Brine2D\.Rendering\.IRenderer\). Set by UICanvas when this dropdown is inside a scroll view so the list can be drawn as a top-level overlay without scissor clipping. |
| TextColor | Text color. |
| Methods | |
|---|---|
| AddItem\(string\) | Adds an item to the dropdown. |
| ClearItems() | Clears all items. |
| Close() | Called by UICanvas to close the dropdown. |
| ConfirmKeyboardSelection() | Selects the item currently under the keyboard cursor and closes the list. Called by UICanvas when Enter/Space is pressed while the dropdown is expanded and focused. |
| IsItemEnabled\(int\) | Returns whether the item at index is enabled. Items are enabled by default. |
| IsOverExpandedList\(Vector2\) | Returns true when screenPosition is over the expanded item list but not over the header row itself. Works for both normal \(below header\) and flipped \(above header\) layouts. |
| NavigateItem\(int\) | Moves the keyboard cursor by direction steps \(\+1 = down, \-1 = up\) within the expanded list. If the list is not open, opens it first. Called by UICanvas when Up/Down arrow keys are pressed while the dropdown is focused. |
| RemoveItem\(string\) | Removes an item from the dropdown. |
| RenderListOverlay\(IRenderer, Vector2\) | Renders only the expanded item list at screenPosition, bypassing any scissor rectangle. Called by UICanvas after all other components are drawn when this dropdown is nested inside a UIScrollView. |
| Scroll\(float\) | Called by UICanvas to scroll the expanded list via the mouse wheel. |
| SelectItem\(Vector2\) | Called by UICanvas when an item in the expanded list is clicked. |
| SetFocused\(bool\) | Called by UICanvas to set keyboard focus on this dropdown. |
| SetItemEnabled\(int, bool\) | Enables or disables a single item by its index. Disabled items are rendered in DisabledItemColor and cannot be selected by mouse click or keyboard. If a currently selected item is disabled the selection is not automatically cleared — the developer should handle that case explicitly. |
| Toggle() | Called by UICanvas when dropdown header is clicked. |
| UpdateHover\(Vector2\) | Called by UICanvas to update hover state for the expanded list. |
| Events | |
|---|---|
| OnFocusGained | Event fired when this dropdown gains keyboard focus. |
| OnFocusLost | Event fired when this dropdown loses keyboard focus. |
| OnSelectionChanged | Event fired when selection changes. |