MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / TableEndRow

Method TableEndRow

ImGUI GLFW Tutorial/imgui/imgui_tables.cpp:1715–1847  ·  view source on GitHub ↗

[Internal] Called by TableNextRow()

Source from the content-addressed store, hash-verified

1713
1714// [Internal] Called by TableNextRow()
1715void ImGui::TableEndRow(ImGuiTable* table)
1716{
1717 ImGuiContext& g = *GImGui;
1718 ImGuiWindow* window = g.CurrentWindow;
1719 IM_ASSERT(window == table->InnerWindow);
1720 IM_ASSERT(table->IsInsideRow);
1721
1722 if (table->CurrentColumn != -1)
1723 TableEndCell(table);
1724
1725 // Logging
1726 if (g.LogEnabled)
1727 LogRenderedText(NULL, "|");
1728
1729 // Position cursor at the bottom of our row so it can be used for e.g. clipping calculation. However it is
1730 // likely that the next call to TableBeginCell() will reposition the cursor to take account of vertical padding.
1731 window->DC.CursorPos.y = table->RowPosY2;
1732
1733 // Row background fill
1734 const float bg_y1 = table->RowPosY1;
1735 const float bg_y2 = table->RowPosY2;
1736 const bool unfreeze_rows_actual = (table->CurrentRow + 1 == table->FreezeRowsCount);
1737 const bool unfreeze_rows_request = (table->CurrentRow + 1 == table->FreezeRowsRequest);
1738 if (table->CurrentRow == 0)
1739 table->LastFirstRowHeight = bg_y2 - bg_y1;
1740
1741 const bool is_visible = (bg_y2 >= table->InnerClipRect.Min.y && bg_y1 <= table->InnerClipRect.Max.y);
1742 if (is_visible)
1743 {
1744 // Decide of background color for the row
1745 ImU32 bg_col0 = 0;
1746 ImU32 bg_col1 = 0;
1747 if (table->RowBgColor[0] != IM_COL32_DISABLE)
1748 bg_col0 = table->RowBgColor[0];
1749 else if (table->Flags & ImGuiTableFlags_RowBg)
1750 bg_col0 = GetColorU32((table->RowBgColorCounter & 1) ? ImGuiCol_TableRowBgAlt : ImGuiCol_TableRowBg);
1751 if (table->RowBgColor[1] != IM_COL32_DISABLE)
1752 bg_col1 = table->RowBgColor[1];
1753
1754 // Decide of top border color
1755 ImU32 border_col = 0;
1756 const float border_size = TABLE_BORDER_SIZE;
1757 if (table->CurrentRow > 0 || table->InnerWindow == table->OuterWindow)
1758 if (table->Flags & ImGuiTableFlags_BordersInnerH)
1759 border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight;
1760
1761 const bool draw_cell_bg_color = table->RowCellDataCurrent >= 0;
1762 const bool draw_strong_bottom_border = unfreeze_rows_actual;
1763 if ((bg_col0 | bg_col1 | border_col) != 0 || draw_strong_bottom_border || draw_cell_bg_color)
1764 {
1765 // In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is
1766 // always followed by a change of clipping rectangle we perform the smallest overwrite possible here.
1767 if ((table->Flags & ImGuiTableFlags_NoClip) == 0)
1768 window->DrawList->_CmdHeader.ClipRect = table->Bg0ClipRectForDrawCmd.ToVec4();
1769 table->DrawSplitter->SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_BG0);
1770 }
1771
1772 // Draw row background

Callers

nothing calls this directly

Calls 6

ImMaxFunction · 0.70
ImMinFunction · 0.70
ImVec2Function · 0.70
SetCurrentChannelMethod · 0.45
AddRectFilledMethod · 0.45
AddLineMethod · 0.45

Tested by

no test coverage detected