void coSubMenuItem::doSecondActionRelease() { if (open) { open = false; closeSubmenu(); } if (listener) listener->menuEvent(this); }
/** This method is called on intersections of the input device with this menu item. @return ACTION_CALL_ON_MISS */ int coSubMenuItem::hit(vruiHit *hit) { if (!vruiRendererInterface::the()->isRayActive()) return ACTION_CALL_ON_MISS; // update coJoystickManager if (vruiRendererInterface::the()->isJoystickActive()) vruiRendererInterface::the()->getJoystickManager()->selectItem(this, myMenu); //VRUILOG("coSubMenuItem::hit info: called") Result preReturn = vruiRendererInterface::the()->hit(this, hit); if (preReturn != ACTION_UNDEF) return preReturn; if (secondaryItem) coInteractionManager::the()->registerInteraction(preventMoveInteraction); background->setHighlighted(true); vruiButtons *buttons = hit->isMouseHit() ? vruiRendererInterface::the()->getMouseButtons() : vruiRendererInterface::the()->getButtons(); if (buttons->wasPressed(vruiButtons::ACTION_BUTTON)) { pressed = true; } if (!pressed && (buttons->wasReleased(vruiButtons::XFORM_BUTTON))) { if (secondaryItem) secondaryItem->doActionRelease(); } if (pressed && buttons->wasReleased(vruiButtons::ACTION_BUTTON)) { // left Button was pressed open = !open; if (open) { openSubmenu(); } else { closeSubmenu(); } if (listener) listener->menuEvent(this); pressed = false; } return ACTION_CALL_ON_MISS; }
/** * open or close Submenu */ void coSubMenuToolboxItem::doActionRelease() { open = !open; if (open) { openSubmenu(); } else closeSubmenu(); if (listener) listener->menuEvent(this); }
void coSubMenuItem::buttonEvent(coRotButton *button) { (void)button; open = !open; if (open) { openSubmenu(); } else { closeSubmenu(); } if (listener) listener->menuEvent(this); }
/** This method is called on intersections of the input device with this menu item. @return ACTION_CALL_ON_MISS */ int coSubMenuToolboxItem::hit(vruiHit *hit) { if (!vruiRendererInterface::the()->isRayActive()) return ACTION_CALL_ON_MISS; // update coJoystickManager if (vruiRendererInterface::the()->isJoystickActive()) vruiRendererInterface::the()->getJoystickManager()->selectItem(this, myMenu); //VRUILOG("coSubMenuToolboxItem::hit info: called"); Result preReturn = vruiRendererInterface::the()->hit(this, hit); if (preReturn != ACTION_UNDEF) return preReturn; background->setHighlighted(true); vruiButtons *buttons = hit->isMouseHit() ? vruiRendererInterface::the()->getMouseButtons() : vruiRendererInterface::the()->getButtons(); if (buttons->wasPressed() & vruiButtons::ACTION_BUTTON) { pressed = true; } if (pressed && (buttons->wasReleased() & vruiButtons::ACTION_BUTTON)) { pressed = false; open = !open; if (open) { openSubmenu(); } else { closeSubmenu(); } if (listener) listener->menuEvent(this); } return ACTION_CALL_ON_MISS; }
//set if item is active void coSubMenuToolboxItem::setActive(bool a) { // if item is activated add background to intersector if (!active_ && a) { vruiIntersection::getIntersectorForAction("coAction")->add(background->getDCS(), this); coToolboxMenuItem::setActive(a); subMenuIcon->setActive(a); } // if item is deactivated remove background from intersector else if (active_ && !a) { if (isOpen()) closeSubmenu(); vruiIntersection::getIntersectorForAction("coAction")->remove(this); coToolboxMenuItem::setActive(a); subMenuIcon->setActive(a); } }