mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-13 22:48:34 +00:00
Merge pull request #45 from andystanton/feature/add_push_and_pop_item_width
Add push and pop item width
This commit is contained in:
commit
9d2d5c6ecf
@ -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