Apply queued resizing/reordering/hiding requests
| 678 | |
| 679 | // Apply queued resizing/reordering/hiding requests |
| 680 | void ImGui::TableBeginApplyRequests(ImGuiTable* table) |
| 681 | { |
| 682 | // Handle resizing request |
| 683 | // (We process this in the TableBegin() of the first instance of each table) |
| 684 | // FIXME-TABLE: Contains columns if our work area doesn't allow for scrolling? |
| 685 | if (table->InstanceCurrent == 0) |
| 686 | { |
| 687 | if (table->ResizedColumn != -1 && table->ResizedColumnNextWidth != FLT_MAX) |
| 688 | TableSetColumnWidth(table->ResizedColumn, table->ResizedColumnNextWidth); |
| 689 | table->LastResizedColumn = table->ResizedColumn; |
| 690 | table->ResizedColumnNextWidth = FLT_MAX; |
| 691 | table->ResizedColumn = -1; |
| 692 | |
| 693 | // Process auto-fit for single column, which is a special case for stretch columns and fixed columns with FixedSame policy. |
| 694 | // FIXME-TABLE: Would be nice to redistribute available stretch space accordingly to other weights, instead of giving it all to siblings. |
| 695 | if (table->AutoFitSingleColumn != -1) |
| 696 | { |
| 697 | TableSetColumnWidth(table->AutoFitSingleColumn, table->Columns[table->AutoFitSingleColumn].WidthAuto); |
| 698 | table->AutoFitSingleColumn = -1; |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | // Handle reordering request |
| 703 | //// Note: we don't clear ReorderColumn after handling the request (FIXME: clarify why or add a test). |
| 704 | if (table->InstanceCurrent == 0) |
| 705 | { |
| 706 | table->LastHeldHeaderColumn = table->HeldHeaderColumn; |
| 707 | table->HeldHeaderColumn = -1; |
| 708 | if (table->ReorderColumn != -1 && table->ReorderColumnDstOrder != -1) |
| 709 | { |
| 710 | TableSetColumnDisplayOrder(table, table->ReorderColumn, table->ReorderColumnDstOrder); |
| 711 | table->ReorderColumnDstOrder = -1; |
| 712 | } |
| 713 | |
| 714 | // Release |
| 715 | ImGuiContext& g = *GImGui; |
| 716 | if (g.ActiveId == 0) // FIXME: Need to revisit. See 38f5e5a. |
| 717 | table->ReorderColumn = -1; |
| 718 | //if (table->HeldHeaderColumn == -1 && table->ReorderColumn != -1) |
| 719 | // table->ReorderColumn = -1; |
| 720 | } |
| 721 | |
| 722 | // Handle display order reset request |
| 723 | if (table->IsResetDisplayOrderRequest) |
| 724 | { |
| 725 | for (int n = 0; n < table->ColumnsCount; n++) |
| 726 | table->DisplayOrderToIndex[n] = table->Columns[n].DisplayOrder = (ImGuiTableColumnIdx)n; |
| 727 | table->IsResetDisplayOrderRequest = false; |
| 728 | table->IsSettingsDirty = true; |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | // Apply immediately. See TableQueueSetColumnDisplayOrder() for additional checks/constraints. |
| 733 | void ImGui::TableSetColumnDisplayOrder(ImGuiTable* table, int column_n, int dst_order) |
nothing calls this directly
no outgoing calls
no test coverage detected