/// Open the submenu. void coSubMenuItem::openSubmenu() { //cannnot open the submenu if item is inacitve if (!getActive()) return; // set own state open = true; // set Icon to appropriate state subMenuIcon->setState(open); if (subMenu) { // show submenu subMenu->setVisible(open); positionSubmenu(); if (attachment == coUIElement::REPLACE) { myMenu->setVisible(false); } } // contact twin if (myTwin != 0) { myTwin->updateContentBool(open); } if (vruiRendererInterface::the()->getJoystickManager()) vruiRendererInterface::the()->getJoystickManager()->openedSubMenu(this, subMenu); }
bool coSubMenuItem::updateContentBool(bool newState) { // copy new status open = newState; // set icon state subMenuIcon->setState(open); // the submenu was opened by a twin, // so open the menu and then command the twin // to position it. If the twin fails, // position it myself. if (subMenu) { subMenu->setVisible(open); if (open) { if (myTwin) { if (!myTwin->updateContentPointer((void *)subMenu)) { positionSubmenu(); } } else { // this one is strange. We received updateContent // without having a registered twin! positionSubmenu(); } } } return true; }
bool coSubMenuToolboxItem::updateContentPointer(void *subItem) { subMenu = static_cast<coMenu *>(subItem); if (subMenu) { // if we got a submenu pointer...position it // maybe some safety checks about the type should go here // some day? positionSubmenu(); } //subMenu = 0; return true; }