mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-11-04 09:44:29 +00:00 
			
		
		
		
	ImGuiTextFilter() can take a default filter string
This commit is contained in:
		
							
								
								
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -1260,10 +1260,18 @@ void ImGuiStorage::SetAllInt(int v)
 | 
				
			|||||||
//-----------------------------------------------------------------------------
 | 
					//-----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
 | 
					// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
 | 
				
			||||||
ImGuiTextFilter::ImGuiTextFilter()
 | 
					ImGuiTextFilter::ImGuiTextFilter(const char* default_filter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    if (default_filter)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        ImFormatString(InputBuf, IM_ARRAYSIZE(InputBuf), "%s", default_filter);
 | 
				
			||||||
 | 
					        Build();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        InputBuf[0] = 0;
 | 
					        InputBuf[0] = 0;
 | 
				
			||||||
        CountGrep = 0;
 | 
					        CountGrep = 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ImGuiTextFilter::Draw(const char* label, float width)
 | 
					void ImGuiTextFilter::Draw(const char* label, float width)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							@@ -651,7 +651,7 @@ struct ImGuiTextFilter
 | 
				
			|||||||
    ImVector<TextRange> Filters;
 | 
					    ImVector<TextRange> Filters;
 | 
				
			||||||
    int                 CountGrep;
 | 
					    int                 CountGrep;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ImGuiTextFilter();
 | 
					    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 = -1.0f);    // Helper calling InputText+Build
 | 
				
			||||||
    bool PassFilter(const char* val) const;
 | 
					    bool PassFilter(const char* val) const;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user