Skip to main content

Module sections

Module sections 

Source
👎Deprecated since 0.5.0: moved to egui_stack::sections::plan, re-exported as egui_pop_core::sections::plan; this copy goes in the next release
Expand description

The arithmetic of a stack of collapsible sections: how heights share a panel, and what a drag on a boundary between two sections does.

Experimental: may change in any release (docs/stability.md).

Deprecated: it moved to egui_stack (egui_stack::sections::plan, re-exported as egui_pop_core::sections::plan), with the section widget; this copy is kept, unchanged and unused, for one release. It is not a re-export, as this crate stays free of egui (ADR 0001) and egui_stack depends on it. Its tests are egui_stack’s. Its types are not egui_stack’s: a DragMode read from egui_pop_core::sections::laid_out is egui_pop_core::sections::DragMode. Heights are in points, a section’s body alone (its title band is the caller’s); folded sections take no height and are skipped.

  • fit: the heights a stack shows in the room it has. A height set by hand is kept while it fits; the sections never set by hand share the rest equally, and the last open section takes what is left, less any empty room kept under it.
  • plan_drag: what moving a boundary does, from the heights shown. Nothing gives way in proportion: sections give in turn, the nearest first, each down to its least height, as a code editor’s split view does. DragMode::Pull moves the sections below as a block instead, opening empty room under the last.
  • resized_above: the section a boundary resizes: under a folded section, the first open one above it.
  • pin_plan: the heights to keep by hand so that fit shows a plan, the sections it did not touch staying sized by the list.
  • keep_title: what folding or opening a section keeps so that its title stays where it is (held_above: the sections that must not move).
  • rows_least: the least height of a section of rows.
use egui_pop_model::sections::{DragMode, Placed, plan_drag};

let section = |height| Placed { open: true, least: 50.0, height };
let stack = [section(100.0), section(100.0), section(100.0)];
// Down, the section just below gives first, down to its least height;
// the last gives only then.
let plan = plan_drag(&stack, 0, 70.0, 0.0, DragMode::Push);
assert_eq!(plan.heights, [170.0, 50.0, 80.0]);
assert_eq!(plan.moved, 70.0);

Structs§

AskedDeprecated
A section as a stack asks for it: what fit lays out.
DragPlanDeprecated
What a drag does (plan_drag).
FitDeprecated
The heights a stack shows (fit).
KeptDeprecated
What to keep so that folding or opening a section leaves its title where it is (keep_title).
PlacedDeprecated
A section as laid out: what a drag starts from.

Enums§

DragModeDeprecated
How a drag moves the sections around a boundary.

Functions§

fitDeprecated
Lays sections out in room points, keeping empty points of it under the last section.
held_aboveDeprecated
The open sections above section, with their shown heights: what must not move for its title to stay where it is.
keep_titleDeprecated
What folding or opening the section section keeps, from the heights shown and the empty room under them, so that its title does not move.
pin_planDeprecated
The heights to keep by hand, section by section, so that fit shows plan in room, with empty kept under the last section.
plan_dragDeprecated
What moving the boundary under the section above by delta does (down if positive), from the heights in placed; empty is the room under the last section.
resized_aboveDeprecated
The section a boundary resizes, the one on the line under the section line: line itself when open, else the first open one above it, past any folded ones (they have no height to change); None when nothing above is open, and the boundary cannot move. open: whether each section is, top first.
rows_leastDeprecated
The least height of a section of count rows, each row tall: two rows, or all of them when it has fewer.