Lock horizontal starting position + capture group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.) Groups are currently a mishmash of functionalities which should perhaps be clarified and separated. FIXME-OPT: Could we safely early out on ->SkipItems?
| 12354 | // Groups are currently a mishmash of functionalities which should perhaps be clarified and separated. |
| 12355 | // FIXME-OPT: Could we safely early out on ->SkipItems? |
| 12356 | void ImGui::BeginGroup() |
| 12357 | { |
| 12358 | ImGuiContext& g = *GImGui; |
| 12359 | ImGuiWindow* window = g.CurrentWindow; |
| 12360 | |
| 12361 | g.GroupStack.resize(g.GroupStack.Size + 1); |
| 12362 | ImGuiGroupData& group_data = g.GroupStack.back(); |
| 12363 | group_data.WindowID = window->ID; |
| 12364 | group_data.BackupCursorPos = window->DC.CursorPos; |
| 12365 | group_data.BackupCursorPosPrevLine = window->DC.CursorPosPrevLine; |
| 12366 | group_data.BackupCursorMaxPos = window->DC.CursorMaxPos; |
| 12367 | group_data.BackupIndent = window->DC.Indent; |
| 12368 | group_data.BackupGroupOffset = window->DC.GroupOffset; |
| 12369 | group_data.BackupCurrLineSize = window->DC.CurrLineSize; |
| 12370 | group_data.BackupCurrLineTextBaseOffset = window->DC.CurrLineTextBaseOffset; |
| 12371 | group_data.BackupActiveIdIsAlive = g.ActiveIdIsAlive; |
| 12372 | group_data.BackupHoveredIdIsAlive = g.HoveredId != 0; |
| 12373 | group_data.BackupIsSameLine = window->DC.IsSameLine; |
| 12374 | group_data.BackupActiveIdHasBeenEditedThisFrame = g.ActiveIdHasBeenEditedThisFrame; |
| 12375 | group_data.BackupDeactivatedIdIsAlive = g.DeactivatedItemData.IsAlive; |
| 12376 | group_data.EmitItem = true; |
| 12377 | |
| 12378 | window->DC.GroupOffset.x = window->DC.CursorPos.x - window->Pos.x - window->DC.ColumnsOffset.x; |
| 12379 | window->DC.Indent = window->DC.GroupOffset; |
| 12380 | window->DC.CursorMaxPos = window->DC.CursorPos; |
| 12381 | window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); |
| 12382 | if (g.LogEnabled) |
| 12383 | g.LogLinePosY = -FLT_MAX; // To enforce a carriage return |
| 12384 | } |
| 12385 | |
| 12386 | void ImGui::EndGroup() |
| 12387 | { |