mirror of https://github.com/ocornut/imgui
add `DrawWithHint` to `ImGuiTextFilter`
This commit is contained in:
parent
45c8c3b611
commit
20fb286e4f
10
imgui.cpp
10
imgui.cpp
|
@ -2472,6 +2472,16 @@ bool ImGuiTextFilter::Draw(const char* label, float width)
|
|||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGuiTextFilter::DrawWithHint(const char* label, const char* hint, float width)
|
||||
{
|
||||
if (width != 0.0f)
|
||||
ImGui::SetNextItemWidth(width);
|
||||
bool value_changed = ImGui::InputTextWithHint(label, hint, InputBuf, IM_ARRAYSIZE(InputBuf));
|
||||
if (value_changed)
|
||||
Build();
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
void ImGuiTextFilter::ImGuiTextRange::split(char separator, ImVector<ImGuiTextRange>* out) const
|
||||
{
|
||||
out->resize(0);
|
||||
|
|
1
imgui.h
1
imgui.h
|
@ -2213,6 +2213,7 @@ struct ImGuiTextFilter
|
|||
{
|
||||
IMGUI_API ImGuiTextFilter(const char* default_filter = "");
|
||||
IMGUI_API bool Draw(const char* label = "Filter (inc,-exc)", float width = 0.0f); // Helper calling InputText+Build
|
||||
IMGUI_API bool DrawWithHint(const char* label, const char* hint = "Filter (inc,-exc)", float width = 0.0f);
|
||||
IMGUI_API bool PassFilter(const char* text, const char* text_end = NULL) const;
|
||||
IMGUI_API void Build();
|
||||
void Clear() { InputBuf[0] = 0; Build(); }
|
||||
|
|
Loading…
Reference in New Issue