TopWindow *Ctrl::GetMainWindow() { GuiLock __; Ctrl *q = GetTopCtrl(); for(;;) { Ctrl *w = q->GetOwner(); if(!w) return dynamic_cast<TopWindow *>(q); q = w; } }
TopWindow *Ctrl::GetTopWindow() { GuiLock __; Ctrl *q = GetTopCtrl(); while(q) { TopWindow *w = dynamic_cast<TopWindow *>(q); if(w) return w; q = q->GetOwner(); } return NULL; }
Ctrl *Ctrl::GetOwner() { GuiLock __; int q = FindTopCtrl(); if(q > 0 && topctrl[q]->top) { Ctrl *x = topctrl[q]->top->owner_window; LDUMP(Upp::Name(x)); return dynamic_cast<TopWindowFrame *>(x) ? x->GetOwner() : x; } return NULL; }
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(); }