[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.
| 2173 | // This is called very frequently, so we need to be mindful of unnecessary overhead. |
| 2174 | // FIXME-TABLE FIXME-OPT: Could probably shortcut some things for non-active or clipped columns. |
| 2175 | void ImGui::TableBeginCell(ImGuiTable* table, int column_n) |
| 2176 | { |
| 2177 | ImGuiContext& g = *GImGui; |
| 2178 | ImGuiTableColumn* column = &table->Columns[column_n]; |
| 2179 | ImGuiWindow* window = table->InnerWindow; |
| 2180 | table->CurrentColumn = column_n; |
| 2181 | |
| 2182 | // Start position is roughly ~~ CellRect.Min + CellPadding + Indent |
| 2183 | float start_x = column->WorkMinX; |
| 2184 | if (column->Flags & ImGuiTableColumnFlags_IndentEnable) |
| 2185 | start_x += table->RowIndentOffsetX; // ~~ += window.DC.Indent.x - table->HostIndentX, except we locked it for the row. |
| 2186 | |
| 2187 | window->DC.CursorPos.x = start_x; |
| 2188 | window->DC.CursorPos.y = table->RowPosY1 + table->RowCellPaddingY; |
| 2189 | window->DC.CursorMaxPos.x = window->DC.CursorPos.x; |
| 2190 | window->DC.ColumnsOffset.x = start_x - window->Pos.x - window->DC.Indent.x; // FIXME-WORKRECT |
| 2191 | window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x; // PrevLine.y is preserved. This allows users to call SameLine() to share LineSize between columns. |
| 2192 | window->DC.CurrLineTextBaseOffset = table->RowTextBaseline; |
| 2193 | window->DC.NavLayerCurrent = (ImGuiNavLayer)column->NavLayerCurrent; |
| 2194 | |
| 2195 | // Note how WorkRect.Max.y is only set once during layout |
| 2196 | window->WorkRect.Min.y = window->DC.CursorPos.y; |
| 2197 | window->WorkRect.Min.x = column->WorkMinX; |
| 2198 | window->WorkRect.Max.x = column->WorkMaxX; |
| 2199 | window->DC.ItemWidth = column->ItemWidth; |
| 2200 | |
| 2201 | window->SkipItems = column->IsSkipItems; |
| 2202 | if (column->IsSkipItems) |
| 2203 | { |
| 2204 | g.LastItemData.ID = 0; |
| 2205 | g.LastItemData.StatusFlags = 0; |
| 2206 | } |
| 2207 | |
| 2208 | // Also see TablePushColumnChannel() |
| 2209 | if (table->Flags & ImGuiTableFlags_NoClip) |
| 2210 | { |
| 2211 | // FIXME: if we end up drawing all borders/bg in EndTable, could remove this and just assert that channel hasn't changed. |
| 2212 | table->DrawSplitter->SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP); |
| 2213 | //IM_ASSERT(table->DrawSplitter._Current == TABLE_DRAW_CHANNEL_NOCLIP); |
| 2214 | } |
| 2215 | else |
| 2216 | { |
| 2217 | // FIXME-TABLE: Could avoid this if draw channel is dummy channel? |
| 2218 | SetWindowClipRectBeforeSetChannel(window, column->ClipRect); |
| 2219 | table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent); |
| 2220 | } |
| 2221 | |
| 2222 | // Logging |
| 2223 | if (g.LogEnabled && !column->IsSkipItems) |
| 2224 | { |
| 2225 | LogRenderedText(&window->DC.CursorPos, "|"); |
| 2226 | g.LogLinePosY = FLT_MAX; |
| 2227 | } |
| 2228 | } |
| 2229 | |
| 2230 | // [Internal] Called by TableNextRow()/TableSetColumnIndex()/TableNextColumn() |
| 2231 | void ImGui::TableEndCell(ImGuiTable* table) |
nothing calls this directly
no test coverage detected