void MenuBar::CloseMenu() { LLOG("CloseMenu"); MenuBar *q = GetLastSubmenu(); while(q && q->IsPopUp()) { if(q->IsOpen()) { q->doeffect = true; q->Close(); if(q->parentmenu) q->parentmenu->WhenSubMenuClose(); } MenuBar *w = q; q = q->parentmenu; w->submenu = w->parentmenu = NULL; } if(q) q->submenu = NULL; while(q) { q->SyncState(); q->doeffect = true; q = q->parentmenu; } }
void MenuBar::PostDeactivate() { LLOG("PostDeactivate"); MenuBar *q = GetLastSubmenu(); MenuBar *u = q; while(q && q->IsPopUp()) { if(q->IsOpen() && q->HasFocusDeep()) return; q = q->parentmenu; } if(u->IsPopUp()) { while(u->parentmenu && u->parentmenu->IsPopUp()) u = u->parentmenu; Ctrl *w = GetActiveCtrl(); while(w) { if(w == u) return; w = w->GetOwner(); } } CloseMenu(); }