| 753 | } |
| 754 | |
| 755 | static int TableGetMaxDisplayOrderAllowed(ImGuiTable* table, int src_order, int dst_order) |
| 756 | { |
| 757 | dst_order = ImClamp(dst_order, 0, table->ColumnsCount - 1); |
| 758 | if (src_order == dst_order) |
| 759 | return dst_order; |
| 760 | |
| 761 | // Cannot cross over the frozen column limit when interactively reordering. |
| 762 | // TableSetupScrollFreeze() enforce a display order range for frozen columns. Reordering across the frozen column barrier is illegal and will be undone. |
| 763 | if (table->FreezeColumnsRequest > 0) |
| 764 | dst_order = (src_order < table->FreezeColumnsRequest) ? ImMin(dst_order, (int)table->FreezeColumnsRequest - 1) : ImMax(dst_order, (int)table->FreezeColumnsRequest); |
| 765 | |
| 766 | // Cannot cross over a column with the ImGuiTableColumnFlags_NoReorder flag. |
| 767 | int reorder_dir = (src_order < dst_order) ? +1 : -1; |
| 768 | for (int order_n = src_order; (src_order < dst_order && order_n <= dst_order) || (dst_order < src_order && order_n >= dst_order); order_n += reorder_dir) |
| 769 | if (table->Columns[table->DisplayOrderToIndex[order_n]].Flags & ImGuiTableColumnFlags_NoReorder) |
| 770 | { |
| 771 | dst_order = (order_n == src_order) ? src_order : order_n - reorder_dir; |
| 772 | break; |
| 773 | } |
| 774 | return dst_order; |
| 775 | } |
| 776 | |
| 777 | // Reorder requested by user interaction. |
| 778 | void ImGui::TableQueueSetColumnDisplayOrder(ImGuiTable* table, int column_n, int dst_order) |
no test coverage detected