use super::*;
impl Ui {
#[doc(alias = "TextUnformatted")]
pub fn text<T: AsRef<str>>(&self, text: T) {
let s = text.as_ref();
unsafe {
let start = s.as_ptr();
let end = start.add(s.len());
crate::sys::igTextUnformatted(
start as *const std::os::raw::c_char,
end as *const std::os::raw::c_char,
);
}
}
#[doc(alias = "ImageWithBg")]
pub fn image_with_bg<'tex>(
&self,
texture: impl Into<TextureRef<'tex>>,
size: [f32; 2],
bg_color: [f32; 4],
tint_color: [f32; 4],
) {
crate::widget::image::Image::new(self, texture, size).build_with_bg(bg_color, tint_color)
}
#[doc(alias = "DragFloat")]
pub fn drag_float(&self, label: impl AsRef<str>, value: &mut f32) -> bool {
crate::widget::drag::Drag::new(label).build(self, value)
}
#[doc(alias = "DragFloat")]
pub fn drag_float_config<L: AsRef<str>>(&self, label: L) -> crate::widget::drag::Drag<f32, L> {
crate::widget::drag::Drag::new(label)
}
#[doc(alias = "DragInt")]
pub fn drag_int(&self, label: impl AsRef<str>, value: &mut i32) -> bool {
crate::widget::drag::Drag::new(label).build(self, value)
}
#[doc(alias = "DragInt")]
pub fn drag_int_config<L: AsRef<str>>(&self, label: L) -> crate::widget::drag::Drag<i32, L> {
crate::widget::drag::Drag::new(label)
}
#[doc(alias = "DragFloatRange2")]
pub fn drag_float_range2(&self, label: impl AsRef<str>, min: &mut f32, max: &mut f32) -> bool {
crate::widget::drag::DragRange::<f32, _>::new(label).build(self, min, max)
}
#[doc(alias = "DragFloatRange2")]
pub fn drag_float_range2_config<L: AsRef<str>>(
&self,
label: L,
) -> crate::widget::drag::DragRange<f32, L> {
crate::widget::drag::DragRange::new(label)
}
#[doc(alias = "DragIntRange2")]
pub fn drag_int_range2(&self, label: impl AsRef<str>, min: &mut i32, max: &mut i32) -> bool {
crate::widget::drag::DragRange::<i32, _>::new(label).build(self, min, max)
}
#[doc(alias = "DragIntRange2")]
pub fn drag_int_range2_config<L: AsRef<str>>(
&self,
label: L,
) -> crate::widget::drag::DragRange<i32, L> {
crate::widget::drag::DragRange::new(label)
}
#[doc(alias = "SetNextItemOpen")]
pub fn set_next_item_open(&self, is_open: bool) {
unsafe {
sys::igSetNextItemOpen(is_open, 0); }
}
#[doc(alias = "SetNextItemOpen")]
pub fn set_next_item_open_with_cond(&self, is_open: bool, cond: crate::Condition) {
unsafe { sys::igSetNextItemOpen(is_open, cond as sys::ImGuiCond) }
}
#[doc(alias = "SetNextItemWidth")]
pub fn set_next_item_width(&self, item_width: f32) {
Self::assert_finite_f32("Ui::set_next_item_width()", "item_width", item_width);
unsafe {
sys::igSetNextItemWidth(item_width);
}
}
#[doc(alias = "Value")]
pub fn value_bool(&self, prefix: impl AsRef<str>, v: bool) {
unsafe { sys::igValue_Bool(self.scratch_txt(prefix), v) }
}
}