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

Method TableBeginCell

tutorials/common/imgui/imgui_tables.cpp:1949–2004  ·  view source on GitHub ↗

[Internal] Called by TableSetColumnIndex()/TableNextColumn() This is called very frequently, so we need to be mindful of unnecessary overhead. FIXME-TABLE FIXME-OPT: Could probably shortcut some things for non-active or clipped columns.

Source from the content-addressed store, hash-verified

1947// This is called very frequently, so we need to be mindful of unnecessary overhead.
1948// FIXME-TABLE FIXME-OPT: Could probably shortcut some things for non-active or clipped columns.
1949void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
1950{
1951 ImGuiTableColumn* column = &table->Columns[column_n];
1952 ImGuiWindow* window = table->InnerWindow;
1953 table->CurrentColumn = column_n;
1954
1955 // Start position is roughly ~~ CellRect.Min + CellPadding + Indent
1956 float start_x = column->WorkMinX;
1957 if (column->Flags & ImGuiTableColumnFlags_IndentEnable)
1958 start_x += table->RowIndentOffsetX; // ~~ += window.DC.Indent.x - table->HostIndentX, except we locked it for the row.
1959
1960 window->DC.CursorPos.x = start_x;
1961 window->DC.CursorPos.y = table->RowPosY1 + table->CellPaddingY;
1962 window->DC.CursorMaxPos.x = window->DC.CursorPos.x;
1963 window->DC.ColumnsOffset.x = start_x - window->Pos.x - window->DC.Indent.x; // FIXME-WORKRECT
1964 window->DC.CurrLineTextBaseOffset = table->RowTextBaseline;
1965 window->DC.NavLayerCurrent = (ImGuiNavLayer)column->NavLayerCurrent;
1966
1967 window->WorkRect.Min.y = window->DC.CursorPos.y;
1968 window->WorkRect.Min.x = column->WorkMinX;
1969 window->WorkRect.Max.x = column->WorkMaxX;
1970 window->DC.ItemWidth = column->ItemWidth;
1971
1972 // To allow ImGuiListClipper to function we propagate our row height
1973 if (!column->IsEnabled)
1974 window->DC.CursorPos.y = ImMax(window->DC.CursorPos.y, table->RowPosY2);
1975
1976 window->SkipItems = column->IsSkipItems;
1977 if (column->IsSkipItems)
1978 {
1979 ImGuiContext& g = *GImGui;
1980 g.LastItemData.ID = 0;
1981 g.LastItemData.StatusFlags = 0;
1982 }
1983
1984 if (table->Flags & ImGuiTableFlags_NoClip)
1985 {
1986 // FIXME: if we end up drawing all borders/bg in EndTable, could remove this and just assert that channel hasn't changed.
1987 table->DrawSplitter->SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);
1988 //IM_ASSERT(table->DrawSplitter._Current == TABLE_DRAW_CHANNEL_NOCLIP);
1989 }
1990 else
1991 {
1992 // FIXME-TABLE: Could avoid this if draw channel is dummy channel?
1993 SetWindowClipRectBeforeSetChannel(window, column->ClipRect);
1994 table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);
1995 }
1996
1997 // Logging
1998 ImGuiContext& g = *GImGui;
1999 if (g.LogEnabled && !column->IsSkipItems)
2000 {
2001 LogRenderedText(&window->DC.CursorPos, "|");
2002 g.LogLinePosY = FLT_MAX;
2003 }
2004}
2005
2006// [Internal] Called by TableNextRow()/TableSetColumnIndex()/TableNextColumn()

Callers

nothing calls this directly

Calls 2

ImMaxFunction · 0.85
SetCurrentChannelMethod · 0.80

Tested by

no test coverage detected