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