Compare to detect usage errors
| 7658 | |
| 7659 | // Compare to detect usage errors |
| 7660 | void ImGuiStackSizes::CompareWithCurrentState() |
| 7661 | { |
| 7662 | ImGuiContext& g = *GImGui; |
| 7663 | ImGuiWindow* window = g.CurrentWindow; |
| 7664 | IM_UNUSED(window); |
| 7665 | |
| 7666 | // Window stacks |
| 7667 | // NOT checking: DC.ItemWidth, DC.TextWrapPos (per window) to allow user to conveniently push once and not pop (they are cleared on Begin) |
| 7668 | IM_ASSERT(SizeOfIDStack == window->IDStack.Size && "PushID/PopID or TreeNode/TreePop Mismatch!"); |
| 7669 | |
| 7670 | // Global stacks |
| 7671 | // For color, style and font stacks there is an incentive to use Push/Begin/Pop/.../End patterns, so we relax our checks a little to allow them. |
| 7672 | IM_ASSERT(SizeOfGroupStack == g.GroupStack.Size && "BeginGroup/EndGroup Mismatch!"); |
| 7673 | IM_ASSERT(SizeOfBeginPopupStack == g.BeginPopupStack.Size && "BeginPopup/EndPopup or BeginMenu/EndMenu Mismatch!"); |
| 7674 | IM_ASSERT(SizeOfDisabledStack == g.DisabledStackSize && "BeginDisabled/EndDisabled Mismatch!"); |
| 7675 | IM_ASSERT(SizeOfItemFlagsStack >= g.ItemFlagsStack.Size && "PushItemFlag/PopItemFlag Mismatch!"); |
| 7676 | IM_ASSERT(SizeOfColorStack >= g.ColorStack.Size && "PushStyleColor/PopStyleColor Mismatch!"); |
| 7677 | IM_ASSERT(SizeOfStyleVarStack >= g.StyleVarStack.Size && "PushStyleVar/PopStyleVar Mismatch!"); |
| 7678 | IM_ASSERT(SizeOfFontStack >= g.FontStack.Size && "PushFont/PopFont Mismatch!"); |
| 7679 | IM_ASSERT(SizeOfFocusScopeStack == g.FocusScopeStack.Size && "PushFocusScope/PopFocusScope Mismatch!"); |
| 7680 | } |
| 7681 | |
| 7682 | |
| 7683 | //----------------------------------------------------------------------------- |