void web_example::keyDown(ci::app::KeyEvent event){ using ci::app::KeyEvent; inherited::keyDown(event); if(event.getChar() == KeyEvent::KEY_v && event.isControlDown()){ auto clipboard = ds::Environment::getClipboard(); if(!clipboard.empty() && mWebView){ mWebView->setUrl(clipboard); } } else if(event.getChar() == KeyEvent::KEY_r){ // R = reload all configs and start over without quitting app setupServer(); } else if(event.getChar() == KeyEvent::KEY_b){ if(mWebView){ mWebView->goBack(); } } else if(event.getChar() == KeyEvent::KEY_f){ if(mWebView){ mWebView->goForward(); } } else if(event.getChar() == KeyEvent::KEY_l){ if(mWebView){ mWebView->reload(); } } }
bool Control::getIsBindedToModifier( ci::app::KeyEvent &event ) { if( event.isMetaDown() && mKeyModifier == app::KeyEvent::META_DOWN ) { return true; } else if ( event.isAltDown() && mKeyModifier == app::KeyEvent::ALT_DOWN ) { return true; } else if( event.isControlDown() && mKeyModifier == app::KeyEvent::CTRL_DOWN ) { return true; } return false; }
void https_example::keyDown(ci::app::KeyEvent event){ using ci::app::KeyEvent; inherited::keyDown(event); if(event.getChar() == KeyEvent::KEY_r){ // R = reload all configs and start over without quitting app setupServer(); } else if(event.getCode() == KeyEvent::KEY_v && event.isControlDown()){ auto fileNameOrig = ds::Environment::getClipboard(); mHttpsRequest.makeGetRequest("https://example.com", false, false); } else if(event.getCode() == KeyEvent::KEY_p){ std::string datay = "{ \"data\": { \"type\": \"collection_links\", \"attributes\": { \"story_type\": \"Achievement\", \"story_id\": \"13\" }}}"; std::vector<std::string> headers; headers.push_back("Accept: application/json"); headers.push_back("Content-Type: application/json"); mHttpsRequest.makePostRequest("https://example.com", datay, true, true, "", headers); // Shows all enabled sprites with a label for class type } else if(event.getCode() == KeyEvent::KEY_f){ const int numRoots = mEngine.getRootCount(); int numPlacemats = 0; for(int i = 0; i < numRoots - 1; i++){ mEngine.getRootSprite(i).forEachChild([this](ds::ui::Sprite& sprite){ if(sprite.isEnabled()){ sprite.setTransparent(false); sprite.setColor(ci::Color(ci::randFloat(), ci::randFloat(), ci::randFloat())); sprite.setOpacity(0.95f); ds::ui::Text* labelly = mGlobals.getText("media_viewer:title").create(mEngine, &sprite); labelly->setText(typeid(sprite).name()); labelly->enable(false); labelly->setColor(ci::Color::black()); } else { ds::ui::Text* texty = dynamic_cast<ds::ui::Text*>(&sprite); if(!texty || (texty && texty->getColor() != ci::Color::black())) sprite.setTransparent(true); } }, true); } } }
void https_example::keyDown(ci::app::KeyEvent event){ using ci::app::KeyEvent; inherited::keyDown(event); if(event.getChar() == KeyEvent::KEY_r){ // R = reload all configs and start over without quitting app setupServer(); } else if(event.getCode() == KeyEvent::KEY_v && event.isControlDown()){ auto fileNameOrig = ci::Clipboard::getString(); mHttpsRequest.makeGetRequest("https://example.com", false, false); // Shows all enabled sprites with a label for class type } else if(event.getCode() == KeyEvent::KEY_f){ const int numRoots = mEngine.getRootCount(); int numPlacemats = 0; for(int i = 0; i < numRoots - 1; i++){ mEngine.getRootSprite(i).forEachChild([this](ds::ui::Sprite& sprite){ if(sprite.isEnabled()){ sprite.setTransparent(false); sprite.setColor(ci::Color(ci::randFloat(), ci::randFloat(), ci::randFloat())); sprite.setOpacity(0.95f); ds::ui::Text* labelly = mGlobals.getText("media_viewer:title").create(mEngine, &sprite); labelly->setText(typeid(sprite).name()); labelly->enable(false); labelly->setColor(ci::Color::black()); } else { ds::ui::Text* texty = dynamic_cast<ds::ui::Text*>(&sprite); if(!texty || (texty && texty->getColor() != ci::Color::black())) sprite.setTransparent(true); } }, true); } } }
bool Control::getIsModifierDown( ci::app::KeyEvent &event ) { if( event.isMetaDown() ) { return true; } else if ( event.isAltDown() ) { return true; } else if( event.isControlDown() ) { return true; } else if( event.isShiftDown() ) { return true; } else if( event.isAccelDown() ) { return true; } return false; }