From 09dda0bc5e0c24956480bd5737c689aacdfbe9a1 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 2 Jun 2023 14:44:19 +0200 Subject: [PATCH] feat: Added provider information to advanced provider tab tooltip --- plugins/builtin/source/content/ui_items.cpp | 31 ++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/plugins/builtin/source/content/ui_items.cpp b/plugins/builtin/source/content/ui_items.cpp index 59b4c12ca..c9dbc3f20 100644 --- a/plugins/builtin/source/content/ui_items.cpp +++ b/plugins/builtin/source/content/ui_items.cpp @@ -239,10 +239,39 @@ namespace hex::plugin::builtin { bool open = true; ImGui::PushID(tabProvider); - if (ImGui::BeginTabItem(tabProvider->getName().c_str(), &open, tabProvider->isDirty() ? ImGuiTabItemFlags_UnsavedDocument : ImGuiTabItemFlags_None)) { + if (ImGui::BeginTabItem(tabProvider->getName().c_str(), &open, ImGuiTabItemFlags_NoTooltip | (tabProvider->isDirty() ? ImGuiTabItemFlags_UnsavedDocument : ImGuiTabItemFlags_None))) { ImHexApi::Provider::setCurrentProvider(i); ImGui::EndTabItem(); } + + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + + ImGui::TextFormatted("{}", tabProvider->getName().c_str()); + + if (ImGui::GetIO().KeyShift) { + ImGui::Separator(); + + if (ImGui::BeginTable("information", 2, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoKeepColumnsVisible)) { + ImGui::TableSetupColumn("type"); + ImGui::TableSetupColumn("value", ImGuiTableColumnFlags_WidthStretch); + + ImGui::TableNextRow(); + + for (auto &[name, value] : provider->getDataDescription()) { + ImGui::TableNextColumn(); + ImGui::TextFormatted("{}", name); + ImGui::TableNextColumn(); + ImGui::TextFormattedWrapped("{}", value); + } + + ImGui::EndTable(); + } + } + + ImGui::EndTooltip(); + } + ImGui::PopID(); if (!open) {