MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / EndColumns

Method EndColumns

Dependencies/ImGui/src/imgui_tables.cpp:4546–4620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4544}
4545
4546void ImGui::EndColumns()
4547{
4548 ImGuiContext& g = *GImGui;
4549 ImGuiWindow* window = GetCurrentWindow();
4550 ImGuiOldColumns* columns = window->DC.CurrentColumns;
4551 IM_ASSERT(columns != NULL);
4552
4553 PopItemWidth();
4554 if (columns->Count > 1)
4555 {
4556 PopClipRect();
4557 columns->Splitter.Merge(window->DrawList);
4558 }
4559
4560 const ImGuiOldColumnFlags flags = columns->Flags;
4561 columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);
4562 window->DC.CursorPos.y = columns->LineMaxY;
4563 if (!(flags & ImGuiOldColumnFlags_GrowParentContentsSize))
4564 window->DC.CursorMaxPos.x = columns->HostCursorMaxPosX; // Restore cursor max pos, as columns don't grow parent
4565
4566 // Draw columns borders and handle resize
4567 // The IsBeingResized flag ensure we preserve pre-resize columns width so back-and-forth are not lossy
4568 bool is_being_resized = false;
4569 if (!(flags & ImGuiOldColumnFlags_NoBorder) && !window->SkipItems)
4570 {
4571 // We clip Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.
4572 const float y1 = ImMax(columns->HostCursorPosY, window->ClipRect.Min.y);
4573 const float y2 = ImMin(window->DC.CursorPos.y, window->ClipRect.Max.y);
4574 int dragging_column = -1;
4575 for (int n = 1; n < columns->Count; n++)
4576 {
4577 ImGuiOldColumnData* column = &columns->Columns[n];
4578 float x = window->Pos.x + GetColumnOffset(n);
4579 const ImGuiID column_id = columns->ID + ImGuiID(n);
4580 const float column_hit_hw = ImTrunc(COLUMNS_HIT_RECT_HALF_THICKNESS * g.CurrentDpiScale);
4581 const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
4582 if (!ItemAdd(column_hit_rect, column_id, NULL, ImGuiItemFlags_NoNav))
4583 continue;
4584
4585 bool hovered = false, held = false;
4586 if (!(flags & ImGuiOldColumnFlags_NoResize))
4587 {
4588 ButtonBehavior(column_hit_rect, column_id, &hovered, &held);
4589 if (hovered || held)
4590 SetMouseCursor(ImGuiMouseCursor_ResizeEW);
4591 if (held && !(column->Flags & ImGuiOldColumnFlags_NoResize))
4592 dragging_column = n;
4593 }
4594
4595 // Draw column
4596 const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
4597 const float xi = IM_TRUNC(x);
4598 window->DrawList->AddLine(ImVec2(xi, y1 + 1.0f), ImVec2(xi, y2), col);
4599 }
4600
4601 // Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame.
4602 if (dragging_column != -1)
4603 {

Callers

nothing calls this directly

Calls 8

GetCurrentWindowFunction · 0.85
ImMaxFunction · 0.85
ImMinFunction · 0.85
ImTruncFunction · 0.85
ImVec2Function · 0.85
GetDraggedColumnOffsetFunction · 0.85
MergeMethod · 0.80
AddLineMethod · 0.80

Tested by

no test coverage detected