use crate::{Ui, sys};
impl Ui {
#[doc(alias = "PushItemWidth")]
pub fn push_item_width(&self, item_width: f32) -> ItemWidthStackToken<'_> {
unsafe { sys::igPushItemWidth(item_width) };
ItemWidthStackToken::new(self)
}
#[doc(alias = "PushItemWidth")]
pub fn push_item_width_text(&self, text: impl AsRef<str>) -> ItemWidthStackToken<'_> {
let text_width = unsafe {
let text_ptr = self.scratch_txt(text);
let out = sys::igCalcTextSize(text_ptr, std::ptr::null(), false, -1.0);
out.x
};
self.push_item_width(text_width)
}
#[doc(alias = "PushTextWrapPos")]
pub fn push_text_wrap_pos(&self, wrap_pos_x: f32) -> TextWrapPosStackToken<'_> {
unsafe { sys::igPushTextWrapPos(wrap_pos_x) };
TextWrapPosStackToken::new(self)
}
}
create_token!(
pub struct ItemWidthStackToken<'ui>;
#[doc(alias = "PopItemWidth")]
drop { unsafe { sys::igPopItemWidth() } }
);
create_token!(
pub struct TextWrapPosStackToken<'ui>;
#[doc(alias = "PopTextWrapPos")]
drop { unsafe { sys::igPopTextWrapPos() } }
);