From c85d7d6e4932f4529059dad3f1b148a66b4ca846 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 12 Jan 2018 19:28:37 +0100 Subject: [PATCH] Nav: Remove GetItemID(), hide ActivateItem() before this feature is unfinished and has issue (full feature is on hold). Undo part of 59c6f35bf6b8919000d7deacc0a7b1c1428a2519 (#787) --- imgui.cpp | 6 ------ imgui.h | 2 -- imgui_demo.cpp | 16 ---------------- imgui_internal.h | 1 + 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 4e46158c..755d49f8 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6965,12 +6965,6 @@ void ImGui::ActivateItem(ImGuiID id) g.NavNextActivateId = id; } -ImGuiID ImGui::GetItemID() -{ - ImGuiContext& g = *GImGui; - return g.CurrentWindow->DC.LastItemId; -} - void ImGui::SetKeyboardFocusHere(int offset) { IM_ASSERT(offset >= -1); // -1 is allowed but not below diff --git a/imgui.h b/imgui.h index 280a9f5e..e73a5445 100644 --- a/imgui.h +++ b/imgui.h @@ -448,8 +448,6 @@ namespace ImGui IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // Focus, Activation - IMGUI_API void ActivateItem(ImGuiID id); // remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again. - IMGUI_API ImGuiID GetItemID(); // get id of previous item, generally ~GetID(label) IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. Please use instead of "if (IsWindowAppearing()) SetScrollHere()" to signify "default item". IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. diff --git a/imgui_demo.cpp b/imgui_demo.cpp index d6be2649..67be3577 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1887,22 +1887,6 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::TreePop(); } -#if 0 - if (ImGui::TreeNode("Remote Activation")) - { - static char label[256]; - ImGui::InputText("Label", label, IM_ARRAYSIZE(label)); - ImGui::PopID(); // We don't yet have an easy way compute ID at other levels of the ID stack so we pop it manually for now (e.g. we'd like something like GetID("../label")) - ImGuiID id = ImGui::GetID(label); - ImGui::PushID("Remote Activation"); - if (ImGui::SmallButton("Activate")) - ImGui::ActivateItem(id); - ImGui::SameLine(); - ImGui::Text("ID = 0x%08X", id); - ImGui::TreePop(); - } -#endif - if (ImGui::TreeNode("Focused & Hovered Test")) { static bool embed_all_inside_a_child_window = false; diff --git a/imgui_internal.h b/imgui_internal.h index cc66758b..8f4ecc20 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1003,6 +1003,7 @@ namespace ImGui IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true); IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit); + IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again. IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);