Better way to display non editable options.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2021-03-29 14:14:57 +01:00
parent bb15de8e99
commit 953571a433

View file

@ -148,6 +148,19 @@ namespace
}
}
void standardLabelText(const char * label, const char * text)
{
// this is "better/different" that ImGui::LabelText();
// because it shows the text in the same style as other options
// it will not display the ARROW_DOWN, to indicate the option cannot be changed
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
if (ImGui::BeginCombo(label, text, ImGuiComboFlags_NoArrowButton))
{
ImGui::EndCombo();
}
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, false);
}
}
namespace sa2
@ -228,11 +241,8 @@ namespace sa2
ImGui::EndCombo();
}
// is there a better way?
std::string cpuName = getCPUName(GetMainCpu());
ImGui::InputText("CPU", cpuName.data(), cpuName.size(), ImGuiInputTextFlags_ReadOnly);
std::string modeName = getModeName(g_nAppMode);
ImGui::InputText("Mode", modeName.data(), modeName.size(), ImGuiInputTextFlags_ReadOnly);
standardLabelText("CPU", getCPUName(GetMainCpu()).c_str());
standardLabelText("Mode", getModeName(g_nAppMode).c_str());
ImGui::Separator();