MCPcopy Create free account
hub / github.com/RenderKit/embree / EndColumns

Method EndColumns

tutorials/common/imgui/imgui_tables.cpp:3990–4063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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