diff --git a/imgui.h b/imgui.h index 3f670d87d6b7..af13b2d84dec 100644 --- a/imgui.h +++ b/imgui.h @@ -562,11 +562,11 @@ namespace ImGui // - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created. IMGUI_API bool BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags = 0); IMGUI_API void EndCombo(); // only call EndCombo() if BeginCombo() returns true! - // MicroStrain start + // MicroStrain start // TODO: Rework to use ImGuiTextFilter instead of InputText IMGUI_API bool BeginComboInputText(const char* label, const char* preview_value, char* buffer, size_t buffer_size, bool* buffer_changed = NULL, ImGuiComboFlags combo_flags = 0, ImGuiInputTextFlags input_flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); IMGUI_API void EndComboInputText(); - // MicroStrain end + // MicroStrain end IMGUI_API bool Combo(const char* label, int* current_item, const char* const items[], int items_count, int popup_max_height_in_items = -1); IMGUI_API bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int popup_max_height_in_items = -1); // Separate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Three\0" IMGUI_API bool Combo(const char* label, int* current_item, const char* (*getter)(void* user_data, int idx), void* user_data, int items_count, int popup_max_height_in_items = -1); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 73ee5067312c..d3db4945b89a 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1792,10 +1792,10 @@ bool ImGui::BeginComboPopup(ImGuiID popup_id, const ImRect& bb, ImGuiComboFlags constraint_min.x = w; if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) == 0 || g.NextWindowData.SizeVal.y <= 0.0f) constraint_max.y = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items); - // MicroStrain start + // MicroStrain start if (flags & ImGuiComboFlags_InputText) constraint_max.y += bb.GetHeight(); - // MicroStrain end + // MicroStrain end SetNextWindowSizeConstraints(constraint_min, constraint_max); } @@ -1820,14 +1820,14 @@ bool ImGui::BeginComboPopup(ImGuiID popup_id, const ImRect& bb, ImGuiComboFlags // We don't use BeginPopupEx() solely because we have a custom name string, which we could make an argument to BeginPopupEx() ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMove; // MicroStrain start - if (flags & ImGuiComboFlags_InputText) + if (flags & ImGuiComboFlags_InputText) { PushStyleVar(ImGuiStyleVar_PopupBorderSize, 0.0f); // The child window only needs a border PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); // Remove padding since the child window will replace the full popup } else PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(g.Style.FramePadding.x, g.Style.WindowPadding.y)); // Horizontally align ourselves with the framed text - // MicroStrain end + // MicroStrain end // PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(g.Style.FramePadding.x, g.Style.WindowPadding.y)); // Horizontally align ourselves with the framed text // MicroStrain (original) bool ret = Begin(name, NULL, window_flags); // PopStyleVar(); // MicroStrain (original) @@ -6892,14 +6892,14 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl ImGui::PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_HeaderText)); else if (disabled_item || disabled_global) ImGui::PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_TextDisabled)); - // MicroStrain end + // MicroStrain end RenderTextClipped(text_min, text_max, label, NULL, &label_size, style.SelectableTextAlign, &bb); // MicroStrain start if (hovered || selected || disabled_item || disabled_global) ImGui::PopStyleColor(); - // MicroStrain end + // MicroStrain end // Automatically close popups // if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_DontClosePopups) && !(g.LastItemData.InFlags & ImGuiItemFlags_SelectableDontClosePopup)) // MicroStrain (original) diff --git a/misc/cpp/imgui_stdlib.cpp b/misc/cpp/imgui_stdlib.cpp index 72cefa415572..8384845037d8 100644 --- a/misc/cpp/imgui_stdlib.cpp +++ b/misc/cpp/imgui_stdlib.cpp @@ -83,7 +83,7 @@ bool ImGui::InputTextWithHint(const char* label, const char* hint, std::string* // MicroStrain start void ImGui::TextUnformatted(std::string_view text) { - ImGui::TextUnformatted(text.data(), text.data() + text.size()); + ImGui::TextUnformatted(text.data(), text.data() + text.size()); } // MicroStrain end