FIXME-TABLE: This is a mess, need to redesign how we render borders (as some are also done in TableEndRow)
| 2789 | |
| 2790 | // FIXME-TABLE: This is a mess, need to redesign how we render borders (as some are also done in TableEndRow) |
| 2791 | void ImGui::TableDrawBorders(ImGuiTable* table) |
| 2792 | { |
| 2793 | ImGuiWindow* inner_window = table->InnerWindow; |
| 2794 | if (!table->OuterWindow->ClipRect.Overlaps(table->OuterRect)) |
| 2795 | return; |
| 2796 | |
| 2797 | ImDrawList* inner_drawlist = inner_window->DrawList; |
| 2798 | table->DrawSplitter->SetCurrentChannel(inner_drawlist, TABLE_DRAW_CHANNEL_BG0); |
| 2799 | inner_drawlist->PushClipRect(table->Bg0ClipRectForDrawCmd.Min, table->Bg0ClipRectForDrawCmd.Max, false); |
| 2800 | |
| 2801 | // Draw inner border and resizing feedback |
| 2802 | ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); |
| 2803 | const float border_size = TABLE_BORDER_SIZE; |
| 2804 | const float draw_y1 = ImMax(table->InnerRect.Min.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table->AngledHeadersHeight) + ((table->Flags & ImGuiTableFlags_BordersOuterH) ? 1.0f : 0.0f); |
| 2805 | const float draw_y2_body = table->InnerRect.Max.y; |
| 2806 | const float draw_y2_head = table->IsUsingHeaders ? ImMin(table->InnerRect.Max.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table_instance->LastTopHeadersRowHeight) : draw_y1; |
| 2807 | if (table->Flags & ImGuiTableFlags_BordersInnerV) |
| 2808 | { |
| 2809 | for (int order_n = 0; order_n < table->ColumnsCount; order_n++) |
| 2810 | { |
| 2811 | if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByDisplayOrder, order_n)) |
| 2812 | continue; |
| 2813 | |
| 2814 | const int column_n = table->DisplayOrderToIndex[order_n]; |
| 2815 | ImGuiTableColumn* column = &table->Columns[column_n]; |
| 2816 | const bool is_hovered = (table->HoveredColumnBorder == column_n); |
| 2817 | const bool is_resized = (table->ResizedColumn == column_n) && (table->InstanceInteracted == table->InstanceCurrent); |
| 2818 | const bool is_resizable = (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_)) == 0; |
| 2819 | const bool is_frozen_separator = (table->FreezeColumnsCount == order_n + 1); |
| 2820 | if (column->MaxX > table->InnerClipRect.Max.x && !is_resized) |
| 2821 | continue; |
| 2822 | |
| 2823 | // Decide whether right-most column is visible |
| 2824 | if (column->NextEnabledColumn == -1 && !is_resizable) |
| 2825 | if ((table->Flags & ImGuiTableFlags_SizingMask_) != ImGuiTableFlags_SizingFixedSame || (table->Flags & ImGuiTableFlags_NoHostExtendX)) |
| 2826 | continue; |
| 2827 | if (column->MaxX <= column->ClipRect.Min.x) // FIXME-TABLE FIXME-STYLE: Assume BorderSize==1, this is problematic if we want to increase the border size.. |
| 2828 | continue; |
| 2829 | |
| 2830 | // Draw in outer window so right-most column won't be clipped |
| 2831 | float draw_y2 = draw_y2_head; |
| 2832 | if (is_frozen_separator) |
| 2833 | draw_y2 = draw_y2_body; |
| 2834 | else if ((table->Flags & ImGuiTableFlags_NoBordersInBodyUntilResize) != 0 && (is_hovered || is_resized)) |
| 2835 | draw_y2 = draw_y2_body; |
| 2836 | else if ((table->Flags & (ImGuiTableFlags_NoBordersInBodyUntilResize | ImGuiTableFlags_NoBordersInBody)) == 0) |
| 2837 | draw_y2 = draw_y2_body; |
| 2838 | if (draw_y2 > draw_y1) |
| 2839 | inner_drawlist->AddLine(ImVec2(column->MaxX, draw_y1), ImVec2(column->MaxX, draw_y2), TableGetColumnBorderCol(table, order_n, column_n), border_size); |
| 2840 | } |
| 2841 | } |
| 2842 | |
| 2843 | // Draw outer border |
| 2844 | // FIXME: could use AddRect or explicit VLine/HLine helper? |
| 2845 | if (table->Flags & ImGuiTableFlags_BordersOuter) |
| 2846 | { |
| 2847 | // Display outer border offset by 1 which is a simple way to display it without adding an extra draw call |
| 2848 | // (Without the offset, in outer_window it would be rendered behind cells, because child windows are above their |
nothing calls this directly
no test coverage detected