Skip to main content

dear_imgui_rs/utils/
item.rs

1use crate::sys;
2
3impl crate::ui::Ui {
4    /// Returns `true` if the last item open state was toggled
5    #[doc(alias = "IsItemToggledOpen")]
6    pub fn is_item_toggled_open(&self) -> bool {
7        unsafe { sys::igIsItemToggledOpen() }
8    }
9
10    /// Returns the upper-left bounding rectangle of the last item (screen space)
11    #[doc(alias = "GetItemRectMin")]
12    pub fn item_rect_min(&self) -> [f32; 2] {
13        let rect = unsafe { sys::igGetItemRectMin() };
14        [rect.x, rect.y]
15    }
16
17    /// Returns the lower-right bounding rectangle of the last item (screen space)
18    #[doc(alias = "GetItemRectMax")]
19    pub fn item_rect_max(&self) -> [f32; 2] {
20        let rect = unsafe { sys::igGetItemRectMax() };
21        [rect.x, rect.y]
22    }
23
24    /// Allows the next item to be overlapped by a subsequent item.
25    #[doc(alias = "SetNextItemAllowOverlap")]
26    pub fn set_next_item_allow_overlap(&self) {
27        unsafe { sys::igSetNextItemAllowOverlap() };
28    }
29}