[Internal] Called by TableNextRow()
| 1741 | |
| 1742 | // [Internal] Called by TableNextRow() |
| 1743 | void ImGui::TableEndRow(ImGuiTable* table) |
| 1744 | { |
| 1745 | ImGuiContext& g = *GImGui; |
| 1746 | ImGuiWindow* window = g.CurrentWindow; |
| 1747 | IM_ASSERT(window == table->InnerWindow); |
| 1748 | IM_ASSERT(table->IsInsideRow); |
| 1749 | |
| 1750 | if (table->CurrentColumn != -1) |
| 1751 | TableEndCell(table); |
| 1752 | |
| 1753 | // Logging |
| 1754 | if (g.LogEnabled) |
| 1755 | LogRenderedText(NULL, "|"); |
| 1756 | |
| 1757 | // Position cursor at the bottom of our row so it can be used for e.g. clipping calculation. However it is |
| 1758 | // likely that the next call to TableBeginCell() will reposition the cursor to take account of vertical padding. |
| 1759 | window->DC.CursorPos.y = table->RowPosY2; |
| 1760 | |
| 1761 | // Row background fill |
| 1762 | const float bg_y1 = table->RowPosY1; |
| 1763 | const float bg_y2 = table->RowPosY2; |
| 1764 | const bool unfreeze_rows_actual = (table->CurrentRow + 1 == table->FreezeRowsCount); |
| 1765 | const bool unfreeze_rows_request = (table->CurrentRow + 1 == table->FreezeRowsRequest); |
| 1766 | if (table->CurrentRow == 0) |
| 1767 | TableGetInstanceData(table, table->InstanceCurrent)->LastFirstRowHeight = bg_y2 - bg_y1; |
| 1768 | |
| 1769 | const bool is_visible = (bg_y2 >= table->InnerClipRect.Min.y && bg_y1 <= table->InnerClipRect.Max.y); |
| 1770 | if (is_visible) |
| 1771 | { |
| 1772 | // Decide of background color for the row |
| 1773 | ImU32 bg_col0 = 0; |
| 1774 | ImU32 bg_col1 = 0; |
| 1775 | if (table->RowBgColor[0] != IM_COL32_DISABLE) |
| 1776 | bg_col0 = table->RowBgColor[0]; |
| 1777 | else if (table->Flags & ImGuiTableFlags_RowBg) |
| 1778 | bg_col0 = GetColorU32((table->RowBgColorCounter & 1) ? ImGuiCol_TableRowBgAlt : ImGuiCol_TableRowBg); |
| 1779 | if (table->RowBgColor[1] != IM_COL32_DISABLE) |
| 1780 | bg_col1 = table->RowBgColor[1]; |
| 1781 | |
| 1782 | // Decide of top border color |
| 1783 | ImU32 border_col = 0; |
| 1784 | const float border_size = TABLE_BORDER_SIZE; |
| 1785 | if (table->CurrentRow > 0 || table->InnerWindow == table->OuterWindow) |
| 1786 | if (table->Flags & ImGuiTableFlags_BordersInnerH) |
| 1787 | border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight; |
| 1788 | |
| 1789 | const bool draw_cell_bg_color = table->RowCellDataCurrent >= 0; |
| 1790 | const bool draw_strong_bottom_border = unfreeze_rows_actual; |
| 1791 | if ((bg_col0 | bg_col1 | border_col) != 0 || draw_strong_bottom_border || draw_cell_bg_color) |
| 1792 | { |
| 1793 | // In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is |
| 1794 | // always followed by a change of clipping rectangle we perform the smallest overwrite possible here. |
| 1795 | if ((table->Flags & ImGuiTableFlags_NoClip) == 0) |
| 1796 | window->DrawList->_CmdHeader.ClipRect = table->Bg0ClipRectForDrawCmd.ToVec4(); |
| 1797 | table->DrawSplitter->SetCurrentChannel(window->DrawList, TABLE_DRAW_CHANNEL_BG0); |
| 1798 | } |
| 1799 | |
| 1800 | // Draw row background |
nothing calls this directly
no test coverage detected