Expand description
Layout helpers named by role, for an application’s own layout code: text by role, spacing by intent, a card and a button in a tone, drawn from the theme’s tokens and kit.
use egui_pop_core::theme::{self, ThemeSpec};
use egui_pop_core::ui::{Space, Tone, UiPop};
let ctx = egui::Context::default();
theme::install(&ctx, &ThemeSpec::new("pop-dark"));
let mut out = ctx.run_ui(Default::default(), |ui| {
ui.section_title("Export");
ui.muted("Writes a copy next to the original.");
ui.space_role(Space::Group);
ui.card(Tone::Neutral, |ui| {
ui.label("IMG_0001.raw");
ui.meta("24 MB, 12 October");
});
if ui.button_tone(Tone::Danger, "Delete").clicked() {
// ...
}
});
out.textures_delta.clear();The helpers are few on purpose, so Ui’s completion list stays
short; role_text and Space::points serve the rest.
Re-exports§
pub use crate::kit::Stock;pub use crate::kit::Tone;pub use crate::theme::TextRole;pub use layout::Align;pub use layout::Cells;pub use layout::Flow;pub use layout::FlowCells;pub use layout::Grid;pub use layout::Length;pub use layout::Row;pub use layout::Track;
Modules§
- layout
- Rows, grids and flows:
UiPop::rowandUiPop::gridplace cells on tracks, align them on their text’s baseline, and leave gaps ofSpaceonly;UiPop::flowplaces whole cells left to right and wraps them.
Enums§
- Space
- Spacing by intent (
space.inline,group,section,page): what the space is for, each an alias of a step of the spacing scale, so densities scale it.
Traits§
- UiPop
- Layout helpers named by role, on egui’s [
Ui]. Each is a few lines over the theme’s tokens and kit; see the module.
Functions§
- contain_
wheel - Keeps the wheel over a scroll area just drawn from what scrolls around it, for
a view that shows its own
ScrollArea(show_viewport,show_rows);UiPop::scroll_area_containeddoes it for the others. Call it right after the area, in theUiit was shown in. - contain_
wheel_ in contain_wheelfor what scrolls in a way a [ScrollAreaOutput] does not tell: overrect, the wheel stops on the ways ofways([x, y]) that are set. Taken as egui’s own scroll area takes it, and only by the axis it would take.- role_
text textin a role’s size, colour and weight (text-role.*), for a widget that takes a [RichText]. A weight other than regular is drawn with the theme’s interface font at that weight once the theme has installed it (fonts::family), at the regular weight before.- set_
scroll_ offset - Moves the scroll area of id
id(its [ScrollAreaOutput::id]) tooffset, in points from its start, as from the next time it is drawn;falsewhen no such area has been drawn. Kinetic scrolling in progress stops there. - strong_
text textas inline emphasis (text-role.strong): the body’s size, a heavier weight and the strong text colour, for a word or a value that must stand out in running text. Not a heading: a title over a group isUiPop::section_title.- tone_
color - The colour of text in
tone(UiPop::text_tone):danger,warning,successandinfothe status colours (status.*),accentaccent.default,mutedtext-role.muted.color,recordstatus.danger,neutraltext-role.body.color.