Skip to main content

Module title_bar

Module title_bar 

Source
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§

ControlButton
A compact, flush-fitting window-control button.
DragRegion
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.
ResizeStrip
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).
TitleBar
A custom window title bar.
WindowControls
The minimize / maximize / close cluster, laid out as an HStack of ControlButtons. Each cell forwards taps to the supplied host.
WindowControlsLayout
Layout snapshot that WindowControls exports to its parent TitleBar so the after_paint aggregator can read the per-button [WidgetId]s. Populated during WindowControls::build.
WindowFrame
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 thickness pixels.

Type Aliases§

CloseAction
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 lacking Window::request_close). Set via TitleBar::close_action.
ControlAction
Action invoked when a ControlButton is tapped.