Skip to main content

Module band

Module band 

Source
Expand description

A header band: the handle a movable surface (a movable dialog, a palette) is dragged by. It sits at the top of a frame’s content, its fill reaching the frame’s edges, with a separator below it and the move cursor over it.

begin registers the band’s drag area first (so the buttons drawn in its row, registered after it, stay on top of it), then lays out its row; paint has the kit’s header-band paint it once the frame’s width is known, at the end of the frame’s content, under the row: in the hover state under the pointer, active while dragged. The band is not focusable: the keyboard moves a surface through a command of its own.

use egui_pop_core::band::{self, BandStyle};

let ctx = egui::Context::default();
let mut out = ctx.run_ui(Default::default(), |ui| {
    let style = BandStyle {
        padding: 12.0,
        gap: 8.0,
    };
    egui::Frame::NONE.inner_margin(style.padding).show(ui, |ui| {
        // The row is told the band's state, for its title's colour.
        let (_, band) = band::begin(ui, &style, |ui, _state| ui.label("Levels"));
        ui.label("content");
        band::paint(ui, &band, &style);
        assert!(!band.dragging);
    });
});
out.textures_delta.clear();

Structs§

Band
A band as laid out this pass, and what the pointer did to it.
BandStyle
Where a band sits in its frame.

Functions§

begin
button
A square icon button of a band, side points wide, named name (for assistive technology and its tooltip), drawn by the kit’s band-icon-button: selected when on (a pinned palette), the icon in its state’s text.
paint
Has the kit’s header-band paint the band across the frame’s width (known once the content is laid out), under its row; call it last in the frame’s content.