MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / DeleteItem

Method DeleteItem

source/script_menu.cpp:570–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568
569
570ResultType UserMenu::DeleteItem(UserMenuItem *aMenuItem, UserMenuItem *aMenuItemPrev, bool aUpdateGuiMenuBars)
571{
572 // Remove this menu item from the linked list:
573 if (aMenuItem == mLastMenuItem)
574 mLastMenuItem = aMenuItemPrev; // Can be NULL if the list will now be empty.
575 if (aMenuItemPrev) // there is another item prior to aMenuItem in the linked list.
576 aMenuItemPrev->mNextMenuItem = aMenuItem->mNextMenuItem; // Can be NULL if aMenuItem was the last one.
577 else // aMenuItem was the first one in the list.
578 mFirstMenuItem = aMenuItem->mNextMenuItem; // Can be NULL if the list will now be empty.
579 if (mMenu) // Delete the item from the menu.
580 RemoveMenu(mMenu, aMenuItem_ID, aMenuItem_MF_BY); // v1.0.48: Lexikos: DeleteMenu() destroys any sub-menu handle associated with the item, so use RemoveMenu. Otherwise the submenu handle stored somewhere else in memory would suddenly become invalid.
581 RemoveItemIcon(aMenuItem); // L17: Free icon or bitmap.
582 if (mDefault == aMenuItem)
583 mDefault = NULL; // No need to SetDefaultMenuItem since the previous default item was removed.
584 delete aMenuItem; // Do this last when its contents are no longer needed.
585 --mMenuItemCount;
586 if (aUpdateGuiMenuBars)
587 UPDATE_GUI_MENU_BARS(mMenuType, mMenu) // Verified as being necessary.
588 return OK;
589}
590
591
592

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected