Internals: Renaming for consistency.

This commit is contained in:
omar
2019-10-31 11:15:40 +01:00
parent 5006639526
commit 8fee5a4349
3 changed files with 28 additions and 28 deletions

View File

@ -6566,13 +6566,13 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
// and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window.
const char* tab_name = tab_bar->GetTabName(tab);
const bool has_close_button = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) ? false : true;
tab->WidthContents = TabItemCalcSize(tab_name, has_close_button).x;
tab->ContentWidth = TabItemCalcSize(tab_name, has_close_button).x;
width_total_contents += (tab_n > 0 ? g.Style.ItemInnerSpacing.x : 0.0f) + tab->WidthContents;
width_total_contents += (tab_n > 0 ? g.Style.ItemInnerSpacing.x : 0.0f) + tab->ContentWidth;
// Store data so we can build an array sorted by width if we need to shrink tabs down
g.ShrinkWidthBuffer[tab_n].Index = tab_n;
g.ShrinkWidthBuffer[tab_n].Width = tab->WidthContents;
g.ShrinkWidthBuffer[tab_n].Width = tab->ContentWidth;
}
// Compute width
@ -6592,7 +6592,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)
{
ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
tab->Width = ImMin(tab->WidthContents, tab_max_width);
tab->Width = ImMin(tab->ContentWidth, tab_max_width);
IM_ASSERT(tab->Width > 0.0f);
}
}
@ -6608,7 +6608,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
if (scroll_track_selected_tab_id == 0 && g.NavJustMovedToId == tab->ID)
scroll_track_selected_tab_id = tab->ID;
offset_x += tab->Width + g.Style.ItemInnerSpacing.x;
offset_x_ideal += tab->WidthContents + g.Style.ItemInnerSpacing.x;
offset_x_ideal += tab->ContentWidth + g.Style.ItemInnerSpacing.x;
}
tab_bar->OffsetMax = ImMax(offset_x - g.Style.ItemInnerSpacing.x, 0.0f);
tab_bar->OffsetMaxIdeal = ImMax(offset_x_ideal - g.Style.ItemInnerSpacing.x, 0.0f);
@ -6929,7 +6929,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
tab_is_new = true;
}
tab_bar->LastTabItemIdx = (short)tab_bar->Tabs.index_from_ptr(tab);
tab->WidthContents = size.x;
tab->ContentWidth = size.x;
if (p_open == NULL)
flags |= ImGuiTabItemFlags_NoCloseButton;
@ -7040,10 +7040,10 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
}
#if 0
if (hovered && g.HoveredIdNotActiveTimer > 0.50f && bb.GetWidth() < tab->WidthContents)
if (hovered && g.HoveredIdNotActiveTimer > 0.50f && bb.GetWidth() < tab->ContentWidth)
{
// Enlarge tab display when hovering
bb.Max.x = bb.Min.x + IM_FLOOR(ImLerp(bb.GetWidth(), tab->WidthContents, ImSaturate((g.HoveredIdNotActiveTimer - 0.40f) * 6.0f)));
bb.Max.x = bb.Min.x + IM_FLOOR(ImLerp(bb.GetWidth(), tab->ContentWidth, ImSaturate((g.HoveredIdNotActiveTimer - 0.40f) * 6.0f)));
display_draw_list = GetForegroundDrawList(window);
TabItemBackground(display_draw_list, bb, flags, GetColorU32(ImGuiCol_TitleBgActive));
}