diff --git a/imgui-sys/build.rs b/imgui-sys/build.rs index 78818c8..c52e66a 100644 --- a/imgui-sys/build.rs +++ b/imgui-sys/build.rs @@ -6,6 +6,7 @@ fn main() { .file("third-party/cimgui/cimgui/cimgui.cpp") .file("third-party/cimgui/cimgui/fontAtlas.cpp") .file("third-party/cimgui/cimgui/drawList.cpp") + .file("third-party/cimgui/cimgui/listClipper.cpp") .file("third-party/cimgui/imgui/imgui.cpp") .file("third-party/cimgui/imgui/imgui_demo.cpp") .file("third-party/cimgui/imgui/imgui_draw.cpp") diff --git a/imgui-sys/src/lib.rs b/imgui-sys/src/lib.rs index d0e2d1d..afa97e7 100644 --- a/imgui-sys/src/lib.rs +++ b/imgui-sys/src/lib.rs @@ -559,7 +559,7 @@ pub struct ImColor { } #[repr(C)] -#[derive(Copy, Clone, Debug, Default)] +#[derive(Copy, Clone, Debug)] pub struct ImGuiListClipper { pub start_pos_y: c_float, pub items_height: c_float, @@ -569,6 +569,19 @@ pub struct ImGuiListClipper { pub display_end: c_int, } +impl Default for ImGuiListClipper { + fn default() -> ImGuiListClipper { + ImGuiListClipper { + start_pos_y: 0.0, + items_height: -1.0, + items_count: -1, + step_no: 0, + display_start: 0, + display_end: 0, + } + } +} + pub type ImDrawCallback = Option; @@ -1672,6 +1685,15 @@ extern "C" { pub fn ImDrawList_UpdateTextureID(list: *mut ImDrawList); } +// ImGuiListClipper +extern "C" { + pub fn ImGuiListClipper_Begin(clipper: *mut ImGuiListClipper, count: c_int, items_height: c_float); + pub fn ImGuiListClipper_End(clipper: *mut ImGuiListClipper); + pub fn ImGuiListClipper_Step(clipper: *mut ImGuiListClipper) -> bool; + pub fn ImGuiListClipper_GetDisplayStart(clipper: *mut ImGuiListClipper) -> c_int; + pub fn ImGuiListClipper_GetDisplayEnd(clipper: *mut ImGuiListClipper) -> c_int; +} + // Although this test is sensitive to ImGui updates, it's useful to reveal potential // alignment errors #[test]