@@ -1473,7 +1473,7 @@ void ImGui::Separator()
1473
1473
}
1474
1474
1475
1475
// Using 'hover_visibility_delay' allows us to hide the highlight and mouse cursor for a short time, which can be convenient to reduce visual noise.
1476
- bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend, float hover_visibility_delay)
1476
+ bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend, float hover_visibility_delay, ImU32 bg_col )
1477
1477
{
1478
1478
ImGuiContext& g = *GImGui;
1479
1479
ImGuiWindow* window = g.CurrentWindow;
@@ -1521,7 +1521,9 @@ bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float
1521
1521
}
1522
1522
}
1523
1523
1524
- // Render
1524
+ // Render at new position
1525
+ if (bg_col & IM_COL32_A_MASK)
1526
+ window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, bg_col, 0.0f);
1525
1527
const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : (hovered && g.HoveredIdTimer >= hover_visibility_delay) ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
1526
1528
window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0f);
1527
1529
@@ -7303,7 +7305,7 @@ struct ImGuiTabBarSection
7303
7305
namespace ImGui
7304
7306
{
7305
7307
static void TabBarLayout(ImGuiTabBar* tab_bar);
7306
- static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label);
7308
+ static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, ImGuiWindow* docked_window );
7307
7309
static float TabBarCalcMaxTabWidth();
7308
7310
static float TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling);
7309
7311
static void TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGuiTabBarSection* sections);
@@ -7696,9 +7698,11 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
7696
7698
window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal);
7697
7699
}
7698
7700
7699
- // Dockables uses Name/ID in the global namespace. Non-dockable items use the ID stack.
7700
- static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label)
7701
+ // Dockable windows uses Name/ID in the global namespace. Non-dockable items use the ID stack.
7702
+ static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, ImGuiWindow* docked_window )
7701
7703
{
7704
+ IM_ASSERT(docked_window == NULL); // master branch only
7705
+ IM_UNUSED(docked_window);
7702
7706
if (tab_bar->Flags & ImGuiTabBarFlags_DockNode)
7703
7707
{
7704
7708
ImGuiID id = ImHashStr(label);
@@ -8005,7 +8009,7 @@ bool ImGui::BeginTabItem(const char* label, bool* p_open, ImGuiTabItemFlags f
8005
8009
}
8006
8010
IM_ASSERT(!(flags & ImGuiTabItemFlags_Button)); // BeginTabItem() Can't be used with button flags, use TabItemButton() instead!
8007
8011
8008
- bool ret = TabItemEx(tab_bar, label, p_open, flags);
8012
+ bool ret = TabItemEx(tab_bar, label, p_open, flags, NULL );
8009
8013
if (ret && !(flags & ImGuiTabItemFlags_NoPushId))
8010
8014
{
8011
8015
ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
@@ -8046,10 +8050,10 @@ bool ImGui::TabItemButton(const char* label, ImGuiTabItemFlags flags)
8046
8050
IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!");
8047
8051
return false;
8048
8052
}
8049
- return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder);
8053
+ return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder, NULL );
8050
8054
}
8051
8055
8052
- bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags)
8056
+ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window )
8053
8057
{
8054
8058
// Layout whole tab bar if not already done
8055
8059
ImGuiContext& g = *GImGui;
@@ -8064,7 +8068,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
8064
8068
return false;
8065
8069
8066
8070
const ImGuiStyle& style = g.Style;
8067
- const ImGuiID id = TabBarCalcTabID(tab_bar, label);
8071
+ const ImGuiID id = TabBarCalcTabID(tab_bar, label, docked_window );
8068
8072
8069
8073
// If the user called us with *p_open == false, we early out and don't render.
8070
8074
// We make a call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID.
@@ -8114,9 +8118,16 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
8114
8118
tab->LastFrameVisible = g.FrameCount;
8115
8119
tab->Flags = flags;
8116
8120
8117
- // Append name with zero-terminator
8118
- tab->NameOffset = (ImS32)tab_bar->TabsNames.size();
8119
- tab_bar->TabsNames.append(label, label + strlen(label) + 1);
8121
+ // Append name _WITH_ the zero-terminator
8122
+ if (docked_window != NULL)
8123
+ {
8124
+ IM_ASSERT(docked_window == NULL); // master branch only
8125
+ }
8126
+ else
8127
+ {
8128
+ tab->NameOffset = (ImS32)tab_bar->TabsNames.size();
8129
+ tab_bar->TabsNames.append(label, label + strlen(label) + 1);
8130
+ }
8120
8131
8121
8132
// Update selected tab
8122
8133
if (!is_tab_button)
@@ -8279,7 +8290,7 @@ void ImGui::SetTabItemClosed(const char* label)
8279
8290
if (is_within_manual_tab_bar)
8280
8291
{
8281
8292
ImGuiTabBar* tab_bar = g.CurrentTabBar;
8282
- ImGuiID tab_id = TabBarCalcTabID(tab_bar, label);
8293
+ ImGuiID tab_id = TabBarCalcTabID(tab_bar, label, NULL );
8283
8294
if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
8284
8295
tab->WantClose = true; // Will be processed by next call to TabBarLayout()
8285
8296
}
@@ -8297,6 +8308,12 @@ ImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button_or_unsave
8297
8308
return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y);
8298
8309
}
8299
8310
8311
+ ImVec2 ImGui::TabItemCalcSize(ImGuiWindow*)
8312
+ {
8313
+ IM_ASSERT(0); // This function exists to facilitate merge with 'docking' branch.
8314
+ return ImVec2(0.0f, 0.0f);
8315
+ }
8316
+
8300
8317
void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col)
8301
8318
{
8302
8319
// While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it.
0 commit comments