MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / EndColumns

Method EndColumns

extern/imgui/imgui_tables.cpp:3989–4062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3987}
3988
3989void ImGui::EndColumns()
3990{
3991 ImGuiContext& g = *GImGui;
3992 ImGuiWindow* window = GetCurrentWindow();
3993 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3994 IM_ASSERT(columns != NULL);
3995
3996 PopItemWidth();
3997 if (columns->Count > 1)
3998 {
3999 PopClipRect();
4000 columns->Splitter.Merge(window->DrawList);
4001 }
4002
4003 const ImGuiOldColumnFlags flags = columns->Flags;
4004 columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);
4005 window->DC.CursorPos.y = columns->LineMaxY;
4006 if (!(flags & ImGuiOldColumnFlags_GrowParentContentsSize))
4007 window->DC.CursorMaxPos.x = columns->HostCursorMaxPosX; // Restore cursor max pos, as columns don't grow parent
4008
4009 // Draw columns borders and handle resize
4010 // The IsBeingResized flag ensure we preserve pre-resize columns width so back-and-forth are not lossy
4011 bool is_being_resized = false;
4012 if (!(flags & ImGuiOldColumnFlags_NoBorder) && !window->SkipItems)
4013 {
4014 // We clip Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.
4015 const float y1 = ImMax(columns->HostCursorPosY, window->ClipRect.Min.y);
4016 const float y2 = ImMin(window->DC.CursorPos.y, window->ClipRect.Max.y);
4017 int dragging_column = -1;
4018 for (int n = 1; n < columns->Count; n++)
4019 {
4020 ImGuiOldColumnData* column = &columns->Columns[n];
4021 float x = window->Pos.x + GetColumnOffset(n);
4022 const ImGuiID column_id = columns->ID + ImGuiID(n);
4023 const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
4024 const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
4025 if (!ItemAdd(column_hit_rect, column_id, NULL, ImGuiItemFlags_NoNav))
4026 continue;
4027
4028 bool hovered = false, held = false;
4029 if (!(flags & ImGuiOldColumnFlags_NoResize))
4030 {
4031 ButtonBehavior(column_hit_rect, column_id, &hovered, &held);
4032 if (hovered || held)
4033 g.MouseCursor = ImGuiMouseCursor_ResizeEW;
4034 if (held && !(column->Flags & ImGuiOldColumnFlags_NoResize))
4035 dragging_column = n;
4036 }
4037
4038 // Draw column
4039 const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
4040 const float xi = IM_FLOOR(x);
4041 window->DrawList->AddLine(ImVec2(xi, y1 + 1.0f), ImVec2(xi, y2), col);
4042 }
4043
4044 // Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame.
4045 if (dragging_column != -1)
4046 {

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected