| 591 | |
| 592 | |
| 593 | ResultType UserMenu::DeleteAllItems() |
| 594 | // Remove all menu items from the linked list and from the menu. |
| 595 | { |
| 596 | // Fixed for v1.1.27.03: Don't attempt to take a shortcut by calling DestroyHandle(), as it |
| 597 | // will fail if this is a sub-menu of a menu bar. Removing the items individually will |
| 598 | // do exactly what the user expects. The following old comment indicates one reason |
| 599 | // DestroyHandle() was used; that reason is now obsolete since submenus are given IDs: |
| 600 | // "In addition, this avoids the need to find any submenus by position:" |
| 601 | if (!mFirstMenuItem) |
| 602 | return OK; // If there are no user-defined menu items, it's already in the correct state. |
| 603 | UserMenuItem *menu_item_to_delete; |
| 604 | for (UserMenuItem *mi = mFirstMenuItem; mi;) |
| 605 | { |
| 606 | if (mMenu) |
| 607 | RemoveMenu(mMenu, mi->mMenuID, MF_BYCOMMAND); |
| 608 | menu_item_to_delete = mi; |
| 609 | mi = mi->mNextMenuItem; |
| 610 | RemoveItemIcon(menu_item_to_delete); // L26: Free icon or bitmap! |
| 611 | delete menu_item_to_delete; |
| 612 | } |
| 613 | mFirstMenuItem = mLastMenuItem = NULL; |
| 614 | mMenuItemCount = 0; |
| 615 | mDefault = NULL; // i.e. there can't be a *user-defined* default item anymore, even if this is the tray. |
| 616 | UPDATE_GUI_MENU_BARS(mMenuType, mMenu) // Verified as being necessary. |
| 617 | return OK; |
| 618 | } |
| 619 | |
| 620 | |
| 621 |
nothing calls this directly
no outgoing calls
no test coverage detected