UITabContainer Class
Definition
Namespace: Brine2D.UI
Tab container UI component for organizing content into tabs.
Inheritance System.Object → UITabContainer
Implements IUIComponent, IAnchoredUIComponent
| Properties | |
|---|---|
| ActiveTabColor | Active tab color. |
| Anchor | The screen anchor point this component is positioned relative to. |
| AnchorOffset | Pixel offset from the resolved anchor point. |
| BorderColor | Border color. |
| ContentBackgroundColor | Content area background color. |
| ContentBackgroundTexture | Optional nine-slice texture for the content area background. When set, replaces the solid ContentBackgroundColor fill. |
| ContentBackgroundTextureBorder | Nine-slice border insets \(texels\) for ContentBackgroundTexture. |
| ContentBackgroundTextureTint | Tint color applied to ContentBackgroundTexture. Defaults to white. |
| FocusColor | Color of the focus ring drawn around the tab bar when the container has keyboard focus. |
| HoverTabColor | Hover tab color. |
| IsFocused | Whether this tab container currently has keyboard focus. |
| MinTabWidth | Minimum tab width in pixels. When tabs would be narrower the bar becomes scrollable, showing arrow buttons of width TabArrowWidth. Set to 0 to let tabs shrink freely. |
| ScreenSize | Screen size used to resolve UIAnchor positions for anchored children. Kept in sync by UICanvas. Defaults to 1280×720. |
| SelectedTabIndex | Currently selected tab index. |
| TabArrowWidth | Width of each scroll arrow button at the ends of the tab bar. Only visible when the tab bar is scrollable. |
| TabBackgroundColor | Background color for tabs. |
| TabCount | Gets the number of tabs. |
| TabHeight | Height of the tab bar. |
| TabTexture | Optional nine-slice texture used for each tab button background. When set, replaces the solid per-state tab color fills. The ActiveTabColor, HoverTabColor, and TabBackgroundColor tints are still applied as a tint on top. |
| TabTextureBorder | Nine-slice border insets \(texels\) for TabTexture. |
| TextColor | Text color. |
| Methods | |
|---|---|
| AddComponentToTab\(int, IUIComponent\) | Adds a component to the specified tab by index. |
| AddComponentToTab\(string, IUIComponent\) | Adds a component to the specified tab by title. |
| AddTab\(string\) | Adds a new tab with the given title. |
| GetContentOrigin() | Returns the absolute screen-space position of the top-left corner of the content area \(below the tab bar\). Useful when you need to convert a content-relative child position to an absolute screen position \(e\.g\. for debug overlays or external hit\-tests\). Child components added via AddComponentToTab\(int, IUIComponent\) use content-origin-relative coordinates, so (0,0) is already the content origin. |
| GetTabComponents\(int\) | Gets all components in the specified tab. |
| GetTabTitle\(int\) | Gets the title of the specified tab. |
| RemoveComponentFromTab\(int, IUIComponent\) | Removes a component from the specified tab. |
| RemoveTab\(int\) | Removes the tab at tabIndex. If the removed tab was selected, the selection moves to index 0 \(or \-1 if no tabs remain\). If a tab before the selected one is removed, the selected index is decremented so the same tab stays selected. OnTabChanged fires only when the selected tab actually changes. |
| RenameTab\(int, string\) | Renames the tab at tabIndex. No-op when the index is out of range. |
| SelectNextTab() | Selects the next tab, wrapping around to the first when the last is selected. No-op when there are fewer than two tabs. |
| SelectPreviousTab() | Selects the previous tab, wrapping around to the last when the first is selected. No-op when there are fewer than two tabs. |
| SelectTab\(Vector2\) | Called by UICanvas when a tab is clicked. |
| SetFocused\(bool\) | Called by UICanvas to set keyboard focus on this tab container. |
| UpdateHover\(Vector2\) | Called by UICanvas to update hover state. |
| Events | |
|---|---|
| OnFocusGained | Event fired when this tab container gains keyboard focus. |
| OnFocusLost | Event fired when this tab container loses keyboard focus. |
| OnTabChanged | Event fired when the selected tab changes. |