pub trait UiPop: Sealed {
Show 26 methods
// Required methods
fn text_role(&mut self, role: TextRole, text: impl Into<String>) -> Response;
fn section_title(&mut self, text: impl Into<String>) -> Response;
fn muted(&mut self, text: impl Into<String>) -> Response;
fn meta(&mut self, text: impl Into<String>) -> Response;
fn strong_text(&mut self, text: impl Into<String>) -> Response;
fn code_text(&mut self, text: impl Into<String>) -> Response;
fn text_tone(&mut self, tone: Tone, text: impl Into<String>) -> Response;
fn divider(&mut self) -> Response;
fn sized(&mut self, size: Vec2, widget: impl Widget) -> Response;
fn sized_ui<R>(
&mut self,
size: Vec2,
layout: Layout,
add: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<R>;
fn rect_ui<R>(
&mut self,
rect: Rect,
layout: Layout,
add: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<R>;
fn space_role(&mut self, space: Space);
fn card<R>(
&mut self,
tone: Tone,
add: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<R>;
fn popover<R>(&mut self, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R>;
fn button_tone(
&mut self,
tone: Tone,
text: impl Into<WidgetText>,
) -> Response;
fn scoped<R>(
&mut self,
stock: Stock,
tone: Tone,
add: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<R>;
fn combo_box<R>(
&mut self,
combo: ComboBox<'_>,
add: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<Option<R>>;
fn scroll_area<R>(
&mut self,
area: ScrollArea,
add: impl FnOnce(&mut Ui) -> R,
) -> ScrollAreaOutput<R>;
fn scroll_area_viewport<R>(
&mut self,
area: ScrollArea,
add: impl FnOnce(&mut Ui, Rect) -> R,
) -> ScrollAreaOutput<R>;
fn scroll_area_rows<R>(
&mut self,
area: ScrollArea,
row_height: f32,
rows: usize,
add: impl FnOnce(&mut Ui, Range<usize>) -> R,
) -> ScrollAreaOutput<R>;
fn scroll_area_contained<R>(
&mut self,
area: ScrollArea,
add: impl FnOnce(&mut Ui) -> R,
) -> ScrollAreaOutput<R>;
fn drag_cursor<'a>(
&self,
response: &'a Response,
kind: DragKind,
) -> DragCursorFor<'a>;
fn row<R>(
&mut self,
row: Row,
add: impl FnOnce(&mut Cells<'_>) -> R,
) -> InnerResponse<R>;
fn grid<R>(
&mut self,
grid: Grid,
add: impl FnOnce(&mut Cells<'_>) -> R,
) -> InnerResponse<R>;
fn flow<R>(
&mut self,
flow: Flow,
add: impl FnOnce(&mut FlowCells<'_>) -> R,
) -> InnerResponse<R>;
// Provided method
fn strong(&mut self, text: impl Into<String>) -> Response { ... }
}Expand description
Layout helpers named by role, on egui’s [Ui]. Each is a few lines
over the theme’s tokens and kit; see the module.
Required Methods§
Sourcefn text_role(&mut self, role: TextRole, text: impl Into<String>) -> Response
fn text_role(&mut self, role: TextRole, text: impl Into<String>) -> Response
A label in a text role (role_text).
Need (text): a label in a named text role (title, section, body, muted, meta).
Sourcefn section_title(&mut self, text: impl Into<String>) -> Response
fn section_title(&mut self, text: impl Into<String>) -> Response
A section’s title (text-role.section).
Need (text): a section title. Need (text): a heading over a group of fields.
Sourcefn muted(&mut self, text: impl Into<String>) -> Response
fn muted(&mut self, text: impl Into<String>) -> Response
Secondary text: a hint, a description (text-role.muted).
Need (text): secondary text, a hint or a description. Need (text): greyed or weak text.
Sourcefn meta(&mut self, text: impl Into<String>) -> Response
fn meta(&mut self, text: impl Into<String>) -> Response
Small print about an item: a date, a size (text-role.meta).
Need (text): small print about an item, a date or a size.
Sourcefn strong_text(&mut self, text: impl Into<String>) -> Response
fn strong_text(&mut self, text: impl Into<String>) -> Response
Inline emphasis: a word or a value that must stand out in running
text, at the body’s size in a heavier weight (text-role.strong,
strong_text). egui’s own strong only brightens the colour.
Need (text): strong or bold text inline, a word that must stand out.
Sourcefn code_text(&mut self, text: impl Into<String>) -> Response
fn code_text(&mut self, text: impl Into<String>) -> Response
Monospace text: a log’s or a console’s line, a path, a piece of
code. egui’s monospace text style (font.text-style.monospace,
in font.family.mono) in the body role’s colour
(text-role.body.color), without the box egui’s own code label
draws, so a log’s lines read as text.
Need (text): monospace text, a log or console line, a path or code.
Sourcefn text_tone(&mut self, tone: Tone, text: impl Into<String>) -> Response
fn text_tone(&mut self, tone: Tone, text: impl Into<String>) -> Response
Text in a tone: a failed state, an error, a warning, a success.
The body role’s size and weight in the tone’s colour, from the
tokens (tone_color): danger, warning, success and info
the status colours (legible as text on panels), accent the
accent, muted the muted role’s colour, record the danger
colour, Tone::Neutral the body’s. The tone is in its colour
only: say it in the words too (“Failed: …”), as colour alone
reaches neither every eye nor assistive technologies.
Need (text): text in a tone, a failed state or an error in the danger colour. Need (status): an inline error, warning or success message.
Sourcefn divider(&mut self) -> Response
fn divider(&mut self) -> Response
A divider: a rule across the layout between two sections, in
border.default, one point wide on whole physical pixels, centred in a space of
Space::Group. Horizontal in a vertical layout, vertical (the
row’s height) in a horizontal one. Decoration: it has no name and
takes no input.
Need (layout): a divider, a rule between two sections (separator).
Sourcefn sized(&mut self, size: Vec2, widget: impl Widget) -> Response
fn sized(&mut self, size: Vec2, widget: impl Widget) -> Response
widget in a box of size at the layout’s cursor, filling it
(centred and justified along the layout’s direction): a row the
width of its room, a field of a set width. egui’s add_sized.
Need (layout): a widget of a fixed size, filling its box (add_sized).
Sourcefn sized_ui<R>(
&mut self,
size: Vec2,
layout: Layout,
add: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<R>
fn sized_ui<R>( &mut self, size: Vec2, layout: Layout, add: impl FnOnce(&mut Ui) -> R, ) -> InnerResponse<R>
add in a box of exactly size at the layout’s cursor, laid out
by layout (Layout::centered_and_justified to fill it): a cell
of a set width in a row. The box takes size whatever add
draws. egui’s allocate_ui_with_layout, whose box shrinks to its
content.
Need (layout): content in a box of a fixed size (allocate_ui_with_layout).
Sourcefn rect_ui<R>(
&mut self,
rect: Rect,
layout: Layout,
add: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<R>
fn rect_ui<R>( &mut self, rect: Rect, layout: Layout, add: impl FnOnce(&mut Ui) -> R, ) -> InnerResponse<R>
add in rect, laid out by layout and clipped to it, for what
places its parts by rectangles (a card laid out by a layout
engine, a slot): nothing it draws goes past rect. egui’s put,
for any content.
Need (layout): content placed in a given rectangle, clipped to it (put).
Sourcefn space_role(&mut self, space: Space)
fn space_role(&mut self, space: Space)
Space by intent along the layout’s direction (Space); egui’s
own add_space takes points.
Need (layout): space between blocks, by intent (never a number of points).
Sourcefn card<R>(
&mut self,
tone: Tone,
add: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<R>
fn card<R>( &mut self, tone: Tone, add: impl FnOnce(&mut Ui) -> R, ) -> InnerResponse<R>
add inside the kit’s card in a tone (Tone::Neutral for
the plain card).
Need (layout): a card, a framed group.
Sourcefn popover<R>(&mut self, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R>
fn popover<R>(&mut self, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R>
add on the kit’s popover surface (its popover component, with
egui’s popup shadow): the look of egui-pop’s own popovers, for an
area the application places itself (a first-run notice, a hint by
a control), outside the overlay stack. The area keeps its own kind
and order; this draws only its surface.
Need (dialog): a popover’s surface in an area the application places itself.
egui’s button in a tone of the kit’s button (button.tone.*):
a Stock::Button scope (UiPop::scoped), so the button keeps
its layout, icon and shortcut text. Tone::Neutral is the plain
button.
Need (action): a button by tone (primary, danger, quiet).
Sourcefn scoped<R>(
&mut self,
stock: Stock,
tone: Tone,
add: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<R>
fn scoped<R>( &mut self, stock: Stock, tone: Tone, add: impl FnOnce(&mut Ui) -> R, ) -> InnerResponse<R>
add in a scope where egui’s own widgets of a Stock kind
(buttons, combo boxes, text fields, buttons shown on or off) are
drawn from the kit’s component, in a tone: its states become
egui’s widget visuals, so egui keeps drawing the widget
(Kit::scope). Visuals compiled with the kit: the scope only
copies them.
Need (layout): one of egui’s own widgets, styled by the kit.
Sourcefn combo_box<R>(
&mut self,
combo: ComboBox<'_>,
add: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<Option<R>>
fn combo_box<R>( &mut self, combo: ComboBox<'_>, add: impl FnOnce(&mut Ui) -> R, ) -> InnerResponse<Option<R>>
Shows egui’s combo box (widgets::combo_box, for the kit’s
arrow) with its box drawn from the kit’s combo-box
(Stock::ComboBox), add its list’s content:
ComboBox::show_ui in a scope.
Need (input): a drop-down choice (combo box).
Sourcefn scroll_area<R>(
&mut self,
area: ScrollArea,
add: impl FnOnce(&mut Ui) -> R,
) -> ScrollAreaOutput<R>
fn scroll_area<R>( &mut self, area: ScrollArea, add: impl FnOnce(&mut Ui) -> R, ) -> ScrollAreaOutput<R>
Shows egui’s scroll area with its bars drawn from the kit’s
scroll-bar (Stock::ScrollBar: the thumb’s fills and corners,
the track), add its content, drawn in this Ui’s own style.
Every scroll area already takes the bar’s width, margin,
placement and visibility from the theme (egui’s ScrollStyle);
this scope adds the colours, which egui shares with buttons.
It also answers Page Up, Page Down, Home, End and the arrows, under the
pointer or holding the focus, unless a binding or a widget inside takes
them, and takes the focus itself when it overflows with nothing focusable
inside. A widget reading those keys without sensing drags says so with
focus::takes_keys.
Need (layout): a scrolling region.
Sourcefn scroll_area_viewport<R>(
&mut self,
area: ScrollArea,
add: impl FnOnce(&mut Ui, Rect) -> R,
) -> ScrollAreaOutput<R>
fn scroll_area_viewport<R>( &mut self, area: ScrollArea, add: impl FnOnce(&mut Ui, Rect) -> R, ) -> ScrollAreaOutput<R>
UiPop::scroll_area for a view drawing only what is in view: egui’s
ScrollArea::show_viewport, add given the rectangle in view, in the
content’s own coordinates.
A view whose focusable widget lies around the area rather than in it (a
list, a grid) says it reads the keys with
focus::takes_keys, inside add, so that the
area does not become a Tab stop of its own.
Sourcefn scroll_area_rows<R>(
&mut self,
area: ScrollArea,
row_height: f32,
rows: usize,
add: impl FnOnce(&mut Ui, Range<usize>) -> R,
) -> ScrollAreaOutput<R>
fn scroll_area_rows<R>( &mut self, area: ScrollArea, row_height: f32, rows: usize, add: impl FnOnce(&mut Ui, Range<usize>) -> R, ) -> ScrollAreaOutput<R>
UiPop::scroll_area for rows rows row_height high, the Ui’s item
spacing apart: egui’s ScrollArea::show_rows, add given the rows in
view.
Need (data): many rows of equal height, only the visible ones drawn.
Sourcefn scroll_area_contained<R>(
&mut self,
area: ScrollArea,
add: impl FnOnce(&mut Ui) -> R,
) -> ScrollAreaOutput<R>
fn scroll_area_contained<R>( &mut self, area: ScrollArea, add: impl FnOnce(&mut Ui) -> R, ) -> ScrollAreaOutput<R>
UiPop::scroll_area keeping the wheel at its ends (contain_wheel),
for what nests in something else that scrolls: a list in a panel, a
preview in a pane. A plain body keeps UiPop::scroll_area, as a sizeable
text in a panel should not trap the wheel. A popup or a dialog needs
neither: it is a layer of its own, and what scrolls under it does not see
the wheel.
Sourcefn drag_cursor<'a>(
&self,
response: &'a Response,
kind: DragKind,
) -> DragCursorFor<'a>
fn drag_cursor<'a>( &self, response: &'a Response, kind: DragKind, ) -> DragCursorFor<'a>
Shows the cursor of a drag of kind for response: its hover
cursor while hovered when dragging is its only action, its drag
cursor for the whole drag, even once the pointer has left the
widget, from the kit and the pointer profile in force; the
widget may change them before it is dropped
(pointer::drag_cursor).
Sourcefn row<R>(
&mut self,
row: Row,
add: impl FnOnce(&mut Cells<'_>) -> R,
) -> InnerResponse<R>
fn row<R>( &mut self, row: Row, add: impl FnOnce(&mut Cells<'_>) -> R, ) -> InnerResponse<R>
One line of cells on Tracks, add filling them in order with
Cells::cell: sized by content, fractions, percentages or em with
minimum and maximum, Space apart, on one text baseline by
default (Row; examples in the layout module).
Sourcefn grid<R>(
&mut self,
grid: Grid,
add: impl FnOnce(&mut Cells<'_>) -> R,
) -> InnerResponse<R>
fn grid<R>( &mut self, grid: Grid, add: impl FnOnce(&mut Cells<'_>) -> R, ) -> InnerResponse<R>
Lines of cells on shared Tracks, add filling them left to
right with Cells::header and Cells::cell: a header/value
grid, folding to one column when narrow (Grid::fold_below).
Sourcefn flow<R>(
&mut self,
flow: Flow,
add: impl FnOnce(&mut FlowCells<'_>) -> R,
) -> InnerResponse<R>
fn flow<R>( &mut self, flow: Flow, add: impl FnOnce(&mut FlowCells<'_>) -> R, ) -> InnerResponse<R>
Whole cells left to right, add filling them in order with
FlowCells::cell: a cell that does not fit on the line moves to
the next one whole, child Uis included (toned buttons, enabled
scopes), as egui’s horizontal_wrapped does only for plain widgets
(Flow).
Provided Methods§
Sourcefn strong(&mut self, text: impl Into<String>) -> Response
👎Deprecated: egui’s inherent Ui::strong shadows it: use UiPop::strong_text
fn strong(&mut self, text: impl Into<String>) -> Response
Ui::strong shadows it: use UiPop::strong_textThe former name of UiPop::strong_text. egui’s Ui has an
inherent strong, and an inherent method wins over a trait one:
ui.strong(..) draws egui’s label, never this one. Call
UiPop::strong_text; ban egui::Ui::strong in Clippy’s
disallowed-methods (docs/first-app.md).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.