MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / EndGroup

Method EndGroup

KBotExt/imgui/imgui.cpp:9819–9880  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9817}
9818
9819void ImGui::EndGroup()
9820{
9821 ImGuiContext& g = *GImGui;
9822 ImGuiWindow* window = g.CurrentWindow;
9823 IM_ASSERT(g.GroupStack.Size > 0); // Mismatched BeginGroup()/EndGroup() calls
9824
9825 ImGuiGroupData& group_data = g.GroupStack.back();
9826 IM_ASSERT(group_data.WindowID == window->ID); // EndGroup() in wrong window?
9827
9828 if (window->DC.IsSetPos)
9829 ErrorCheckUsingSetCursorPosToExtendParentBoundaries();
9830
9831 ImRect group_bb(group_data.BackupCursorPos, ImMax(window->DC.CursorMaxPos, group_data.BackupCursorPos));
9832
9833 window->DC.CursorPos = group_data.BackupCursorPos;
9834 window->DC.CursorMaxPos = ImMax(group_data.BackupCursorMaxPos, window->DC.CursorMaxPos);
9835 window->DC.Indent = group_data.BackupIndent;
9836 window->DC.GroupOffset = group_data.BackupGroupOffset;
9837 window->DC.CurrLineSize = group_data.BackupCurrLineSize;
9838 window->DC.CurrLineTextBaseOffset = group_data.BackupCurrLineTextBaseOffset;
9839 if (g.LogEnabled)
9840 g.LogLinePosY = -FLT_MAX; // To enforce a carriage return
9841
9842 if (!group_data.EmitItem)
9843 {
9844 g.GroupStack.pop_back();
9845 return;
9846 }
9847
9848 window->DC.CurrLineTextBaseOffset = ImMax(window->DC.PrevLineTextBaseOffset, group_data.BackupCurrLineTextBaseOffset); // FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now.
9849 ItemSize(group_bb.GetSize());
9850 ItemAdd(group_bb, 0, NULL, ImGuiItemFlags_NoTabStop);
9851
9852 // If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group.
9853 // It would be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets.
9854 // Also if you grep for LastItemId you'll notice it is only used in that context.
9855 // (The two tests not the same because ActiveIdIsAlive is an ID itself, in order to be able to handle ActiveId being overwritten during the frame.)
9856 const bool group_contains_curr_active_id = (group_data.BackupActiveIdIsAlive != g.ActiveId) && (g.ActiveIdIsAlive == g.ActiveId) && g.ActiveId;
9857 const bool group_contains_prev_active_id = (group_data.BackupActiveIdPreviousFrameIsAlive == false) && (g.ActiveIdPreviousFrameIsAlive == true);
9858 if (group_contains_curr_active_id)
9859 g.LastItemData.ID = g.ActiveId;
9860 else if (group_contains_prev_active_id)
9861 g.LastItemData.ID = g.ActiveIdPreviousFrame;
9862 g.LastItemData.Rect = group_bb;
9863
9864 // Forward Hovered flag
9865 const bool group_contains_curr_hovered_id = (group_data.BackupHoveredIdIsAlive == false) && g.HoveredId != 0;
9866 if (group_contains_curr_hovered_id)
9867 g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow;
9868
9869 // Forward Edited flag
9870 if (group_contains_curr_active_id && g.ActiveIdHasBeenEditedThisFrame)
9871 g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_Edited;
9872
9873 // Forward Deactivated flag
9874 g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HasDeactivated;
9875 if (group_contains_prev_active_id && g.ActiveId != g.ActiveIdPreviousFrame)
9876 g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_Deactivated;

Callers

nothing calls this directly

Calls 3

ImMaxFunction · 0.85
ItemSizeFunction · 0.85
GetSizeMethod · 0.80

Tested by

no test coverage detected