mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 13:37:00 +00:00
ImGuiTextFilter: default parameter width=0.0f for no override, allow override with negative values
This commit is contained in:
parent
307ed78006
commit
07de0448f9
@ -1283,10 +1283,10 @@ ImGuiTextFilter::ImGuiTextFilter(const char* default_filter)
|
|||||||
|
|
||||||
void ImGuiTextFilter::Draw(const char* label, float width)
|
void ImGuiTextFilter::Draw(const char* label, float width)
|
||||||
{
|
{
|
||||||
if (width > 0.0f)
|
if (width != 0.0f)
|
||||||
ImGui::PushItemWidth(width);
|
ImGui::PushItemWidth(width);
|
||||||
ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf));
|
ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf));
|
||||||
if (width > 0.0f)
|
if (width != 0.0f)
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
Build();
|
Build();
|
||||||
}
|
}
|
||||||
|
2
imgui.h
2
imgui.h
@ -850,7 +850,7 @@ struct ImGuiTextFilter
|
|||||||
|
|
||||||
ImGuiTextFilter(const char* default_filter = "");
|
ImGuiTextFilter(const char* default_filter = "");
|
||||||
void Clear() { InputBuf[0] = 0; Build(); }
|
void Clear() { InputBuf[0] = 0; Build(); }
|
||||||
void Draw(const char* label = "Filter (inc,-exc)", float width = -1.0f); // Helper calling InputText+Build
|
void 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 PassFilter(const char* text, const char* text_end = NULL) const;
|
||||||
bool IsActive() const { return !Filters.empty(); }
|
bool IsActive() const { return !Filters.empty(); }
|
||||||
IMGUI_API void Build();
|
IMGUI_API void Build();
|
||||||
|
@ -1979,7 +1979,7 @@ struct ExampleAppLog
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
bool copy = ImGui::Button("Copy");
|
bool copy = ImGui::Button("Copy");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
Filter.Draw();
|
Filter.Draw("Filter", -100.0f);
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::BeginChild("scrolling");
|
ImGui::BeginChild("scrolling");
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0));
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0));
|
||||||
|
Loading…
Reference in New Issue
Block a user