src/gui/kernel/qcocoaview_mac.mm
branchRCL_3
changeset 8 3f74d0d4af4c
parent 5 d3bac044e0f0
equal deleted inserted replaced
6:dee5afe5301f 8:3f74d0d4af4c
   518 }
   518 }
   519 
   519 
   520 - (void)drawRect:(NSRect)aRect
   520 - (void)drawRect:(NSRect)aRect
   521 {
   521 {
   522     if (QApplicationPrivate::graphicsSystem() != 0) {
   522     if (QApplicationPrivate::graphicsSystem() != 0) {
   523         if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore())
   523         if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore()) {
   524             bs->markDirty(qwidget->rect(), qwidget);
   524             // Drawing is handled on the window level
   525         qwidgetprivate->syncBackingStore(qwidget->rect());
   525             // See qcocoasharedwindowmethods_mac_p.
   526         return;
   526             return;
       
   527         }
   527     }
   528     }
   528     CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
   529     CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
   529     qwidgetprivate->hd = cg;
   530     qwidgetprivate->hd = cg;
   530     CGContextSaveGState(cg);
   531     CGContextSaveGState(cg);
   531 
   532 
   825         deltaX = qBound(-120, int([theEvent deltaX] * 10000), 120);
   826         deltaX = qBound(-120, int([theEvent deltaX] * 10000), 120);
   826         deltaY = qBound(-120, int([theEvent deltaY] * 10000), 120);
   827         deltaY = qBound(-120, int([theEvent deltaY] * 10000), 120);
   827         deltaZ = qBound(-120, int([theEvent deltaZ] * 10000), 120);
   828         deltaZ = qBound(-120, int([theEvent deltaZ] * 10000), 120);
   828     }
   829     }
   829 
   830 
       
   831 #ifndef QT_NO_WHEELEVENT
   830     if (deltaX != 0) {
   832     if (deltaX != 0) {
   831         QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal);
   833         QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal);
   832         qt_sendSpontaneousEvent(widgetToGetMouse, &qwe);
   834         qt_sendSpontaneousEvent(widgetToGetMouse, &qwe);
   833         wheelOK = qwe.isAccepted();
   835         wheelOK = qwe.isAccepted();
   834         if (!wheelOK && QApplicationPrivate::focus_widget
   836         if (!wheelOK && QApplicationPrivate::focus_widget
   865                              deltaZ, buttons, keyMods, (Qt::Orientation)3);
   867                              deltaZ, buttons, keyMods, (Qt::Orientation)3);
   866             qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2);
   868             qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2);
   867             wheelOK = qwe2.isAccepted();
   869             wheelOK = qwe2.isAccepted();
   868         }
   870         }
   869     }
   871     }
       
   872 #endif //QT_NO_WHEELEVENT
       
   873 
   870     if (!wheelOK) {
   874     if (!wheelOK) {
   871         return [super scrollWheel:theEvent];
   875         return [super scrollWheel:theEvent];
   872     }
   876     }
   873 }
   877 }
   874 
   878 
  1401     QAccessible::updateAccessibility(this, 0, QAccessible::DragDropStart);
  1405     QAccessible::updateAccessibility(this, 0, QAccessible::DragDropStart);
  1402 #endif
  1406 #endif
  1403 
  1407 
  1404     // setup the data
  1408     // setup the data
  1405     QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND);
  1409     QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND);
  1406     dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray());
  1410     dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
  1407     dragBoard.setMimeData(dragPrivate()->data);
  1411     dragBoard.setMimeData(dragPrivate()->data);
  1408 
  1412 
  1409     // create the image
  1413     // create the image
  1410     QPoint hotspot;
  1414     QPoint hotspot;
  1411     QPixmap pix = dragPrivate()->pixmap;
  1415     QPixmap pix = dragPrivate()->pixmap;