mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Added basic sizes edition in the style editor
This commit is contained in:
		
							
								
								
									
										25
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -2344,7 +2344,7 @@ const char* GetStyleColorName(ImGuiCol idx) | |||||||
|     case ImGuiCol_PlotLines: return "PlotLines"; |     case ImGuiCol_PlotLines: return "PlotLines"; | ||||||
|     case ImGuiCol_PlotLinesHovered: return "PlotLinesHovered"; |     case ImGuiCol_PlotLinesHovered: return "PlotLinesHovered"; | ||||||
|     case ImGuiCol_PlotHistogram: return "PlotHistogram"; |     case ImGuiCol_PlotHistogram: return "PlotHistogram"; | ||||||
|     case ImGuiCol_PlotHistogramHovered: return "ImGuiCol_PlotHistogramHovered"; |     case ImGuiCol_PlotHistogramHovered: return "PlotHistogramHovered"; | ||||||
|     case ImGuiCol_TextSelectedBg: return "TextSelectedBg"; |     case ImGuiCol_TextSelectedBg: return "TextSelectedBg"; | ||||||
|     case ImGuiCol_TooltipBg: return "TooltipBg"; |     case ImGuiCol_TooltipBg: return "TooltipBg"; | ||||||
|     } |     } | ||||||
| @@ -5413,9 +5413,24 @@ void ShowStyleEditor(ImGuiStyle* ref) | |||||||
|             *ref = g.Style; |             *ref = g.Style; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     ImGui::SliderFloat("Alpha", &style.Alpha, 0.20f, 1.0f, "%.2f");                 // Not exposing zero here so user doesn't "lose" the UI. But application code could have a toggle to switch between zero and non-zero. |     ImGui::PushItemWidth(ImGui::GetWindowWidth()*0.55f); | ||||||
|     ImGui::SliderFloat("Rounding", &style.WindowRounding, 0.0f, 16.0f, "%.0f"); |  | ||||||
|  |  | ||||||
|  |     if (ImGui::TreeNode("Sizes")) | ||||||
|  |     { | ||||||
|  |         ImGui::SliderFloat("Alpha", &style.Alpha, 0.20f, 1.0f, "%.2f");                 // Not exposing zero here so user doesn't "lose" the UI. But application code could have a toggle to switch between zero and non-zero. | ||||||
|  |         ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f"); | ||||||
|  |         ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 16.0f, "%.0f"); | ||||||
|  |         ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f"); | ||||||
|  |         ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f"); | ||||||
|  |         ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f"); | ||||||
|  |         ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 20.0f, "%.0f"); | ||||||
|  |         ImGui::SliderFloat("TreeNodeSpacing", &style.TreeNodeSpacing, 0.0f, 20.0f, "%.0f"); | ||||||
|  |         ImGui::SliderFloat("ScrollBarWidth", &style.ScrollBarWidth, 0.0f, 20.0f, "%.0f"); | ||||||
|  |         ImGui::TreePop(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if (ImGui::TreeNode("Colors")) | ||||||
|  |     { | ||||||
|         static ImGuiColorEditMode edit_mode = ImGuiColorEditMode_RGB; |         static ImGuiColorEditMode edit_mode = ImGuiColorEditMode_RGB; | ||||||
|         ImGui::RadioButton("RGB", &edit_mode, ImGuiColorEditMode_RGB); |         ImGui::RadioButton("RGB", &edit_mode, ImGuiColorEditMode_RGB); | ||||||
|         ImGui::SameLine(); |         ImGui::SameLine(); | ||||||
| @@ -5441,6 +5456,10 @@ void ShowStyleEditor(ImGuiStyle* ref) | |||||||
|             } |             } | ||||||
|             ImGui::PopID(); |             ImGui::PopID(); | ||||||
|         } |         } | ||||||
|  |         ImGui::TreePop(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     ImGui::PopItemWidth(); | ||||||
| } | } | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ocornut
					ocornut