68 styleMask:(NSUInteger)windowStyle
69 backing:(NSBackingStoreType)bufferingType
70 defer:(BOOL)deferCreation
73 backing:bufferingType defer:deferCreation];
75 currentCustomDragTypes = 0;
82 delete currentCustomDragTypes;
110 return !(isPopup || isToolTip ||
isTool);
120 if (![
self isVisible])
121 [
self orderOut:
self];
124 - (void)toggleToolbarShown:(
id)sender
127 [super toggleToolbarShown:sender];
130 - (void)flagsChanged:(NSEvent *)theEvent
133 [super flagsChanged:theEvent];
137 - (void)tabletProximity:(NSEvent *)tabletEvent
142 - (void)terminate:(
id)sender
146 [NSApp terminate:sender];
149 - (void)setLevel:(NSInteger)windowLevel
158 [super setLevel:NSPopUpMenuWindowLevel];
160 [super setLevel:windowLevel];
163 - (void)sendEvent:(NSEvent *)
event 167 bool handled =
false;
183 [super sendEvent:
event];
184 qt_mac_handleNonClientAreaMouseEvent(
self,
event);
189 - (void)setInitialFirstResponder:(NSView *)view
199 [super setInitialFirstResponder:view];
202 - (BOOL)makeFirstResponder:(NSResponder *)responder
206 if (responder == nil &&
qApp->focusWidget())
208 return [super makeFirstResponder:responder];
211 + (Class)frameViewClassForStyleMask:(NSUInteger)styleMask
213 if (styleMask & QtMacCustomizeWindow)
215 return [super frameViewClassForStyleMask:styleMask];
218 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 219 - (void)touchesBeganWithEvent:(NSEvent *)
event;
224 if (!widgetToGetTouch)
236 if (!widgetToGetTouch)
248 if (!widgetToGetTouch)
260 if (!widgetToGetTouch)
266 #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 274 if (currentCustomDragTypes == 0 || *currentCustomDragTypes != customTypes) {
275 if (currentCustomDragTypes == 0)
278 const NSString* mimeTypeGeneric =
@"com.trolltech.qt.MimeTypeName";
279 NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType,
280 NSFilenamesPboardType, NSStringPboardType,
281 NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType,
282 NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType,
283 NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType,
284 NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType,
285 NSURLPboardType, NSPDFPboardType, NSVCardPboardType,
286 NSFilesPromisePboardType, NSInkTextPboardType,
287 NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil];
289 for (
int i = 0; i < customTypes.
size(); i++) {
290 [supportedTypes addObject:qt_mac_QStringToNSString(customTypes[i])];
292 [
self registerForDraggedTypes:supportedTypes];
304 - (void)addDropData:(id <NSDraggingInfo>)sender
311 - (void)changeDraggingCursor:(NSDragOperation)newOperation
313 static SEL action = nil;
314 static bool operationSupported =
false;
316 action = NSSelectorFromString(
@"operationNotAllowedCursor");
317 if ([NSCursor respondsToSelector:action]) {
318 operationSupported =
true;
321 if (operationSupported) {
322 NSCursor *notAllowedCursor = [NSCursor performSelector:action];
323 bool isNotAllowedCursor = ([NSCursor
currentCursor] == notAllowedCursor);
324 if (newOperation == NSDragOperationNone && !isNotAllowedCursor) {
325 [notAllowedCursor push];
326 }
else if (newOperation != NSDragOperationNone && isNotAllowedCursor) {
327 [notAllowedCursor pop];
333 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
343 NSPoint nswindowPoint = [sender draggingLocation];
344 NSPoint nsglobalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:nswindowPoint];
348 *currentDragTarget() = qwidget;
350 return NSDragOperationNone;
352 return NSDragOperationNone;
354 [
self addDropData:sender];
360 NSDragOperation nsActions = [sender draggingSourceOperationMask];
361 Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations(nsActions);
365 if ([sender draggingSource] != nil) {
379 if (!qDEEvent.isAccepted()) {
383 [
self changeDraggingCursor:NSDragOperationNone];
384 return NSDragOperationNone;
395 nsActions = NSDragOperationNone;
403 [
self changeDraggingCursor:nsActions];
408 - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
410 NSPoint nswindowPoint = [sender draggingLocation];
411 NSPoint nsglobalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:nswindowPoint];
416 return NSDragOperationNone;
421 if (qwidget != *currentDragTarget()) {
422 if (*currentDragTarget() && dropData) {
427 return [
self draggingEntered:sender];
431 return NSDragOperationNone;
437 [
self changeDraggingCursor:NSDragOperationNone];
438 return NSDragOperationNone;
444 NSDragOperation nsActions = [sender draggingSourceOperationMask];
449 [
self changeDraggingCursor:operation];
458 if ([sender draggingSource] != nil) {
481 NSDragOperation operation = qt_mac_mapDropAction(qDMEvent.
dropAction());
485 operation = NSDragOperationNone;
490 [
self changeDraggingCursor:operation];
495 - (void)draggingExited:(id <NSDraggingInfo>)sender
497 NSPoint nswindowPoint = [sender draggingLocation];
498 NSPoint nsglobalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:nswindowPoint];
501 QWidget *qwidget = *currentDragTarget();
513 *currentDragTarget() = 0;
514 [
self changeDraggingCursor:NSDragOperationEvery];
517 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
519 QWidget *qwidget = *currentDragTarget();
523 *currentDragTarget() = 0;
524 NSPoint nswindowPoint = [sender draggingLocation];
525 NSPoint nsglobalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:nswindowPoint];
528 [
self addDropData:sender];
530 NSDragOperation nsActions = [sender draggingSourceOperationMask];
531 Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations(nsActions);
540 QDropEvent de(localPoint, qtAllowed, mimeData,
547 return de.isAccepted();
553 static bool firstDrawingInvocation =
true;
582 [id(
self) drawRectOriginal:rect];
587 macDrawRectOnTop((
void *)window);
591 if(firstDrawingInvocation) {
592 firstDrawingInvocation =
false;
593 macSyncDrawingOnFirstInvocation((
void *)
window);
595 [
toolbar setShowsBaselineSeparator:NO];
599 macDrawRectOnTop((
void *)
window);
604 - (void)drawRectOriginal:(NSRect)rect
const struct __CFString * CFStringRef
const QStringList & customTypes
bool qt_mac_mouse_inside_answer_rect(QPoint mouse)
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
bool isPopup
Use windowType() == Qt::Popup instead.
void touchesMovedWithEvent
void qt_dispatchTabletProximityEvent(const ::TabletProximityRec &proxRec)
static Qt::MouseButtons buttons
void setDropAction(Qt::DropAction action)
Sets the action to be performed on the data by the target.
Qt::DropAction dropAction() const
Returns the action to be performed on the data by the target.
const QStringList & qEnabledDraggedTypes()
void accept()
Calls QDropEvent::accept().
Q_GLOBAL_STATIC(QPointer< QWidget >, currentDragTarget)
QPointF flipPoint(const NSPoint &p)
QPointer< QWidget > qt_button_down
The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress...
Qt::KeyboardModifiers keyboardModifiers() const
Returns the modifier keys that are pressed.
void touchesCancelledWithEvent
Qt::KeyboardModifiers qt_cocoaModifiers2QtModifiers(ulong modifierFlags)
void macSendToolbarChangeEvent(QWidget *widget)
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or 0 if there is no Qt widget there...
void qt_dispatchModifiersChanged(void *flagsChangedEvent, QWidget *widgetToGetEvent)
#define QT_BEGIN_NAMESPACE
This macro expands to.
static QCursorData * currentCursor
The QStringList class provides a list of strings.
#define QT_PREPEND_NAMESPACE(name)
This macro qualifies identifier with the full namespace.
void touchesEndedWithEvent
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QDragLeaveEvent class provides an event that is sent to a widget when a drag and drop action leav...
The QMimeData class provides a container for data that records information about its MIME type...
qt_translateRawTouchEvent(widgetToGetTouch, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all))
void qt_mac_copy_answer_rect(const QDragMoveEvent &event)
Qt::KeyboardModifiers qt_cocoaDragOperation2QtModifiers(uint dragOperations)
static QDragManager * self()
Qt::MouseButtons mouseButtons() const
Returns the mouse buttons that are pressed.
QMacDndAnswerRecord qt_mac_dnd_answer_rec
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
static Qt::KeyboardModifiers modifier_buttons
static bool isBlockedByModal(QWidget *widget)
Returns true if widget is blocked by a modal window.
unsigned int lastOperation
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
#define QT_MANGLE_NAMESPACE(name)
Qt::DropAction executed_action
The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action ent...
The QPoint class defines a point in the plane using integer precision.
int size() const
Returns the number of items in the list.
if(void) toggleToolbarShown
Qt::DropAction lastAction
void qt_event_request_window_change(QWidget *)
static Qt::MouseButtons mouseButtons()
Returns the current state of the buttons on the mouse.
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
void qt_mac_send_posted_gl_updates(QWidget *widget)
QWidget * widgetToGetTouch
QDragPrivate * dragPrivate() const
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, 0, &widgetToGetTouch)