Skip to main content

UiExt

Trait UiExt 

Source
pub trait UiExt {
Show 66 methods // Required methods fn small_icon(&mut self, icon: &Icon) -> Response; fn medium_icon(&mut self, icon: &Icon) -> Response; fn large_icon(&mut self, icon: &Icon) -> Response; fn icon_with_size(&mut self, icon: &Icon, size: f32) -> Response; fn error_label(&mut self, text: impl Into<String>) -> Response; fn warning_label(&mut self, text: impl Into<String>) -> Response; fn success_label(&mut self, text: impl Into<String>) -> Response; fn info_label(&mut self, text: impl Into<String>) -> Response; fn muted_label(&mut self, text: impl Into<String>) -> Response; fn subdued_label(&mut self, text: impl Into<String>) -> Response; fn hint_label(&mut self, text: impl Into<String>) -> Response; fn strong_label(&mut self, text: impl Into<String>) -> Response; fn monospace_label(&mut self, text: impl Into<String>) -> Response; fn code_label(&mut self, text: impl Into<String>) -> Response; fn label_with_icon( &mut self, icon: &Icon, text: impl Into<String>, ) -> Response; fn clickable_label(&mut self, text: impl Into<String>) -> Response; fn primary_button(&mut self, text: impl Into<String>) -> Response; fn secondary_button(&mut self, text: impl Into<String>) -> Response; fn danger_button(&mut self, text: impl Into<String>) -> Response; fn icon_button(&mut self, icon: &Icon) -> Response; fn icon_button_with_tooltip( &mut self, icon: &Icon, tooltip: impl Into<String>, ) -> Response; fn toggle_button( &mut self, selected: &mut bool, text: impl Into<String>, ) -> Response; fn selectable_label_with_icon( &mut self, selected: bool, icon: &Icon, text: impl Into<String>, ) -> Response; fn selectable_value_ui<T: PartialEq + Clone>( &mut self, current: &mut T, value: T, text: impl Into<String>, ) -> Response; fn radio_value_ui<T: PartialEq + Clone>( &mut self, current: &mut T, value: T, text: impl Into<String>, ) -> Response; fn combo_select<T: PartialEq + Clone>( &mut self, id_salt: impl Hash + Debug, value: &mut T, options: impl IntoIterator<Item = T>, display: impl Fn(&T) -> String, ) -> bool; fn combo_select_width<T: PartialEq + Clone>( &mut self, id_salt: impl Hash + Debug, value: &mut T, options: impl IntoIterator<Item = T>, display: impl Fn(&T) -> String, width: f32, ) -> bool; fn combo_str_select( &mut self, id_salt: impl Hash + Debug, value: &mut String, options: &[&str], ) -> bool; fn combo_str_select_width( &mut self, id_salt: impl Hash + Debug, value: &mut String, options: &[&str], width: f32, ) -> bool; fn panel_content(&mut self, add_contents: impl FnOnce(&mut Ui)); fn section_header(&mut self, text: impl Into<String>); fn section_label(&mut self, text: impl Into<String>) -> Response; fn subsection( &mut self, text: impl Into<String>, add_contents: impl FnOnce(&mut Ui), ); fn list(&mut self, add_contents: impl FnOnce(&mut Ui)); fn right_aligned(&mut self, add_contents: impl FnOnce(&mut Ui)); fn scroll_vertical(&mut self, add_contents: impl FnOnce(&mut Ui)); fn separator_with_margin(&mut self, margin: f32); fn spaced_separator(&mut self); fn themed_separator(&mut self); fn toolbar_separator(&mut self); fn full_width(&self) -> f32; fn space_xs(&mut self); fn space_sm(&mut self); fn space_md(&mut self); fn space_lg(&mut self); fn space_xl(&mut self); fn space_xxl(&mut self); fn small_space(&mut self); fn medium_space(&mut self); fn large_space(&mut self); fn text_edit_singleline_ui(&mut self, text: &mut String) -> Response; fn text_edit_multiline_ui(&mut self, text: &mut String) -> Response; fn number_edit(&mut self, value: &mut f64) -> Response; fn search_input(&mut self, query: &mut String) -> Response; fn drag_value_f32(&mut self, value: &mut f32) -> Response; fn drag_value_with_range( &mut self, value: &mut f32, range: RangeInclusive<f32>, ) -> Response; fn drag_angle(&mut self, radians: &mut f32) -> Response; fn property_row( &mut self, label: impl Into<String>, add_value: impl FnOnce(&mut Ui), ); fn visible_rect(&self) -> Rect; fn is_visible(&self) -> bool; fn current_theme(&self) -> Theme; fn is_dark_mode(&self) -> bool; fn is_light_mode(&self) -> bool; fn is_touch_mode(&self) -> bool; fn min_touch_target(&self) -> f32; fn pnl_color(&self, value: f64) -> Color32;
}
Expand description

Extension trait for egui::Ui with convenience methods for common UI patterns.

Required Methods§

Source

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

Render a small icon (16px)

Source

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

Render a medium icon (20px)

Source

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

Render a large icon (24px)

Source

fn icon_with_size(&mut self, icon: &Icon, size: f32) -> Response

Render an icon at a specific size

Source

fn error_label(&mut self, text: impl Into<String>) -> Response

Render an error label (red text)

Source

fn warning_label(&mut self, text: impl Into<String>) -> Response

Render a warning label (orange text)

Source

fn success_label(&mut self, text: impl Into<String>) -> Response

Render a success label (green text)

Source

fn info_label(&mut self, text: impl Into<String>) -> Response

Render an info label (blue text)

Source

fn muted_label(&mut self, text: impl Into<String>) -> Response

Render a muted/secondary label (subdued text)

Source

fn subdued_label(&mut self, text: impl Into<String>) -> Response

Render a subdued label (alias for muted_label)

Source

fn hint_label(&mut self, text: impl Into<String>) -> Response

Render a hint label (small + weak, for column headers and auxiliary info)

Source

fn strong_label(&mut self, text: impl Into<String>) -> Response

Render a strong/bold label

Source

fn monospace_label(&mut self, text: impl Into<String>) -> Response

Render a monospace label

Source

fn code_label(&mut self, text: impl Into<String>) -> Response

Render a code-style label (monospace with background)

Source

fn label_with_icon(&mut self, icon: &Icon, text: impl Into<String>) -> Response

Render a label with an icon prefix

Source

fn clickable_label(&mut self, text: impl Into<String>) -> Response

Render a clickable label (looks like link)

Source

fn primary_button(&mut self, text: impl Into<String>) -> Response

Render a primary button (high emphasis)

Source

fn secondary_button(&mut self, text: impl Into<String>) -> Response

Render a secondary button (medium emphasis)

Source

fn danger_button(&mut self, text: impl Into<String>) -> Response

Render a danger button (destructive action)

Source

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

Render an icon-only button

Source

fn icon_button_with_tooltip( &mut self, icon: &Icon, tooltip: impl Into<String>, ) -> Response

Render an icon button with tooltip

Source

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

Render a toggle button

Source

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

Render a selectable label with an icon

Source

fn selectable_value_ui<T: PartialEq + Clone>( &mut self, current: &mut T, value: T, text: impl Into<String>, ) -> Response

Render a selectable value (like radio button without the circle)

Source

fn radio_value_ui<T: PartialEq + Clone>( &mut self, current: &mut T, value: T, text: impl Into<String>, ) -> Response

Render a radio-style value

Source

fn combo_select<T: PartialEq + Clone>( &mut self, id_salt: impl Hash + Debug, value: &mut T, options: impl IntoIterator<Item = T>, display: impl Fn(&T) -> String, ) -> bool

Combo box for selecting from typed options.

Replaces the 11-line ComboBox::from_id_salt → .show_ui → for … selectable_value pattern. Returns true if the value changed.

let mut theme = "dark";
let names = egui_charts::theme::presets().map(|(name, _)| name);
let changed = ui.combo_select("theme", &mut theme, names, |n| n.to_string());
Source

fn combo_select_width<T: PartialEq + Clone>( &mut self, id_salt: impl Hash + Debug, value: &mut T, options: impl IntoIterator<Item = T>, display: impl Fn(&T) -> String, width: f32, ) -> bool

Combo box for selecting from typed options with explicit width.

Source

fn combo_str_select( &mut self, id_salt: impl Hash + Debug, value: &mut String, options: &[&str], ) -> bool

Combo box for selecting a String value from &str options.

let changed = ui.combo_str_select("condition", &mut condition, &["Crossing", "Greater Than", "Less Than"]);
Source

fn combo_str_select_width( &mut self, id_salt: impl Hash + Debug, value: &mut String, options: &[&str], width: f32, ) -> bool

Combo box for selecting a String value from &str options with explicit width.

Source

fn panel_content(&mut self, add_contents: impl FnOnce(&mut Ui))

Add content within a panel-style container

Source

fn section_header(&mut self, text: impl Into<String>)

Render a section header

Source

fn section_label(&mut self, text: impl Into<String>) -> Response

Render a small uppercase section label (e.g. “BALANCE”, “MARGIN”).

Source

fn subsection( &mut self, text: impl Into<String>, add_contents: impl FnOnce(&mut Ui), )

Render a subsection with collapsible header

Source

fn list(&mut self, add_contents: impl FnOnce(&mut Ui))

Render content in a list-style container

Source

fn right_aligned(&mut self, add_contents: impl FnOnce(&mut Ui))

Right-align content within the current horizontal layout.

Replaces ui.with_layout(Layout::right_to_left(Align::Center), |ui| { ... }).

Source

fn scroll_vertical(&mut self, add_contents: impl FnOnce(&mut Ui))

Vertical scroll area that fills available space.

Replaces egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, ...).

Source

fn separator_with_margin(&mut self, margin: f32)

Add a separator with margin

Source

fn spaced_separator(&mut self)

Add a separator with small spacing above and below, the usual section divider.

Source

fn themed_separator(&mut self)

Add a horizontal separator with theme-appropriate color

Source

fn toolbar_separator(&mut self)

Vertical separator for top toolbar 1px width, 20px height, 12px padding each side

Source

fn full_width(&self) -> f32

Get full available width

Source

fn space_xs(&mut self)

Add extra small spacing (2px)

Source

fn space_sm(&mut self)

Add small spacing (4px)

Source

fn space_md(&mut self)

Add medium spacing (6px)

Source

fn space_lg(&mut self)

Add large spacing (8px)

Source

fn space_xl(&mut self)

Add extra large spacing (12px)

Source

fn space_xxl(&mut self)

Add extra extra large spacing (16px)

Source

fn small_space(&mut self)

Add small spacing (4px) - alias for space_sm

Source

fn medium_space(&mut self)

Add medium spacing (8px) - alias for space_lg

Source

fn large_space(&mut self)

Add large spacing (12px) - alias for space_xl

Source

fn text_edit_singleline_ui(&mut self, text: &mut String) -> Response

Single-line text edit

Source

fn text_edit_multiline_ui(&mut self, text: &mut String) -> Response

Multi-line text edit

Source

fn number_edit(&mut self, value: &mut f64) -> Response

Number edit field

Source

fn search_input(&mut self, query: &mut String) -> Response

Search input with icon

Source

fn drag_value_f32(&mut self, value: &mut f32) -> Response

Drag value for f32

Source

fn drag_value_with_range( &mut self, value: &mut f32, range: RangeInclusive<f32>, ) -> Response

Drag value with range

Source

fn drag_angle(&mut self, radians: &mut f32) -> Response

Drag angle (radians, displayed as degrees)

Source

fn property_row( &mut self, label: impl Into<String>, add_value: impl FnOnce(&mut Ui), )

Render a property row (label: value)

Source

fn visible_rect(&self) -> Rect

Get the visible rect

Source

fn is_visible(&self) -> bool

Check if the UI is visible

Source

fn current_theme(&self) -> Theme

Get the current theme

Source

fn is_dark_mode(&self) -> bool

Check if dark mode is active

Source

fn is_light_mode(&self) -> bool

Check if light mode is active

Source

fn is_touch_mode(&self) -> bool

Check if touch input mode is active

Source

fn min_touch_target(&self) -> f32

Get minimum touch target size for current input mode

Source

fn pnl_color(&self, value: f64) -> Color32

Get P&L color: bullish for positive, bearish for negative, neutral for zero

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl UiExt for Ui

Source§

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

Source§

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

Source§

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

Source§

fn icon_with_size(&mut self, icon: &Icon, size: f32) -> Response

Source§

fn error_label(&mut self, text: impl Into<String>) -> Response

Source§

fn warning_label(&mut self, text: impl Into<String>) -> Response

Source§

fn success_label(&mut self, text: impl Into<String>) -> Response

Source§

fn info_label(&mut self, text: impl Into<String>) -> Response

Source§

fn muted_label(&mut self, text: impl Into<String>) -> Response

Source§

fn subdued_label(&mut self, text: impl Into<String>) -> Response

Source§

fn hint_label(&mut self, text: impl Into<String>) -> Response

Source§

fn strong_label(&mut self, text: impl Into<String>) -> Response

Source§

fn monospace_label(&mut self, text: impl Into<String>) -> Response

Source§

fn code_label(&mut self, text: impl Into<String>) -> Response

Source§

fn label_with_icon(&mut self, icon: &Icon, text: impl Into<String>) -> Response

Source§

fn clickable_label(&mut self, text: impl Into<String>) -> Response

Source§

fn primary_button(&mut self, text: impl Into<String>) -> Response

Source§

fn secondary_button(&mut self, text: impl Into<String>) -> Response

Source§

fn danger_button(&mut self, text: impl Into<String>) -> Response

Source§

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

Source§

fn icon_button_with_tooltip( &mut self, icon: &Icon, tooltip: impl Into<String>, ) -> Response

Source§

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

Source§

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

Source§

fn selectable_value_ui<T: PartialEq + Clone>( &mut self, current: &mut T, value: T, text: impl Into<String>, ) -> Response

Source§

fn radio_value_ui<T: PartialEq + Clone>( &mut self, current: &mut T, value: T, text: impl Into<String>, ) -> Response

Source§

fn combo_select<T: PartialEq + Clone>( &mut self, id_salt: impl Hash + Debug, value: &mut T, options: impl IntoIterator<Item = T>, display: impl Fn(&T) -> String, ) -> bool

Source§

fn combo_select_width<T: PartialEq + Clone>( &mut self, id_salt: impl Hash + Debug, value: &mut T, options: impl IntoIterator<Item = T>, display: impl Fn(&T) -> String, width: f32, ) -> bool

Source§

fn combo_str_select( &mut self, id_salt: impl Hash + Debug, value: &mut String, options: &[&str], ) -> bool

Source§

fn combo_str_select_width( &mut self, id_salt: impl Hash + Debug, value: &mut String, options: &[&str], width: f32, ) -> bool

Source§

fn panel_content(&mut self, add_contents: impl FnOnce(&mut Ui))

Source§

fn section_header(&mut self, text: impl Into<String>)

Source§

fn section_label(&mut self, text: impl Into<String>) -> Response

Source§

fn subsection( &mut self, text: impl Into<String>, add_contents: impl FnOnce(&mut Ui), )

Source§

fn right_aligned(&mut self, add_contents: impl FnOnce(&mut Ui))

Source§

fn scroll_vertical(&mut self, add_contents: impl FnOnce(&mut Ui))

Source§

fn list(&mut self, add_contents: impl FnOnce(&mut Ui))

Source§

fn separator_with_margin(&mut self, margin: f32)

Source§

fn spaced_separator(&mut self)

Source§

fn themed_separator(&mut self)

Source§

fn toolbar_separator(&mut self)

Source§

fn full_width(&self) -> f32

Source§

fn space_xs(&mut self)

Source§

fn space_sm(&mut self)

Source§

fn space_md(&mut self)

Source§

fn space_lg(&mut self)

Source§

fn space_xl(&mut self)

Source§

fn space_xxl(&mut self)

Source§

fn small_space(&mut self)

Source§

fn medium_space(&mut self)

Source§

fn large_space(&mut self)

Source§

fn text_edit_singleline_ui(&mut self, text: &mut String) -> Response

Source§

fn text_edit_multiline_ui(&mut self, text: &mut String) -> Response

Source§

fn number_edit(&mut self, value: &mut f64) -> Response

Source§

fn search_input(&mut self, query: &mut String) -> Response

Source§

fn drag_value_f32(&mut self, value: &mut f32) -> Response

Source§

fn drag_value_with_range( &mut self, value: &mut f32, range: RangeInclusive<f32>, ) -> Response

Source§

fn drag_angle(&mut self, radians: &mut f32) -> Response

Source§

fn property_row( &mut self, label: impl Into<String>, add_value: impl FnOnce(&mut Ui), )

Source§

fn visible_rect(&self) -> Rect

Source§

fn is_visible(&self) -> bool

Source§

fn current_theme(&self) -> Theme

Source§

fn is_dark_mode(&self) -> bool

Source§

fn is_light_mode(&self) -> bool

Source§

fn is_touch_mode(&self) -> bool

Source§

fn min_touch_target(&self) -> f32

Source§

fn pnl_color(&self, value: f64) -> Color32

Implementors§