diff --git a/imgui-sys/src/lib.rs b/imgui-sys/src/lib.rs index 6b7eb61..46e0f07 100644 --- a/imgui-sys/src/lib.rs +++ b/imgui-sys/src/lib.rs @@ -357,6 +357,29 @@ bitflags!( } ); +bitflags!( + /// Flags for igBeginCombo + #[repr(C)] + pub struct ImGuiComboFlags: c_int { + /// Align the popup toward the left by default + const PopupAlignLeft = 1 << 0; + /// Max ~4 items visible. + /// Tip: If you want your combo popup to be a specific size you can use + /// igSetNextWindowSizeConstraints() prior to calling igBeginCombo() + const HeightSmall = 1 << 1; + /// Max ~8 items visible (default) + const HeightRegular = 1 << 2; + /// Max ~20 items visible + const HeightLarge = 1 << 3; + /// As many fitting items as possible + const HeightLargest = 1 << 4; + const HeightMask = ImGuiComboFlags::HeightSmall.bits + | ImGuiComboFlags::HeightRegular.bits + | ImGuiComboFlags::HeightLarge.bits + | ImGuiComboFlags::HeightLargest.bits; + } +); + bitflags!( /// Flags for indictating which corner of a rectangle should be rounded #[repr(C)] @@ -1156,28 +1179,6 @@ extern "C" { pub fn igCheckboxFlags(label: *const c_char, flags: *mut c_uint, flags_value: c_uint) -> bool; pub fn igRadioButtonBool(label: *const c_char, active: bool) -> bool; pub fn igRadioButton(label: *const c_char, v: *mut c_int, v_button: c_int) -> bool; - pub fn igCombo( - label: *const c_char, - current_item: *mut c_int, - items: *const *const c_char, - items_count: c_int, - height_in_items: c_int, - ) -> bool; - pub fn igCombo2( - label: *const c_char, - current_item: *mut c_int, - items_separated_by_zeros: *const c_char, - height_in_items: c_int, - ) -> bool; - pub fn igCombo3( - label: *const c_char, - current_item: *mut c_int, - items_getter: extern "C" fn(data: *mut c_void, idx: c_int, out_text: *mut *const c_char) - -> bool, - data: *mut c_void, - items_count: c_int, - height_in_items: c_int, - ) -> bool; pub fn igPlotLines( label: *const c_char, values: *const c_float, @@ -1225,6 +1226,37 @@ extern "C" { pub fn igProgressBar(fraction: c_float, size_arg: *const ImVec2, overlay: *const c_char); } +// Combo +extern "C" { + pub fn igBeginCombo( + label: *const c_char, + preview_value: *const c_char, + flags: ImGuiComboFlags, + ) -> bool; + pub fn igEndCombo(); + pub fn igCombo( + label: *const c_char, + current_item: *mut c_int, + items: *const *const c_char, + items_count: c_int, + height_in_items: c_int, + ) -> bool; + pub fn igCombo2( + label: *const c_char, + current_item: *mut c_int, + items_separated_by_zeros: *const c_char, + height_in_items: c_int, + ) -> bool; + pub fn igCombo3( + label: *const c_char, + current_item: *mut c_int, + items_getter: extern "C" fn(data: *mut c_void, idx: c_int, out_text: *mut *const c_char) -> bool, + data: *mut c_void, + items_count: c_int, + height_in_items: c_int, + ) -> bool; +} + // Widgets: Color Editor/Picker extern "C" { pub fn igColorEdit3(