diff --git a/imgui.cpp b/imgui.cpp index 4e77774..0c86ae2 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -426,11 +426,12 @@ - popup: border options. richer api like BeginChild() perhaps? (#197) - combo: sparse combo boxes (via function call?) - combo: contents should extends to fit label if combo widget is small - - combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keybord for custom listbox (pr #203) + - combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keyboard for custom listbox (pr #203) - listbox: multiple selection - listbox: user may want to initial scroll to focus on the one selected value? - listbox: keyboard navigation. - listbox: scrolling should track modified selection. + ! menus/popups: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331) - menus: local shortcuts, global shortcuts (#126) - menus: icons - menus: menubars: some sort of priority / effect of main menu-bar on desktop size? @@ -1303,14 +1304,16 @@ } } -void ImGuiTextFilter::Draw(const char* label, float width) +bool ImGuiTextFilter::Draw(const char* label, float width) { if (width != 0.0f) ImGui::PushItemWidth(width); - ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf)); + bool value_changed = ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf)); if (width != 0.0f) ImGui::PopItemWidth(); - Build(); + if (value_changed) + Build(); + return value_changed; } void ImGuiTextFilter::TextRange::split(char separator, ImVector& out) diff --git a/imgui.cpp b/imgui.cpp index 4e77774..0c86ae2 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -426,11 +426,12 @@ - popup: border options. richer api like BeginChild() perhaps? (#197) - combo: sparse combo boxes (via function call?) - combo: contents should extends to fit label if combo widget is small - - combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keybord for custom listbox (pr #203) + - combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keyboard for custom listbox (pr #203) - listbox: multiple selection - listbox: user may want to initial scroll to focus on the one selected value? - listbox: keyboard navigation. - listbox: scrolling should track modified selection. + ! menus/popups: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331) - menus: local shortcuts, global shortcuts (#126) - menus: icons - menus: menubars: some sort of priority / effect of main menu-bar on desktop size? @@ -1303,14 +1304,16 @@ } } -void ImGuiTextFilter::Draw(const char* label, float width) +bool ImGuiTextFilter::Draw(const char* label, float width) { if (width != 0.0f) ImGui::PushItemWidth(width); - ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf)); + bool value_changed = ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf)); if (width != 0.0f) ImGui::PopItemWidth(); - Build(); + if (value_changed) + Build(); + return value_changed; } void ImGuiTextFilter::TextRange::split(char separator, ImVector& out) diff --git a/imgui.h b/imgui.h index 160941d..4c6fbb6 100644 --- a/imgui.h +++ b/imgui.h @@ -868,7 +868,7 @@ ImGuiTextFilter(const char* default_filter = ""); void Clear() { InputBuf[0] = 0; Build(); } - void Draw(const char* label = "Filter (inc,-exc)", float width = 0.0f); // Helper calling InputText+Build + bool Draw(const char* label = "Filter (inc,-exc)", float width = 0.0f); // Helper calling InputText+Build bool PassFilter(const char* text, const char* text_end = NULL) const; bool IsActive() const { return !Filters.empty(); } IMGUI_API void Build();