mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	ImGuiTextFilter::Draw helper return bool and resplit when filter is modified
This commit is contained in:
		| @@ -426,11 +426,12 @@ | |||||||
|  - popup: border options. richer api like BeginChild() perhaps? (#197) |  - popup: border options. richer api like BeginChild() perhaps? (#197) | ||||||
|  - combo: sparse combo boxes (via function call?) |  - combo: sparse combo boxes (via function call?) | ||||||
|  - combo: contents should extends to fit label if combo widget is small |  - 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: multiple selection | ||||||
|  - listbox: user may want to initial scroll to focus on the one selected value? |  - listbox: user may want to initial scroll to focus on the one selected value? | ||||||
|  - listbox: keyboard navigation. |  - listbox: keyboard navigation. | ||||||
|  - listbox: scrolling should track modified selection. |  - 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: local shortcuts, global shortcuts (#126) | ||||||
|  - menus: icons |  - menus: icons | ||||||
|  - menus: menubars: some sort of priority / effect of main menu-bar on desktop size? |  - menus: menubars: some sort of priority / effect of main menu-bar on desktop size? | ||||||
| @@ -1303,14 +1304,16 @@ ImGuiTextFilter::ImGuiTextFilter(const char* default_filter) | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| void ImGuiTextFilter::Draw(const char* label, float width) | bool 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)); |     bool value_changed = ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf)); | ||||||
|     if (width != 0.0f) |     if (width != 0.0f) | ||||||
|         ImGui::PopItemWidth(); |         ImGui::PopItemWidth(); | ||||||
|  |     if (value_changed) | ||||||
|         Build(); |         Build(); | ||||||
|  |     return value_changed; | ||||||
| } | } | ||||||
|  |  | ||||||
| void ImGuiTextFilter::TextRange::split(char separator, ImVector<TextRange>& out) | void ImGuiTextFilter::TextRange::split(char separator, ImVector<TextRange>& out) | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -868,7 +868,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 = 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 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(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ocornut
					ocornut