MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / EndColumns

Method EndColumns

lib/imgui/imgui_widgets.cpp:7626–7699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7624}
7625
7626void ImGui::EndColumns()
7627{
7628 ImGuiContext& g = *GImGui;
7629 ImGuiWindow* window = GetCurrentWindow();
7630 ImGuiColumns* columns = window->DC.CurrentColumns;
7631 IM_ASSERT(columns != NULL);
7632
7633 PopItemWidth();
7634 if (columns->Count > 1)
7635 {
7636 PopClipRect();
7637 columns->Splitter.Merge(window->DrawList);
7638 }
7639
7640 const ImGuiColumnsFlags flags = columns->Flags;
7641 columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);
7642 window->DC.CursorPos.y = columns->LineMaxY;
7643 if (!(flags & ImGuiColumnsFlags_GrowParentContentsSize))
7644 window->DC.CursorMaxPos.x = columns->HostCursorMaxPosX; // Restore cursor max pos, as columns don't grow parent
7645
7646 // Draw columns borders and handle resize
7647 // The IsBeingResized flag ensure we preserve pre-resize columns width so back-and-forth are not lossy
7648 bool is_being_resized = false;
7649 if (!(flags & ImGuiColumnsFlags_NoBorder) && !window->SkipItems)
7650 {
7651 // We clip Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.
7652 const float y1 = ImMax(columns->HostCursorPosY, window->ClipRect.Min.y);
7653 const float y2 = ImMin(window->DC.CursorPos.y, window->ClipRect.Max.y);
7654 int dragging_column = -1;
7655 for (int n = 1; n < columns->Count; n++)
7656 {
7657 ImGuiColumnData* column = &columns->Columns[n];
7658 float x = window->Pos.x + GetColumnOffset(n);
7659 const ImGuiID column_id = columns->ID + ImGuiID(n);
7660 const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
7661 const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
7662 KeepAliveID(column_id);
7663 if (IsClippedEx(column_hit_rect, column_id, false))
7664 continue;
7665
7666 bool hovered = false, held = false;
7667 if (!(flags & ImGuiColumnsFlags_NoResize))
7668 {
7669 ButtonBehavior(column_hit_rect, column_id, &hovered, &held);
7670 if (hovered || held)
7671 g.MouseCursor = ImGuiMouseCursor_ResizeEW;
7672 if (held && !(column->Flags & ImGuiColumnsFlags_NoResize))
7673 dragging_column = n;
7674 }
7675
7676 // Draw column
7677 const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
7678 const float xi = IM_FLOOR(x);
7679 window->DrawList->AddLine(ImVec2(xi, y1 + 1.0f), ImVec2(xi, y2), col);
7680 }
7681
7682 // Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame.
7683 if (dragging_column != -1)

Callers

nothing calls this directly

Calls 7

GetCurrentWindowFunction · 0.85
ImMaxFunction · 0.85
ImMinFunction · 0.85
ImVec2Class · 0.85
GetDraggedColumnOffsetFunction · 0.85
MergeMethod · 0.80
AddLineMethod · 0.80

Tested by

no test coverage detected