Compare to detect usage errors
| 8901 | |
| 8902 | // Compare to detect usage errors |
| 8903 | void ImGuiStackSizes::CompareWithCurrentState() |
| 8904 | { |
| 8905 | ImGuiContext& g = *GImGui; |
| 8906 | ImGuiWindow* window = g.CurrentWindow; |
| 8907 | IM_UNUSED(window); |
| 8908 | |
| 8909 | // Window stacks |
| 8910 | // NOT checking: DC.ItemWidth, DC.TextWrapPos (per window) to allow user to conveniently push once and not pop (they are cleared on Begin) |
| 8911 | IM_ASSERT(SizeOfIDStack == window->IDStack.Size && "PushID/PopID or TreeNode/TreePop Mismatch!"); |
| 8912 | |
| 8913 | // Global stacks |
| 8914 | // 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. |
| 8915 | IM_ASSERT(SizeOfGroupStack == g.GroupStack.Size && "BeginGroup/EndGroup Mismatch!"); |
| 8916 | IM_ASSERT(SizeOfBeginPopupStack == g.BeginPopupStack.Size && "BeginPopup/EndPopup or BeginMenu/EndMenu Mismatch!"); |
| 8917 | IM_ASSERT(SizeOfDisabledStack == g.DisabledStackSize && "BeginDisabled/EndDisabled Mismatch!"); |
| 8918 | IM_ASSERT(SizeOfItemFlagsStack >= g.ItemFlagsStack.Size && "PushItemFlag/PopItemFlag Mismatch!"); |
| 8919 | IM_ASSERT(SizeOfColorStack >= g.ColorStack.Size && "PushStyleColor/PopStyleColor Mismatch!"); |
| 8920 | IM_ASSERT(SizeOfStyleVarStack >= g.StyleVarStack.Size && "PushStyleVar/PopStyleVar Mismatch!"); |
| 8921 | IM_ASSERT(SizeOfFontStack >= g.FontStack.Size && "PushFont/PopFont Mismatch!"); |
| 8922 | IM_ASSERT(SizeOfFocusScopeStack == g.FocusScopeStack.Size && "PushFocusScope/PopFocusScope Mismatch!"); |
| 8923 | } |
| 8924 | |
| 8925 | |
| 8926 | //----------------------------------------------------------------------------- |