From 9a16fd2cf0bca13d8a3015da89833db2230b391f Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 20 Sep 2025 19:38:37 +0200 Subject: ui refactor --- src/ui/imgui_extensions.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/ui/imgui_extensions.cpp') diff --git a/src/ui/imgui_extensions.cpp b/src/ui/imgui_extensions.cpp index 5fdc3a7..1875c22 100644 --- a/src/ui/imgui_extensions.cpp +++ b/src/ui/imgui_extensions.cpp @@ -9,19 +9,16 @@ namespace ImGui { - void FormInputTextWithErrorHint(const char* hint, void* data, char* buffer, size_t buf_size, bool has_error) + void FormInputTextWithErrorHint(const char* hint, char* buffer, size_t buf_size, bool has_error) { float widthAvailable = ImGui::GetContentRegionAvail().x; ImGui::SetNextItemWidth(widthAvailable*0.5f); - char id[MAX_LEN_LONG_DESC]; - snprintf(id, sizeof(id), "%s##%p", hint, data); - if (has_error) { ImGui::PushStyleColor(ImGuiCol_Border, COLOR_ERROR_OUTLINE); ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.5f); } - ImGui::InputTextWithHint(id, hint, buffer, buf_size); + ImGui::InputTextWithHint(hint, hint, buffer, buf_size); if (has_error) { ImGui::PopStyleVar(); ImGui::PopStyleColor(); @@ -32,10 +29,9 @@ namespace ImGui } } - void FormCountryCombo(void* data, char* buffer, size_t buf_size) + void FormCountryCombo(char* buffer, size_t buf_size) { const char* selected_country = 0; - char id[MAX_LEN_LONG_DESC]; float widthAvailable = ImGui::GetContentRegionAvail().x; ImGui::SetNextItemWidth(widthAvailable*0.5f); @@ -58,14 +54,12 @@ namespace ImGui bool has_a_selection = selected_country != 0; int selected_country_index = -1; - snprintf(id, sizeof(id), "%s##%p", localize("contact.form.country"), data); - if (!has_a_selection) { ImGui::PushStyleColor(ImGuiCol_Border, COLOR_ERROR_OUTLINE); ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.5f); } - if (ImGui::BeginCombo(id, selected_country)) + if (ImGui::BeginCombo(localize("contact.form.country"), selected_country)) { for (int n = 0; n < country_count; n++) { -- cgit v1.2.3-70-g09d2