Compare to detect usage errors
| 7291 | |
| 7292 | // Compare to detect usage errors |
| 7293 | void ImGuiStackSizes::CompareWithCurrentState() |
| 7294 | { |
| 7295 | ImGuiContext& g = *GImGui; |
| 7296 | ImGuiWindow* window = g.CurrentWindow; |
| 7297 | IM_UNUSED(window); |
| 7298 | |
| 7299 | // Window stacks |
| 7300 | // NOT checking: DC.ItemWidth, DC.TextWrapPos (per window) to allow user to conveniently push once and not pop (they are cleared on Begin) |
| 7301 | IM_ASSERT(SizeOfIDStack == window->IDStack.Size && "PushID/PopID or TreeNode/TreePop Mismatch!"); |
| 7302 | |
| 7303 | // Global stacks |
| 7304 | // 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. |
| 7305 | IM_ASSERT(SizeOfGroupStack == g.GroupStack.Size && "BeginGroup/EndGroup Mismatch!"); |
| 7306 | IM_ASSERT(SizeOfBeginPopupStack == g.BeginPopupStack.Size && "BeginPopup/EndPopup or BeginMenu/EndMenu Mismatch!"); |
| 7307 | IM_ASSERT(SizeOfColorStack >= g.ColorStack.Size && "PushStyleColor/PopStyleColor Mismatch!"); |
| 7308 | IM_ASSERT(SizeOfStyleVarStack >= g.StyleVarStack.Size && "PushStyleVar/PopStyleVar Mismatch!"); |
| 7309 | IM_ASSERT(SizeOfFontStack >= g.FontStack.Size && "PushFont/PopFont Mismatch!"); |
| 7310 | IM_ASSERT(SizeOfFocusScopeStack == g.FocusScopeStack.Size && "PushFocusScope/PopFocusScope Mismatch!"); |
| 7311 | } |
| 7312 | |
| 7313 | |
| 7314 | //----------------------------------------------------------------------------- |