void CGUIDialog::processLogic() { // For the special effect not used in the galaxy engine if( g_pBehaviorEngine->getEngine() != ENGINE_GALAXY ) { if( mFXhStep > 0 ) { mFXhStep--; return; } else if( mFXvStep > 0 ) { mFXvStep--; return; } } // Try to get a control that is waiting for input to be typed CGUIInputText *pInputCtrl = nullptr; for( auto &it : mControlList ) { CGUIControl *ctrl = it.get(); pInputCtrl = dynamic_cast<CGUIInputText*>(ctrl); if(pInputCtrl) { if(pInputCtrl->Typing()) break; pInputCtrl = nullptr; } } if(pInputCtrl != nullptr) { pInputCtrl->processLogic(); } else { // Process the subcontrols its logic int sel = 0; for( auto &it : mControlList ) { CGUIControl *ctrl = it.get(); ctrl->processLogic(); if( dynamic_cast<CGUIButton*>(ctrl) || dynamic_cast<CGUIInputText*>(ctrl) ) { if( ctrl->getHovered() ) { mpCurrentCtrl = ctrl; mSelection = sel; } } sel++; } } if(!g_pInput->m_EventList.empty()) g_pInput->m_EventList.clear(); }
void CSaveMenu::sendEvent(SmartPointer<CEvent> command) { // Before all events are sent to the dialog which handles selection catch some specific events // required for the saving process. if( CommandEvent *ev = dynamic_cast<CommandEvent*>(command.get()) ) { const int sel = mpMenuDialog->Selection(); if( sel > 0 ) { if(ev->mCommand == IC_JUMP || ev->mCommand == IC_STATUS) { CGUIInputText *pInput = dynamic_cast<CGUIInputText*>(mpMenuDialog->CurrentControl()); if(pInput->Typing()) { gpSaveGameController->prepareSaveGame( sel, pInput->getText() ); g_pBehaviorEngine->EventList().add( new CloseAllMenusEvent() ); } else { if(pInput->getText() == EMPTY_TEXT) pInput->setText(""); pInput->setTypeMode(true); } return; } } } mpMenuDialog->sendEvent(command); }