| 6508 | } |
| 6509 | |
| 6510 | bool ImGui::BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& tab_bar_bb, ImGuiTabBarFlags flags) |
| 6511 | { |
| 6512 | ImGuiContext& g = *GImGui; |
| 6513 | ImGuiWindow* window = g.CurrentWindow; |
| 6514 | if (window->SkipItems) |
| 6515 | return false; |
| 6516 | |
| 6517 | if ((flags & ImGuiTabBarFlags_DockNode) == 0) |
| 6518 | PushOverrideID(tab_bar->ID); |
| 6519 | |
| 6520 | // Add to stack |
| 6521 | g.CurrentTabBarStack.push_back(GetTabBarRefFromTabBar(tab_bar)); |
| 6522 | g.CurrentTabBar = tab_bar; |
| 6523 | |
| 6524 | if (tab_bar->CurrFrameVisible == g.FrameCount) |
| 6525 | { |
| 6526 | //IMGUI_DEBUG_LOG("BeginTabBarEx already called this frame\n", g.FrameCount); |
| 6527 | IM_ASSERT(0); |
| 6528 | return true; |
| 6529 | } |
| 6530 | |
| 6531 | // When toggling back from ordered to manually-reorderable, shuffle tabs to enforce the last visible order. |
| 6532 | // Otherwise, the most recently inserted tabs would move at the end of visible list which can be a little too confusing or magic for the user. |
| 6533 | if ((flags & ImGuiTabBarFlags_Reorderable) && !(tab_bar->Flags & ImGuiTabBarFlags_Reorderable) && tab_bar->Tabs.Size > 1 && tab_bar->PrevFrameVisible != -1) |
| 6534 | ImQsort(tab_bar->Tabs.Data, tab_bar->Tabs.Size, sizeof(ImGuiTabItem), TabItemComparerByVisibleOffset); |
| 6535 | |
| 6536 | // Flags |
| 6537 | if ((flags & ImGuiTabBarFlags_FittingPolicyMask_) == 0) |
| 6538 | flags |= ImGuiTabBarFlags_FittingPolicyDefault_; |
| 6539 | |
| 6540 | tab_bar->Flags = flags; |
| 6541 | tab_bar->BarRect = tab_bar_bb; |
| 6542 | tab_bar->WantLayout = true; // Layout will be done on the first call to ItemTab() |
| 6543 | tab_bar->PrevFrameVisible = tab_bar->CurrFrameVisible; |
| 6544 | tab_bar->CurrFrameVisible = g.FrameCount; |
| 6545 | tab_bar->FramePadding = g.Style.FramePadding; |
| 6546 | |
| 6547 | // Layout |
| 6548 | ItemSize(ImVec2(tab_bar->OffsetMaxIdeal, tab_bar->BarRect.GetHeight()), tab_bar->FramePadding.y); |
| 6549 | window->DC.CursorPos.x = tab_bar->BarRect.Min.x; |
| 6550 | |
| 6551 | // Draw separator |
| 6552 | const ImU32 col = GetColorU32((flags & ImGuiTabBarFlags_IsFocused) ? ImGuiCol_TabActive : ImGuiCol_TabUnfocusedActive); |
| 6553 | const float y = tab_bar->BarRect.Max.y - 1.0f; |
| 6554 | { |
| 6555 | const float separator_min_x = tab_bar->BarRect.Min.x - IM_FLOOR(window->WindowPadding.x * 0.5f); |
| 6556 | const float separator_max_x = tab_bar->BarRect.Max.x + IM_FLOOR(window->WindowPadding.x * 0.5f); |
| 6557 | window->DrawList->AddLine(ImVec2(separator_min_x, y), ImVec2(separator_max_x, y), col, 1.0f); |
| 6558 | } |
| 6559 | return true; |
| 6560 | } |
| 6561 | |
| 6562 | void ImGui::EndTabBar() |
| 6563 | { |
nothing calls this directly
no test coverage detected