mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-25 21:17:01 +00:00
Misc shallow merge/sync from docking designed to faciliate cross-merging between docking and string_view.
This commit is contained in:
parent
317b33d647
commit
59b63defe5
12
imgui.cpp
12
imgui.cpp
@ -1027,7 +1027,7 @@ static void UpdateKeyRoutingTable(ImGuiKeyRoutingTable* rt);
|
|||||||
static void UpdateSettings();
|
static void UpdateSettings();
|
||||||
static bool UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect);
|
static bool UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect);
|
||||||
static void RenderWindowOuterBorders(ImGuiWindow* window);
|
static void RenderWindowOuterBorders(ImGuiWindow* window);
|
||||||
static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size);
|
static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size);
|
||||||
static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open);
|
static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open);
|
||||||
static void RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 col);
|
static void RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 col);
|
||||||
static void RenderDimmedBackgrounds();
|
static void RenderDimmedBackgrounds();
|
||||||
@ -5765,7 +5765,7 @@ static void ImGui::RenderWindowOuterBorders(ImGuiWindow* window)
|
|||||||
|
|
||||||
// Draw background and borders
|
// Draw background and borders
|
||||||
// Draw and handle scrollbars
|
// Draw and handle scrollbars
|
||||||
void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size)
|
void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiStyle& style = g.Style;
|
ImGuiStyle& style = g.Style;
|
||||||
@ -5830,7 +5830,7 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
|
|||||||
Scrollbar(ImGuiAxis_Y);
|
Scrollbar(ImGuiAxis_Y);
|
||||||
|
|
||||||
// Render resize grips (after their input handling so we don't have a frame of latency)
|
// Render resize grips (after their input handling so we don't have a frame of latency)
|
||||||
if (!(flags & ImGuiWindowFlags_NoResize))
|
if (handle_borders_and_resize_grips && !(flags & ImGuiWindowFlags_NoResize))
|
||||||
{
|
{
|
||||||
for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
|
for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
|
||||||
{
|
{
|
||||||
@ -5844,7 +5844,8 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Borders
|
// Borders
|
||||||
RenderWindowOuterBorders(window);
|
if (handle_borders_and_resize_grips)
|
||||||
|
RenderWindowOuterBorders(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6503,7 +6504,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// Handle title bar, scrollbar, resize grips and resize borders
|
// Handle title bar, scrollbar, resize grips and resize borders
|
||||||
const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;
|
const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;
|
||||||
const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight);
|
const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight);
|
||||||
RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, resize_grip_count, resize_grip_col, resize_grip_draw_size);
|
const bool handle_borders_and_resize_grips = true; // This exists to facilitate merge with 'docking' branch.
|
||||||
|
RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, handle_borders_and_resize_grips, resize_grip_count, resize_grip_col, resize_grip_draw_size);
|
||||||
|
|
||||||
if (render_decorations_in_parent)
|
if (render_decorations_in_parent)
|
||||||
window->DrawList = &window->DrawListInst;
|
window->DrawList = &window->DrawListInst;
|
||||||
|
1
imgui.h
1
imgui.h
@ -783,6 +783,7 @@ namespace ImGui
|
|||||||
IMGUI_API int GetColumnsCount();
|
IMGUI_API int GetColumnsCount();
|
||||||
|
|
||||||
// Tab Bars, Tabs
|
// Tab Bars, Tabs
|
||||||
|
// - Note: Tabs are automatically created by the docking system (when in 'docking' branch). Use this to create tab bars/tabs yourself.
|
||||||
IMGUI_API bool BeginTabBar(const char* str_id, ImGuiTabBarFlags flags = 0); // create and append into a TabBar
|
IMGUI_API bool BeginTabBar(const char* str_id, ImGuiTabBarFlags flags = 0); // create and append into a TabBar
|
||||||
IMGUI_API void EndTabBar(); // only call EndTabBar() if BeginTabBar() returns true!
|
IMGUI_API void EndTabBar(); // only call EndTabBar() if BeginTabBar() returns true!
|
||||||
IMGUI_API bool BeginTabItem(const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0); // create a Tab. Returns true if the Tab is selected.
|
IMGUI_API bool BeginTabItem(const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0); // create a Tab. Returns true if the Tab is selected.
|
||||||
|
@ -3017,8 +3017,9 @@ namespace ImGui
|
|||||||
IMGUI_API void TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int offset);
|
IMGUI_API void TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int offset);
|
||||||
IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, ImVec2 mouse_pos);
|
IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, ImVec2 mouse_pos);
|
||||||
IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar);
|
IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar);
|
||||||
IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags);
|
IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window);
|
||||||
IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker);
|
IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker);
|
||||||
|
IMGUI_API ImVec2 TabItemCalcSize(ImGuiWindow* window);
|
||||||
IMGUI_API void TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col);
|
IMGUI_API void TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col);
|
||||||
IMGUI_API void TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char* label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool* out_just_closed, bool* out_text_clipped);
|
IMGUI_API void TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char* label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool* out_just_closed, bool* out_text_clipped);
|
||||||
|
|
||||||
@ -3048,25 +3049,27 @@ namespace ImGui
|
|||||||
// Widgets
|
// Widgets
|
||||||
IMGUI_API void TextEx(const char* text, const char* text_end = NULL, ImGuiTextFlags flags = 0);
|
IMGUI_API void TextEx(const char* text, const char* text_end = NULL, ImGuiTextFlags flags = 0);
|
||||||
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);
|
||||||
|
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
||||||
|
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col);
|
||||||
|
IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags);
|
||||||
|
IMGUI_API bool CheckboxFlags(const char* label, ImS64* flags, ImS64 flags_value);
|
||||||
|
IMGUI_API bool CheckboxFlags(const char* label, ImU64* flags, ImU64 flags_value);
|
||||||
|
|
||||||
|
// Widgets: Window Decorations
|
||||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos);
|
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos);
|
||||||
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
||||||
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
|
||||||
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
||||||
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 avail_v, ImS64 contents_v, ImDrawFlags flags);
|
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 avail_v, ImS64 contents_v, ImDrawFlags flags);
|
||||||
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col);
|
|
||||||
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
||||||
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
||||||
IMGUI_API ImGuiID GetWindowResizeCornerID(ImGuiWindow* window, int n); // 0..3: corners
|
IMGUI_API ImGuiID GetWindowResizeCornerID(ImGuiWindow* window, int n); // 0..3: corners
|
||||||
IMGUI_API ImGuiID GetWindowResizeBorderID(ImGuiWindow* window, ImGuiDir dir);
|
IMGUI_API ImGuiID GetWindowResizeBorderID(ImGuiWindow* window, ImGuiDir dir);
|
||||||
IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags);
|
|
||||||
IMGUI_API bool CheckboxFlags(const char* label, ImS64* flags, ImS64 flags_value);
|
|
||||||
IMGUI_API bool CheckboxFlags(const char* label, ImU64* flags, ImU64 flags_value);
|
|
||||||
|
|
||||||
// Widgets low-level behaviors
|
// Widgets low-level behaviors
|
||||||
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags);
|
IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags);
|
||||||
IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
||||||
IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f);
|
IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f, ImU32 bg_col = 0);
|
||||||
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
|
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
|
||||||
IMGUI_API void TreePushOverrideID(ImGuiID id);
|
IMGUI_API void TreePushOverrideID(ImGuiID id);
|
||||||
IMGUI_API void TreeNodeSetOpen(ImGuiID id, bool open);
|
IMGUI_API void TreeNodeSetOpen(ImGuiID id, bool open);
|
||||||
|
@ -1473,7 +1473,7 @@ void ImGui::Separator()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
// 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.
|
||||||
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)
|
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)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
@ -1521,7 +1521,9 @@ bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render
|
// Render at new position
|
||||||
|
if (bg_col & IM_COL32_A_MASK)
|
||||||
|
window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, bg_col, 0.0f);
|
||||||
const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : (hovered && g.HoveredIdTimer >= hover_visibility_delay) ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
|
const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : (hovered && g.HoveredIdTimer >= hover_visibility_delay) ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
|
||||||
window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0f);
|
window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0f);
|
||||||
|
|
||||||
@ -7303,7 +7305,7 @@ struct ImGuiTabBarSection
|
|||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
static void TabBarLayout(ImGuiTabBar* tab_bar);
|
static void TabBarLayout(ImGuiTabBar* tab_bar);
|
||||||
static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label);
|
static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, ImGuiWindow* docked_window);
|
||||||
static float TabBarCalcMaxTabWidth();
|
static float TabBarCalcMaxTabWidth();
|
||||||
static float TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling);
|
static float TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling);
|
||||||
static void TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGuiTabBarSection* sections);
|
static void TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGuiTabBarSection* sections);
|
||||||
@ -7696,9 +7698,11 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|||||||
window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal);
|
window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dockables uses Name/ID in the global namespace. Non-dockable items use the ID stack.
|
// Dockable windows uses Name/ID in the global namespace. Non-dockable items use the ID stack.
|
||||||
static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label)
|
static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, ImGuiWindow* docked_window)
|
||||||
{
|
{
|
||||||
|
IM_ASSERT(docked_window == NULL); // master branch only
|
||||||
|
IM_UNUSED(docked_window);
|
||||||
if (tab_bar->Flags & ImGuiTabBarFlags_DockNode)
|
if (tab_bar->Flags & ImGuiTabBarFlags_DockNode)
|
||||||
{
|
{
|
||||||
ImGuiID id = ImHashStr(label);
|
ImGuiID id = ImHashStr(label);
|
||||||
@ -8005,7 +8009,7 @@ bool ImGui::BeginTabItem(const char* label, bool* p_open, ImGuiTabItemFlags f
|
|||||||
}
|
}
|
||||||
IM_ASSERT(!(flags & ImGuiTabItemFlags_Button)); // BeginTabItem() Can't be used with button flags, use TabItemButton() instead!
|
IM_ASSERT(!(flags & ImGuiTabItemFlags_Button)); // BeginTabItem() Can't be used with button flags, use TabItemButton() instead!
|
||||||
|
|
||||||
bool ret = TabItemEx(tab_bar, label, p_open, flags);
|
bool ret = TabItemEx(tab_bar, label, p_open, flags, NULL);
|
||||||
if (ret && !(flags & ImGuiTabItemFlags_NoPushId))
|
if (ret && !(flags & ImGuiTabItemFlags_NoPushId))
|
||||||
{
|
{
|
||||||
ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
|
ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
|
||||||
@ -8046,10 +8050,10 @@ bool ImGui::TabItemButton(const char* label, ImGuiTabItemFlags flags)
|
|||||||
IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!");
|
IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder);
|
return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags)
|
bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window)
|
||||||
{
|
{
|
||||||
// Layout whole tab bar if not already done
|
// Layout whole tab bar if not already done
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -8064,7 +8068,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
const ImGuiStyle& style = g.Style;
|
const ImGuiStyle& style = g.Style;
|
||||||
const ImGuiID id = TabBarCalcTabID(tab_bar, label);
|
const ImGuiID id = TabBarCalcTabID(tab_bar, label, docked_window);
|
||||||
|
|
||||||
// If the user called us with *p_open == false, we early out and don't render.
|
// If the user called us with *p_open == false, we early out and don't render.
|
||||||
// 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.
|
// 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,
|
|||||||
tab->LastFrameVisible = g.FrameCount;
|
tab->LastFrameVisible = g.FrameCount;
|
||||||
tab->Flags = flags;
|
tab->Flags = flags;
|
||||||
|
|
||||||
// Append name with zero-terminator
|
// Append name _WITH_ the zero-terminator
|
||||||
tab->NameOffset = (ImS32)tab_bar->TabsNames.size();
|
if (docked_window != NULL)
|
||||||
tab_bar->TabsNames.append(label, label + strlen(label) + 1);
|
{
|
||||||
|
IM_ASSERT(docked_window == NULL); // master branch only
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tab->NameOffset = (ImS32)tab_bar->TabsNames.size();
|
||||||
|
tab_bar->TabsNames.append(label, label + strlen(label) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Update selected tab
|
// Update selected tab
|
||||||
if (!is_tab_button)
|
if (!is_tab_button)
|
||||||
@ -8279,7 +8290,7 @@ void ImGui::SetTabItemClosed(const char* label)
|
|||||||
if (is_within_manual_tab_bar)
|
if (is_within_manual_tab_bar)
|
||||||
{
|
{
|
||||||
ImGuiTabBar* tab_bar = g.CurrentTabBar;
|
ImGuiTabBar* tab_bar = g.CurrentTabBar;
|
||||||
ImGuiID tab_id = TabBarCalcTabID(tab_bar, label);
|
ImGuiID tab_id = TabBarCalcTabID(tab_bar, label, NULL);
|
||||||
if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
|
if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
|
||||||
tab->WantClose = true; // Will be processed by next call to TabBarLayout()
|
tab->WantClose = true; // Will be processed by next call to TabBarLayout()
|
||||||
}
|
}
|
||||||
@ -8297,6 +8308,12 @@ ImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button_or_unsave
|
|||||||
return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y);
|
return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImVec2 ImGui::TabItemCalcSize(ImGuiWindow*)
|
||||||
|
{
|
||||||
|
IM_ASSERT(0); // This function exists to facilitate merge with 'docking' branch.
|
||||||
|
return ImVec2(0.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col)
|
void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col)
|
||||||
{
|
{
|
||||||
// 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.
|
// 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user