mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Added GetItemsLineHeightWithSpacing() helper.
This commit is contained in:
		| @@ -4516,6 +4516,12 @@ float ImGui::GetTextLineHeightWithSpacing() | |||||||
|     return g.FontSize + g.Style.ItemSpacing.y; |     return g.FontSize + g.Style.ItemSpacing.y; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | float ImGui::GetItemsLineHeightWithSpacing() | ||||||
|  | { | ||||||
|  |     ImGuiState& g = *GImGui; | ||||||
|  |     return g.FontSize + g.Style.FramePadding.y * 2.0f + g.Style.ItemSpacing.y; | ||||||
|  | } | ||||||
|  |  | ||||||
| ImDrawList* ImGui::GetWindowDrawList() | ImDrawList* ImGui::GetWindowDrawList() | ||||||
| { | { | ||||||
|     ImGuiWindow* window = GetCurrentWindow(); |     ImGuiWindow* window = GetCurrentWindow(); | ||||||
| @@ -11722,7 +11728,7 @@ struct ExampleAppConsole | |||||||
|         // Display every line as a separate entry so we can change their color or add custom widgets. If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end()); |         // Display every line as a separate entry so we can change their color or add custom widgets. If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end()); | ||||||
|         // NB- if you have thousands of entries this approach may be too inefficient. You can seek and display only the lines that are visible - CalcListClipping() is a helper to compute this information. |         // NB- if you have thousands of entries this approach may be too inefficient. You can seek and display only the lines that are visible - CalcListClipping() is a helper to compute this information. | ||||||
|         // If your items are of variable size you may want to implement code similar to what CalcListClipping() does. Or split your data into fixed height items to allow random-seeking into your list. |         // If your items are of variable size you may want to implement code similar to what CalcListClipping() does. Or split your data into fixed height items to allow random-seeking into your list. | ||||||
|         ImGui::BeginChild("ScrollingRegion", ImVec2(0,-ImGui::GetTextLineHeightWithSpacing()*2)); |         ImGui::BeginChild("ScrollingRegion", ImVec2(0,-ImGui::GetItemsLineHeightWithSpacing())); | ||||||
|         if (ImGui::BeginPopupContextWindow()) |         if (ImGui::BeginPopupContextWindow()) | ||||||
|         { |         { | ||||||
|             if (ImGui::Selectable("Clear")) ClearLog(); |             if (ImGui::Selectable("Clear")) ClearLog(); | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -202,6 +202,7 @@ namespace ImGui | |||||||
|     IMGUI_API void          AlignFirstTextHeightToWidgets();                                    // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets |     IMGUI_API void          AlignFirstTextHeightToWidgets();                                    // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets | ||||||
|     IMGUI_API float         GetTextLineHeight();                                                // height of font == GetWindowFontSize() |     IMGUI_API float         GetTextLineHeight();                                                // height of font == GetWindowFontSize() | ||||||
|     IMGUI_API float         GetTextLineHeightWithSpacing();                                     // spacing (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y |     IMGUI_API float         GetTextLineHeightWithSpacing();                                     // spacing (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y | ||||||
|  |     IMGUI_API float         GetItemsLineHeightWithSpacing(); | ||||||
|  |  | ||||||
|     // ID scopes |     // ID scopes | ||||||
|     // If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them |     // If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user