Struct dotrix_egui::CollapsingHeader[][src]

pub struct CollapsingHeader { /* fields omitted */ }
Expand description

A header which can be collapsed/expanded, revealing a contained Ui region.

egui::CollapsingHeader::new("Heading")
    .show(ui, |ui| {
        ui.label("Contents");
    });

// Short version:
ui.collapsing("Heading", |ui| { ui.label("Contents"); });

Implementations

The CollapsingHeader starts out collapsed unless you call default_open.

The label is used as an Id source. If the label is unique and static this is fine, but if it changes or there are several CollapsingHeader with the same title you need to provide a unique id source with Self::id_source.

By default, the CollapsingHeader is collapsed. Call .default_open(true) to change this.

Explicitly set the source of the Id of this widget, instead of using title label. This is useful if the title label is dynamic or not unique.

By default, the CollapsingHeader text style is TextStyle::Button. Call .text_style(style) to change this.

If you set this to false, the CollapsingHeader will be grayed out and un-clickable.

This is a convenience for Ui::set_enabled.

Can the CollapsingHeader be selected by clicking it? Default: false.

If you set this to ‘true’, the CollapsingHeader will be shown as selected.

Example:

let mut selected = false;
let response = egui::CollapsingHeader::new("Select and open me")
    .selectable(true)
    .selected(selected)
    .show(ui, |ui| ui.label("Content"));
if response.header_response.clicked() {
    selected = true;
}

Should the CollapsingHeader show a background behind it? Default: false.

To show it behind all CollapsingHeader you can just use:

ui.visuals_mut().collapsing_header_frame = true;

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Constructs wrapped service

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.