mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 07:01:04 +01:00 
			
		
		
		
	Merge branch 'master' into docking
# Conflicts: # docs/CHANGELOG.txt # imgui.cpp
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
// dear imgui, v1.70 WIP
 | 
			
		||||
// dear imgui, v1.71 WIP
 | 
			
		||||
// (widgets code)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@@ -380,6 +380,7 @@ void ImGui::BulletTextV(const char* fmt, va_list args)
 | 
			
		||||
// - ArrowButton()
 | 
			
		||||
// - CloseButton() [Internal]
 | 
			
		||||
// - CollapseButton() [Internal]
 | 
			
		||||
// - ScrollbarEx() [Internal]
 | 
			
		||||
// - Scrollbar() [Internal]
 | 
			
		||||
// - Image()
 | 
			
		||||
// - ImageButton()
 | 
			
		||||
@@ -808,125 +809,124 @@ ImGuiID ImGui::GetScrollbarID(ImGuiWindow* window, ImGuiAxis axis)
 | 
			
		||||
// - We handle absolute seeking (when first clicking outside the grab) and relative manipulation (afterward or when clicking inside the grab)
 | 
			
		||||
// - We store values as normalized ratio and in a form that allows the window content to change while we are holding on a scrollbar
 | 
			
		||||
// - We handle both horizontal and vertical scrollbars, which makes the terminology not ideal.
 | 
			
		||||
void ImGui::Scrollbar(ImGuiAxis axis)
 | 
			
		||||
// Still, the code should probably be made simpler..
 | 
			
		||||
bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, float* p_scroll_v, float size_avail_v, float size_contents_v, ImDrawCornerFlags rounding_corners)
 | 
			
		||||
{
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    ImGuiWindow* window = g.CurrentWindow;
 | 
			
		||||
    if (window->SkipItems)
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
    const bool horizontal = (axis == ImGuiAxis_X);
 | 
			
		||||
    const ImGuiStyle& style = g.Style;
 | 
			
		||||
    const ImGuiID id = GetScrollbarID(window, axis);
 | 
			
		||||
    KeepAliveID(id);
 | 
			
		||||
 | 
			
		||||
    // Render background
 | 
			
		||||
    bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX);
 | 
			
		||||
    float other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f;
 | 
			
		||||
    const ImRect host_rect = window->Rect();
 | 
			
		||||
    const float border_size = window->WindowBorderSize;
 | 
			
		||||
    ImRect bb = horizontal
 | 
			
		||||
        ? ImRect(host_rect.Min.x + border_size, host_rect.Max.y - style.ScrollbarSize, host_rect.Max.x - other_scrollbar_size_w - border_size, host_rect.Max.y - border_size)
 | 
			
		||||
        : ImRect(host_rect.Max.x - style.ScrollbarSize, host_rect.Min.y + border_size, host_rect.Max.x - border_size, host_rect.Max.y - other_scrollbar_size_w - border_size);
 | 
			
		||||
    bb.Min.x = ImMax(host_rect.Min.x, bb.Min.x); // Handle case where the host rectangle is smaller than the scrollbar
 | 
			
		||||
    bb.Min.y = ImMax(host_rect.Min.y, bb.Min.y);
 | 
			
		||||
    if (!horizontal)
 | 
			
		||||
        bb.Min.y += window->TitleBarHeight() + ((window->Flags & ImGuiWindowFlags_MenuBar) ? window->MenuBarHeight() : 0.0f); // FIXME: InnerRect?
 | 
			
		||||
 | 
			
		||||
    const float bb_width = bb.GetWidth();
 | 
			
		||||
    const float bb_height = bb.GetHeight();
 | 
			
		||||
    if (bb_width <= 0.0f || bb_height <= 0.0f)
 | 
			
		||||
        return;
 | 
			
		||||
    const float bb_frame_width = bb_frame.GetWidth();
 | 
			
		||||
    const float bb_frame_height = bb_frame.GetHeight();
 | 
			
		||||
    if (bb_frame_width <= 0.0f || bb_frame_height <= 0.0f)
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
    // When we are too small, start hiding and disabling the grab (this reduce visual noise on very small window and facilitate using the resize grab)
 | 
			
		||||
    float alpha = 1.0f;
 | 
			
		||||
    if ((axis == ImGuiAxis_Y) && bb_height < g.FontSize + g.Style.FramePadding.y * 2.0f)
 | 
			
		||||
    {
 | 
			
		||||
        alpha = ImSaturate((bb_height - g.FontSize) / (g.Style.FramePadding.y * 2.0f));
 | 
			
		||||
        if (alpha <= 0.0f)
 | 
			
		||||
            return;
 | 
			
		||||
    }
 | 
			
		||||
    const bool allow_interaction = (alpha >= 1.0f);
 | 
			
		||||
    if ((axis == ImGuiAxis_Y) && bb_frame_height < g.FontSize + g.Style.FramePadding.y * 2.0f)
 | 
			
		||||
        alpha = ImSaturate((bb_frame_height - g.FontSize) / (g.Style.FramePadding.y * 2.0f));
 | 
			
		||||
    if (alpha <= 0.0f)
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
    int window_rounding_corners;
 | 
			
		||||
    if (horizontal)
 | 
			
		||||
        window_rounding_corners = ImDrawCornerFlags_BotLeft | (other_scrollbar ? 0 : ImDrawCornerFlags_BotRight);
 | 
			
		||||
    else
 | 
			
		||||
        window_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImDrawCornerFlags_TopRight : 0) | (other_scrollbar ? 0 : ImDrawCornerFlags_BotRight);
 | 
			
		||||
    window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_ScrollbarBg), window->WindowRounding, window_rounding_corners);
 | 
			
		||||
    bb.Expand(ImVec2(-ImClamp((float)(int)((bb_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp((float)(int)((bb_height - 2.0f) * 0.5f), 0.0f, 3.0f)));
 | 
			
		||||
    const ImGuiStyle& style = g.Style;
 | 
			
		||||
    const bool allow_interaction = (alpha >= 1.0f);
 | 
			
		||||
    const bool horizontal = (axis == ImGuiAxis_X);
 | 
			
		||||
 | 
			
		||||
    ImRect bb = bb_frame;
 | 
			
		||||
    bb.Expand(ImVec2(-ImClamp((float)(int)((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp((float)(int)((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f)));
 | 
			
		||||
 | 
			
		||||
    // V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
 | 
			
		||||
    float scrollbar_size_v = horizontal ? bb.GetWidth() : bb.GetHeight();
 | 
			
		||||
    float scroll_v = horizontal ? window->Scroll.x : window->Scroll.y;
 | 
			
		||||
    float win_size_avail_v = (horizontal ? window->SizeFull.x : window->SizeFull.y) - other_scrollbar_size_w;
 | 
			
		||||
    float win_size_contents_v = horizontal ? window->SizeContents.x : window->SizeContents.y;
 | 
			
		||||
    const float scrollbar_size_v = horizontal ? bb.GetWidth() : bb.GetHeight();
 | 
			
		||||
 | 
			
		||||
    // Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount)
 | 
			
		||||
    // But we maintain a minimum size in pixel to allow for the user to still aim inside.
 | 
			
		||||
    IM_ASSERT(ImMax(win_size_contents_v, win_size_avail_v) > 0.0f); // Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers.
 | 
			
		||||
    const float win_size_v = ImMax(ImMax(win_size_contents_v, win_size_avail_v), 1.0f);
 | 
			
		||||
    const float grab_h_pixels = ImClamp(scrollbar_size_v * (win_size_avail_v / win_size_v), style.GrabMinSize, scrollbar_size_v);
 | 
			
		||||
    IM_ASSERT(ImMax(size_contents_v, size_avail_v) > 0.0f); // Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers.
 | 
			
		||||
    const float win_size_v = ImMax(ImMax(size_contents_v, size_avail_v), 1.0f);
 | 
			
		||||
    const float grab_h_pixels = ImClamp(scrollbar_size_v * (size_avail_v / win_size_v), style.GrabMinSize, scrollbar_size_v);
 | 
			
		||||
    const float grab_h_norm = grab_h_pixels / scrollbar_size_v;
 | 
			
		||||
 | 
			
		||||
    // Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar().
 | 
			
		||||
    bool held = false;
 | 
			
		||||
    bool hovered = false;
 | 
			
		||||
    const bool previously_held = (g.ActiveId == id);
 | 
			
		||||
    ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavFocus);
 | 
			
		||||
 | 
			
		||||
    float scroll_max = ImMax(1.0f, win_size_contents_v - win_size_avail_v);
 | 
			
		||||
    float scroll_ratio = ImSaturate(scroll_v / scroll_max);
 | 
			
		||||
    float scroll_max = ImMax(1.0f, size_contents_v - size_avail_v);
 | 
			
		||||
    float scroll_ratio = ImSaturate(*p_scroll_v / scroll_max);
 | 
			
		||||
    float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
 | 
			
		||||
    if (held && allow_interaction && grab_h_norm < 1.0f)
 | 
			
		||||
    {
 | 
			
		||||
        float scrollbar_pos_v = horizontal ? bb.Min.x : bb.Min.y;
 | 
			
		||||
        float mouse_pos_v = horizontal ? g.IO.MousePos.x : g.IO.MousePos.y;
 | 
			
		||||
        float* click_delta_to_grab_center_v = horizontal ? &g.ScrollbarClickDeltaToGrabCenter.x : &g.ScrollbarClickDeltaToGrabCenter.y;
 | 
			
		||||
 | 
			
		||||
        // Click position in scrollbar normalized space (0.0f->1.0f)
 | 
			
		||||
        const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
 | 
			
		||||
        SetHoveredID(id);
 | 
			
		||||
 | 
			
		||||
        bool seek_absolute = false;
 | 
			
		||||
        if (!previously_held)
 | 
			
		||||
        if (g.ActiveIdIsJustActivated)
 | 
			
		||||
        {
 | 
			
		||||
            // On initial click calculate the distance between mouse and the center of the grab
 | 
			
		||||
            if (clicked_v_norm >= grab_v_norm && clicked_v_norm <= grab_v_norm + grab_h_norm)
 | 
			
		||||
            {
 | 
			
		||||
                *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f;
 | 
			
		||||
            }
 | 
			
		||||
            seek_absolute = (clicked_v_norm < grab_v_norm || clicked_v_norm > grab_v_norm + grab_h_norm);
 | 
			
		||||
            if (seek_absolute)
 | 
			
		||||
                g.ScrollbarClickDeltaToGrabCenter = 0.0f;
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                seek_absolute = true;
 | 
			
		||||
                *click_delta_to_grab_center_v = 0.0f;
 | 
			
		||||
            }
 | 
			
		||||
                g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Apply scroll
 | 
			
		||||
        // It is ok to modify Scroll here because we are being called in Begin() after the calculation of SizeContents and before setting up our starting position
 | 
			
		||||
        const float scroll_v_norm = ImSaturate((clicked_v_norm - *click_delta_to_grab_center_v - grab_h_norm*0.5f) / (1.0f - grab_h_norm));
 | 
			
		||||
        scroll_v = (float)(int)(0.5f + scroll_v_norm * scroll_max);//(win_size_contents_v - win_size_v));
 | 
			
		||||
        if (horizontal)
 | 
			
		||||
            window->Scroll.x = scroll_v;
 | 
			
		||||
        else
 | 
			
		||||
            window->Scroll.y = scroll_v;
 | 
			
		||||
        const float scroll_v_norm = ImSaturate((clicked_v_norm - g.ScrollbarClickDeltaToGrabCenter - grab_h_norm * 0.5f) / (1.0f - grab_h_norm));
 | 
			
		||||
        *p_scroll_v = (float)(int)(0.5f + scroll_v_norm * scroll_max);//(win_size_contents_v - win_size_v));
 | 
			
		||||
 | 
			
		||||
        // Update values for rendering
 | 
			
		||||
        scroll_ratio = ImSaturate(scroll_v / scroll_max);
 | 
			
		||||
        scroll_ratio = ImSaturate(*p_scroll_v / scroll_max);
 | 
			
		||||
        grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
 | 
			
		||||
 | 
			
		||||
        // Update distance to grab now that we have seeked and saturated
 | 
			
		||||
        if (seek_absolute)
 | 
			
		||||
            *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f;
 | 
			
		||||
            g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Render grab
 | 
			
		||||
    // Render
 | 
			
		||||
    window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, GetColorU32(ImGuiCol_ScrollbarBg), window->WindowRounding, rounding_corners);
 | 
			
		||||
    const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha);
 | 
			
		||||
    ImRect grab_rect;
 | 
			
		||||
    if (horizontal)
 | 
			
		||||
        grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImMin(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, host_rect.Max.x), bb.Max.y);
 | 
			
		||||
        grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, bb.Max.y);
 | 
			
		||||
    else
 | 
			
		||||
        grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImMin(ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels, host_rect.Max.y));
 | 
			
		||||
        grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels);
 | 
			
		||||
    window->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding);
 | 
			
		||||
 | 
			
		||||
    return held;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ImGui::Scrollbar(ImGuiAxis axis)
 | 
			
		||||
{
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    ImGuiWindow* window = g.CurrentWindow;
 | 
			
		||||
 | 
			
		||||
    const ImGuiID id = GetScrollbarID(window, axis);
 | 
			
		||||
    KeepAliveID(id);
 | 
			
		||||
 | 
			
		||||
    // Calculate scrollbar bounding box
 | 
			
		||||
    const ImRect outer_rect = window->Rect();
 | 
			
		||||
    const float other_scrollbar_size = window->ScrollbarSizes[axis];
 | 
			
		||||
    ImDrawCornerFlags rounding_corners = (other_scrollbar_size <= 0.0f) ? ImDrawCornerFlags_BotRight : 0;
 | 
			
		||||
    ImRect bb;
 | 
			
		||||
    if (axis == ImGuiAxis_X)
 | 
			
		||||
    {
 | 
			
		||||
        bb.Min = ImVec2(window->InnerMainRect.Min.x, window->InnerMainRect.Max.y);
 | 
			
		||||
        bb.Max = ImVec2(window->InnerMainRect.Max.x, outer_rect.Max.y - window->WindowBorderSize);
 | 
			
		||||
        rounding_corners |= ImDrawCornerFlags_BotLeft;
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        bb.Min = ImVec2(window->InnerMainRect.Max.x, window->InnerMainRect.Min.y);
 | 
			
		||||
        bb.Max = ImVec2(outer_rect.Max.x - window->WindowBorderSize, window->InnerMainRect.Max.y);
 | 
			
		||||
        rounding_corners |= ((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImDrawCornerFlags_TopRight : 0;
 | 
			
		||||
    }
 | 
			
		||||
    ScrollbarEx(bb, id, axis, &window->Scroll[axis], window->SizeFull[axis] - other_scrollbar_size, window->SizeContents[axis], rounding_corners);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col)
 | 
			
		||||
@@ -1177,8 +1177,8 @@ void ImGui::Bullet()
 | 
			
		||||
// - Dummy()
 | 
			
		||||
// - NewLine()
 | 
			
		||||
// - AlignTextToFramePadding()
 | 
			
		||||
// - SeparatorEx() [Internal]
 | 
			
		||||
// - Separator()
 | 
			
		||||
// - VerticalSeparator() [Internal]
 | 
			
		||||
// - SplitterBehavior() [Internal]
 | 
			
		||||
//-------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
@@ -1229,69 +1229,78 @@ void ImGui::AlignTextToFramePadding()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Horizontal/vertical separating line
 | 
			
		||||
void ImGui::Separator()
 | 
			
		||||
void ImGui::SeparatorEx(ImGuiSeparatorFlags flags)
 | 
			
		||||
{
 | 
			
		||||
    ImGuiWindow* window = GetCurrentWindow();
 | 
			
		||||
    if (window->SkipItems)
 | 
			
		||||
        return;
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
 | 
			
		||||
    // Those flags should eventually be overrideable by the user
 | 
			
		||||
    ImGuiSeparatorFlags flags = (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal;
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    IM_ASSERT(ImIsPowerOfTwo(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical)));   // Check that only 1 option is selected
 | 
			
		||||
 | 
			
		||||
    float thickness_draw = 1.0f;
 | 
			
		||||
    float thickness_layout = 0.0f;
 | 
			
		||||
    if (flags & ImGuiSeparatorFlags_Vertical)
 | 
			
		||||
    {
 | 
			
		||||
        VerticalSeparator();
 | 
			
		||||
        return;
 | 
			
		||||
        // Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout.
 | 
			
		||||
        float y1 = window->DC.CursorPos.y;
 | 
			
		||||
        float y2 = window->DC.CursorPos.y + window->DC.CurrentLineSize.y;
 | 
			
		||||
        const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + thickness_draw, y2));
 | 
			
		||||
        ItemSize(ImVec2(thickness_layout, 0.0f));
 | 
			
		||||
        if (!ItemAdd(bb, 0))
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        // Draw
 | 
			
		||||
        window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator));
 | 
			
		||||
        if (g.LogEnabled)
 | 
			
		||||
            LogText(" |");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Horizontal Separator
 | 
			
		||||
    if (window->DC.CurrentColumns)
 | 
			
		||||
        PopClipRect();
 | 
			
		||||
 | 
			
		||||
    float x1 = window->Pos.x;
 | 
			
		||||
    float x2 = window->Pos.x + window->Size.x;
 | 
			
		||||
    if (!window->DC.GroupStack.empty())
 | 
			
		||||
        x1 += window->DC.Indent.x;
 | 
			
		||||
 | 
			
		||||
    const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y+1.0f));
 | 
			
		||||
    ItemSize(ImVec2(0.0f, 1.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit
 | 
			
		||||
    if (!ItemAdd(bb, 0))
 | 
			
		||||
    else if (flags & ImGuiSeparatorFlags_Horizontal)
 | 
			
		||||
    {
 | 
			
		||||
        if (window->DC.CurrentColumns)
 | 
			
		||||
            PushColumnClipRect();
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
        // Horizontal Separator
 | 
			
		||||
        float x1 = window->Pos.x;
 | 
			
		||||
        float x2 = window->Pos.x + window->Size.x;
 | 
			
		||||
        if (!window->DC.GroupStack.empty())
 | 
			
		||||
            x1 += window->DC.Indent.x;
 | 
			
		||||
 | 
			
		||||
    window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x,bb.Min.y), GetColorU32(ImGuiCol_Separator));
 | 
			
		||||
        ImGuiColumns* columns = (flags & ImGuiSeparatorFlags_SpanAllColumns) ? window->DC.CurrentColumns : NULL;
 | 
			
		||||
        if (columns)
 | 
			
		||||
            PushColumnsBackground();
 | 
			
		||||
 | 
			
		||||
    if (g.LogEnabled)
 | 
			
		||||
        LogRenderedText(&bb.Min, "--------------------------------");
 | 
			
		||||
        // We don't provide our width to the layout so that it doesn't get feed back into AutoFit
 | 
			
		||||
        const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + thickness_draw));
 | 
			
		||||
        ItemSize(ImVec2(0.0f, thickness_layout));
 | 
			
		||||
        if (!ItemAdd(bb, 0))
 | 
			
		||||
        {
 | 
			
		||||
            if (columns)
 | 
			
		||||
                PopColumnsBackground();
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    if (window->DC.CurrentColumns)
 | 
			
		||||
    {
 | 
			
		||||
        PushColumnClipRect();
 | 
			
		||||
        window->DC.CurrentColumns->LineMinY = window->DC.CursorPos.y;
 | 
			
		||||
        // Draw
 | 
			
		||||
        window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x, bb.Min.y), GetColorU32(ImGuiCol_Separator));
 | 
			
		||||
        if (g.LogEnabled)
 | 
			
		||||
            LogRenderedText(&bb.Min, "--------------------------------");
 | 
			
		||||
 | 
			
		||||
        if (columns)
 | 
			
		||||
        {
 | 
			
		||||
            PopColumnsBackground();
 | 
			
		||||
            columns->LineMinY = window->DC.CursorPos.y;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ImGui::VerticalSeparator()
 | 
			
		||||
void ImGui::Separator()
 | 
			
		||||
{
 | 
			
		||||
    ImGuiWindow* window = GetCurrentWindow();
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
    ImGuiWindow* window = g.CurrentWindow;
 | 
			
		||||
    if (window->SkipItems)
 | 
			
		||||
        return;
 | 
			
		||||
    ImGuiContext& g = *GImGui;
 | 
			
		||||
 | 
			
		||||
    float y1 = window->DC.CursorPos.y;
 | 
			
		||||
    float y2 = window->DC.CursorPos.y + window->DC.CurrentLineSize.y;
 | 
			
		||||
    const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + 1.0f, y2));
 | 
			
		||||
    ItemSize(ImVec2(1.0f, 0.0f));
 | 
			
		||||
    if (!ItemAdd(bb, 0))
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator));
 | 
			
		||||
    if (g.LogEnabled)
 | 
			
		||||
        LogText(" |");
 | 
			
		||||
    // Those flags should eventually be overridable by the user
 | 
			
		||||
    ImGuiSeparatorFlags flags = (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal;
 | 
			
		||||
    flags |= ImGuiSeparatorFlags_SpanAllColumns;
 | 
			
		||||
    SeparatorEx(flags);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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.
 | 
			
		||||
@@ -5345,7 +5354,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
 | 
			
		||||
    const ImGuiStyle& style = g.Style;
 | 
			
		||||
 | 
			
		||||
    if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.CurrentColumns) // FIXME-OPT: Avoid if vertically clipped.
 | 
			
		||||
        PopClipRect();
 | 
			
		||||
        PushColumnsBackground();
 | 
			
		||||
 | 
			
		||||
    ImGuiID id = window->GetID(label);
 | 
			
		||||
    ImVec2 label_size = CalcTextSize(label, NULL, true);
 | 
			
		||||
@@ -5389,7 +5398,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
 | 
			
		||||
    if (!item_add)
 | 
			
		||||
    {
 | 
			
		||||
        if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.CurrentColumns)
 | 
			
		||||
            PushColumnClipRect();
 | 
			
		||||
            PopColumnsBackground();
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -5435,7 +5444,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
 | 
			
		||||
 | 
			
		||||
    if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.CurrentColumns)
 | 
			
		||||
    {
 | 
			
		||||
        PushColumnClipRect();
 | 
			
		||||
        PopColumnsBackground();
 | 
			
		||||
        bb.Max.x -= (GetContentRegionMax().x - max_x);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user