[Internal] Called by TableNextRow()
| 1796 | |
| 1797 | // [Internal] Called by TableNextRow() |
| 1798 | void ImGui::TableEndRow(ImGuiTable* table) |
| 1799 | { |
| 1800 | ImGuiContext& g = *GImGui; |
| 1801 | ImGuiWindow* window = g.CurrentWindow; |
| 1802 | IM_ASSERT(window == table->InnerWindow); |
| 1803 | IM_ASSERT(table->IsInsideRow); |
| 1804 | |
| 1805 | if (table->CurrentColumn != -1) |
| 1806 | TableEndCell(table); |
| 1807 | |
| 1808 | // Logging |
| 1809 | if (g.LogEnabled) |
| 1810 | LogRenderedText(NULL, "|"); |
| 1811 | |
| 1812 | // Position cursor at the bottom of our row so it can be used for e.g. clipping calculation. However it is |
| 1813 | // likely that the next call to TableBeginCell() will reposition the cursor to take account of vertical padding. |
| 1814 | window->DC.CursorPos.y = table->RowPosY2; |
| 1815 | |
| 1816 | // Row background fill |
| 1817 | const float bg_y1 = table->RowPosY1; |
| 1818 | const float bg_y2 = table->RowPosY2; |
| 1819 | const bool unfreeze_rows_actual = (table->CurrentRow + 1 == table->FreezeRowsCount); |
| 1820 | const bool unfreeze_rows_request = (table->CurrentRow + 1 == table->FreezeRowsRequest); |
| 1821 | if (table->CurrentRow == 0) |
| 1822 | TableGetInstanceData(table, table->InstanceCurrent)->LastFirstRowHeight = bg_y2 - bg_y1; |
| 1823 | |
| 1824 | const bool is_visible = (bg_y2 >= table->InnerClipRect.Min.y && bg_y1 <= table->InnerClipRect.Max.y); |
| 1825 | if (is_visible) |
| 1826 | { |
| 1827 | // Update data for TableGetHoveredRow() |
| 1828 | if (table->HoveredColumnBody != -1 && g.IO.MousePos.y >= bg_y1 && g.IO.MousePos.y < bg_y2) |
| 1829 | TableGetInstanceData(table, table->InstanceCurrent)->HoveredRowNext = table->CurrentRow; |
| 1830 | |
| 1831 | // Decide of background color for the row |
| 1832 | ImU32 bg_col0 = 0; |
| 1833 | ImU32 bg_col1 = 0; |
| 1834 | if (table->RowBgColor[0] != IM_COL32_DISABLE) |
| 1835 | bg_col0 = table->RowBgColor[0]; |
| 1836 | else if (table->Flags & ImGuiTableFlags_RowBg) |
| 1837 | bg_col0 = GetColorU32((table->RowBgColorCounter & 1) ? ImGuiCol_TableRowBgAlt : ImGuiCol_TableRowBg); |
| 1838 | if (table->RowBgColor[1] != IM_COL32_DISABLE) |
| 1839 | bg_col1 = table->RowBgColor[1]; |
| 1840 | |
| 1841 | // Decide of top border color |
| 1842 | ImU32 border_col = 0; |
| 1843 | const float border_size = TABLE_BORDER_SIZE; |
| 1844 | if (table->CurrentRow > 0 || table->InnerWindow == table->OuterWindow) |
| 1845 | if (table->Flags & ImGuiTableFlags_BordersInnerH) |
| 1846 | border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight; |
| 1847 | |
| 1848 | const bool draw_cell_bg_color = table->RowCellDataCurrent >= 0; |
| 1849 | const bool draw_strong_bottom_border = unfreeze_rows_actual; |
| 1850 | if ((bg_col0 | bg_col1 | border_col) != 0 || draw_strong_bottom_border || draw_cell_bg_color) |
| 1851 | { |
| 1852 | // In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is |
| 1853 | // always followed by a change of clipping rectangle we perform the smallest overwrite possible here. |
| 1854 | if ((table->Flags & ImGuiTableFlags_NoClip) == 0) |
| 1855 | window->DrawList->_CmdHeader.ClipRect = table->Bg0ClipRectForDrawCmd.ToVec4(); |
nothing calls this directly
no test coverage detected