[Internal] Called by TableNextRow()
| 1979 | |
| 1980 | // [Internal] Called by TableNextRow() |
| 1981 | void ImGui::TableEndRow(ImGuiTable* table) |
| 1982 | { |
| 1983 | ImGuiContext& g = *GImGui; |
| 1984 | ImGuiWindow* window = g.CurrentWindow; |
| 1985 | IM_ASSERT(window == table->InnerWindow); |
| 1986 | IM_ASSERT(table->IsInsideRow); |
| 1987 | |
| 1988 | if (table->CurrentColumn != -1) |
| 1989 | { |
| 1990 | TableEndCell(table); |
| 1991 | table->CurrentColumn = -1; |
| 1992 | } |
| 1993 | |
| 1994 | // Logging |
| 1995 | if (g.LogEnabled) |
| 1996 | LogRenderedText(NULL, "|"); |
| 1997 | |
| 1998 | // Position cursor at the bottom of our row so it can be used for e.g. clipping calculation. However it is |
| 1999 | // likely that the next call to TableBeginCell() will reposition the cursor to take account of vertical padding. |
| 2000 | window->DC.CursorPos.y = table->RowPosY2; |
| 2001 | |
| 2002 | // Row background fill |
| 2003 | const float bg_y1 = table->RowPosY1; |
| 2004 | const float bg_y2 = table->RowPosY2; |
| 2005 | const bool unfreeze_rows_actual = (table->CurrentRow + 1 == table->FreezeRowsCount); |
| 2006 | const bool unfreeze_rows_request = (table->CurrentRow + 1 == table->FreezeRowsRequest); |
| 2007 | ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); |
| 2008 | if ((table->RowFlags & ImGuiTableRowFlags_Headers) && (table->CurrentRow == 0 || (table->LastRowFlags & ImGuiTableRowFlags_Headers))) |
| 2009 | table_instance->LastTopHeadersRowHeight += bg_y2 - bg_y1; |
| 2010 | |
| 2011 | const bool is_visible = (bg_y2 >= table->InnerClipRect.Min.y && bg_y1 <= table->InnerClipRect.Max.y); |
| 2012 | if (is_visible) |
| 2013 | { |
| 2014 | // Update data for TableGetHoveredRow() |
| 2015 | if (table->HoveredColumnBody != -1 && g.IO.MousePos.y >= bg_y1 && g.IO.MousePos.y < bg_y2 && table_instance->HoveredRowNext < 0) |
| 2016 | table_instance->HoveredRowNext = table->CurrentRow; |
| 2017 | |
| 2018 | // Decide of background color for the row |
| 2019 | ImU32 bg_col0 = 0; |
| 2020 | ImU32 bg_col1 = 0; |
| 2021 | if (table->RowBgColor[0] != IM_COL32_DISABLE) |
| 2022 | bg_col0 = table->RowBgColor[0]; |
| 2023 | else if (table->Flags & ImGuiTableFlags_RowBg) |
| 2024 | bg_col0 = GetColorU32((table->RowBgColorCounter & 1) ? ImGuiCol_TableRowBgAlt : ImGuiCol_TableRowBg); |
| 2025 | if (table->RowBgColor[1] != IM_COL32_DISABLE) |
| 2026 | bg_col1 = table->RowBgColor[1]; |
| 2027 | |
| 2028 | // Decide of top border color |
| 2029 | ImU32 top_border_col = 0; |
| 2030 | const float border_size = TABLE_BORDER_SIZE; |
| 2031 | if (table->CurrentRow > 0 && (table->Flags & ImGuiTableFlags_BordersInnerH)) |
| 2032 | top_border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight; |
| 2033 | |
| 2034 | const bool draw_cell_bg_color = table->RowCellDataCurrent >= 0; |
| 2035 | const bool draw_strong_bottom_border = unfreeze_rows_actual; |
| 2036 | if ((bg_col0 | bg_col1 | top_border_col) != 0 || draw_strong_bottom_border || draw_cell_bg_color) |
| 2037 | { |
| 2038 | // In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is |
nothing calls this directly
no test coverage detected