MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / TableBeginCell

Method TableBeginCell

KBotExt/imgui/imgui_tables.cpp:2004–2056  ·  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

2002// This is called very frequently, so we need to be mindful of unnecessary overhead.
2003// FIXME-TABLE FIXME-OPT: Could probably shortcut some things for non-active or clipped columns.
2004void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
2005{
2006 ImGuiContext& g = *GImGui;
2007 ImGuiTableColumn* column = &table->Columns[column_n];
2008 ImGuiWindow* window = table->InnerWindow;
2009 table->CurrentColumn = column_n;
2010
2011 // Start position is roughly ~~ CellRect.Min + CellPadding + Indent
2012 float start_x = column->WorkMinX;
2013 if (column->Flags & ImGuiTableColumnFlags_IndentEnable)
2014 start_x += table->RowIndentOffsetX; // ~~ += window.DC.Indent.x - table->HostIndentX, except we locked it for the row.
2015
2016 window->DC.CursorPos.x = start_x;
2017 window->DC.CursorPos.y = table->RowPosY1 + table->RowCellPaddingY;
2018 window->DC.CursorMaxPos.x = window->DC.CursorPos.x;
2019 window->DC.ColumnsOffset.x = start_x - window->Pos.x - window->DC.Indent.x; // FIXME-WORKRECT
2020 window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x; // PrevLine.y is preserved. This allows users to call SameLine() to share LineSize between columns.
2021 window->DC.CurrLineTextBaseOffset = table->RowTextBaseline;
2022 window->DC.NavLayerCurrent = (ImGuiNavLayer)column->NavLayerCurrent;
2023
2024 // Note how WorkRect.Max.y is only set once during layout
2025 window->WorkRect.Min.y = window->DC.CursorPos.y;
2026 window->WorkRect.Min.x = column->WorkMinX;
2027 window->WorkRect.Max.x = column->WorkMaxX;
2028 window->DC.ItemWidth = column->ItemWidth;
2029
2030 window->SkipItems = column->IsSkipItems;
2031 if (column->IsSkipItems)
2032 {
2033 g.LastItemData.ID = 0;
2034 g.LastItemData.StatusFlags = 0;
2035 }
2036
2037 if (table->Flags & ImGuiTableFlags_NoClip)
2038 {
2039 // FIXME: if we end up drawing all borders/bg in EndTable, could remove this and just assert that channel hasn't changed.
2040 table->DrawSplitter->SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);
2041 //IM_ASSERT(table->DrawSplitter._Current == TABLE_DRAW_CHANNEL_NOCLIP);
2042 }
2043 else
2044 {
2045 // FIXME-TABLE: Could avoid this if draw channel is dummy channel?
2046 SetWindowClipRectBeforeSetChannel(window, column->ClipRect);
2047 table->DrawSplitter->SetCurrentChannel(window->DrawList, column->DrawChannelCurrent);
2048 }
2049
2050 // Logging
2051 if (g.LogEnabled && !column->IsSkipItems)
2052 {
2053 LogRenderedText(&window->DC.CursorPos, "|");
2054 g.LogLinePosY = FLT_MAX;
2055 }
2056}
2057
2058// [Internal] Called by TableNextRow()/TableSetColumnIndex()/TableNextColumn()
2059void ImGui::TableEndCell(ImGuiTable* table)

Callers

nothing calls this directly

Calls 1

SetCurrentChannelMethod · 0.80

Tested by

no test coverage detected