bool TextInput::keyDown(SDL_keysym sym) { std::string beforeCursor = str.substr(0, cursorPos), afterCursor = str.substr(cursorPos, str.size()-cursorPos); switch(sym.sym) { case SDLK_ESCAPE: disableEvents(); result = -1; break; case SDLK_RETURN: disableEvents(); result = 1; break; case SDLK_BACKSPACE: if(cursorPos > 0) { str = beforeCursor.substr(0, beforeCursor.size()-1) + afterCursor; cursorPos--; } break; default: if(sym.unicode > 15 && sym.unicode < 128) { str = beforeCursor; str += sym.unicode; str += afterCursor; cursorPos++; } else return false; } return true; }
void Frame::disable() { enabled = false; disableEvents(); onDisable(); // Tell each widget that the frame changed typedef std::deque<Widget *> WidgetTraversal; WidgetTraversal widgets; widgets.push_back(rootWidget); while (!widgets.empty()) { Widget *currWidget = widgets.front(); widgets.pop_front(); currWidget->onLeavingFrame(); const Widget::WidgetPool &childWidgets = currWidget->getChildWidgets(); for (Widget::WidgetPool::const_iterator it = childWidgets.begin(); it != childWidgets.end(); it++) { Widget *currChildWidget = *it; widgets.push_back(currChildWidget); } } }
TextInput::TextInput(float x, float y,TextParams fontToUse, bool startEnabled) : EventListener(3), x(x), y(y), cursorPos(0), str(""), result(0),fontName(fontToUse) { if (!startEnabled) disableEvents(); }
void Voronoi::ParabolaNode::removeParabola(ParabolaNode * parabola) { assert(isLeaf(parabola)); // Check if parabola is root if (parabola == this) { setInvalid(); } // Any event involving parabolaNode->site() should be deleted. disableEvents(parabola); // Set siblings ParabolaNode::_cross(parabola->_leftSibling, parabola->_rightSibling); // Release parent's another child auto otherBranch = _releaseTwin(parabola); // Move parent's another child into parent's parent if (parabola->parent()->parent()) { _setParentsTwin(parabola->parent(), std::move(otherBranch)); } else { /// Make "otherBranch" to be "this" _move(std::move(otherBranch)); } }
CGenericCanvas::~CGenericCanvas(void) { beginUpdate(); disableEvents(); // Release all managed data. Start with the visual parts to avoid frequent change events between model and other elements. for (CViews::iterator iterator = FViews.begin(); iterator != FViews.end(); ++iterator) delete *iterator; for (CLayers::iterator iterator = FLayers.begin(); iterator != FLayers.end(); ++iterator) delete *iterator; delete FModel; delete FAnimationManager; // Release the lock we placed in the constructor. // If this is the last GC instance then also the font manager can be released. unlockFontManager(); endUpdate(); #ifdef _WINDOWS DeleteCriticalSection(&FLock); #else g_static_rec_mutex_free(&FLock); #endif }
/** * Make the set of event filters that correspond with this * node inactive (including disabling the corresponding events * and freeing resources). */ jint eventFilterRestricted_deinstall(HandlerNode *node) { jint error1, error2; error1 = disableEvents(node); error2 = clearFilters(node); return error1 != JVMDI_ERROR_NONE? error1 : error2; }
void xmlgui::ofGuiEventDispatcher::setEnabled(bool enabled) { if(enabled!=this->enabled) { if(enabled) { enableEvents(); } else { disableEvents(); } } this->enabled = enabled; }
void phdPopupMenu::setVisible(bool _value) { if(_value != visible) { visible = _value; if(!visible) { disableEvents(); for(int i = 0; i < items.size(); i++) { if(items[i]->subMenu != NULL) items[i]->subMenu->setVisible(false); // ocults every child } } else { if(items.size() > 0) { enableEvents(); } } } }
//---------------------------------------------------- ofxCvCoordWarpingGui::~ofxCvCoordWarpingGui(){ disableEvents(); }
void ofxTimeline::disable(){ isEnabled = false; disableEvents(); }
/** * realiza a renderização de um frame do jogo */ void RobotWindow::display() { // ajusta para a matriz de modelo e zera as transformações glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // obtém a posição do robô e ajusta câmera para apontar para essa direção robot.configureLookAt(lookAt); setCameraPosition(cameraLongitude, cameraLatitude); gluLookAt(eye.x, eye.y, eye.z, lookAt.x, lookAt.y, lookAt.z, 0.0, 1.0, 0.0); // limpa o atual buffer de renderização glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // verifica se o jogo terminou (o robo tem vidas?) if (robot.getLives() == 0) { // desenha o Game Over e paralisa a aplicação textGameOver.draw2D(); glutSwapBuffers(); disableEvents(); return; } else // senão existem vidas // verifica se o robot deve ser revivido if (!robot.isAlive()) { robot.revive(); newEvent(EVENT_RESET, interval); } // verifica se deve desenhar o limite espacial do jogo if (drawCage) { //glPushMatrix(); borderland.draw(); //glPopMatrix(); } // desenha a plataforma //glPushMatrix(); glColor4dv(platformColor.getVect()); platform.draw(); //glPopMatrix(); /*/ Desenha uma pequena esfera na posição lookAt para referência visual glPushMatrix(); glTranslated(lookAt.x, lookAt.y, lookAt.z); glColor3dv(laranja.getVect()); glutSolidSphere(0.1, 20, 20); glPopMatrix(); /*/ // desenha o robô //glPushMatrix(); robot.draw(); //glPopMatrix(); // desenha o número de vidas textLives.setText("Vidas: %d", robot.getLives()); textLives.draw2D(); // desenha o número de Frames Per Second textFps.setText("FPS: %d", getFps()); textFps.draw2D(); // solicita a saída em vídeo do quadro renderizado glutSwapBuffers(); }
void Window::shootEvent() { static bool shooting = false; if (shooting) return; shooting = true; if (!initialised) return; //Gather information int delay = ui.SpinDelay->value(); auto startTime = std::chrono::steady_clock::now() + std::chrono::seconds(delay); bool saveProcessed = ui.CheckSaveProcessed->isChecked(); bool saveRaw = ui.CheckSaveRaw->isChecked(); bool saveGroundTruth = ui.CheckSaveGroundTruth->isChecked(); std::string processedExtension = ui.BoxProcessedformat->itemText(ui.BoxProcessedformat->currentIndex()).toUtf8(); //Get and validate colours QStringList colours = mColourModel->stringList(); if (colours.size() == 0) { Inform("Can not take photos with no colours selected."); shooting = false; return; } for (auto it = colours.begin(); it != colours.end(); ++it) if (!QColor(std::string(it->toUtf8()).c_str()).isValid()) { Error(std::string(("Invalid colour " + *it + ", Aborting sequence.").toUtf8())); shooting = false; return; } if (!saveRaw && !saveProcessed && !saveGroundTruth) { Inform("Can not take photos: No target saving format"); shooting = false; return; } if (saveGroundTruth && colours.size() < 5) { Inform("Can not take photos: Please select at least five colours for ground truth generation."); shooting = false; return; } //setWindowState(Qt::WindowState::WindowMinimized); disableEvents(); //Shoot sequence if (!mActionClass->shootSequence(startTime, colours, saveProcessed, saveRaw, saveGroundTruth, processedExtension, mSaveDir)) Error("Failed taking image sequence"); enableEvents(); shooting = false; //showNormal(); }
void EventListener::setEventPriority(int priority) { disableEvents(); eventPriority = priority; enableEvents(); }
EventListener::~EventListener() { disableEvents(); }
EventsGuard::EventsGuard() { disableEvents(); }
phdControlManager::~phdControlManager() { resetFocus(); disableEvents(); freeControls(); }
Container::~Container(){ disableEvents(); }