| 8079 | } |
| 8080 | |
| 8081 | bool ImGui::TabBarProcessReorder(ImGuiTabBar* tab_bar) |
| 8082 | { |
| 8083 | ImGuiTabItem* tab1 = TabBarFindTabByID(tab_bar, tab_bar->ReorderRequestTabId); |
| 8084 | if (tab1 == NULL || (tab1->Flags & ImGuiTabItemFlags_NoReorder)) |
| 8085 | return false; |
| 8086 | |
| 8087 | //IM_ASSERT(tab_bar->Flags & ImGuiTabBarFlags_Reorderable); // <- this may happen when using debug tools |
| 8088 | int tab2_order = TabBarGetTabOrder(tab_bar, tab1) + tab_bar->ReorderRequestOffset; |
| 8089 | if (tab2_order < 0 || tab2_order >= tab_bar->Tabs.Size) |
| 8090 | return false; |
| 8091 | |
| 8092 | // Reordered tabs must share the same section |
| 8093 | // (Note: TabBarQueueReorderFromMousePos() also has a similar test but since we allow direct calls to TabBarQueueReorder() we do it here too) |
| 8094 | ImGuiTabItem* tab2 = &tab_bar->Tabs[tab2_order]; |
| 8095 | if (tab2->Flags & ImGuiTabItemFlags_NoReorder) |
| 8096 | return false; |
| 8097 | if ((tab1->Flags & ImGuiTabItemFlags_SectionMask_) != (tab2->Flags & ImGuiTabItemFlags_SectionMask_)) |
| 8098 | return false; |
| 8099 | |
| 8100 | ImGuiTabItem item_tmp = *tab1; |
| 8101 | ImGuiTabItem* src_tab = (tab_bar->ReorderRequestOffset > 0) ? tab1 + 1 : tab2; |
| 8102 | ImGuiTabItem* dst_tab = (tab_bar->ReorderRequestOffset > 0) ? tab1 : tab2 + 1; |
| 8103 | const int move_count = (tab_bar->ReorderRequestOffset > 0) ? tab_bar->ReorderRequestOffset : -tab_bar->ReorderRequestOffset; |
| 8104 | memmove(dst_tab, src_tab, move_count * sizeof(ImGuiTabItem)); |
| 8105 | *tab2 = item_tmp; |
| 8106 | |
| 8107 | if (tab_bar->Flags & ImGuiTabBarFlags_SaveSettings) |
| 8108 | MarkIniSettingsDirty(); |
| 8109 | return true; |
| 8110 | } |
| 8111 | |
| 8112 | static ImGuiTabItem* ImGui::TabBarScrollingButtons(ImGuiTabBar* tab_bar) |
| 8113 | { |
nothing calls this directly
no test coverage detected