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