Module widgets

Source
Expand description

Widgets are pieces of GUI such as Label, Button, Slider etc.

Example widget uses:

  • ui.add(Label::new("Text").text_color(color::red));
  • if ui.add(Button::new("Click me")).clicked() { … }

Re-exports§

pub use self::text_edit::TextBuffer;
pub use self::text_edit::TextEdit;

Modules§

color_picker
Color picker widgets.
text_edit

Structs§

Button
Clickable button with text.
Checkbox
Boolean on/off control with text label.
DragValue
A numeric value that you can change by dragging the number. More compact than a crate::Slider.
FrameDurations
Stores the durations between each frame of an animated image
Hyperlink
A clickable hyperlink, e.g. to "https://github.com/emilk/egui".
Image
A widget which displays an image.
ImageButton
A clickable image within a frame.
ImageOptions
ImageSize
This type determines the constraints on how the size of an image should be calculated.
Label
Static text.
Link
Clickable text, that looks like a hyperlink.
ProgressBar
A simple progress bar.
RadioButton
One out of several alternatives, either selected or not.
SelectableLabel
One out of several alternatives, either selected or not. Will mark selected items with a different background color. An alternative to crate::RadioButton and crate::Checkbox.
Separator
A visual separator. A horizontal or vertical line (depending on crate::Layout).
Slider
Control a number with a slider.
Spinner
A spinner widget used to indicate loading.

Enums§

ImageFit
This type determines how the image should try to fit within the UI.
ImageSource
This type tells the Ui how to load an image.
SliderClamping
Specifies how values in a Slider are clamped.
SliderOrientation
Specifies the orientation of a Slider.

Traits§

Widget
Anything implementing Widget can be added to a Ui with Ui::add.
WidgetWithState
Helper so that you can do e.g. TextEdit::State::load.

Functions§

decode_animated_image_uri
Extracts uri and frame index
global_dark_light_mode_buttonsDeprecated
Show larger buttons for switching between light and dark mode (globally).
global_dark_light_mode_switchDeprecated
Show a small button to switch to/from dark/light mode (globally).
global_theme_preference_buttons
Show larger buttons for switching between light and dark mode (globally).
global_theme_preference_switch
Show a small button to switch to/from dark/light mode (globally).
has_gif_magic_header
Checks if bytes are gifs
has_webp_header
Checks if bytes are webp
paint_texture_at
reset_button
Show a button to reset a value to its default. The button is only enabled if the value does not already have its original value.
reset_button_with
Show a button to reset a value to its default. The button is only enabled if the value does not already have its original value.
stroke_uiDeprecated