UIMenuBar Class
Definition
Namespace: Brine2D.UI
A horizontal menu bar containing top-level menus \(e\.g\. File, Edit, View\). Clicking a title opens a dropdown submenu rendered as a canvas-managed overlay.
Inheritance System.Object → UIMenuBar
Implements IUIComponent, IAnchoredUIComponent
Remarks
Add menus with AddMenu\(UIMenuBarMenu\). Set Size = new Vector2(canvasWidth, BarHeight)
after constructing. The canvas renders the open submenu as a top-level overlay
and routes all input to the menu bar while a submenu is open.
| Properties | |
|---|---|
| BarHeight | Height of the menu bar title strip in pixels. Defaults to 28. |
| Font | Optional font for all text. Null uses the renderer default. |
| IsOpen | Whether any submenu is currently open. |
| ItemHeight | Height of each non-separator submenu item. Defaults to 28. |
| ItemTextPadding | Horizontal text padding inside submenu items. |
| Menus | Read-only view of registered menus. |
| OpenMenuIndex | Index of the currently open menu, or -1 if none. |
| SeparatorHeight | Height of separator items. Defaults to 8. |
| SubmenuWidth | Width of the dropdown submenu panel. Defaults to 180. |
| TitlePadding | Horizontal padding around each title label in pixels. Defaults to 12. |
| Methods | |
|---|---|
| AddMenu\(UIMenuBarMenu\) | Adds a top-level menu and returns this for fluent chaining. |
| AddMenu\(string\) | Adds a top-level menu by title and returns the new menu. |
| HandleClick\(Vector2\) | Handles a left-button click. Returns true if the click was consumed. |
| RenderSubmenuOverlay\(IRenderer\) | Draws the open submenu as a top-level overlay. Called by UICanvas. |
| SubmenuContains\(Vector2\) | Returns true if pos is within the open submenu's bounds. |
| UpdateHover\(Vector2\) | Handles mouse movement: updates hovered title and hovered item. |