impr: Better UI for the settings view

This commit is contained in:
WerWolv
2023-11-15 22:22:57 +01:00
parent e32def409a
commit a51f9fd90c
4 changed files with 27 additions and 10 deletions

View File

@@ -53,8 +53,6 @@ namespace hex::plugin::builtin {
ImGui::NewLine();
}
bool firstSubCategory = true;
// Draw all settings of that category
for (auto &subCategory : category.subCategories) {
@@ -62,15 +60,13 @@ namespace hex::plugin::builtin {
if (subCategory.entries.empty())
continue;
if (!subCategory.unlocalizedName.empty())
ImGui::Header(LangEntry(subCategory.unlocalizedName), firstSubCategory);
firstSubCategory = false;
if (ImGui::BeginBox()) {
ImGui::BeginSubWindow(LangEntry(subCategory.unlocalizedName));
{
for (auto &setting : subCategory.entries) {
ImGui::BeginDisabled(!setting.widget->isEnabled());
ImGui::PushItemWidth(-200_scaled);
bool settingChanged = setting.widget->draw(LangEntry(setting.unlocalizedName));
ImGui::PopItemWidth();
ImGui::EndDisabled();
if (auto tooltip = setting.widget->getTooltip(); tooltip.has_value() && ImGui::IsItemHovered())
@@ -98,8 +94,8 @@ namespace hex::plugin::builtin {
}
}
ImGui::EndBox();
}
ImGui::EndSubWindow();
}