diff --git a/imgui/src/widget/combo_box.rs b/imgui/src/widget/combo_box.rs index 56984ec..557ccf3 100644 --- a/imgui/src/widget/combo_box.rs +++ b/imgui/src/widget/combo_box.rs @@ -54,25 +54,37 @@ pub struct ComboBoxFlags: u32 { /// Builder for a combo box widget #[derive(Copy, Clone, Debug)] #[must_use] -pub struct ComboBox { - label: T, - preview_value: Option

, +pub struct ComboBox { + label: Label, + preview_value: Option, flags: ComboBoxFlags, } -impl<'a, T: AsRef, P: AsRef> ComboBox { +impl> ComboBox

) -> Self { + pub fn new(label: Label) -> Self { ComboBox { label, - preview_value, + preview_value: None, flags: ComboBoxFlags::empty(), } } +} + +impl, Preview: AsRef> ComboBox { + pub fn preview_value>( + self, + preview_value: Preview2, + ) -> ComboBox { + ComboBox { + label: self.label, + preview_value: Some(preview_value), + flags: self.flags, + } + } /// Replaces all current settings with the given flags. - #[inline] pub fn flags(mut self, flags: ComboBoxFlags) -> Self { self.flags = flags; self @@ -81,7 +93,6 @@ impl<'a, T: AsRef, P: AsRef> ComboBox { /// Enables/disables aligning the combo box popup toward the left. /// /// Disabled by default. - #[inline] pub fn popup_align_left(mut self, popup_align_left: bool) -> Self { self.flags .set(ComboBoxFlags::POPUP_ALIGN_LEFT, popup_align_left);