mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-13 06:28:36 +00:00
Add push/pop item width and convenience function that calls push and pop either side of a closure
This commit is contained in:
parent
87b31d6601
commit
c1ca4aafe5
@ -801,7 +801,7 @@ extern "C" {
|
||||
// Parameter stack (current window)
|
||||
extern "C" {
|
||||
pub fn igPushItemWidth(item_width: c_float);
|
||||
pub fn igPopitemWidth();
|
||||
pub fn igPopItemWidth();
|
||||
pub fn igCalcItemWidth() -> c_float;
|
||||
pub fn igPushTextWrapPos(wrap_pos_x: c_float);
|
||||
pub fn igPopTextWrapPos();
|
||||
|
||||
@ -400,6 +400,13 @@ impl<'ui> Ui<'ui> {
|
||||
|
||||
// Layout
|
||||
impl<'ui> Ui<'ui> {
|
||||
pub fn push_item_width(&self, width: f32) { unsafe { imgui_sys::igPushItemWidth(width) } }
|
||||
pub fn pop_item_width(&self) { unsafe { imgui_sys::igPopItemWidth() } }
|
||||
pub fn with_item_width<F>(&self, width: f32, f: F) where F: FnOnce() {
|
||||
self.push_item_width(width);
|
||||
f();
|
||||
self.pop_item_width();
|
||||
}
|
||||
pub fn separator(&self) { unsafe { imgui_sys::igSeparator() }; }
|
||||
pub fn same_line(&self, pos_x: f32) { unsafe { imgui_sys::igSameLine(pos_x, -1.0f32) } }
|
||||
pub fn same_line_spacing(&self, pos_x: f32, spacing_w: f32) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user