MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / EndTable

Method EndTable

extern/imgui/imgui_tables.cpp:1200–1405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1198}
1199
1200void ImGui::EndTable()
1201{
1202 ImGuiContext& g = *GImGui;
1203 ImGuiTable* table = g.CurrentTable;
1204 IM_ASSERT(table != NULL && "Only call EndTable() if BeginTable() returns true!");
1205
1206 // This assert would be very useful to catch a common error... unfortunately it would probably trigger in some
1207 // cases, and for consistency user may sometimes output empty tables (and still benefit from e.g. outer border)
1208 //IM_ASSERT(table->IsLayoutLocked && "Table unused: never called TableNextRow(), is that the intent?");
1209
1210 // If the user never got to call TableNextRow() or TableNextColumn(), we call layout ourselves to ensure all our
1211 // code paths are consistent (instead of just hoping that TableBegin/TableEnd will work), get borders drawn, etc.
1212 if (!table->IsLayoutLocked)
1213 TableUpdateLayout(table);
1214
1215 const ImGuiTableFlags flags = table->Flags;
1216 ImGuiWindow* inner_window = table->InnerWindow;
1217 ImGuiWindow* outer_window = table->OuterWindow;
1218 ImGuiTableTempData* temp_data = table->TempData;
1219 IM_ASSERT(inner_window == g.CurrentWindow);
1220 IM_ASSERT(outer_window == inner_window || outer_window == inner_window->ParentWindow);
1221
1222 if (table->IsInsideRow)
1223 TableEndRow(table);
1224
1225 // Context menu in columns body
1226 if (flags & ImGuiTableFlags_ContextMenuInBody)
1227 if (table->HoveredColumnBody != -1 && !IsAnyItemHovered() && IsMouseReleased(ImGuiMouseButton_Right))
1228 TableOpenContextMenu((int)table->HoveredColumnBody);
1229
1230 // Finalize table height
1231 ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent);
1232 inner_window->DC.PrevLineSize = temp_data->HostBackupPrevLineSize;
1233 inner_window->DC.CurrLineSize = temp_data->HostBackupCurrLineSize;
1234 inner_window->DC.CursorMaxPos = temp_data->HostBackupCursorMaxPos;
1235 const float inner_content_max_y = table->RowPosY2;
1236 IM_ASSERT(table->RowPosY2 == inner_window->DC.CursorPos.y);
1237 if (inner_window != outer_window)
1238 inner_window->DC.CursorMaxPos.y = inner_content_max_y;
1239 else if (!(flags & ImGuiTableFlags_NoHostExtendY))
1240 table->OuterRect.Max.y = table->InnerRect.Max.y = ImMax(table->OuterRect.Max.y, inner_content_max_y); // Patch OuterRect/InnerRect height
1241 table->WorkRect.Max.y = ImMax(table->WorkRect.Max.y, table->OuterRect.Max.y);
1242 table_instance->LastOuterHeight = table->OuterRect.GetHeight();
1243
1244 // Setup inner scrolling range
1245 // FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window->DC.CursorMaxPos.y,
1246 // but since the later is likely to be impossible to do we'd rather update both axises together.
1247 if (table->Flags & ImGuiTableFlags_ScrollX)
1248 {
1249 const float outer_padding_for_border = (table->Flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f;
1250 float max_pos_x = table->InnerWindow->DC.CursorMaxPos.x;
1251 if (table->RightMostEnabledColumn != -1)
1252 max_pos_x = ImMax(max_pos_x, table->Columns[table->RightMostEnabledColumn].WorkMaxX + table->CellPaddingX + table->OuterPaddingX - outer_padding_for_border);
1253 if (table->ResizedColumn != -1)
1254 max_pos_x = ImMax(max_pos_x, table->ResizeLockMinContentsX2);
1255 table->InnerWindow->DC.CursorMaxPos.x = max_pos_x;
1256 }
1257

Callers

nothing calls this directly

Calls 13

TableGetInstanceDataFunction · 0.85
ImMaxFunction · 0.85
ImFloorFunction · 0.85
ItemSizeFunction · 0.85
ImMinFunction · 0.85
backMethod · 0.80
SetCurrentChannelMethod · 0.80
MergeMethod · 0.80
GetSizeMethod · 0.80
GetByIndexMethod · 0.80
GetIndexMethod · 0.80
PopClipRectMethod · 0.45

Tested by

no test coverage detected