mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 13:08:47 +02:00
TabItem: honor ImGuiTabItemFlags_NoCloseButton passed as parameter (although undocumented and part of private api) (#2923)
This commit is contained in:
@ -6927,6 +6927,12 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||
return false;
|
||||
}
|
||||
|
||||
// Store into ImGuiTabItemFlags_NoCloseButton, also honor ImGuiTabItemFlags_NoCloseButton passed by user (although not documented)
|
||||
if (flags & ImGuiTabItemFlags_NoCloseButton)
|
||||
p_open = NULL;
|
||||
else if (p_open == NULL)
|
||||
flags |= ImGuiTabItemFlags_NoCloseButton;
|
||||
|
||||
// Calculate tab contents size
|
||||
ImVec2 size = TabItemCalcSize(label, p_open != NULL);
|
||||
|
||||
@ -6944,9 +6950,6 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||
tab_bar->LastTabItemIdx = (short)tab_bar->Tabs.index_from_ptr(tab);
|
||||
tab->ContentWidth = size.x;
|
||||
|
||||
if (p_open == NULL)
|
||||
flags |= ImGuiTabItemFlags_NoCloseButton;
|
||||
|
||||
const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);
|
||||
const bool tab_bar_focused = (tab_bar->Flags & ImGuiTabBarFlags_IsFocused) != 0;
|
||||
const bool tab_appearing = (tab->LastFrameVisible + 1 < g.FrameCount);
|
||||
|
Reference in New Issue
Block a user