Trait re_viewer::external::re_ui::UiExt

source ·
pub trait UiExt {
Show 45 methods // Required methods fn ui(&self) -> &Ui; fn ui_mut(&mut self) -> &mut Ui; // Provided methods fn success_label(&mut self, success_text: &str) -> Response { ... } fn warning_label(&mut self, warning_text: &str) -> Response { ... } fn error_with_details_on_hover(&mut self, error_text: &str) -> Response { ... } fn error_label_background_color(&self) -> Color32 { ... } fn error_label(&mut self, error_text: &str) -> Response { ... } fn small_icon_button(&mut self, icon: &Icon) -> Response { ... } fn small_icon_button_widget<'a>(&self, icon: &'a Icon) -> Button<'a> { ... } fn medium_icon_toggle_button( &mut self, icon: &Icon, selected: &mut bool ) -> Response { ... } fn large_button_impl( &mut self, icon: &Icon, bg_fill: Option<Color32>, tint: Option<Color32> ) -> Response { ... } fn re_checkbox( &mut self, selected: &mut bool, text: impl Into<WidgetText> ) -> Response { ... } fn checkbox_indeterminate( &mut self, selected: &mut bool, text: impl Into<WidgetText>, indeterminate: bool ) -> Response { ... } fn re_radio_value<Value>( &mut self, current_value: &mut Value, alternative: Value, text: impl Into<WidgetText> ) -> Response where Value: PartialEq { ... } fn large_button(&mut self, icon: &Icon) -> Response { ... } fn large_button_selected(&mut self, icon: &Icon, selected: bool) -> Response { ... } fn visibility_toggle_button(&mut self, visible: &mut bool) -> Response { ... } fn full_span_separator(&mut self) -> Response { ... } fn list_item_popup<R>( &self, popup_id: Id, widget_response: &Response, vertical_offset: f32, add_contents: impl FnOnce(&mut Ui) -> R ) -> Option<R> { ... } fn panel_content<R>(&mut self, add_contents: impl FnOnce(&mut Ui) -> R) -> R { ... } fn panel_title_bar(&mut self, label: &str, hover_text: Option<&str>) { ... } fn panel_title_bar_with_buttons<R>( &mut self, label: &str, hover_text: Option<&str>, add_right_buttons: impl FnOnce(&mut Ui) -> R ) -> R { ... } fn collapsing_header<R>( &mut self, label: &str, default_open: bool, add_body: impl FnOnce(&mut Ui) -> R ) -> CollapsingResponse<R> { ... } fn maybe_collapsing_header<R>( &mut self, collapsing: bool, label: &str, default_open: bool, add_body: impl FnOnce(&mut Ui) -> R ) -> CollapsingResponse<R> { ... } fn paint_collapsing_triangle( &self, openness: f32, center: Pos2, visuals: &WidgetVisuals ) { ... } fn grid_left_hand_label(&mut self, label: &str) -> Response { ... } fn selection_grid(&self, id: &str) -> Grid { ... } fn draw_shadow_line(&self, rect: Rect, direction: Direction) { ... } fn list_item(&self) -> ListItem { ... } fn list_item_flat_noninteractive( &mut self, content: impl ListItemContent ) -> Response { ... } fn list_item_collapsible_noninteractive_label<R>( &mut self, label: impl Into<WidgetText>, default_open: bool, children_ui: impl FnOnce(&mut Ui) -> R ) -> Option<R> { ... } fn section_collapsing_header<'a>( &self, label: impl Into<WidgetText> ) -> SectionCollapsingHeader<'a> { ... } fn selectable_label_with_icon( &mut self, icon: &Icon, text: impl Into<WidgetText>, selected: bool, style: LabelStyle ) -> Response { ... } fn paint_time_cursor( &self, painter: &Painter, response: &Response, x: f32, y: Rangef ) { ... } fn bullet(&mut self, color: Color32) { ... } fn center<R>( &mut self, id_salt: impl Hash, add_contents: impl FnOnce(&mut Ui) -> R ) -> R { ... } fn toggle_switch(&mut self, height: f32, on: &mut bool) -> Response { ... } fn re_hyperlink( &mut self, text: impl Into<WidgetText>, url: impl ToString ) -> Response { ... } fn native_window_buttons_ui(&mut self) { ... } fn help_hover_button(&mut self) -> Response { ... } fn markdown_ui(&mut self, markdown: &str) { ... } fn drop_down_menu( &mut self, id_salt: impl Hash, selected_text: String, content: impl FnOnce(&mut Ui) ) { ... } fn full_span_scope<R>( &mut self, span: impl Into<Rangef>, content: impl FnOnce(&mut Ui) -> R ) -> R { ... } fn full_span(&self) -> Rangef { ... } fn selectable_toggle<R>(&mut self, content: impl FnOnce(&mut Ui) -> R) -> R { ... }
}
Expand description

Rerun custom extensions to [egui::Ui].

Required Methods§

source

fn ui(&self) -> &Ui

source

fn ui_mut(&mut self) -> &mut Ui

Provided Methods§

source

fn success_label(&mut self, success_text: &str) -> Response

Shows a success label with a large border.

If you don’t want a border, use crate::ContextExt::success_text.

source

fn warning_label(&mut self, warning_text: &str) -> Response

Shows a warning label with a large border.

If you don’t want a border, use crate::ContextExt::warning_text.

source

fn error_with_details_on_hover(&mut self, error_text: &str) -> Response

Shows a small error label with the given text on hover and copies the text to the clipboard on click with a large border.

This has a large border! If you don’t want a border, use crate::ContextExt::error_text.

source

fn error_label_background_color(&self) -> Color32

source

fn error_label(&mut self, error_text: &str) -> Response

Shows an error label with the entire error text and copies the text to the clipboard on click.

Use this only if the error message is short, or you have a lot of room. Otherwise, use Self::error_with_details_on_hover.

This has a large border! If you don’t want a border, use crate::ContextExt::error_text.

source

fn small_icon_button(&mut self, icon: &Icon) -> Response

source

fn small_icon_button_widget<'a>(&self, icon: &'a Icon) -> Button<'a>

source

fn medium_icon_toggle_button( &mut self, icon: &Icon, selected: &mut bool ) -> Response

source

fn large_button_impl( &mut self, icon: &Icon, bg_fill: Option<Color32>, tint: Option<Color32> ) -> Response

source

fn re_checkbox( &mut self, selected: &mut bool, text: impl Into<WidgetText> ) -> Response

source

fn checkbox_indeterminate( &mut self, selected: &mut bool, text: impl Into<WidgetText>, indeterminate: bool ) -> Response

source

fn re_radio_value<Value>( &mut self, current_value: &mut Value, alternative: Value, text: impl Into<WidgetText> ) -> Response
where Value: PartialEq,

source

fn large_button(&mut self, icon: &Icon) -> Response

source

fn large_button_selected(&mut self, icon: &Icon, selected: bool) -> Response

source

fn visibility_toggle_button(&mut self, visible: &mut bool) -> Response

source

fn full_span_separator(&mut self) -> Response

Create a separator similar to [egui::Separator] but with the full span behavior.

The span is determined using crate::UiExt::full_span. Contrary to [egui::Separator], this separator allocates a single pixel in height, as spacing is typically handled by content when full span highlighting is used.

source

fn list_item_popup<R>( &self, popup_id: Id, widget_response: &Response, vertical_offset: f32, add_contents: impl FnOnce(&mut Ui) -> R ) -> Option<R>

Popup similar to [egui::popup_below_widget] but suitable for use with crate::list_item::ListItem.

Note that add_contents is called within a crate::list_item::list_item_scope.

source

fn panel_content<R>(&mut self, add_contents: impl FnOnce(&mut Ui) -> R) -> R

source

fn panel_title_bar(&mut self, label: &str, hover_text: Option<&str>)

Static title bar used to separate panels into section.

This title bar is meant to be used in a panel with proper inner margin and clip rectangle set.

Use UiExt::panel_title_bar_with_buttons to display buttons in the title bar.

source

fn panel_title_bar_with_buttons<R>( &mut self, label: &str, hover_text: Option<&str>, add_right_buttons: impl FnOnce(&mut Ui) -> R ) -> R

Static title bar used to separate panels into section with custom buttons when hovered. h This title bar is meant to be used in a panel with proper inner margin and clip rectangle set.

source

fn collapsing_header<R>( &mut self, label: &str, default_open: bool, add_body: impl FnOnce(&mut Ui) -> R ) -> CollapsingResponse<R>

Replacement for [egui::CollapsingHeader] that respect our style.

The layout is fine-tuned to fit well in inspector panels (such as Rerun’s Selection Panel) where the collapsing header should align nicely with checkboxes and other controls.

source

fn maybe_collapsing_header<R>( &mut self, collapsing: bool, label: &str, default_open: bool, add_body: impl FnOnce(&mut Ui) -> R ) -> CollapsingResponse<R>

Conditionally collapsing header.

Display content under a header that is conditionally collapsible. If collapsing is true, this is equivalent to Self::collapsing_header. If collapsing is false, the content is displayed under a static, non-collapsible header.

source

fn paint_collapsing_triangle( &self, openness: f32, center: Pos2, visuals: &WidgetVisuals )

Paint a collapsing triangle with rounded corners.

Alternative to [egui::collapsing_header::paint_default_icon]. Note that the triangle is painted with a fixed size.

source

fn grid_left_hand_label(&mut self, label: &str) -> Response

Workaround for putting a label into a grid at the top left of its row.

You only need to use this if you expect the right side to have multi-line entries.

source

fn selection_grid(&self, id: &str) -> Grid

Two-column grid to be used in selection view.

Use this when you expect the right column to have multi-line entries.

source

fn draw_shadow_line(&self, rect: Rect, direction: Direction)

Draws a shadow into the given rect with the shadow direction given from dark to light

source

fn list_item(&self) -> ListItem

Convenience function to create a list_item::ListItem.

source

fn list_item_flat_noninteractive( &mut self, content: impl ListItemContent ) -> Response

Convenience for adding a flat non-interactive list_item::ListItemContent

source

fn list_item_collapsible_noninteractive_label<R>( &mut self, label: impl Into<WidgetText>, default_open: bool, children_ui: impl FnOnce(&mut Ui) -> R ) -> Option<R>

Convenience to create a non-interactive, collapsible list_item::ListItem with just a label. The children UI is wrapped in a list_item::list_item_scope.

source

fn section_collapsing_header<'a>( &self, label: impl Into<WidgetText> ) -> SectionCollapsingHeader<'a>

Convenience function to create a crate::SectionCollapsingHeader.

source

fn selectable_label_with_icon( &mut self, icon: &Icon, text: impl Into<WidgetText>, selected: bool, style: LabelStyle ) -> Response

source

fn paint_time_cursor( &self, painter: &Painter, response: &Response, x: f32, y: Rangef )

Paints a time cursor for indicating the time on a time axis along x.

source

fn bullet(&mut self, color: Color32)

Draw a bullet (for text lists).

source

fn center<R>( &mut self, id_salt: impl Hash, add_contents: impl FnOnce(&mut Ui) -> R ) -> R

Center the content within [egui::Ui::max_rect()].

The add_contents closure is executed in the context of a vertical layout.

source

fn toggle_switch(&mut self, height: f32, on: &mut bool) -> Response

Binary toggle switch.

Adapted from egui_demo_lib/src/demo/toggle_switch.rs

Helper for adding a list-item hyperlink.

source

fn native_window_buttons_ui(&mut self)

Show some close/maximize/minimize buttons for the native window.

Assumes it is in a right-to-left layout.

Use when crate::CUSTOM_WINDOW_DECORATIONS is set.

source

fn help_hover_button(&mut self) -> Response

source

fn markdown_ui(&mut self, markdown: &str)

Show some markdown

source

fn drop_down_menu( &mut self, id_salt: impl Hash, selected_text: String, content: impl FnOnce(&mut Ui) )

A drop-down menu with a list of options.

Designed for use with list_item content.

Use this instead of using [egui::ComboBox] directly.

source

fn full_span_scope<R>( &mut self, span: impl Into<Rangef>, content: impl FnOnce(&mut Ui) -> R ) -> R

Use the provided range as full span for the nested content.

See Self::full_span for details.

source

fn full_span(&self) -> Rangef

Retrieve the current full-span scope.

By default, this method uses a heuristics to identify which parent Ui’s boundary should be used (e.g. top-level panel, tooltip, etc.). Use Self::full_span_scope to set a specific range as full span.

source

fn selectable_toggle<R>(&mut self, content: impl FnOnce(&mut Ui) -> R) -> R

Style [egui::Ui::selectable_value]s and friends into a horizontal, toggle-like widget.

§Example
let mut flag = false;
ui.selectable_toggle(|ui| {
    ui.selectable_value(&mut flag, false, "Inactive");
    ui.selectable_value(&mut flag, true, "Active");
});

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl UiExt for Ui

source§

fn ui(&self) -> &Ui

source§

fn ui_mut(&mut self) -> &mut Ui

Implementors§