use crate::{Ui, create_token, sys};
create_token!(
pub struct ButtonRepeatToken<'ui>;
#[doc(alias = "PopButtonRepeat")]
drop { unsafe { sys::igPopItemFlag() } }
);
impl ButtonRepeatToken<'_> {
pub fn pop(self) {
self.end()
}
}
impl Ui {
#[doc(alias = "PushButtonRepeat")]
pub fn push_button_repeat(&self, repeat: bool) {
unsafe { sys::igPushItemFlag(sys::ImGuiItemFlags_ButtonRepeat as i32, repeat) }
}
#[doc(alias = "PushButtonRepeat")]
pub fn push_button_repeat_token(&self, repeat: bool) -> ButtonRepeatToken<'_> {
self.push_button_repeat(repeat);
ButtonRepeatToken::new(self)
}
#[doc(alias = "PushButtonRepeat", alias = "PopButtonRepeat")]
pub fn with_button_repeat<R>(&self, repeat: bool, f: impl FnOnce() -> R) -> R {
let _repeat = self.push_button_repeat_token(repeat);
f()
}
#[doc(alias = "PopButtonRepeat")]
pub fn pop_button_repeat(&self) {
unsafe { sys::igPopItemFlag() }
}
}