//------------------------------------------------------------------------------ void ofApp::setup() { instructions = "Drag file onto the window for more info."; mediaType = ""; // simulate a drag event for platforms that don't yet support drag events ofDragInfo simulatedDrag; simulatedDrag.files.push_back(ofToDataPath("automat.ttf")); ofNotifyDragEvent(simulatedDrag); }
//------------------------------------------------------------ void ofxFensterManager::drop_cb(GLFWwindow* windowP_, int numFiles, const char** dropString) { string drop = *dropString; ofDragInfo drag; drag.position.set(ofGetMouseX(),ofGetMouseY()); drag.files = ofSplitString(drop,"\n",true); #ifdef TARGET_LINUX for(int i=0; i<(int)drag.files.size(); i++) { drag.files[i] = Poco::URI(drag.files[i]).getPath(); } #endif ofNotifyDragEvent(drag); }
//------------------------------------------------------------ void ofAppGlutWindow::dragEvent(char ** names, int howManyFiles, int dragX, int dragY){ // TODO: we need position info on mac passed through ofDragInfo info; info.position.x = dragX; info.position.y = ofGetHeight()-dragY; for (int i = 0; i < howManyFiles; i++){ string temp = string(names[i]); info.files.push_back(temp); } ofNotifyDragEvent(info); }