From 6e1f359d08f8c33d31664a80c3eec20427de52ea Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Tue, 14 Sep 2021 11:14:09 -0400 Subject: [PATCH] rebased and waiting for green --- imgui/src/lib.rs | 6 +++--- imgui/src/tables.rs | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/imgui/src/lib.rs b/imgui/src/lib.rs index 55164ab..91a09de 100644 --- a/imgui/src/lib.rs +++ b/imgui/src/lib.rs @@ -294,15 +294,15 @@ impl<'a> Id<'a> { fn as_imgui_id(&self) -> sys::ImGuiID { unsafe { match self { - Id::Ptr(p) => sys::igGetIDPtr(*p), + Id::Ptr(p) => sys::igGetID_Ptr(*p), Id::Str(s) => { let s1 = s.as_ptr() as *const std::os::raw::c_char; let s2 = s1.add(s.len()); - sys::igGetIDStrStr(s1, s2) + sys::igGetID_StrStr(s1, s2) } Id::Int(i) => { let p = *i as *const std::os::raw::c_void; - sys::igGetIDPtr(p) + sys::igGetID_Ptr(p) } // Id::ImGuiID(n) => *n, } } diff --git a/imgui/src/tables.rs b/imgui/src/tables.rs index 726450b..bfda31e 100644 --- a/imgui/src/tables.rs +++ b/imgui/src/tables.rs @@ -684,7 +684,30 @@ impl<'ui> Ui<'ui> { } } + /// Change user accessible enabled/disabled state of the current column. + /// + /// Set to false to hide the column. Users can use the context menu to change + /// this themselves by right-clicking in headers, or right-clicking in columns body + /// if [TableFlags::CONTEXT_MENU_IN_BODY]. + /// + /// Use [table_set_enabled_with_column](Self::table_set_enabled_with_column) to set + /// for arbitrary indices. + pub fn table_set_enabled(&self, enabled: bool) { + unsafe { sys::igTableSetColumnEnabled(-1, enabled) } + } + + /// Change user accessible enabled/disabled state of the current column. + /// + /// Set to false to hide the column. Users can use the context menu to change + /// this themselves by right-clicking in headers, or right-clicking in columns body + /// if [TableFlags::CONTEXT_MENU_IN_BODY]. + pub fn table_set_enabled_with_column(&self, enabled: bool, column_idx: usize) { + unsafe { sys::igTableSetColumnEnabled(column_idx as i32, enabled) } + } + /// Gets the sorting data for a table. This will be `None` when not sorting. + /// + /// See the examples folder for how to use the sorting API. pub fn table_sort_specs_mut(&self) -> Option> { unsafe { let value = sys::igTableGetSortSpecs();