MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / TableDrawBorders

Method TableDrawBorders

3rdparty/imgui/src/imgui_tables.cpp:2810–2897  ·  view source on GitHub ↗

FIXME-TABLE: This is a mess, need to redesign how we render borders (as some are also done in TableEndRow)

Source from the content-addressed store, hash-verified

2808
2809// FIXME-TABLE: This is a mess, need to redesign how we render borders (as some are also done in TableEndRow)
2810void ImGui::TableDrawBorders(ImGuiTable* table)
2811{
2812 ImGuiWindow* inner_window = table->InnerWindow;
2813 if (!table->OuterWindow->ClipRect.Overlaps(table->OuterRect))
2814 return;
2815
2816 ImDrawList* inner_drawlist = inner_window->DrawList;
2817 table->DrawSplitter->SetCurrentChannel(inner_drawlist, TABLE_DRAW_CHANNEL_BG0);
2818 inner_drawlist->PushClipRect(table->Bg0ClipRectForDrawCmd.Min, table->Bg0ClipRectForDrawCmd.Max, false);
2819
2820 // Draw inner border and resizing feedback
2821 ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent);
2822 const float border_size = TABLE_BORDER_SIZE;
2823 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);
2824 const float draw_y2_body = table->InnerRect.Max.y;
2825 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;
2826 if (table->Flags & ImGuiTableFlags_BordersInnerV)
2827 {
2828 for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
2829 {
2830 if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByDisplayOrder, order_n))
2831 continue;
2832
2833 const int column_n = table->DisplayOrderToIndex[order_n];
2834 ImGuiTableColumn* column = &table->Columns[column_n];
2835 const bool is_hovered = (table->HoveredColumnBorder == column_n);
2836 const bool is_resized = (table->ResizedColumn == column_n) && (table->InstanceInteracted == table->InstanceCurrent);
2837 const bool is_resizable = (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_)) == 0;
2838 const bool is_frozen_separator = (table->FreezeColumnsCount == order_n + 1);
2839 if (column->MaxX > table->InnerClipRect.Max.x && !is_resized)
2840 continue;
2841
2842 // Decide whether right-most column is visible
2843 if (column->NextEnabledColumn == -1 && !is_resizable)
2844 if ((table->Flags & ImGuiTableFlags_SizingMask_) != ImGuiTableFlags_SizingFixedSame || (table->Flags & ImGuiTableFlags_NoHostExtendX))
2845 continue;
2846 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..
2847 continue;
2848
2849 // Draw in outer window so right-most column won't be clipped
2850 float draw_y2 = draw_y2_head;
2851 if (is_frozen_separator)
2852 draw_y2 = draw_y2_body;
2853 else if ((table->Flags & ImGuiTableFlags_NoBordersInBodyUntilResize) != 0 && (is_hovered || is_resized))
2854 draw_y2 = draw_y2_body;
2855 else if ((table->Flags & (ImGuiTableFlags_NoBordersInBodyUntilResize | ImGuiTableFlags_NoBordersInBody)) == 0)
2856 draw_y2 = draw_y2_body;
2857 if (draw_y2 > draw_y1)
2858 inner_drawlist->AddLineV(column->MaxX, draw_y1, draw_y2, TableGetColumnBorderCol(table, order_n, column_n), border_size);
2859 }
2860 }
2861
2862 // Draw outer border
2863 // FIXME: could use AddRect or explicit VLine/HLine helper?
2864 if (table->Flags & ImGuiTableFlags_BordersOuter)
2865 {
2866 // Display outer border offset by 1 which is a simple way to display it without adding an extra draw call
2867 // (Without the offset, in outer_window it would be rendered behind cells, because child windows are above their

Callers

nothing calls this directly

Calls 11

TableGetInstanceDataFunction · 0.85
ImMaxFunction · 0.85
ImMinFunction · 0.85
TableGetColumnBorderColFunction · 0.85
SetCurrentChannelMethod · 0.80
AddLineVMethod · 0.80
AddLineHMethod · 0.80
OverlapsMethod · 0.45
PushClipRectMethod · 0.45
AddRectMethod · 0.45
PopClipRectMethod · 0.45

Tested by

no test coverage detected