diff --git a/soh/soh/SohGui/UIWidgets.cpp b/soh/soh/SohGui/UIWidgets.cpp index 7fbad6705..18abb0094 100644 --- a/soh/soh/SohGui/UIWidgets.cpp +++ b/soh/soh/SohGui/UIWidgets.cpp @@ -777,7 +777,12 @@ bool InputString(const char* label, std::string* value, const InputOptions& opti } } ImGui::SetNextItemWidth(width); - if (ImGui::InputText(label, (char*)value->c_str(), value->capacity() + 1, ImGuiInputTextFlags_CallbackResize, InputTextResizeCallback, value)) { + ImGuiInputTextFlags flags = ImGuiInputTextFlags_CallbackResize; + if (options.secret) { + flags |= ImGuiInputTextFlags_Password; + } + flags |= options.addedFlags; + if (ImGui::InputText(label, (char*)value->c_str(), value->capacity() + 1, flags, InputTextResizeCallback, value)) { dirty = true; } if (value->empty() && !options.placeholder.empty()) { @@ -828,7 +833,7 @@ bool InputInt(const char* label, int32_t* value, const InputOptions& options) { } } ImGui::SetNextItemWidth(width); - if (ImGui::InputScalar(label, ImGuiDataType_S32, value)) { + if (ImGui::InputScalar(label, ImGuiDataType_S32, value, nullptr, nullptr, nullptr, options.addedFlags)) { dirty = true; } if ((ImGui::GetItemStatusFlags() & ImGuiItemStatusFlags_Edited) && !options.placeholder.empty()) { diff --git a/soh/soh/SohGui/UIWidgets.hpp b/soh/soh/SohGui/UIWidgets.hpp index ebf483194..649395b43 100644 --- a/soh/soh/SohGui/UIWidgets.hpp +++ b/soh/soh/SohGui/UIWidgets.hpp @@ -425,6 +425,8 @@ namespace UIWidgets { std::string placeholder = ""; InputTypes type = InputTypes::String; std::string defaultValue = ""; + bool secret = false; + ImGuiInputFlags addedFlags = 0; InputOptions& Tooltip(const char* tooltip_) { WidgetOptions::tooltip = tooltip_; @@ -463,6 +465,11 @@ namespace UIWidgets { defaultValue = defaultValue_; return *this; } + + InputOptions& IsSecret(bool secret_ = false) { + secret = secret_; + return *this; + } }; void PushStyleMenu(const ImVec4& color);