UIMenuItem *UIMenu::addOption(String label, String _id, void *data) { UIMenuItem *newItem = new UIMenuItem(label, _id, data, menuWidth, menuItemHeight); items.push_back(newItem); dropDownBox->addChild(newItem); newItem->setPosition(0,paddingY+nextItemHeight); nextItemHeight += menuItemHeight; dropDownBox->resizeBox(menuWidth, nextItemHeight + (paddingY * 2.0)); return newItem; }
UIMenuItem *UIMenu::addDivider() { Number newItemHeight = menuItemHeight; UIMenuItem *newItem = new UIMenuDivider(menuWidth, newItemHeight); items.push_back(newItem); dropDownBox->addChild(newItem); newItem->setPosition(0, paddingY+nextItemHeight); nextItemHeight += newItemHeight; dropDownBox->resizeBox(menuWidth, nextItemHeight + (paddingY*2.0)); return newItem; }
UIMenuItem *UIMenu::addOption(String label, String _id, void *data) { UIMenuItem *newItem = new UIMenuItem(label, _id, data, menuWidth, menuItemHeight); items.push_back(newItem); dropDownBox->addChild(newItem); newItem->setPosition(0,paddingY+nextItemHeight); nextItemHeight += menuItemHeight; dropDownBox->resizeBox(menuWidth, nextItemHeight + (paddingY * 2.0)); Number difference = CoreServices::getInstance()->getCore()->getYRes() - (getPosition().y + dropDownBox->getHeight()); if(difference < 0) { setPositionY(getPosition().y + difference); } difference = CoreServices::getInstance()->getCore()->getXRes() - (getPosition().x + dropDownBox->getWidth()); if(difference < 0) { setPositionX(getPosition().x + difference); } return newItem; }