pub struct EguiUiBuilder<'a> { /* private fields */ }Expand description
Wraps &mut egui::Ui to implement the abstract [UiBuilder] trait.
Implementations§
Trait Implementations§
Source§impl UiBuilder for EguiUiBuilder<'_>
impl UiBuilder for EguiUiBuilder<'_>
Source§fn small_label(&mut self, text: &str)
fn small_label(&mut self, text: &str)
Small / secondary label.
Push-button. Returns
true the frame it is clicked.Small push-button (less padding).
Source§fn selectable_label(&mut self, active: bool, text: &str) -> bool
fn selectable_label(&mut self, active: bool, text: &str) -> bool
Selectable label — highlights when
active is true.
Returns true when clicked.Source§fn selectable_label_double_clicked(&mut self, active: bool, text: &str) -> bool
fn selectable_label_double_clicked(&mut self, active: bool, text: &str) -> bool
Selectable label that returns
true when double-clicked.Source§fn checkbox(&mut self, checked: &mut bool, text: &str) -> bool
fn checkbox(&mut self, checked: &mut bool, text: &str) -> bool
Boolean checkbox. Returns
true when toggled.Source§fn drag_value_f32(&mut self, label: &str, value: &mut f32, speed: f32) -> bool
fn drag_value_f32(&mut self, label: &str, value: &mut f32, speed: f32) -> bool
Draggable
f32 value. Returns true when changed.Source§fn slider_f32(
&mut self,
label: &str,
value: &mut f32,
min: f32,
max: f32,
) -> bool
fn slider_f32( &mut self, label: &str, value: &mut f32, min: f32, max: f32, ) -> bool
Slider for
f32. Returns true when changed.Source§fn text_edit_singleline(&mut self, text: &mut String) -> bool
fn text_edit_singleline(&mut self, text: &mut String) -> bool
Single-line text input. Returns
true when changed.Source§fn vec3_editor(&mut self, label: &str, value: &mut [f32; 3], speed: f32) -> bool
fn vec3_editor(&mut self, label: &str, value: &mut [f32; 3], speed: f32) -> bool
Editable Vec3 as three drag-values (X / Y / Z). Returns
true when any component changed.Source§fn color_edit(&mut self, label: &str, color: &mut [f32; 4]) -> bool
fn color_edit(&mut self, label: &str, color: &mut [f32; 4]) -> bool
RGBA color picker. Returns
true when changed.Source§fn combo_box(
&mut self,
id_salt: &str,
label: &str,
current: &mut usize,
options: &[&str],
) -> bool
fn combo_box( &mut self, id_salt: &str, label: &str, current: &mut usize, options: &[&str], ) -> bool
Drop-down combo box picking among string options.
current is the index of the currently selected item.
Returns true when the selection changed.
Dropdown over options, writing the picked index into current. Read moreSource§fn horizontal(&mut self, f: &mut dyn FnMut(&mut dyn UiBuilder))
fn horizontal(&mut self, f: &mut dyn FnMut(&mut dyn UiBuilder))
Horizontal layout — children placed left-to-right.
Source§fn vertical(&mut self, f: &mut dyn FnMut(&mut dyn UiBuilder))
fn vertical(&mut self, f: &mut dyn FnMut(&mut dyn UiBuilder))
Vertical layout (default, but useful inside a horizontal).
Source§fn collapsing(
&mut self,
header: &str,
default_open: bool,
f: &mut dyn FnMut(&mut dyn UiBuilder),
)
fn collapsing( &mut self, header: &str, default_open: bool, f: &mut dyn FnMut(&mut dyn UiBuilder), )
Collapsible section with a header.
Source§fn scroll_area(&mut self, id: &str, f: &mut dyn FnMut(&mut dyn UiBuilder))
fn scroll_area(&mut self, id: &str, f: &mut dyn FnMut(&mut dyn UiBuilder))
Scrollable area.
Source§fn viewport_image(
&mut self,
handle: ViewportTextureHandle,
size: [f32; 2],
) -> Option<[f32; 2]>
fn viewport_image( &mut self, handle: ViewportTextureHandle, size: [f32; 2], ) -> Option<[f32; 2]>
Display a viewport texture at the given size. Read more
Source§fn is_last_item_double_clicked(&self) -> bool
fn is_last_item_double_clicked(&self) -> bool
Returns
true if the last widget was double-clicked.Source§fn is_last_item_hovered(&self) -> bool
fn is_last_item_hovered(&self) -> bool
Returns
true if the last widget is currently hovered by the pointer.Source§fn is_last_item_enter_pressed(&self) -> bool
fn is_last_item_enter_pressed(&self) -> bool
Returns
true if Enter was pressed while the last widget had focus.Source§fn is_last_item_escape_pressed(&self) -> bool
fn is_last_item_escape_pressed(&self) -> bool
Returns
true if Escape was pressed while the last widget had focus.Shows a right-click context menu on the last widget.
The closure is called to build menu content when the menu is open.
Shows a right-click context menu when the user right-clicks anywhere on
the current panel background (not on a specific widget). Read more
Close the currently open context menu (if any). Read more
Shows a sub-menu button inside a context menu.
Unlike
collapsing, this creates a proper egui sub-menu that doesn’t
steal focus from the parent context menu.Source§fn paint_line(
&mut self,
from: [f32; 2],
to: [f32; 2],
color: [f32; 4],
thickness: f32,
)
fn paint_line( &mut self, from: [f32; 2], to: [f32; 2], color: [f32; 4], thickness: f32, )
Paints a line in window-space coordinates.
Source§fn paint_rect_filled(
&mut self,
min: [f32; 2],
size: [f32; 2],
color: [f32; 4],
rounding: f32,
)
fn paint_rect_filled( &mut self, min: [f32; 2], size: [f32; 2], color: [f32; 4], rounding: f32, )
Paints a filled rectangle in window-space coordinates.
Source§fn paint_text(&mut self, pos: [f32; 2], color: [f32; 4], text: &str)
fn paint_text(&mut self, pos: [f32; 2], color: [f32; 4], text: &str)
Paints text at a window-space position.
Source§fn available_width(&self) -> f32
fn available_width(&self) -> f32
Available width in the current layout region.
Source§fn available_height(&self) -> f32
fn available_height(&self) -> f32
Available height in the current layout region.
Source§fn panel_rect(&self) -> [f32; 4]
fn panel_rect(&self) -> [f32; 4]
Returns the current paint region in screen-space coordinates as
[min_x, min_y, width, height]. Read moreSource§fn screen_rect(&self) -> [f32; 4]
fn screen_rect(&self) -> [f32; 4]
Source§fn paint_rect_stroke(
&mut self,
min: [f32; 2],
size: [f32; 2],
color: [f32; 4],
rounding: f32,
thickness: f32,
)
fn paint_rect_stroke( &mut self, min: [f32; 2], size: [f32; 2], color: [f32; 4], rounding: f32, thickness: f32, )
Paints a stroked (outlined) rectangle in window-space.
Source§fn paint_circle_filled(
&mut self,
center: [f32; 2],
radius: f32,
color: [f32; 4],
)
fn paint_circle_filled( &mut self, center: [f32; 2], radius: f32, color: [f32; 4], )
Paints a filled circle.
Source§fn paint_circle_stroke(
&mut self,
center: [f32; 2],
radius: f32,
color: [f32; 4],
thickness: f32,
)
fn paint_circle_stroke( &mut self, center: [f32; 2], radius: f32, color: [f32; 4], thickness: f32, )
Paints a circle outline.
Source§fn paint_text_styled(
&mut self,
pos: [f32; 2],
text: &str,
size: f32,
color: [f32; 4],
family: FontFamilyHint,
align: TextAlign,
)
fn paint_text_styled( &mut self, pos: [f32; 2], text: &str, size: f32, color: [f32; 4], family: FontFamilyHint, align: TextAlign, )
Paints text with explicit size, font family and alignment.
Source§fn paint_path_filled(&mut self, points: &[[f32; 2]], color: [f32; 4])
fn paint_path_filled(&mut self, points: &[[f32; 2]], color: [f32; 4])
Paints a closed polygon path (for diamonds, triangles, custom shapes).
points is a list of [x, y] window-space coordinates.Source§fn interact_rect(&mut self, id_salt: &str, rect: [f32; 4]) -> Interaction
fn interact_rect(&mut self, id_salt: &str, rect: [f32; 4]) -> Interaction
Allocates a clickable region at the given absolute window-space rect
and reports interaction this frame. The
id_salt disambiguates
overlapping or repeatedly-painted hot regions.Source§fn key_pressed(&self, key: KeyCode) -> bool
fn key_pressed(&self, key: KeyCode) -> bool
Whether
key was pressed this frame and no text field is consuming
keyboard input. Read moreSource§fn keyboard_captured(&self) -> bool
fn keyboard_captured(&self) -> bool
Whether any widget currently holds keyboard focus — typically a text
field being typed into. Read more
Source§fn raw_key_pressed(&self, key: KeyCode) -> bool
fn raw_key_pressed(&self, key: KeyCode) -> bool
Whether
key was pressed this frame, regardless of focus. Read moreSource§fn focus_last_item(&mut self)
fn focus_last_item(&mut self)
Asks the backend to give the last widget keyboard focus. Read more
Source§fn push_clip_rect(&mut self, rect: [f32; 4])
fn push_clip_rect(&mut self, rect: [f32; 4])
Source§fn pop_clip_rect(&mut self)
fn pop_clip_rect(&mut self)
Restores the clip region saved by
push_clip_rect.Source§fn scroll_delta_in(&self, rect: [f32; 4]) -> f32
fn scroll_delta_in(&self, rect: [f32; 4]) -> f32
Accumulated scroll-wheel delta this frame while the pointer is inside
rect, in points. Positive means the content should move down
(the user scrolled towards the top of the list). Read moreSource§fn dnd_attach_drag_payload(&mut self, payload: u64)
fn dnd_attach_drag_payload(&mut self, payload: u64)
Attaches a drag payload (typically an entity ID packed into a
u64) to the last interacted region (the most recent
interact_rect call). Should be called
immediately after interact_rect. Avoids creating a competing
hit-target on the same rect, which would steal pointer events.
Default: no-op.Source§fn dnd_take_drop_payload(&mut self) -> Option<u64>
fn dnd_take_drop_payload(&mut self) -> Option<u64>
If a drag-and-drop just released on the last interacted region,
returns its
u64 payload. Should be called after
interact_rect. Default: no-op.Source§fn pointer_position(&self) -> Option<[f32; 2]>
fn pointer_position(&self) -> Option<[f32; 2]>
Current pointer (cursor) position in window-space
[x, y], or None
when the pointer is outside the window or unknown. Drop targets use this
to place a dropped item where the cursor released (e.g. unproject the
drop point into the 3D scene). Default: None.Source§fn is_last_item_dragged(&self) -> bool
fn is_last_item_dragged(&self) -> bool
Returns
true if the last interacted region is currently being dragged.
Used by drag sources to paint a cursor-following ghost so the user can
see a drag is in progress. Default: false.Source§fn is_drag_active(&self) -> bool
fn is_drag_active(&self) -> bool
true while any u64 drag payload is in flight this frame (a drag
started and hasn’t been released). Drop targets use it to show a
“droppable here” highlight. Default: false.Source§fn inline_text_field(
&mut self,
rect: [f32; 4],
id_salt: &str,
text: &mut String,
request_focus: bool,
) -> InlineEditEvent
fn inline_text_field( &mut self, rect: [f32; 4], id_salt: &str, text: &mut String, request_focus: bool, ) -> InlineEditEvent
Draws a single-line text editor at an absolute window-space rect and
returns its outcome this frame (see [
InlineEditEvent]). Unlike the
generic region_at + response-tracking helpers, this
is self-contained: it owns the widget’s Response, so Enter / Escape /
focus-loss are detected reliably. Pass request_focus = true on the
frame the field first appears so the user can type immediately.
Default: no-op returning [InlineEditEvent::Idle].Source§fn overlay_rect_filled(
&mut self,
min: [f32; 2],
size: [f32; 2],
color: [f32; 4],
rounding: f32,
)
fn overlay_rect_filled( &mut self, min: [f32; 2], size: [f32; 2], color: [f32; 4], rounding: f32, )
Paints a filled rounded rect in an unclipped top overlay layer
(above all panels). For cursor-following affordances like drag ghosts
that must remain visible outside the current panel’s clip rect.
Default: no-op.
Source§fn overlay_rect_stroke(
&mut self,
min: [f32; 2],
size: [f32; 2],
color: [f32; 4],
rounding: f32,
thickness: f32,
)
fn overlay_rect_stroke( &mut self, min: [f32; 2], size: [f32; 2], color: [f32; 4], rounding: f32, thickness: f32, )
Stroked rounded rect in the unclipped overlay layer. See
overlay_rect_filled. Default: no-op.Source§fn overlay_text(
&mut self,
pos: [f32; 2],
text: &str,
size: f32,
color: [f32; 4],
family: FontFamilyHint,
)
fn overlay_text( &mut self, pos: [f32; 2], text: &str, size: f32, color: [f32; 4], family: FontFamilyHint, )
Text in the unclipped overlay layer. See
overlay_rect_filled. Default: no-op.Source§fn tooltip_for_last(&mut self, text: &str)
fn tooltip_for_last(&mut self, text: &str)
Attaches a tooltip to the most recently created widget / interaction.
Source§fn region_at(
&mut self,
id_salt: &str,
rect: [f32; 4],
f: &mut dyn FnMut(&mut dyn UiBuilder),
)
fn region_at( &mut self, id_salt: &str, rect: [f32; 4], f: &mut dyn FnMut(&mut dyn UiBuilder), )
Pushes a child layout region at the given absolute screen-space rect.
Inside the closure,
&mut dyn UiBuilder reflects the constrained
region — egui-native widgets (button, text_edit_singleline,
vec3_editor, …) lay out within it instead of the parent panel.
Used by composite widgets (inspector cards) that paint their frame
absolutely but want native egui controls inside. Read moreSource§fn cursor_pos(&self) -> [f32; 2]
fn cursor_pos(&self) -> [f32; 2]
Returns the current layout cursor in screen-space
(x, y). Useful for
composites that need to know where to place an absolutely-painted
frame before advancing egui’s natural layout.Source§fn allocate_size(&mut self, size: [f32; 2]) -> [f32; 4]
fn allocate_size(&mut self, size: [f32; 2]) -> [f32; 4]
Allocates
[width, height] of space at the current cursor in
the active layout direction. Returns the resulting rect as
[x, y, w, h] — feed it to the paint primitives. Read moreSource§fn measure_text(
&self,
text: &str,
size: f32,
family: FontFamilyHint,
) -> [f32; 2]
fn measure_text( &self, text: &str, size: f32, family: FontFamilyHint, ) -> [f32; 2]
Measures the rendered size of
text at size points using family.
Returns [width, height] in logical points. Read moreSource§fn top_inset_panel(
&mut self,
id: &str,
height: f32,
f: &mut dyn FnMut(&mut dyn UiBuilder),
)
fn top_inset_panel( &mut self, id: &str, height: f32, f: &mut dyn FnMut(&mut dyn UiBuilder), )
Inset panel along the top edge of the current region. Read more
Source§fn bottom_inset_panel(
&mut self,
id: &str,
height: f32,
f: &mut dyn FnMut(&mut dyn UiBuilder),
)
fn bottom_inset_panel( &mut self, id: &str, height: f32, f: &mut dyn FnMut(&mut dyn UiBuilder), )
Inset panel along the bottom edge — counterpart of
top_inset_panel.Source§fn left_inset_panel(
&mut self,
id: &str,
width: f32,
f: &mut dyn FnMut(&mut dyn UiBuilder),
)
fn left_inset_panel( &mut self, id: &str, width: f32, f: &mut dyn FnMut(&mut dyn UiBuilder), )
Inset sidebar on the left edge of the current region. Read more
Source§fn right_inset_panel(
&mut self,
id: &str,
width: f32,
f: &mut dyn FnMut(&mut dyn UiBuilder),
)
fn right_inset_panel( &mut self, id: &str, width: f32, f: &mut dyn FnMut(&mut dyn UiBuilder), )
Inset sidebar on the right edge — counterpart of
left_inset_panel.Source§fn central_inset(&mut self, f: &mut dyn FnMut(&mut dyn UiBuilder))
fn central_inset(&mut self, f: &mut dyn FnMut(&mut dyn UiBuilder))
Central region — fills whatever space remains after the inset
panels above were placed.
Source§fn modal(
&mut self,
id: &str,
size: [f32; 2],
f: &mut dyn FnMut(&mut dyn UiBuilder),
)
fn modal( &mut self, id: &str, size: [f32; 2], f: &mut dyn FnMut(&mut dyn UiBuilder), )
Open a modal dialog overlaid on top of the current screen. Read more
Source§fn frame_box(
&mut self,
margin: Margin,
fill: Option<LinearRgba>,
stroke: Stroke,
radius: CornerRadius,
f: &mut dyn FnMut(&mut dyn UiBuilder),
)
fn frame_box( &mut self, margin: Margin, fill: Option<LinearRgba>, stroke: Stroke, radius: CornerRadius, f: &mut dyn FnMut(&mut dyn UiBuilder), )
Wraps
f in a visual frame: paints the optional fill / stroke /
rounded background first, then runs f inside the inner
content rect (after applying margin). Read moreAuto Trait Implementations§
impl<'a> Freeze for EguiUiBuilder<'a>
impl<'a> !RefUnwindSafe for EguiUiBuilder<'a>
impl<'a> Send for EguiUiBuilder<'a>
impl<'a> Sync for EguiUiBuilder<'a>
impl<'a> Unpin for EguiUiBuilder<'a>
impl<'a> UnsafeUnpin for EguiUiBuilder<'a>
impl<'a> !UnwindSafe for EguiUiBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.