void WMenuItem::setMenu(WMenu *menu) { subMenu_ = menu; subMenu_->parentItem_ = this; Wt::WContainerWidget *sparent = dynamic_cast<Wt::WContainerWidget *>(subMenu_->parent()); if (sparent) sparent->removeWidget(subMenu_); addWidget(subMenu_); if (subMenu_->isPopup() && parentMenu() && parentMenu()->isPopup()) { subMenu_->webWidget()->setZIndex(std::max(parentMenu()->zIndex() + 100, subMenu_->zIndex())); } WPopupMenu *popup = dynamic_cast<WPopupMenu *>(subMenu_); if (popup) { popup->setJavaScriptMember("wtNoReparent", "true"); setSelectable(false); popup->setButton(anchor()); updateInternalPath(); // WPopupMenus are hidden by default, 'show' this WPopupMenu // but not really, since the parent is still hidden. This fixes // an issue where child widgets would remain unexposed, even // though this submenu was open (e.g. in a submenu where items // are checkable) if (dynamic_cast<WPopupMenu*>(menu_)) popup->show(); } }
void WMenuItem::setMenu(WMenu *menu) { subMenu_ = menu; subMenu_->parentItem_ = this; Wt::WContainerWidget *sparent = dynamic_cast<Wt::WContainerWidget *>(subMenu_->parent()); if (sparent) sparent->removeWidget(subMenu_); addWidget(subMenu_); WPopupMenu *popup = dynamic_cast<WPopupMenu *>(subMenu_); if (popup) { popup->setJavaScriptMember("wtNoReparent", "true"); setSelectable(false); popup->setButton(anchor()); updateInternalPath(); } }