Expand description
Custom window title bar widget.
TitleBar replaces a window’s native chrome with a horizontal bar that
can host menus, tools, and the standard window controls (minimize /
maximize / close). The platform plumbing — beginning a window drag,
returning the right WM_NCHITTEST codes on Windows, repositioning the
macOS traffic lights — lives behind the
[PlatformTitleBarHost] trait in
teksilo-platform. The widget itself is platform-agnostic.
Construct a TitleBar from inside the root-builder closure, fetching
the host from the widget tree:
ⓘ
.root(|tree| {
let host = tree.title_bar_host().expect("custom_chrome enabled");
tree.add(
VStack::new()
.child(TitleBar::new(host)
.background(theme.colors.surface_raised)
.border(theme.colors.border, 1.0)
.leading(TextWidget::new(lit!("My App"))))
.child(Expand::new().child(/* body */)))
})Structs§
- Control
Button - A compact, flush-fitting window-control button.
- Drag
Region - Flexible, hit-transparent region inside a title bar that routes pointer events to the platform host for window dragging, maximize-toggle, and the system window menu.
- Resize
Strip - A single edge of a resize frame. Construct one per side and lay them out around your content (HStack of left + content + right inside a VStack of top + middle + bottom is the conventional shape — see the title bar demo for an example).
- Title
Bar - A custom window title bar.
- Window
Controls - The minimize / maximize / close cluster, laid out as an HStack of
ControlButtons. Each cell forwards taps to the supplied host. - Window
Controls Layout - Layout snapshot that
WindowControlsexports to its parentTitleBarso theafter_paintaggregator can read the per-button [WidgetId]s. Populated duringWindowControls::build. - Window
Frame - Invisible overlay of resize strips and corner cells that gives a borderless window
draggable edges. The content child fills the full client area with no visible inset;
the strips are hit-test-only overlays along the outer
thicknesspixels.
Type Aliases§
- Close
Action - Type alias for the user-supplied close action that overrides
host.close()(which on Wayland is currently a no-op due to winit 0.30 lackingWindow::request_close). Set viaTitleBar::close_action. - Control
Action - Action invoked when a
ControlButtonis tapped.