void Lab3Canvas::mouseMoveEvent(QMouseEvent *event) { if(event->buttons() & Qt::LeftButton || event->buttons() & Qt::RightButton) //Mouse drag - don't modify this emit _mouseDrag(event); else if (event->buttons() & Qt::NoButton) { } }
int ParticleWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QGLWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: _glInit(); break; case 1: _mouseDrag((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; case 2: mouseDragEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; case 3: redraw(); break; default: ; } _id -= 4; } return _id; }
void FV_VisualDragText::mouseDrag(UT_sint32 x, UT_sint32 y) { _mouseDrag(x,y); }
void FV_UnixFrameEdit::mouseDrag(UT_sint32 x, UT_sint32 y) { UT_DEBUGMSG(("Mouse drag x=%d y=%d \n",x,y)); bool bYOK = ( (y > 0) && (y < getView()->getWindowHeight())); if(!bYOK || (x> 0 && x < getView()->getWindowWidth())) { m_bDragOut = false; _mouseDrag(x,y); return; } if(FV_DragWhole != getDragWhat()) { m_bDragOut = false; _mouseDrag(x,y); return; } if(FV_FrameEdit_DRAG_EXISTING != getFrameEditMode()) { m_bDragOut = false; _mouseDrag(x,y); return; } if(!isImageWrapper()) { m_bDragOut = false; _mouseDrag(x,y); return; } if(!m_bDragOut) { const UT_ByteBuf * pBuf = NULL; const char * pszData = getPNGImage(&pBuf); UT_DEBUGMSG(("Got image buffer %p pszData %p \n",pBuf,pszData)); if(pBuf) { // // write the image to a temperary file // XAP_UnixApp * pXApp = static_cast<XAP_UnixApp *>(XAP_App::getApp()); pXApp->removeTmpFile(); char ** pszTmpName = pXApp->getTmpFile(); UT_UTF8String sTmpF = g_get_tmp_dir(); sTmpF += "/"; sTmpF += pszData; sTmpF += ".png"; // // Now write the contents of the buffer to a temp file. // FILE * fd = fopen(sTmpF.utf8_str(),"w"); fwrite(pBuf->getPointer(0),sizeof(UT_Byte),pBuf->getLength(),fd); fclose(fd); // // OK set up the gtk drag and drop code to andle this // XAP_Frame * pFrame = static_cast<XAP_Frame*>(getView()->getParentData()); XAP_UnixFrameImpl * pFrameImpl =static_cast<XAP_UnixFrameImpl *>( pFrame->getFrameImpl()); GtkWidget * pWindow = pFrameImpl->getTopLevelWindow(); GtkTargetList *target_list = gtk_target_list_new(targets, G_N_ELEMENTS(targets)); GdkDragContext *context = gtk_drag_begin(pWindow, target_list, (GdkDragAction)(GDK_ACTION_COPY ), 1, NULL); gdk_drag_status(context, GDK_ACTION_COPY, 0); gtk_target_list_unref(target_list); *pszTmpName = g_strdup(sTmpF.utf8_str()); UT_DEBUGMSG(("Created Tmp File %s XApp %s \n",sTmpF.utf8_str(),*pXApp->getTmpFile())); } // // OK quit dragging the image and return to the previous state // m_bDragOut = true; abortDrag(); } m_bDragOut = true; }
void FV_Base::mouseDrag(UT_sint32 x, UT_sint32 y) { _mouseDrag(x,y); }