void ButtonTaskMenu::createGroup() { QDesignerFormWindowInterface *fw = formWindow(); const ButtonList bl = buttonList(fw->cursor()); // Do we need to remove the buttons from an existing group? QUndoCommand *removeCmd = 0; if (bl.front()->group()) { removeCmd = createRemoveButtonsCommand(fw, bl); if (!removeCmd) return; } // Add cmd CreateButtonGroupCommand *addCmd = new CreateButtonGroupCommand(fw); if (!addCmd->init(bl)) { qWarning("** WARNING Failed to initialize CreateButtonGroupCommand!"); delete addCmd; return; } // Need a macro [even if we only have the add command] since the command might trigger additional commands QUndoStack *history = fw->commandHistory(); history->beginMacro(addCmd->text()); if (removeCmd) history->push(removeCmd); history->push(addCmd); history->endMacro(); }
void ButtonTaskMenu::addToGroup(QAction *a) { QButtonGroup *bg = qvariant_cast<QButtonGroup *>(a->data()); Q_ASSERT(bg); QDesignerFormWindowInterface *fw = formWindow(); const ButtonList bl = buttonList(fw->cursor()); // Do we need to remove the buttons from an existing group? QUndoCommand *removeCmd = 0; if (bl.front()->group()) { removeCmd = createRemoveButtonsCommand(fw, bl); if (!removeCmd) return; } AddButtonsToGroupCommand *addCmd = new AddButtonsToGroupCommand(fw); addCmd->init(bl, bg); QUndoStack *history = fw->commandHistory(); if (removeCmd) { history->beginMacro(addCmd->text()); history->push(removeCmd); history->push(addCmd); history->endMacro(); } else { history->push(addCmd); } }
void InfoBoxDialog::setButtons(ButtonList &buttons) { for (std::vector<MyGUI::ButtonPtr>::iterator it = this->mButtons.begin(); it != this->mButtons.end(); ++it) { MyGUI::Gui::getInstance().destroyWidget(*it); } this->mButtons.clear(); mCurrentButton = -1; // TODO: The buttons should be generated from a template in the layout file, ie. cloning an existing widget MyGUI::ButtonPtr button; MyGUI::IntCoord coord = MyGUI::IntCoord(0, 0, mButtonBar->getWidth(), 10); ButtonList::const_iterator end = buttons.end(); for (ButtonList::const_iterator it = buttons.begin(); it != end; ++it) { const std::string &text = *it; button = mButtonBar->createWidget<MyGUI::Button>("MW_Button", coord, MyGUI::Align::Top | MyGUI::Align::HCenter, ""); button->getSubWidgetText()->setWordWrap(true); button->setCaption(text); fitToText(button); button->eventMouseButtonClick += MyGUI::newDelegate(this, &InfoBoxDialog::onButtonClicked); coord.top += button->getHeight(); this->mButtons.push_back(button); } }
ClassChoiceDialog::ClassChoiceDialog(WindowManager& parWindowManager) : InfoBoxDialog(parWindowManager) { setText(""); ButtonList buttons; buttons.push_back(mWindowManager.getGameSettingString("sClassChoiceMenu1", "")); buttons.push_back(mWindowManager.getGameSettingString("sClassChoiceMenu2", "")); buttons.push_back(mWindowManager.getGameSettingString("sClassChoiceMenu3", "")); buttons.push_back(mWindowManager.getGameSettingString("sBack", "")); setButtons(buttons); }
void ButtonGroupMenu::selectGroup() { // Select and make current button "current" again by selecting it last (if there is any) const ButtonList buttons = m_buttonGroup->buttons(); m_formWindow->clearSelection(false); const ButtonList::const_iterator cend = buttons.constEnd(); for (ButtonList::const_iterator it = buttons.constBegin(); it != cend; ++it) if (*it != m_currentButton) m_formWindow->selectWidget(*it, true); if (m_currentButton) m_formWindow->selectWidget(m_currentButton, true); }
ClassChoiceDialog::ClassChoiceDialog(MWWorld::Environment& environment) : InfoBoxDialog(environment) { WindowManager *mw = environment.mWindowManager; setText(""); ButtonList buttons; buttons.push_back(mw->getGameSettingString("sClassChoiceMenu1", "")); buttons.push_back(mw->getGameSettingString("sClassChoiceMenu2", "")); buttons.push_back(mw->getGameSettingString("sClassChoiceMenu3", "")); buttons.push_back(mw->getGameSettingString("sBack", "")); setButtons(buttons); }
bool RemoveButtonsFromGroupCommand::init(const ButtonList &bl) { if (bl.empty()) return false; QButtonGroup *group = bl.front()->group(); if (!group) return false; if (bl.size() >= group->buttons().size()) return false; initialize(bl, group); //: Command description for removing buttons from a QButtonGroup setText(QApplication::translate("Command", "Remove '%1' from '%2'").arg(nameList(bl), group->objectName())); return true; }
bool CreateButtonGroupCommand::init(const ButtonList &bl) { if (bl.empty()) return false; QDesignerFormWindowInterface *fw = formWindow(); QButtonGroup *buttonGroup = new QButtonGroup(fw->mainContainer()); buttonGroup->setObjectName(QLatin1String("buttonGroup")); fw->ensureUniqueObjectName(buttonGroup); initialize(bl, buttonGroup); return true; }
bool ActionMapper::pollAction(int actionID) { bool down = false; ActionData *ad = getActionDataByID(actionID); if (ad) { ButtonList *blist = &ad->buttonList; ButtonList::iterator j; j = blist->begin(); for (; j != blist->end(); j++) { if (getKeyState((*j))) { down = true; break; } } } return down; }
QString ButtonGroupCommand::nameList(const ButtonList& bl) { QString rc; const QChar quote = QLatin1Char('\''); const QString separator = QLatin1String(", "); const int size = bl.size(); for (int i = 0; i < size; i++) { if (i) rc += separator; rc += quote; rc += bl[i]->objectName(); rc += quote; } return rc; }
void OnDraw(void) { float vista[9]; camera->getBackCamera(vista); switch (interfaz.sMenu){ //Menu case 0: interfaz.Menu(camera); break; //Juego normal default: camera = &pList[turno.thisSubturn()].pCamera; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Para definir el punto de vista glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt( vista[0], vista[1], vista[2], // posicion del ojo vista[3], vista[4], vista[5], // hacia que punto mira (0,0,0) vista[6], vista[7], vista[8] // definimos hacia arriba (eje Y) ); Casilla::lightUp(posRaton[x], posRaton[y]); //Es la funcion que ilumina la casilla donde esta el raton glColor3ub(2, 2, 2); glTranslatef(posRaton[x], posRaton[y], posRaton[z]); glutSolidSphere(0.05, 20, 20); glTranslatef(-posRaton[x], -posRaton[y], -posRaton[z]); superficie.doDrawWorldMap(); superficie.doDrawWorldContent(); //////////////////////////Dibujo de rango//////////////////////////// if (flagAttack&&flagRangeD) superficie.doDrawRange(pti, Interfaz::interactuable(turno.enableFaction()), 1); if (flagMove&&flagRangeD) superficie.doDrawRange(pti, Interfaz::interactuable(turno.enableFaction()), 0); //////////////////////////Dibujo de menus//////////////////////////// cuadro.putInfoFull(pti, posRatonW); dialog.drawButtos(); break; } glutSwapBuffers();//Cambia los buffer de dibujo, no borrar esta linea ni poner nada despues }