[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.
| 1917 | // This is called very frequently, so we need to be mindful of unnecessary overhead. |
| 1918 | // FIXME-TABLE FIXME-OPT: Could probably shortcut some things for non-active or clipped columns. |
| 1919 | void ImGui::TableBeginCell(ImGuiTable* table, int column_n) |
| 1920 | { |
| 1921 | ImGuiTableColumn* column = &table->Columns[column_n]; |
| 1922 | ImGuiWindow* window = table->InnerWindow; |
| 1923 | table->CurrentColumn = column_n; |
| 1924 | |
| 1925 | // Start position is roughly ~~ CellRect.Min + CellPadding + Indent |
| 1926 | float start_x = column->WorkMinX; |
| 1927 | if (column->Flags & ImGuiTableColumnFlags_IndentEnable) |
| 1928 | start_x += table->RowIndentOffsetX; // ~~ += window.DC.Indent.x - table->HostIndentX, except we locked it for the row. |
| 1929 | |
| 1930 | window->DC.CursorPos.x = start_x; |
| 1931 | window->DC.CursorPos.y = table->RowPosY1 + table->CellPaddingY; |
| 1932 | window->DC.CursorMaxPos.x = window->DC.CursorPos.x; |
| 1933 | window->DC.ColumnsOffset.x = start_x - window->Pos.x - window->DC.Indent.x; // FIXME-WORKRECT |
| 1934 | window->DC.CurrLineTextBaseOffset = table->RowTextBaseline; |
| 1935 | window->DC.NavLayerCurrent = (ImGuiNavLayer)column->NavLayerCurrent; |
| 1936 | |
| 1937 | window->WorkRect.Min.y = window->DC.CursorPos.y; |
| 1938 | window->WorkRect.Min.x = column->WorkMinX; |
| 1939 | window->WorkRect.Max.x = column->WorkMaxX; |
| 1940 | window->DC.ItemWidth = column->ItemWidth; |
| 1941 | |
| 1942 | // To allow ImGuiListClipper to function we propagate our row height |
| 1943 | if (!column->IsEnabled) |
| 1944 | window->DC.CursorPos.y = ImMax(window->DC.CursorPos.y, table->RowPosY2); |
| 1945 | |
| 1946 | window->SkipItems = column->IsSkipItems; |
| 1947 | if (column->IsSkipItems) |
| 1948 | { |
| 1949 | window->DC.LastItemId = 0; |
| 1950 | window->DC.LastItemStatusFlags = 0; |
| 1951 | } |
| 1952 | |
| 1953 | if (table->Flags & ImGuiTableFlags_NoClip) |
| 1954 | { |
| 1955 | // FIXME: if we end up drawing all borders/bg in EndTable, could remove this and just assert that channel hasn't changed. |
| 1956 | table->DrawSplitter->SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP); |
| 1957 | //IM_ASSERT(table->DrawSplitter._Current == TABLE_DRAW_CHANNEL_NOCLIP); |
| 1958 | } |
| 1959 | else |
| 1960 | { |
| 1961 | // FIXME-TABLE: Could avoid this if draw channel is dummy channel? |
| 1962 | SetWindowClipRectBeforeSetChannel(window, column->ClipRect); |
| 1963 | table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent); |
| 1964 | } |
| 1965 | |
| 1966 | // Logging |
| 1967 | ImGuiContext& g = *GImGui; |
| 1968 | if (g.LogEnabled && !column->IsSkipItems) |
| 1969 | { |
| 1970 | LogRenderedText(&window->DC.CursorPos, "|"); |
| 1971 | g.LogLinePosY = FLT_MAX; |
| 1972 | } |
| 1973 | } |
| 1974 | |
| 1975 | // [Internal] Called by TableNextRow()/TableSetColumnIndex()/TableNextColumn() |
| 1976 | void ImGui::TableEndCell(ImGuiTable* table) |
nothing calls this directly
no test coverage detected