MCPcopy Create free account
hub / github.com/RenderKit/embree / EndTable

Method EndTable

tutorials/common/imgui/imgui_tables.cpp:1201–1406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 12

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

Tested by

no test coverage detected