pub struct ChipEditBuilder { /* private fields */ }Expand description
A builder for creating a ChipEdit widget with various customization
options.
§Examples
use egui::Color32;
use egui_chip::ChipEditBuilder;
let chip_edit = ChipEditBuilder::new(",")
.unwrap()
.texts(vec!["Chip1", "Chip2", "Chip3"])
.chip_colors(Color32::from_rgb(255, 0, 0), Color32::from_rgb(0, 255, 0))
.widget_colors(Color32::from_rgb(0, 0, 255), Color32::from_rgb(255, 255, 0))
.frame(true)
.chip_size(Some([100.0, 50.0]))
.build();Implementations§
Source§impl ChipEditBuilder
impl ChipEditBuilder
Sourcepub fn texts(self, texts: impl IntoIterator<Item = impl ToString>) -> Self
pub fn texts(self, texts: impl IntoIterator<Item = impl ToString>) -> Self
Sets the initial texts for the chips.
§Arguments
texts- An iterator of strings representing the initial texts for the chips.
Sourcepub fn chip_colors(self, bg_color: Color32, text_color: Color32) -> Self
pub fn chip_colors(self, bg_color: Color32, text_color: Color32) -> Self
Sets the background and text colors for the chips within ChipEdit.
§Arguments
bg_color- The background color for the chips.text_color- The text color for the chips.
Sourcepub fn widget_colors(self, bg_color: Color32, fg_color: Color32) -> Self
pub fn widget_colors(self, bg_color: Color32, fg_color: Color32) -> Self
Sets the background and foreground colors for the widget.
§Arguments
bg_color- The background color for the widget.fg_color- The foreground color for the widget.
Sourcepub fn frame(self, frame: bool) -> Self
pub fn frame(self, frame: bool) -> Self
Sets whether the widget should have a frame.
§Arguments
frame- A boolean indicating whether the widget should have a frame.
Sourcepub fn chip_size(self, chip_size: Option<[f32; 2]>) -> Self
pub fn chip_size(self, chip_size: Option<[f32; 2]>) -> Self
Sets the size of the chips.
§Arguments
chip_size- An optional array representing the width and height of the chips.
Auto Trait Implementations§
impl Freeze for ChipEditBuilder
impl RefUnwindSafe for ChipEditBuilder
impl Send for ChipEditBuilder
impl Sync for ChipEditBuilder
impl Unpin for ChipEditBuilder
impl UnwindSafe for ChipEditBuilder
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