mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	Tables: Tidying up. Shuffle some columns fields to facilitate debugging + comments + demo tweaks + metrics highlight.
This commit is contained in:
		| @@ -3514,12 +3514,12 @@ static void ShowDemoWindowTables() | ||||
|         ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuter", &flags, ImGuiTableFlags_BordersOuter); | ||||
|         ImGui::CheckboxFlags("ImGuiTableFlags_BordersInner", &flags, ImGuiTableFlags_BordersInner); | ||||
|         ImGui::Unindent(); | ||||
|         ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appears in Headers"); | ||||
|  | ||||
|         ImGui::AlignTextToFramePadding(); ImGui::Text("Cell contents:"); | ||||
|         ImGui::SameLine(); ImGui::RadioButton("Text", &contents_type, CT_Text); | ||||
|         ImGui::SameLine(); ImGui::RadioButton("FillButton", &contents_type, CT_FillButton); | ||||
|         ImGui::Checkbox("Display headers", &display_headers); | ||||
|         ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appears in Headers"); | ||||
|         PopStyleCompact(); | ||||
|  | ||||
|         if (ImGui::BeginTable("##table1", 3, flags)) | ||||
| @@ -3563,7 +3563,7 @@ static void ShowDemoWindowTables() | ||||
|         PushStyleCompact(); | ||||
|         ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", &flags, ImGuiTableFlags_Resizable); | ||||
|         ImGui::CheckboxFlags("ImGuiTableFlags_BordersV", &flags, ImGuiTableFlags_BordersV); | ||||
|         ImGui::SameLine(); HelpMarker("Using the _Resizable flag automatically enables the _BordersInnerV flag as well."); | ||||
|         ImGui::SameLine(); HelpMarker("Using the _Resizable flag automatically enables the _BordersInnerV flag as well, this is why the resize borders are still showing when unchecking this."); | ||||
|         PopStyleCompact(); | ||||
|  | ||||
|         if (ImGui::BeginTable("##table1", 3, flags)) | ||||
| @@ -3670,7 +3670,9 @@ static void ShowDemoWindowTables() | ||||
|         ImGui::SetNextItemOpen(open_action != 0); | ||||
|     if (ImGui::TreeNode("Reorderable, hideable, with headers")) | ||||
|     { | ||||
|         HelpMarker("Click and drag column headers to reorder columns.\n\nYou can also right-click on a header to open a context menu."); | ||||
|         HelpMarker( | ||||
|             "Click and drag column headers to reorder columns.\n\n" | ||||
|             "Right-click on a header to open a context menu."); | ||||
|         static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV; | ||||
|         PushStyleCompact(); | ||||
|         ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", &flags, ImGuiTableFlags_Resizable); | ||||
| @@ -3733,7 +3735,8 @@ static void ShowDemoWindowTables() | ||||
|             "- BorderOuterV\n" | ||||
|             "- any form of row selection\n" | ||||
|             "Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\n\n" | ||||
|             "Actual padding values are using style.CellPadding."); | ||||
|             "Actual padding values are using style.CellPadding.\n\n" | ||||
|             "In this demo we don't show horizontal borders to emphasis how they don't affect default horizontal padding."); | ||||
|  | ||||
|         static ImGuiTableFlags flags1 = ImGuiTableFlags_BordersV; | ||||
|         PushStyleCompact(); | ||||
| @@ -3787,7 +3790,7 @@ static void ShowDemoWindowTables() | ||||
|         HelpMarker("Setting style.CellPadding to (0,0) or a custom value."); | ||||
|         static ImGuiTableFlags flags2 = ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg; | ||||
|         static ImVec2 cell_padding(0.0f, 0.0f); | ||||
|         static bool show_widget_frame_bg = false; | ||||
|         static bool show_widget_frame_bg = true; | ||||
|  | ||||
|         PushStyleCompact(); | ||||
|         ImGui::CheckboxFlags("ImGuiTableFlags_Borders", &flags2, ImGuiTableFlags_Borders); | ||||
| @@ -3833,14 +3836,15 @@ static void ShowDemoWindowTables() | ||||
|     if (ImGui::TreeNode("Sizing policies")) | ||||
|     { | ||||
|         HelpMarker("This section allows you to interact and see the effect of various sizing policies depending on whether Scroll is enabled and the contents of your columns."); | ||||
|         enum ContentsType { CT_ShortText, CT_LongText, CT_Button, CT_FillButton, CT_InputText }; | ||||
|         static ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_RowBg; | ||||
|         static int contents_type = CT_LongText; | ||||
|  | ||||
|         enum ContentsType { CT_ShowWidth, CT_ShortText, CT_LongText, CT_Button, CT_FillButton, CT_InputText }; | ||||
|         static ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_Resizable; | ||||
|         static int contents_type = CT_ShowWidth; | ||||
|         static int column_count = 3; | ||||
|  | ||||
|         PushStyleCompact(); | ||||
|         ImGui::PushItemWidth(TEXT_BASE_WIDTH * 30); | ||||
|         ImGui::Combo("Contents", &contents_type, "Short Text\0Long Text\0Button\0Fill Button\0InputText\0"); | ||||
|         ImGui::Combo("Contents", &contents_type, "Show width\0Short Text\0Long Text\0Button\0Fill Button\0InputText\0"); | ||||
|         if (contents_type == CT_FillButton) | ||||
|         { | ||||
|             ImGui::SameLine(); | ||||
| @@ -3878,7 +3882,8 @@ static void ShowDemoWindowTables() | ||||
|                 switch (contents_type) | ||||
|                 { | ||||
|                 case CT_ShortText:  ImGui::TextUnformatted(label); break; | ||||
|                 case CT_LongText:   ImGui::Text("Some longer text %d,%d\nOver two lines..", column, row); break; | ||||
|                 case CT_LongText:   ImGui::Text("Some %s text %d,%d\nOver two lines..", column == 0 ? "long" : "longeeer", column, row); break; | ||||
|                 case CT_ShowWidth:  ImGui::Text("W: %.1f", ImGui::GetContentRegionAvail().x); break; | ||||
|                 case CT_Button:     ImGui::Button(label); break; | ||||
|                 case CT_FillButton: ImGui::Button(label, ImVec2(-FLT_MIN, 0.0f)); break; | ||||
|                 case CT_InputText:  ImGui::SetNextItemWidth(-FLT_MIN); ImGui::InputText("##", text_buf, IM_ARRAYSIZE(text_buf)); break; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user