[cimgui 1.53.1] Add new combo functions

Move igCombo{1,2,3} into the combo group along with igBeginCombo and
igEndCombo.
This commit is contained in:
Malik Olivier Boussejra 2018-05-01 11:12:49 +09:00
parent 4b788d095c
commit db5059d179

View File

@ -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(