mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	Tables: TableSetupColumn() user id uses ImGuiID as intended (typedef ImU32). internals: added GetCurrentTable(), LeftMostEnabledColumn. Demo/docs tweaks.
This commit is contained in:
		| @@ -687,13 +687,14 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) | ||||
|     table->ColumnsEnabledCount = 0; | ||||
|     table->EnabledMaskByIndex = 0x00; | ||||
|     table->EnabledMaskByDisplayOrder = 0x00; | ||||
|     table->LeftMostEnabledColumn = -1; | ||||
|     table->MinColumnWidth = ImMax(1.0f, g.Style.FramePadding.x * 1.0f); // g.Style.ColumnsMinSpacing; // FIXME-TABLE | ||||
|  | ||||
|     // [Part 1] Apply/lock Enabled and Order states. Calculate auto/ideal width for columns. Count fixed/stretch columns. | ||||
|     // Process columns in their visible orders as we are building the Prev/Next indices. | ||||
|     int count_fixed = 0;                // Number of columns that have fixed sizing policies | ||||
|     int count_stretch = 0;              // Number of columns that have stretch sizing policies | ||||
|     int last_visible_column_idx = -1; | ||||
|     int prev_visible_column_idx = -1; | ||||
|     bool has_auto_fit_request = false; | ||||
|     bool has_resizable = false; | ||||
|     float stretch_sum_width_auto = 0.0f; | ||||
| @@ -741,14 +742,16 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) | ||||
|         } | ||||
|  | ||||
|         // Mark as enabled and link to previous/next enabled column | ||||
|         column->PrevEnabledColumn = (ImGuiTableColumnIdx)last_visible_column_idx; | ||||
|         column->PrevEnabledColumn = (ImGuiTableColumnIdx)prev_visible_column_idx; | ||||
|         column->NextEnabledColumn = -1; | ||||
|         if (last_visible_column_idx != -1) | ||||
|             table->Columns[last_visible_column_idx].NextEnabledColumn = (ImGuiTableColumnIdx)column_n; | ||||
|         if (prev_visible_column_idx != -1) | ||||
|             table->Columns[prev_visible_column_idx].NextEnabledColumn = (ImGuiTableColumnIdx)column_n; | ||||
|         else | ||||
|             table->LeftMostEnabledColumn = (ImGuiTableColumnIdx)column_n; | ||||
|         column->IndexWithinEnabledSet = table->ColumnsEnabledCount++; | ||||
|         table->EnabledMaskByIndex |= (ImU64)1 << column_n; | ||||
|         table->EnabledMaskByDisplayOrder |= (ImU64)1 << column->DisplayOrder; | ||||
|         last_visible_column_idx = column_n; | ||||
|         prev_visible_column_idx = column_n; | ||||
|         IM_ASSERT(column->IndexWithinEnabledSet <= column->DisplayOrder); | ||||
|  | ||||
|         // Calculate ideal/auto column width (that's the width required for all contents to be visible without clipping) | ||||
| @@ -778,8 +781,8 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) | ||||
|     } | ||||
|     if ((table->Flags & ImGuiTableFlags_Sortable) && table->SortSpecsCount == 0 && !(table->Flags & ImGuiTableFlags_SortTristate)) | ||||
|         table->IsSortSpecsDirty = true; | ||||
|     table->RightMostEnabledColumn = (ImGuiTableColumnIdx)last_visible_column_idx; | ||||
|     IM_ASSERT(table->RightMostEnabledColumn >= 0); | ||||
|     table->RightMostEnabledColumn = (ImGuiTableColumnIdx)prev_visible_column_idx; | ||||
|     IM_ASSERT(table->LeftMostEnabledColumn >= 0 && table->RightMostEnabledColumn >= 0); | ||||
|  | ||||
|     // [Part 2] Disable child window clipping while fitting columns. This is not strictly necessary but makes it possible | ||||
|     // to avoid the column fitting having to wait until the first visible frame of the child container (may or not be a good thing). | ||||
|   | ||||
		Reference in New Issue
	
	Block a user