1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
347 QApplication::sendEvent(qwidget, &qDMEvent); |
347 QApplication::sendEvent(qwidget, &qDMEvent); |
348 if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) { |
348 if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) { |
349 // since we accepted the drag enter event, the widget expects |
349 // since we accepted the drag enter event, the widget expects |
350 // future drage move events. |
350 // future drage move events. |
351 // ### check if we need to treat this like the drag enter event. |
351 // ### check if we need to treat this like the drag enter event. |
352 nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDEEvent.dropAction()); |
352 nsActions = NSDragOperationNone; |
|
353 // Save as ignored in the answer rect. |
|
354 qDMEvent.setDropAction(Qt::IgnoreAction); |
353 } else { |
355 } else { |
354 nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDMEvent.dropAction()); |
356 nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDMEvent.dropAction()); |
355 } |
357 } |
356 QT_PREPEND_NAMESPACE(qt_mac_copy_answer_rect)(qDMEvent); |
358 QT_PREPEND_NAMESPACE(qt_mac_copy_answer_rect)(qDMEvent); |
357 return nsActions; |
359 return nsActions; |
358 } |
360 } |
359 } |
361 } |
360 |
|
361 - (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender |
362 - (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender |
362 { |
363 { |
363 NSPoint windowPoint = [sender draggingLocation]; |
364 NSPoint windowPoint = [sender draggingLocation]; |
364 if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { |
365 if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { |
365 // pass the drag move event to the view underneath. |
366 // pass the drag move event to the view underneath. |
400 mimeData = QDragManager::self()->dragPrivate()->data; |
401 mimeData = QDragManager::self()->dragPrivate()->data; |
401 QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers); |
402 QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers); |
402 qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction); |
403 qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction); |
403 qDMEvent.accept(); |
404 qDMEvent.accept(); |
404 QApplication::sendEvent(qwidget, &qDMEvent); |
405 QApplication::sendEvent(qwidget, &qDMEvent); |
405 qt_mac_copy_answer_rect(qDMEvent); |
|
406 |
406 |
407 NSDragOperation operation = qt_mac_mapDropAction(qDMEvent.dropAction()); |
407 NSDragOperation operation = qt_mac_mapDropAction(qDMEvent.dropAction()); |
408 if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) { |
408 if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) { |
409 // ignore this event (we will still receive further notifications) |
409 // ignore this event (we will still receive further notifications) |
410 operation = NSDragOperationNone; |
410 operation = NSDragOperationNone; |
411 } |
411 // Save as ignored in the answer rect. |
|
412 qDMEvent.setDropAction(Qt::IgnoreAction); |
|
413 } |
|
414 qt_mac_copy_answer_rect(qDMEvent); |
412 return operation; |
415 return operation; |
413 } |
416 } |
414 |
417 |
415 - (void)draggingExited:(id < NSDraggingInfo >)sender |
418 - (void)draggingExited:(id < NSDraggingInfo >)sender |
416 { |
419 { |
502 { |
505 { |
503 [self setNeedsDisplayInRect:rects[count]]; |
506 [self setNeedsDisplayInRect:rects[count]]; |
504 } |
507 } |
505 } else { |
508 } else { |
506 [self setNeedsDisplay:YES]; |
509 [self setNeedsDisplay:YES]; |
|
510 } |
|
511 |
|
512 // Make sure the opengl context is updated on resize. |
|
513 if (qwidgetprivate->isGLWidget) { |
|
514 qwidgetprivate->needWindowChange = true; |
|
515 QEvent event(QEvent::MacGLWindowChange); |
|
516 qApp->sendEvent(qwidget, &event); |
507 } |
517 } |
508 } |
518 } |
509 |
519 |
510 - (void)drawRect:(NSRect)aRect |
520 - (void)drawRect:(NSRect)aRect |
511 { |
521 { |