equal
deleted
inserted
replaced
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 ** |
141 extern QWidget * mac_mouse_grabber; |
141 extern QWidget * mac_mouse_grabber; |
142 extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp |
142 extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp |
143 |
143 |
144 void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds) |
144 void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds) |
145 { |
145 { |
|
146 #ifdef QT_MAC_USE_COCOA |
|
147 QMacCocoaAutoReleasePool pool; |
|
148 #endif |
146 OSWindowRef wnd = static_cast<OSWindowRef>(window); |
149 OSWindowRef wnd = static_cast<OSWindowRef>(window); |
147 if (wnd) { |
150 if (wnd) { |
148 QWidget *widget; |
151 QWidget *widget; |
149 #if QT_MAC_USE_COCOA |
152 #if QT_MAC_USE_COCOA |
150 widget = [wnd QT_MANGLE_NAMESPACE(qt_qwidget)]; |
153 widget = [wnd QT_MANGLE_NAMESPACE(qt_qwidget)]; |
1157 #ifndef QT_MAC_USE_COCOA |
1160 #ifndef QT_MAC_USE_COCOA |
1158 CGContextRef context; |
1161 CGContextRef context; |
1159 CGrafPtr port = GetWindowPort(qt_mac_window_for(widget)); |
1162 CGrafPtr port = GetWindowPort(qt_mac_window_for(widget)); |
1160 QDBeginCGContext(port, &context); |
1163 QDBeginCGContext(port, &context); |
1161 #else |
1164 #else |
1162 CGContextRef context = (CGContextRef)[[NSGraphicsContext graphicsContextWithWindow:qt_mac_window_for(widget)] graphicsPort]; |
1165 CGContextRef context = reinterpret_cast<CGContextRef>([[qt_mac_window_for(widget) graphicsContext] graphicsPort]); |
1163 #endif |
1166 #endif |
1164 return context; |
1167 return context; |
1165 } |
1168 } |
1166 |
1169 |
1167 CGFloat qt_mac_get_scalefactor() |
1170 CGFloat qt_mac_get_scalefactor() |
1276 QMacCocoaAutoReleasePool pool; |
1279 QMacCocoaAutoReleasePool pool; |
1277 [static_cast<NSCursor *>(qt_mac_nsCursorForQCursor(cursor)) set]; |
1280 [static_cast<NSCursor *>(qt_mac_nsCursorForQCursor(cursor)) set]; |
1278 } |
1281 } |
1279 #endif |
1282 #endif |
1280 |
1283 |
|
1284 QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool() |
|
1285 { |
|
1286 #ifndef QT_MAC_USE_COCOA |
|
1287 NSApplicationLoad(); |
|
1288 #endif |
|
1289 pool = (void*)[[NSAutoreleasePool alloc] init]; |
|
1290 } |
|
1291 |
|
1292 QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool() |
|
1293 { |
|
1294 [(NSAutoreleasePool*)pool release]; |
|
1295 } |
|
1296 |
1281 QT_END_NAMESPACE |
1297 QT_END_NAMESPACE |