/************************************************************************* Recursive function that closes all popups down the hierarchy starting with this one. *************************************************************************/ void MenuItem::closeAllMenuItemPopups() { // are we attached to a PopupMenu? if (!d_ownerList) return; if (dynamic_cast<Menubar*>(d_ownerList)) { closePopupMenu(); return; } PopupMenu* pop = dynamic_cast<PopupMenu*>(d_ownerList); if (pop) { // is this parent popup attached to a menu item? Window* popParent = pop->getParent(); MenuItem* mi = dynamic_cast<MenuItem*>(popParent); if (mi) { // recurse mi->closeAllMenuItemPopups(); } // otherwise we just hide the parent popup else { pop->closePopupMenu(false); } } }