From 3019f15b92f2986d17043b2c52cd0e5cd2d18066 Mon Sep 17 00:00:00 2001 From: Miguel Michelson Date: Wed, 25 May 2016 01:55:50 -0300 Subject: [PATCH 1/7] implement columns --- src/lib.rs | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ac43177..bdc5f5c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,7 @@ pub use imgui_sys::{ ImGuiWindowFlags_HorizontalScrollbar, ImGuiWindowFlags_NoFocusOnAppearing, ImGuiWindowFlags_NoBringToFrontOnFocus, ImVec2, ImVec4, - ImGuiKey + ImGuiKey }; pub use input::{InputText}; pub use menus::{Menu, MenuItem}; @@ -398,8 +398,41 @@ impl<'ui> Ui<'ui> { } } pub fn spacing(&self) { unsafe { imgui_sys::igSpacing() }; } + + + pub fn columns(&self, i: i32, b: *const i8, b2: bool){ + unsafe { imgui_sys::igColumns(i, b, b2 ) }; + } + + pub fn next_column(&self) { + unsafe { imgui_sys::igNextColumn() }; + } + + pub fn get_column_index(&self) { + unsafe { imgui_sys::igGetColumnIndex() }; + } + + pub fn get_column_offset(&self, i: i32) { + unsafe { imgui_sys::igGetColumnOffset(i) }; + } + + pub fn set_column_offset(&self, column_index: i32, offset_x: f32) { + unsafe { imgui_sys::igSetColumnOffset(column_index, offset_x ) }; + } + + pub fn get_column_width(&self, i: i32) { + unsafe { imgui_sys::igGetColumnWidth(i) }; + } + + pub fn get_columns_count(&self) { + unsafe { imgui_sys::igGetColumnsCount() }; + } + + } + + // Widgets impl<'ui> Ui<'ui> { pub fn text<'p>(&self, text: ImStr<'p>) { From e7dfdd251838ee7c3eb9d449bbc7a5f79474f98c Mon Sep 17 00:00:00 2001 From: Miguel Michelson Date: Wed, 25 May 2016 02:06:14 -0300 Subject: [PATCH 2/7] use ImguiString --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index bdc5f5c..0e0ea5e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -400,8 +400,8 @@ impl<'ui> Ui<'ui> { pub fn spacing(&self) { unsafe { imgui_sys::igSpacing() }; } - pub fn columns(&self, i: i32, b: *const i8, b2: bool){ - unsafe { imgui_sys::igColumns(i, b, b2 ) }; + pub fn columns<'p>(&self, i: i32, b: ImStr<'p>, b2: bool){ + unsafe { imgui_sys::igColumns(i, b.as_ptr(), b2 ) }; } pub fn next_column(&self) { From cdb7a929eeb25c34c9d2c176e43e83bbe2610df0 Mon Sep 17 00:00:00 2001 From: Miguel Michelson Date: Fri, 27 May 2016 21:29:31 -0300 Subject: [PATCH 3/7] rename args and declare return types --- src/lib.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0e0ea5e..00090ba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,7 @@ pub use imgui_sys::{ ImGuiWindowFlags_HorizontalScrollbar, ImGuiWindowFlags_NoFocusOnAppearing, ImGuiWindowFlags_NoBringToFrontOnFocus, ImVec2, ImVec4, - ImGuiKey + ImGuiKey }; pub use input::{InputText}; pub use menus::{Menu, MenuItem}; @@ -399,33 +399,32 @@ impl<'ui> Ui<'ui> { } pub fn spacing(&self) { unsafe { imgui_sys::igSpacing() }; } - - pub fn columns<'p>(&self, i: i32, b: ImStr<'p>, b2: bool){ - unsafe { imgui_sys::igColumns(i, b.as_ptr(), b2 ) }; + pub fn columns<'p>(&self, count: i32, id: ImStr<'p>, border: bool){ + unsafe { imgui_sys::igColumns(count, id.as_ptr(), border ) } } pub fn next_column(&self) { - unsafe { imgui_sys::igNextColumn() }; + unsafe { imgui_sys::igNextColumn() } } - pub fn get_column_index(&self) { - unsafe { imgui_sys::igGetColumnIndex() }; + pub fn get_column_index(&self) -> i32 { + unsafe { imgui_sys::igGetColumnIndex() } } - pub fn get_column_offset(&self, i: i32) { - unsafe { imgui_sys::igGetColumnOffset(i) }; + pub fn get_column_offset(&self, i: i32) -> f32 { + unsafe { imgui_sys::igGetColumnOffset(i) } } pub fn set_column_offset(&self, column_index: i32, offset_x: f32) { - unsafe { imgui_sys::igSetColumnOffset(column_index, offset_x ) }; + unsafe { imgui_sys::igSetColumnOffset(column_index, offset_x ) } } - pub fn get_column_width(&self, i: i32) { - unsafe { imgui_sys::igGetColumnWidth(i) }; + pub fn get_column_width(&self, i: i32) -> f32 { + unsafe { imgui_sys::igGetColumnWidth(i) } } - pub fn get_columns_count(&self) { - unsafe { imgui_sys::igGetColumnsCount() }; + pub fn get_columns_count(&self) -> i32 { + unsafe { imgui_sys::igGetColumnsCount() } } @@ -508,6 +507,9 @@ impl<'ui> Ui<'ui> { pub fn tree_node<'p>(&self, id: ImStr<'p>) -> TreeNode<'ui, 'p> { TreeNode::new(id) } + pub fn tree_pop<'p>(&self){ + unsafe { imgui_sys::igTreePop() }; + } } // Widgets: Menus From a1ba49af4301db5660d4d174d60bd5d9c7c5519e Mon Sep 17 00:00:00 2001 From: Miguel Michelson Date: Fri, 27 May 2016 21:41:35 -0300 Subject: [PATCH 4/7] remove tree_pop method --- src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 00090ba..6f6d399 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -507,9 +507,6 @@ impl<'ui> Ui<'ui> { pub fn tree_node<'p>(&self, id: ImStr<'p>) -> TreeNode<'ui, 'p> { TreeNode::new(id) } - pub fn tree_pop<'p>(&self){ - unsafe { imgui_sys::igTreePop() }; - } } // Widgets: Menus From 5ad669e9c05d8d21ea056f219c0d2c1c92ca51d3 Mon Sep 17 00:00:00 2001 From: Miguel Michelson Date: Fri, 27 May 2016 21:51:04 -0300 Subject: [PATCH 5/7] remove extra breaklines --- src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6f6d399..76fdf4d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -430,8 +430,6 @@ impl<'ui> Ui<'ui> { } - - // Widgets impl<'ui> Ui<'ui> { pub fn text<'p>(&self, text: ImStr<'p>) { From a4dba71d1a866f443a31254f60f703e162c5354e Mon Sep 17 00:00:00 2001 From: Miguel Michelson Date: Sat, 28 May 2016 20:09:05 -0300 Subject: [PATCH 6/7] more on formatting --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 76fdf4d..f1e369a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -399,8 +399,8 @@ impl<'ui> Ui<'ui> { } pub fn spacing(&self) { unsafe { imgui_sys::igSpacing() }; } - pub fn columns<'p>(&self, count: i32, id: ImStr<'p>, border: bool){ - unsafe { imgui_sys::igColumns(count, id.as_ptr(), border ) } + pub fn columns<'p>(&self, count: i32, id: ImStr<'p>, border: bool){ + unsafe { imgui_sys::igColumns(count, id.as_ptr(), border) } } pub fn next_column(&self) { @@ -416,7 +416,7 @@ impl<'ui> Ui<'ui> { } pub fn set_column_offset(&self, column_index: i32, offset_x: f32) { - unsafe { imgui_sys::igSetColumnOffset(column_index, offset_x ) } + unsafe { imgui_sys::igSetColumnOffset(column_index, offset_x) } } pub fn get_column_width(&self, i: i32) -> f32 { From 7a7de21135cadb40d0b147d266cbf3f5973ac6a6 Mon Sep 17 00:00:00 2001 From: Miguel Michelson Date: Sat, 28 May 2016 20:36:47 -0300 Subject: [PATCH 7/7] rename args on columns methods in order to be consitent with ig* arg methods --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f1e369a..d0ff98b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -411,16 +411,16 @@ impl<'ui> Ui<'ui> { unsafe { imgui_sys::igGetColumnIndex() } } - pub fn get_column_offset(&self, i: i32) -> f32 { - unsafe { imgui_sys::igGetColumnOffset(i) } + pub fn get_column_offset(&self, column_index: i32) -> f32 { + unsafe { imgui_sys::igGetColumnOffset(column_index) } } pub fn set_column_offset(&self, column_index: i32, offset_x: f32) { unsafe { imgui_sys::igSetColumnOffset(column_index, offset_x) } } - pub fn get_column_width(&self, i: i32) -> f32 { - unsafe { imgui_sys::igGetColumnWidth(i) } + pub fn get_column_width(&self, column_index: i32) -> f32 { + unsafe { imgui_sys::igGetColumnWidth(column_index) } } pub fn get_columns_count(&self) -> i32 {