76 #include <private/qt_mac_p.h> 77 #include <private/qeventdispatcher_mac_p.h> 89 #include <private/qbackingstore_p.h> 90 #include <private/qwindowsurface_mac_p.h> 91 #include <private/qpaintengine_mac_p.h> 97 #include <private/qmainwindowlayout_p.h> 99 #include <private/qabstractscrollarea_p.h> 101 #include <ApplicationServices/ApplicationServices.h> 103 #include <private/qt_cocoa_helpers_mac_p.h> 104 #include <private/qcocoaview_mac_p.h> 105 #include <private/qcocoawindow_mac_p.h> 106 #include <private/qcocoawindowdelegate_mac_p.h> 107 #include <private/qcocoapanel_mac_p.h> 112 #include <QtGui/qgraphicsproxywidget.h> 120 #define XCOORD_MAX 16383 121 #define WRECT_MAX 8191 123 #ifndef QT_MAC_USE_COCOA 127 OptionBits) __attribute__ ((weak));
129 #define kHIViewScrollRectAdjustInvalid 1 130 #define kHIViewScrollRectDontInvalidateRevealedArea 2 145 #ifndef QT_MAC_USE_COCOA 159 #ifndef QT_MAC_USE_COCOA 165 #define S "com.trolltech.qt-" S0(QT_NAMESPACE) ".widget" 175 #endif // QT_NAMESPACE 176 #endif // QT_MAC_USE_COCOA 206 CGDisplayCount cg_count;
207 CGGetActiveDisplayList(0, 0, &cg_count);
209 CGGetActiveDisplayList(cg_count, displays.
data(), &cg_count);
211 for(
int i = 0; i < (int)cg_count; ++i) {
212 CGRect r = CGDisplayBounds(displays.
at(i));
213 w = qMax<int>(w,
qRound(r.origin.x + r.size.width));
214 h = qMax<int>(h,
qRound(r.origin.y + r.size.height));
219 #ifdef QT_MAC_USE_COCOA 223 NSArray *windows = [NSApp windows];
224 for (NSWindow *
window in windows) {
225 NSArray *drawers = [
window drawers];
226 for (NSDrawer *drawer in drawers) {
227 if ([drawer contentView] == widgetView)
237 #ifdef QT_MAC_USE_COCOA 239 if ([window contentView] == view) {
240 NSView* newView = [[NSView alloc] initWithFrame:[view bounds]];
241 [window setContentView:newView];
244 [view removeFromSuperview];
248 HIViewRemoveFromSuperview(view);
255 #ifdef QT_MAC_USE_COCOA 256 if ([window isVisible] && [window isSheet]){
272 #ifdef QT_MAC_USE_COCOA 273 [[
QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] resignDelegateForDrawer:drawer];
282 static int qt_mac_carbon_clickthrough = -1;
283 if (qt_mac_carbon_clickthrough < 0)
284 qt_mac_carbon_clickthrough = !
qgetenv(
"QT_MAC_NO_COCOA_CLICKTHROUGH").
isEmpty();
285 bool ret = !qt_mac_carbon_clickthrough;
313 #ifdef QT_MAC_USE_COCOA 327 NSDrawer *drawer = qt_mac_drawer_for(w);
342 if (edge == [drawer preferredEdge])
347 [drawer openOnEdge:edge];
349 [drawer setPreferredEdge:edge];
353 if(where & Qt::LeftDockWidgetArea)
354 edge = kWindowEdgeLeft;
355 else if(where & Qt::RightDockWidgetArea)
356 edge = kWindowEdgeRight;
357 else if(where & Qt::TopDockWidgetArea)
358 edge = kWindowEdgeTop;
359 else if(where & Qt::BottomDockWidgetArea)
360 edge = kWindowEdgeBottom;
364 if(edge == GetDrawerPreferredEdge(window))
368 SetDrawerPreferredEdge(window, edge);
370 CloseDrawer(window,
false);
371 OpenDrawer(window, edge,
true);
377 #ifndef QT_MAC_USE_COCOA 393 #ifdef QT_MAC_USE_COCOA 409 if(qt_mac_app_fullscreen == b)
411 qt_mac_app_fullscreen = b;
413 SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
415 SetSystemUIMode(kUIModeNormal, 0);
433 #ifdef QT_MAC_USE_COCOA 434 return [w contentView];
437 OSStatus err = GetRootControl(w, &contentView);
438 if (err == errUnknownControl) {
439 contentView = HIViewGetRoot(w);
440 }
else if (err != noErr) {
441 qWarning(
"Qt:Could not get content or root view of window! %s:%d [%ld]",
442 __FILE__, __LINE__, err);
455 #ifdef QT_MAC_USE_COCOA 460 return HIViewGetWindow(view);
466 #ifdef QT_MAC_USE_COCOA 506 toplevel->d_func()->createWindow_sys();
515 #ifndef QT_MAC_USE_COCOA 521 if (
it.value() == group) {
522 qt_mac_window_groups()->remove(
it.key());
533 if (GetWindowGroupRetainCount(group) == 0)
536 #define ReleaseWindowGroup(x) Are you sure you wanted to do that? (you wanted qt_mac_release_window_group) 541 CGWindowLevel tmpLevel;
542 GetWindowGroupLevelOfType(GetWindowGroupOfClass(wclass), kWindowGroupLevelActive, &tmpLevel);
543 group_level = tmpLevel;
548 #ifndef QT_MAC_USE_COCOA 551 WindowGroupRef group = 0;
552 if (qt_mac_window_groups()->contains(flags)) {
553 group = qt_mac_window_groups()->value(flags);
554 RetainWindowGroup(group);
556 CreateWindowGroup(kWindowActivationScopeNone, &group);
557 SetWindowGroupLevel(group, level);
558 SetWindowGroupParent(group, GetWindowGroupOfClass(kAllWindowClasses));
559 qt_mac_window_groups()->insert(flags, group);
561 SetWindowGroup(window, group);
597 #ifndef QT_NO_GRAPHICSVIEW 614 #ifndef QT_NO_GRAPHICSVIEW 620 for (
int i = 0; i < rects.size(); ++i)
629 void QWidgetPrivate::macSetNeedsDisplay(
QRegion region)
632 #ifndef QT_MAC_USE_COCOA 635 else if (
RgnHandle rgnHandle = region.toQDRgnForUpdate_sys())
643 [nativeView setNeedsDisplay:YES];
646 for (
int i = 0; i<rects.
count(); ++i) {
647 const QRect &rect = rects.
at(i);
648 NSRect nsrect = NSMakeRect(rect.
x(), rect.
y(), rect.
width(), rect.
height());
649 [nativeView setNeedsDisplayInRect:nsrect];
656 const QRect &rect = q->rect();
658 NSRect nsrect = NSMakeRect(p.
x(), p.
y(), rect.
width(), rect.
height());
659 [effectiveView setNeedsDisplayInRect:nsrect];
662 for (
int i = 0; i<rects.
count(); ++i) {
663 const QRect &rect = rects.
at(i);
665 NSRect nsrect = NSMakeRect(p.
x(), p.
y(), rect.
width(), rect.
height());
666 [effectiveView setNeedsDisplayInRect:nsrect];
674 void QWidgetPrivate::macUpdateIsOpaque()
679 #ifndef QT_MAC_USE_COCOA 682 HIViewGetFeatures(hiview, &bits);
683 if ((bits & kHIViewIsOpaque) ==
isOpaque)
686 HIViewChangeFeatures(hiview, kHIViewIsOpaque, 0);
688 HIViewChangeFeatures(hiview, 0, kHIViewIsOpaque);
701 #ifdef QT_MAC_USE_COCOA 703 NSUInteger wattr,
const QRect &crect)
713 Qt::WindowFlags flags = widget ? widget->
windowFlags() : Qt::WindowFlags(0);
718 wattr |= QtMacCustomizeWindow;
725 NSRect geo = NSMakeRect(crect.
left(),
731 case kMovableModalWindowClass:
732 case kModalWindowClass:
733 case kSheetWindowClass:
734 case kFloatingWindowClass:
735 case kOverlayWindowClass:
736 case kHelpWindowClass: {
738 BOOL needFloating = NO;
742 case kSheetWindowClass:
743 wattr |= NSDocModalWindowMask;
745 case kFloatingWindowClass:
746 case kHelpWindowClass:
748 wattr |= NSUtilityWindowMask;
754 [panel setFloatingPanel:needFloating];
755 [panel setWorksWhenModal:worksWhenModal];
759 case kDrawerWindowClass: {
760 NSDrawer *drawer = [[NSDrawer alloc] initWithContentSize:geo.size preferredEdge:NSMinXEdge];
765 [drawer setLeadingOffset:0.0];
766 [drawer setTrailingOffset:25.0];
767 window = [[drawer contentView]
window];
785 if(geo.right <= geo.left) geo.right = geo.left + 1;
786 if(geo.bottom <= geo.top) geo.bottom = geo.top + 1;
788 SetRect(&null_rect, 0, 0, 1, 1);
789 err = CreateNewWindow(wclass, wattr, &null_rect, &window);
791 err = SetWindowBounds(window, kWindowContentRgn, &geo);
793 qWarning(
"QWidget: Internal error (%s:%d)", __FILE__, __LINE__);
798 #ifndef QT_NO_GESTURES 799 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 815 #endif // QT_NO_GESTURES 819 { kEventClassWindow, kEventWindowClose },
820 { kEventClassWindow, kEventWindowExpanded },
821 { kEventClassWindow, kEventWindowHidden },
822 { kEventClassWindow, kEventWindowZoom },
823 { kEventClassWindow, kEventWindowZoomed },
824 { kEventClassWindow, kEventWindowCollapsed },
825 { kEventClassWindow, kEventWindowToolbarSwitchMode },
826 { kEventClassWindow, kEventWindowProxyBeginDrag },
827 { kEventClassWindow, kEventWindowProxyEndDrag },
828 { kEventClassWindow, kEventWindowResizeCompleted },
829 { kEventClassWindow, kEventWindowBoundsChanging },
830 { kEventClassWindow, kEventWindowGetRegion },
831 { kEventClassWindow, kEventWindowGetClickModality },
832 { kEventClassWindow, kEventWindowTransitionCompleted },
838 { kEventClassMouse, kEventMouseDown }
851 return mac_win_eventUPP = NewEventHandlerUPP(QWidgetPrivate::qt_window_event);
856 bool handled_event =
true;
857 UInt32 ekind = GetEventKind(
event), eclass = GetEventClass(
event);
859 case kEventClassWindow: {
861 GetEventParameter(
event, kEventParamDirectObject, typeWindowRef, 0,
865 handled_event =
false;
866 }
else if(ekind == kEventWindowGetClickModality) {
875 handled_event =
qApp->activePopupWidget() ? true :
false;
876 }
else if(ekind == kEventWindowClose) {
879 }
else if (ekind == kEventWindowTransitionCompleted) {
880 WindowTransitionAction transitionAction;
881 GetEventParameter(
event, kEventParamWindowTransitionAction, typeWindowTransitionAction,
882 0,
sizeof(transitionAction), 0, &transitionAction);
883 if (transitionAction == kWindowHideTransitionAction)
885 }
else if(ekind == kEventWindowExpanded) {
887 Qt::WindowStates newState = currState;
892 if (newState != currState) {
903 }
else if(ekind == kEventWindowZoom) {
905 handled_event =
false;
906 }
else if(ekind == kEventWindowZoomed) {
907 WindowPartCode windowPart;
908 GetEventParameter(
event, kEventParamWindowPartCode,
909 typeWindowPartCode, 0,
sizeof(windowPart), 0, &windowPart);
910 if(windowPart == inZoomIn && widget->
isMaximized()) {
915 }
else if(windowPart == inZoomOut && !widget->
isMaximized()) {
922 }
else if(ekind == kEventWindowCollapsed) {
935 for (WindowPtr wp = GetFrontWindowOfClass(kDocumentWindowClass,
true);
936 wp; wp = GetNextWindowOfClass(wp, kDocumentWindowClass,
true)) {
942 qApp->setActiveWindow(0);
949 }
else if(ekind == kEventWindowToolbarSwitchMode) {
952 if (GetWindowToolbar(wid, &toolbar) == noErr) {
956 CallNextEventHandler(er,
event);
961 }
else if(ekind == kEventWindowGetRegion) {
963 GetEventParameter(
event, kEventParamDirectObject, typeWindowRef, 0,
964 sizeof(window), 0, &window);
965 WindowRegionCode wcode;
966 GetEventParameter(
event, kEventParamWindowRegionCode, typeWindowRegionCode, 0,
967 sizeof(wcode), 0, &wcode);
968 if (wcode != kWindowOpaqueRgn){
972 CallNextEventHandler(er,
event);
975 GetEventParameter(
event, kEventParamRgnHandle, typeQDRgnHandle, 0,
976 sizeof(rgn), 0, &rgn);
979 SetEventParameter(
event, kEventParamRgnHandle, typeQDRgnHandle,
sizeof(rgn), &rgn);
980 }
else if(ekind == kEventWindowProxyBeginDrag) {
983 }
else if(ekind == kEventWindowResizeCompleted) {
987 CreateEvent(0, kEventClassMouse, kEventMouseUp, 0, kEventAttributeUserEvent, &mouseUpEvent);
988 UInt16 mbutton = kEventMouseButtonPrimary;
989 SetEventParameter(mouseUpEvent, kEventParamMouseButton, typeMouseButton,
sizeof(mbutton), &mbutton);
991 GetEventParameter(
event, kEventParamDirectObject, typeWindowRef, 0,
sizeof(window), 0, &window);
993 GetWindowBounds(window, kWindowGrowRgn, &dragRect);
994 Point pos = {dragRect.bottom, dragRect.right};
995 SetEventParameter(mouseUpEvent, kEventParamMouseLocation, typeQDPoint,
sizeof(pos), &pos);
996 SendEventToApplication(mouseUpEvent);
997 ReleaseEvent(mouseUpEvent);
998 }
else if(ekind == kEventWindowBoundsChanging) {
1000 GetEventParameter(
event, kEventParamAttributes, typeUInt32, 0,
1001 sizeof(flags), 0, &flags);
1003 GetEventParameter(
event, kEventParamCurrentBounds, typeQDRectangle, 0,
1004 sizeof(nr), 0, &nr);
1006 QRect newRect(nr.left, nr.top, nr.right - nr.left, nr.bottom - nr.top);
1008 QTLWExtra *
const tlwExtra = widget->d_func()->maybeTopData();
1009 if (tlwExtra && tlwExtra->isSetGeometry == 1) {
1010 widget->d_func()->setGeometry_sys_helper(newRect.
left(), newRect.
top(), newRect.
width(), newRect.
height(), tlwExtra->isMove);
1014 IsWindowInStandardState(wid, 0, 0)) {
1022 handled_event =
false;
1024 if((flags & kWindowBoundsChangeOriginChanged)) {
1025 if(nr.left != oldRect.
x() || nr.top != oldRect.
y()) {
1031 if((flags & kWindowBoundsChangeSizeChanged)) {
1036 if (dw != 0 || dh != 0) {
1037 handled_event =
true;
1043 nr.left = newRect.
x();
1044 nr.top = newRect.
y();
1045 nr.right = nr.left + newRect.
width();
1046 nr.bottom = nr.top + newRect.
height();
1047 SetEventParameter(
event, kEventParamCurrentBounds, typeQDRectangle,
sizeof(Rect), &nr);
1053 HIRect bounds = CGRectMake(0, 0, newRect.
width(), newRect.
height());
1062 HIViewSetDrawingEnabled(view,
false);
1063 HIViewSetFrame(view, &bounds);
1065 HIViewSetDrawingEnabled(view,
true);
1073 }
else if (ekind == kEventWindowHidden) {
1077 const int childCount = children.
count();
1078 for (
int i = 0; i < childCount; ++i) {
1087 handled_event =
false;
1090 case kEventClassMouse: {
1092 return SendEventToApplication(
event);
1095 bool send_to_app =
false;
1098 if (GetEventParameter(
event, kEventParamWindowPartCode, typeWindowPartCode, 0,
1099 sizeof(wpc), 0, &wpc) == noErr && wpc != inContent)
1104 if(GetEventParameter(
event, kEventParamWindowRef, typeWindowRef, 0,
1105 sizeof(window), 0, &window) == noErr) {
1107 if(HIViewGetViewForMouseEvent(HIViewGetRoot(window),
event, &hiview) == noErr) {
1110 send_to_app = !w->isActiveWindow();
1120 return SendEventToApplication(
event);
1121 handled_event =
false;
1124 #ifndef QT_NO_GESTURES 1128 HIPoint screenLocation;
1129 if (GetEventParameter(
event, kEventParamMouseLocation, typeHIPoint, 0,
1130 sizeof(screenLocation), 0, &screenLocation) != noErr) {
1131 handled_event =
false;
1136 handled_event =
false;
1153 sizeof(amount), 0, &amount) != noErr) {
1154 handled_event =
false;
1161 HIPoint swipeDirection;
1163 sizeof(swipeDirection), 0, &swipeDirection) != noErr) {
1164 handled_event =
false;
1168 if (swipeDirection.x == 1)
1169 qNGEvent.
angle = 180.0f;
1170 else if (swipeDirection.x == -1)
1171 qNGEvent.
angle = 0.0f;
1172 else if (swipeDirection.y == 1)
1173 qNGEvent.
angle = 90.0f;
1174 else if (swipeDirection.y == -1)
1175 qNGEvent.
angle = 270.0f;
1180 sizeof(amount), 0, &amount) != noErr) {
1181 handled_event =
false;
1191 #endif // QT_NO_GESTURES 1194 handled_event =
false;
1197 return eventNotHandledErr;
1204 { kEventClassHIObject, kEventHIObjectConstruct },
1205 { kEventClassHIObject, kEventHIObjectDestruct },
1207 { kEventClassControl, kEventControlDraw },
1208 { kEventClassControl, kEventControlInitialize },
1209 { kEventClassControl, kEventControlGetPartRegion },
1210 { kEventClassControl, kEventControlGetClickActivation },
1211 { kEventClassControl, kEventControlSetFocusPart },
1212 { kEventClassControl, kEventControlDragEnter },
1213 { kEventClassControl, kEventControlDragWithin },
1214 { kEventClassControl, kEventControlDragLeave },
1215 { kEventClassControl, kEventControlDragReceive },
1216 { kEventClassControl, kEventControlOwningWindowChanged },
1217 { kEventClassControl, kEventControlBoundsChanged },
1218 { kEventClassControl, kEventControlGetSizeConstraints },
1219 { kEventClassControl, kEventControlVisibilityChanged },
1221 { kEventClassMouse, kEventMouseDown },
1222 { kEventClassMouse, kEventMouseUp },
1223 { kEventClassMouse, kEventMouseMoved },
1224 { kEventClassMouse, kEventMouseDragged }
1243 bool handled_event =
true;
1244 UInt32 ekind = GetEventKind(
event), eclass = GetEventClass(
event);
1246 case kEventClassHIObject: {
1248 GetEventParameter(
event, kEventParamHIObjectInstance, typeHIObjectRef,
1249 0,
sizeof(view), 0, &view);
1250 if(ekind == kEventHIObjectConstruct) {
1252 HIViewChangeFeatures(view, kHIViewAllowsSubviews, 0);
1253 SetEventParameter(
event, kEventParamHIObjectInstance,
1254 typeVoidPtr,
sizeof(view), &view);
1256 }
else if(ekind == kEventHIObjectDestruct) {
1259 handled_event =
false;
1262 case kEventClassControl: {
1265 if(GetEventParameter(
event, kEventParamDirectObject, typeControlRef,
1266 0,
sizeof(hiview), 0, &hiview) == noErr)
1270 if(ekind == kEventControlDraw) {
1279 widget->d_func()->syncBackingStore();
1280 widget->d_func()->dirtyOnWidget =
QRegion();
1286 GetEventParameter(
event, kEventParamRgnHandle, typeQDRgnHandle, 0,
sizeof(rgn), 0, &rgn);
1292 if(GetEventParameter(
event, kEventParamCGContextRef, typeCGContextRef, 0,
sizeof(cg), 0, &cg) != noErr) {
1295 widget->d_func()->hd = cg;
1296 widget->d_func()->qd_hd = qd;
1297 CGContextSaveGState(cg);
1299 #ifdef DEBUG_WIDGET_PAINT 1300 const bool doDebug =
true;
1308 qDebug(
"Region! %d", region_rects.count());
1309 for(
int i = 0; i < region_rects.count(); i++)
1310 qDebug(
"%d %d %d %d", region_rects[i].x(), region_rects[i].y(),
1311 region_rects[i].width(), region_rects[i].height());
1312 region_rects = widget->d_func()->clp.rects();
1313 qDebug(
"Widget Region! %d", region_rects.count());
1314 for(
int i = 0; i < region_rects.count(); i++)
1315 qDebug(
"%d %d %d %d", region_rects[i].x(), region_rects[i].y(),
1316 region_rects[i].width(), region_rects[i].height());
1322 qWarning(
"QWidget::repaint: Recursive repaint detected");
1323 if (widget->
isWindow() && !widget->d_func()->isOpaque
1326 CGContextClearRect(cg, CGRectMake(qrgnRect.
x(), qrgnRect.
y(), qrgnRect.
width(), qrgnRect.
height()));
1329 QPoint redirectionOffset(0, 0);
1335 if(tl->d_func()->extra && !tl->d_func()->extra->
mask.
isEmpty())
1351 #ifdef DEBUG_WIDGET_PAINT 1356 if (!redirectionOffset.
isNull())
1357 widget->d_func()->setRedirected(widget, redirectionOffset);
1370 for (
int i = 0; i < rects.
size(); ++i)
1374 if (!redirectionOffset.
isNull())
1375 widget->d_func()->restoreRedirected();
1379 CallNextEventHandler(er,
event);
1383 if (!redirectionOffset.
isNull())
1384 widget->d_func()->setRedirected(widget, redirectionOffset);
1387 widget->d_func()->dirtyOnWidget =
QRegion();
1392 if (!redirectionOffset.
isNull())
1393 widget->d_func()->restoreRedirected();
1401 qWarning(
"QWidget: It is dangerous to leave painters active on a widget outside of the PaintEvent");
1404 widget->d_func()->hd = 0;
1405 widget->d_func()->qd_hd = 0;
1406 CGContextRestoreGState(cg);
1408 CallNextEventHandler(er,
event);
1410 }
else if(ekind == kEventControlInitialize) {
1412 UInt32 features = kControlSupportsDragAndDrop | kControlSupportsClickActivation | kControlSupportsFocus;
1413 SetEventParameter(
event, kEventParamControlFeatures, typeUInt32,
sizeof(features), &features);
1415 handled_event =
false;
1417 }
else if(ekind == kEventControlSetFocusPart) {
1419 ControlPartCode part;
1420 GetEventParameter(
event, kEventParamControlPart, typeControlPartCode, 0,
1421 sizeof(part), 0, &part);
1422 if(part == kControlFocusNoPart){
1429 CallNextEventHandler(er,
event);
1430 }
else if(ekind == kEventControlGetClickActivation) {
1431 ClickActivationResult clickT = kActivateAndIgnoreClick;
1432 SetEventParameter(
event, kEventParamClickActivation, typeClickActivationResult,
1433 sizeof(clickT), &clickT);
1434 }
else if(ekind == kEventControlGetPartRegion) {
1435 handled_event =
false;
1437 handled_event =
true;
1440 if(widget && !widget->
isWindow()) {
1441 ControlPartCode part;
1442 GetEventParameter(
event, kEventParamControlPart, typeControlPartCode, 0,
1443 sizeof(part), 0, &part);
1446 GetEventParameter(
event, kEventParamControlRegion, typeQDRgnHandle, 0,
1447 sizeof(rgn), 0, &rgn);
1449 handled_event =
true;
1450 }
else if(part == kControlStructureMetaPart || part == kControlClickableMetaPart) {
1452 GetEventParameter(
event, kEventParamControlRegion, typeQDRgnHandle, 0,
1453 sizeof(rgn), 0, &rgn);
1454 SetRectRgn(rgn, 0, 0, widget->
width(), widget->
height());
1455 if(QWidgetPrivate::qt_widget_rgn(widget, kWindowStructureRgn, rgn,
false))
1456 handled_event =
true;
1457 }
else if(part == kControlOpaqueMetaPart) {
1458 if(widget->d_func()->isOpaque) {
1460 GetEventParameter(
event, kEventParamControlRegion, typeQDRgnHandle, 0,
1462 SetRectRgn(rgn, 0, 0, widget->
width(), widget->
height());
1463 QWidgetPrivate::qt_widget_rgn(widget, kWindowStructureRgn, rgn,
false);
1464 SetEventParameter(
event, kEventParamControlRegion, typeQDRgnHandle,
1466 handled_event =
true;
1470 }
else if(ekind == kEventControlOwningWindowChanged) {
1472 CallNextEventHandler(er,
event);
1475 GetEventParameter(
event, kEventParamControlCurrentOwningWindow, typeWindowRef, 0,
1476 sizeof(foo), 0, &foo);
1477 widget->d_func()->initWindowPtr();
1481 }
else if(ekind == kEventControlDragEnter || ekind == kEventControlDragWithin ||
1482 ekind == kEventControlDragLeave || ekind == kEventControlDragReceive) {
1486 GetEventParameter(
event, kEventParamDragRef, typeDragRef, 0,
sizeof(drag), 0, &drag);
1487 handled_event =
false;
1488 bool drag_allowed =
false;
1491 if (qobject_cast<QFocusFrame *>(widget)){
1494 drag_allowed =
true;
1495 handled_event =
true;
1497 GetDragMouse(drag, &where, 0);
1502 if (ekind == kEventControlDragEnter) {
1506 dropWidget->d_func()->qt_mac_dnd_event(kEventControlDragEnter, drag);
1511 }
else if (ekind == kEventControlDragLeave) {
1514 dropWidget->d_func()->qt_mac_dnd_event(kEventControlDragLeave, drag);
1524 if (dropWidget && dropWidget->d_func()->qt_mac_dnd_event(ekind, drag)) {
1525 drag_allowed =
true;
1526 handled_event =
true;
1529 if (ekind == kEventControlDragEnter) {
1532 const Boolean wouldAccept = drag_allowed ? true :
false;
1533 SetEventParameter(
event, kEventParamControlWouldAcceptDrop, typeBoolean,
1534 sizeof(wouldAccept), &wouldAccept);
1536 }
else if (ekind == kEventControlBoundsChanged) {
1538 handled_event =
false;
1541 handled_event =
true;
1543 GetEventParameter(
event, kEventParamCurrentBounds,
1544 typeQDRectangle, 0,
sizeof(Rect), 0, &newBounds);
1545 QRect rect(newBounds.left, newBounds.top,
1546 newBounds.right - newBounds.left, newBounds.bottom - newBounds.top);
1555 }
else if (ekind == kEventControlGetSizeConstraints) {
1557 handled_event =
false;
1559 handled_event =
true;
1563 SetEventParameter(
event, kEventParamMinimumSize, typeHISize,
sizeof(HISize), &hisize);
1566 hisize.height = size.
height();
1567 SetEventParameter(
event, kEventParamMaximumSize, typeHISize,
sizeof(HISize), &hisize);
1569 }
else if (ekind == kEventControlVisibilityChanged) {
1570 handled_event =
false;
1574 if (widget == qt_button_down)
1580 case kEventClassMouse: {
1581 bool send_to_app =
false;
1587 handled_event =
false;
1589 CallNextEventHandler(er,
event);
1593 handled_event =
false;
1597 return eventNotHandledErr;
1604 #ifdef QT_MAC_USE_COCOA 1613 [parent addSubview:view];
1622 if (err && err != hiObjectClassExistsErr)
1623 qWarning(
"QWidget: Internal error (%d)", __LINE__);
1627 qWarning(
"QWidget: Internal error (%d)", __LINE__);
1629 HIViewAddSubview(parent, ret);
1636 #ifndef QT_MAC_USE_COCOA 1642 void QWidgetPrivate::toggleDrawers(
bool visible)
1666 bool QWidgetPrivate::qt_mac_update_sizer(
QWidget *w,
int up)
1676 if (up >= 0 || topData->resizer != 0)
1677 topData->resizer += up;
1680 #ifndef QT_MAC_USE_COCOA 1682 GetWindowClass(windowRef, &wclass);
1683 if(!(GetAvailableWindowAttributes(wclass) & kWindowResizableAttribute))
1688 || (extraData->
maxw && extraData->
maxh &&
1689 extraData->
maxw == extraData->
minw && extraData->
maxh == extraData->
minh));
1690 #ifndef QT_MAC_USE_COCOA 1691 WindowAttributes attr;
1692 GetWindowAttributes(windowRef, &attr);
1694 if(attr & kWindowResizableAttribute) {
1696 kWindowResizableAttribute);
1699 }
else if(!(attr & kWindowResizableAttribute)) {
1700 ChangeWindowAttributes(windowRef, kWindowResizableAttribute,
1701 kWindowNoAttributes);
1702 ReshapeCustomWindow(windowRef);
1705 [windowRef setShowsResizeIndicator:!remove_grip];
1710 void QWidgetPrivate::qt_clean_root_win()
1712 #ifdef QT_MAC_USE_COCOA 1723 bool QWidgetPrivate::qt_create_root_win()
1729 #ifdef QT_MAC_USE_COCOA 1732 WindowAttributes wattr = (kWindowCompositingAttribute | kWindowStandardHandlerAttribute);
1741 bool QWidgetPrivate::qt_widget_rgn(
QWidget *widget,
short wcode,
RgnHandle rgn,
bool force =
false)
1744 #ifndef QT_MAC_USE_COCOA 1746 case kWindowStructureRgn: {
1748 if(widget->d_func()->extra && !widget->d_func()->extra->
mask.
isEmpty()) {
1797 void QWidgetPrivate::determineWindowClass()
1800 #if !defined(QT_NO_MAINWINDOW) && !defined(QT_NO_TOOLBAR) 1809 #ifndef QT_MAC_USE_COCOA 1818 WindowClass wclass = kSheetWindowClass;
1820 wclass = kDrawerWindowClass;
1822 wclass = kDocumentWindowClass;
1824 wclass = kModalWindowClass;
1826 wclass = kMovableModalWindowClass;
1828 wclass = kHelpWindowClass;
1831 wclass = kFloatingWindowClass;
1833 wclass = kDocumentWindowClass;
1835 WindowGroupRef grp = 0;
1836 WindowAttributes wattr = (kWindowCompositingAttribute | kWindowStandardHandlerAttribute);
1838 wattr |= kWindowFrameworkScaledAttribute;
1841 wclass = kSheetWindowClass;
1843 grp = GetWindowGroupOfClass(wclass);
1848 if (framelessWindow) {
1849 if(wclass == kDocumentWindowClass) {
1850 wattr |= kWindowNoTitleBarAttribute;
1851 }
else if(wclass == kFloatingWindowClass) {
1852 wattr |= kWindowNoTitleBarAttribute;
1853 }
else if (wclass == kMovableModalWindowClass) {
1854 wclass = kModalWindowClass;
1857 if(wclass != kModalWindowClass)
1858 wattr |= kWindowResizableAttribute;
1862 if(wclass != kModalWindowClass && wclass != kMovableModalWindowClass
1863 && wclass != kSheetWindowClass && wclass != kPlainWindowClass
1864 && !framelessWindow && wclass != kDrawerWindowClass
1865 && wclass != kHelpWindowClass) {
1867 wattr |= kWindowFullZoomAttribute;
1869 wattr |= kWindowCollapseBoxAttribute;
1871 wattr |= kWindowCloseBoxAttribute;
1873 wattr |= kWindowToolbarButtonAttribute;
1880 if((popup || type ==
Qt::Tool) && !q->isModal())
1881 wattr |= kWindowHideOnSuspendAttribute;
1882 wattr |= kWindowLiveResizeAttribute;
1884 #ifdef DEBUG_WINDOW_CREATE 1885 #define ADD_DEBUG_WINDOW_NAME(x) { x, #x } 1889 } known_attribs[] = {
1890 ADD_DEBUG_WINDOW_NAME(kWindowCompositingAttribute),
1891 ADD_DEBUG_WINDOW_NAME(kWindowStandardHandlerAttribute),
1892 ADD_DEBUG_WINDOW_NAME(kWindowMetalAttribute),
1893 ADD_DEBUG_WINDOW_NAME(kWindowHideOnSuspendAttribute),
1894 ADD_DEBUG_WINDOW_NAME(kWindowStandardHandlerAttribute),
1895 ADD_DEBUG_WINDOW_NAME(kWindowCollapseBoxAttribute),
1896 ADD_DEBUG_WINDOW_NAME(kWindowHorizontalZoomAttribute),
1897 ADD_DEBUG_WINDOW_NAME(kWindowVerticalZoomAttribute),
1898 ADD_DEBUG_WINDOW_NAME(kWindowResizableAttribute),
1899 ADD_DEBUG_WINDOW_NAME(kWindowNoActivatesAttribute),
1900 ADD_DEBUG_WINDOW_NAME(kWindowNoUpdatesAttribute),
1901 ADD_DEBUG_WINDOW_NAME(kWindowOpaqueForEventsAttribute),
1902 ADD_DEBUG_WINDOW_NAME(kWindowLiveResizeAttribute),
1903 ADD_DEBUG_WINDOW_NAME(kWindowCloseBoxAttribute),
1904 ADD_DEBUG_WINDOW_NAME(kWindowHideOnSuspendAttribute),
1906 }, known_classes[] = {
1907 ADD_DEBUG_WINDOW_NAME(kHelpWindowClass),
1908 ADD_DEBUG_WINDOW_NAME(kPlainWindowClass),
1909 ADD_DEBUG_WINDOW_NAME(kDrawerWindowClass),
1910 ADD_DEBUG_WINDOW_NAME(kUtilityWindowClass),
1911 ADD_DEBUG_WINDOW_NAME(kToolbarWindowClass),
1912 ADD_DEBUG_WINDOW_NAME(kSheetWindowClass),
1913 ADD_DEBUG_WINDOW_NAME(kFloatingWindowClass),
1914 ADD_DEBUG_WINDOW_NAME(kUtilityWindowClass),
1915 ADD_DEBUG_WINDOW_NAME(kDocumentWindowClass),
1916 ADD_DEBUG_WINDOW_NAME(kToolbarWindowClass),
1917 ADD_DEBUG_WINDOW_NAME(kMovableModalWindowClass),
1918 ADD_DEBUG_WINDOW_NAME(kModalWindowClass),
1921 qDebug(
"Qt: internal: ************* Creating new window %p (%s::%s)", q, q->metaObject()->className(),
1922 q->objectName().toLocal8Bit().constData());
1923 bool found_class =
false;
1924 for(
int i = 0; known_classes[i].name; i++) {
1925 if(wclass == known_classes[i].tag) {
1927 qDebug(
"Qt: internal: ** Class: %s", known_classes[i].
name);
1932 qDebug(
"Qt: internal: !! Class: Unknown! (%d)", (
int)wclass);
1934 WindowAttributes tmp_wattr = wattr;
1935 qDebug(
"Qt: internal: ** Attributes:");
1936 for(
int i = 0; tmp_wattr && known_attribs[i].name; i++) {
1937 if((tmp_wattr & known_attribs[i].tag) == known_attribs[i].tag) {
1938 tmp_wattr ^= known_attribs[i].tag;
1939 qDebug(
"Qt: internal: * %s %s", known_attribs[i].
name,
1940 (GetAvailableWindowAttributes(wclass) & known_attribs[i].tag) ?
"" :
"(*)");
1944 qDebug(
"Qt: internal: !! Attributes: Unknown (%d)", (
int)tmp_wattr);
1950 if((GetAvailableWindowAttributes(wclass) & wattr) != wattr) {
1951 WindowClass tmp_class = wclass;
1952 if(wclass == kToolbarWindowClass || wclass == kUtilityWindowClass)
1953 wclass = kFloatingWindowClass;
1954 if(tmp_class != wclass) {
1956 grp = GetWindowGroupOfClass(wclass);
1969 WindowClass wclass = kSheetWindowClass;
1971 wclass = kDrawerWindowClass;
1973 wclass = kDocumentWindowClass;
1975 wclass = kModalWindowClass;
1977 wclass = kMovableModalWindowClass;
1979 wclass = kHelpWindowClass;
1982 wclass = kFloatingWindowClass;
1984 wclass = kMovableModalWindowClass;
1986 wclass = kDocumentWindowClass;
1988 WindowAttributes wattr = NSBorderlessWindowMask;
1991 wclass = kSheetWindowClass;
1992 wattr = NSTitledWindowMask | NSResizableWindowMask;
1994 #ifndef QT_MAC_USE_COCOA 1995 grp = GetWindowGroupOfClass(wclass);
2001 if (framelessWindow) {
2002 if (wclass == kDocumentWindowClass) {
2003 wclass = kSimpleWindowClass;
2004 }
else if (wclass == kFloatingWindowClass) {
2005 wclass = kToolbarWindowClass;
2006 }
else if (wclass == kMovableModalWindowClass) {
2007 wclass = kModalWindowClass;
2010 wattr |= NSTitledWindowMask;
2011 if (wclass != kModalWindowClass)
2012 wattr |= NSResizableWindowMask;
2016 if (wclass != kModalWindowClass
2017 && wclass != kSheetWindowClass && wclass != kPlainWindowClass
2018 && !framelessWindow && wclass != kDrawerWindowClass
2019 && wclass != kHelpWindowClass) {
2021 wattr |= NSMiniaturizableWindowMask;
2023 wattr |= NSClosableWindowMask;
2031 wattr |= NSTexturedBackgroundWindowMask;
2033 #ifdef DEBUG_WINDOW_CREATE 2034 #define ADD_DEBUG_WINDOW_NAME(x) { x, #x } 2038 } known_attribs[] = {
2039 ADD_DEBUG_WINDOW_NAME(kWindowCompositingAttribute),
2040 ADD_DEBUG_WINDOW_NAME(kWindowStandardHandlerAttribute),
2041 ADD_DEBUG_WINDOW_NAME(kWindowMetalAttribute),
2042 ADD_DEBUG_WINDOW_NAME(kWindowHideOnSuspendAttribute),
2043 ADD_DEBUG_WINDOW_NAME(kWindowStandardHandlerAttribute),
2044 ADD_DEBUG_WINDOW_NAME(kWindowCollapseBoxAttribute),
2045 ADD_DEBUG_WINDOW_NAME(kWindowHorizontalZoomAttribute),
2046 ADD_DEBUG_WINDOW_NAME(kWindowVerticalZoomAttribute),
2047 ADD_DEBUG_WINDOW_NAME(kWindowResizableAttribute),
2048 ADD_DEBUG_WINDOW_NAME(kWindowNoActivatesAttribute),
2049 ADD_DEBUG_WINDOW_NAME(kWindowNoUpdatesAttribute),
2050 ADD_DEBUG_WINDOW_NAME(kWindowOpaqueForEventsAttribute),
2051 ADD_DEBUG_WINDOW_NAME(kWindowLiveResizeAttribute),
2052 ADD_DEBUG_WINDOW_NAME(kWindowCloseBoxAttribute),
2053 ADD_DEBUG_WINDOW_NAME(kWindowHideOnSuspendAttribute),
2055 }, known_classes[] = {
2056 ADD_DEBUG_WINDOW_NAME(kHelpWindowClass),
2057 ADD_DEBUG_WINDOW_NAME(kPlainWindowClass),
2058 ADD_DEBUG_WINDOW_NAME(kDrawerWindowClass),
2059 ADD_DEBUG_WINDOW_NAME(kUtilityWindowClass),
2060 ADD_DEBUG_WINDOW_NAME(kToolbarWindowClass),
2061 ADD_DEBUG_WINDOW_NAME(kSheetWindowClass),
2062 ADD_DEBUG_WINDOW_NAME(kFloatingWindowClass),
2063 ADD_DEBUG_WINDOW_NAME(kUtilityWindowClass),
2064 ADD_DEBUG_WINDOW_NAME(kDocumentWindowClass),
2065 ADD_DEBUG_WINDOW_NAME(kToolbarWindowClass),
2066 ADD_DEBUG_WINDOW_NAME(kMovableModalWindowClass),
2067 ADD_DEBUG_WINDOW_NAME(kModalWindowClass),
2070 qDebug(
"Qt: internal: ************* Creating new window %p (%s::%s)", q, q->metaObject()->className(),
2071 q->objectName().toLocal8Bit().constData());
2072 bool found_class =
false;
2073 for(
int i = 0; known_classes[i].name; i++) {
2074 if(wclass == known_classes[i].tag) {
2076 qDebug(
"Qt: internal: ** Class: %s", known_classes[i].
name);
2081 qDebug(
"Qt: internal: !! Class: Unknown! (%d)", (
int)wclass);
2083 WindowAttributes tmp_wattr = wattr;
2084 qDebug(
"Qt: internal: ** Attributes:");
2085 for(
int i = 0; tmp_wattr && known_attribs[i].name; i++) {
2086 if((tmp_wattr & known_attribs[i].tag) == known_attribs[i].tag) {
2087 tmp_wattr ^= known_attribs[i].tag;
2091 qDebug(
"Qt: internal: !! Attributes: Unknown (%d)", (
int)tmp_wattr);
2095 #ifndef QT_MAC_USE_COCOA 2098 if((GetAvailableWindowAttributes(wclass) & wattr) != wattr) {
2099 WindowClass tmp_class = wclass;
2100 if(wclass == kToolbarWindowClass || wclass == kUtilityWindowClass)
2101 wclass = kFloatingWindowClass;
2102 if(tmp_class != wclass) {
2104 grp = GetWindowGroupOfClass(wclass);
2114 #ifndef QT_MAC_USE_COCOA // This is handled in Cocoa via our category. 2115 void QWidgetPrivate::initWindowPtr()
2128 qWarning(
"Qt:Internal error (%s:%d)", __FILE__, __LINE__);
2135 void QWidgetPrivate::finishCreateWindow_sys_Carbon(
OSWindowRef windowRef)
2148 quint32 wattr = topExtra->wattr;
2150 SetAutomaticControlDragTrackingEnabledForWindow(windowRef,
true);
2151 HIWindowChangeFeatures(windowRef, kWindowCanCollapse, 0);
2152 if (wattr & kWindowHideOnSuspendAttribute)
2153 HIWindowChangeAvailability(windowRef, kHIWindowExposeHidden, 0);
2155 HIWindowChangeAvailability(windowRef, 0, kHIWindowExposeHidden);
2157 ChangeWindowAttributes(windowRef, kWindowNoAttributes, kWindowHideOnSuspendAttribute);
2160 if (topExtra->group) {
2162 topExtra->group = 0;
2166 else if (type ==
Qt::Popup && (flags & Qt::WindowStaysOnTopHint))
2168 else if (flags & Qt::WindowStaysOnTopHint)
2171 SetWindowGroup(windowRef, GetWindowGroupOfClass(kMovableModalWindowClass));
2173 #ifdef DEBUG_WINDOW_CREATE 2174 if (WindowGroupRef grpf = GetWindowGroup(windowRef)) {
2176 CopyWindowGroupName(grpf, &cfname);
2178 GetWindowGroupLevel(grpf, &lvl);
2179 const char *from =
"Default";
2180 if (topExtra && grpf ==
topData()->group)
2182 else if (grpf == grp)
2184 qDebug(
"Qt: internal: With window group '%s' [%p] @ %d: %s",
2185 static_cast<QString>(cfname).toLatin1().constData(), grpf, (
int)lvl, from);
2187 qDebug(
"Qt: internal: No window group!!!");
2189 HIWindowAvailability hi_avail = 0;
2190 if (HIWindowGetAvailability(windowRef, &hi_avail) == noErr) {
2195 ADD_DEBUG_WINDOW_NAME(kHIWindowExposeHidden),
2198 qDebug(
"Qt: internal: ** HIWindowAvailibility:");
2199 for (
int i = 0; hi_avail && known_avail[i].name; i++) {
2200 if ((hi_avail & known_avail[i].tag) == known_avail[i].tag) {
2201 hi_avail ^= known_avail[i].tag;
2202 qDebug(
"Qt: internal: * %s", known_avail[i].
name);
2206 qDebug(
"Qt: internal: !! Attributes: Unknown (%d)", (
int)hi_avail);
2208 #undef ADD_DEBUG_WINDOW_NAME 2211 ReshapeCustomWindow(windowRef);
2212 SetWindowModality(windowRef, kWindowModalityNone, 0);
2214 SetDrawerOffsets(windowRef, 0.0, 25.0);
2222 HIViewAddSubview(window_hiview, hiview);
2226 GetWindowBounds(
qt_mac_window_for (window_hiview), kWindowContentRgn, &win_rect);
2227 HIRect bounds = CGRectMake(0, 0, win_rect.right-win_rect.left, win_rect.bottom-win_rect.top);
2228 HIViewSetFrame(hiview, &bounds);
2229 HIViewSetVisible(hiview,
true);
2241 SetRect(&r, r.left + fStrut.
left(), r.top + fStrut.
top(),
2244 SetWindowBounds(windowRef, kWindowContentRgn, &r);
2249 q->setWindowOpacity(topExtra->
opacity / 255.0f);
2251 SetThemeWindowBackground(
qt_mac_window_for(q), kThemeBrushSheetBackgroundTransparent,
true);
2258 q->setWindowOpacity(0.95f);
2264 q->setWindowOpacity(1.0f);
2269 macUpdateHideOnSuspend();
2270 macUpdateOpaqueSizeGrip();
2271 macUpdateMetalAttribute();
2272 macUpdateIgnoreMouseEvents();
2276 setWindowModified_sys(q->isWindowModified());
2278 qt_mac_update_sizer(q);
2279 applyMaxAndMinSizeOnWindow();
2281 #else // QT_MAC_USE_COCOA 2283 void QWidgetPrivate::setWindowLevel()
2287 const QWidget *
const primaryWindow = windowParent ? windowParent->
window() : 0;
2288 NSInteger winLevel = -1;
2291 winLevel = NSPopUpMenuWindowLevel;
2293 if (primaryWindow) {
2295 winLevel =
qMax([parentRef level], winLevel);
2297 }
else if (q->windowType() ==
Qt::Tool) {
2298 winLevel = NSFloatingWindowLevel;
2302 winLevel = NSNormalWindowLevel;
2307 winLevel = NSPopUpMenuWindowLevel;
2310 winLevel = NSScreenSaverWindowLevel;
2313 winLevel = NSNormalWindowLevel;
2317 void QWidgetPrivate::finishCreateWindow_sys_Cocoa(
void * voidWindowRef)
2321 NSWindow *windowRef =
static_cast<NSWindow *
>(voidWindowRef);
2334 [windowRef setHidesOnDeactivate:YES];
2336 [windowRef setHidesOnDeactivate:NO];
2339 [windowRef setHasShadow:NO];
2341 [windowRef setHasShadow:YES];
2352 [windowRef setContentView:nsview];
2353 [nsview setHidden:NO];
2359 [windowRef makeFirstResponder:nsview];
2371 [windowRef setFrame:cocoaFrameRect
display:NO];
2376 q->setWindowOpacity(topExtra->
opacity / 255.0f);
2380 q->setWindowOpacity(0.95f);
2386 q->setWindowOpacity(1.0f);
2392 [windowRef disableCursorRects];
2395 macUpdateHideOnSuspend();
2396 macUpdateOpaqueSizeGrip();
2397 macUpdateIgnoreMouseEvents();
2400 setWindowModified_sys(q->isWindowModified());
2403 macUpdateIsOpaque();
2404 qt_mac_update_sizer(q);
2405 applyMaxAndMinSizeOnWindow();
2408 #endif // QT_MAC_USE_COCOA 2414 void QWidgetPrivate::recreateMacWindow()
2419 #ifndef QT_MAC_USE_COCOA 2420 HIViewRemoveFromSuperview(myView);
2421 determineWindowClass();
2425 mwl->updateHIToolBarStatus();
2428 if (IsWindowVisible(oldWindow))
2432 [myView removeFromSuperview];
2433 determineWindowClass();
2437 [newWindow setToolbar:
toolbar];
2438 [toolbar setVisible:[toolbar isVisible]];
2440 if ([oldWindow isVisible]){
2441 if ([oldWindow isSheet])
2442 [NSApp endSheet:oldWindow];
2443 [oldWindow orderOut:oldWindow];
2446 #endif // QT_MAC_USE_COCOA 2453 void QWidgetPrivate::createWindow_sys()
2462 quint32 wattr = topExtra->wattr;
2471 qWarning(
"QWidget: Internal error: %s:%d: If you reach this error please contact Qt Support and include the\n" 2472 " WidgetFlags used in creating the widget.", __FILE__, __LINE__);
2473 #ifndef QT_MAC_USE_COCOA 2474 finishCreateWindow_sys_Carbon(windowRef);
2476 finishCreateWindow_sys_Cocoa(windowRef);
2486 #ifndef QT_MAC_USE_COCOA 2504 determineWindowClass();
2510 dialog = popup =
false;
2516 int deskn = dsk->primaryScreen();
2518 deskn = dsk->screenNumber(parentWidget);
2519 QRect screenGeo = dsk->screenGeometry(deskn);
2521 #ifndef QT_MAC_USE_COCOA 2524 NSRect newRect = [NSWindow frameRectForContentRect:NSMakeRect(0, 0,
2525 screenGeo.
width() / 2.,
2526 4 * screenGeo.
height() / 10.)
2542 3 * screenGeo.
height() / 10));
2549 initializeWindow=
true;
2555 #ifndef QT_MAC_USE_COCOA 2556 CFRetain(nativeView);
2558 [nativeView retain];
2560 if (destroyOldWindow)
2562 bool transfer =
false;
2564 #ifndef QT_MAC_USE_COCOA 2565 #ifndef HIViewInstallEventHandler 2567 #define HIViewInstallEventHandler( target, handler, numTypes, list, userData, outHandlerRef ) \ 2568 InstallEventHandler( HIObjectGetEventTarget( (HIObjectRef) (target) ), (handler), (numTypes), (list), (userData), (outHandlerRef) ) 2573 for(
int i = 0; i < 2; ++i) {
2575 if(!initializeWindow)
2580 #ifndef QT_MAC_USE_COCOA 2581 CFRetain(windowref);
2585 if (initializeWindow) {
2588 #ifndef QT_MAC_USE_COCOA 2589 parent = HIViewGetSuperview(nativeView);
2591 parent = [nativeView superview];
2599 }
else if (parentWidget) {
2606 if(parent != nativeView && parent) {
2607 #ifndef QT_MAC_USE_COCOA 2608 HIViewAddSubview(parent, nativeView);
2610 [parent addSubview:nativeView];
2617 #ifndef QT_MAC_USE_COCOA
2618 HIViewIsVisible(nativeView)
2620 ![nativeView isHidden]
2623 if(initializeWindow) {
2624 #ifndef QT_MAC_USE_COCOA 2626 HIViewSetFrame(nativeView, &bounds);
2630 [nativeView setFrame:bounds];
2634 #ifndef QT_MAC_USE_COCOA 2637 }
else if (desktop) {
2639 QWidgetPrivate::qt_create_root_win();
2642 #ifndef QT_MAC_USE_COCOA 2645 rootWinID = (
WId)rootContentView;
2646 CFRetain(rootContentView);
2651 rootWinID = (
WId)rootContentView;
2652 [rootContentView retain];
2656 }
else if (topLevel) {
2657 determineWindowClass();
2659 #ifndef QT_MAC_USE_COCOA 2662 HIViewSetFrame(osview, &bounds);
2666 [osview setFrame:bounds];
2673 #ifdef QT_MAC_USE_COCOA 2679 #ifndef QT_MAC_USE_COCOA 2681 HIViewSetFrame(osview, &bounds);
2685 [osview setFrame:bounds];
2687 if (q->isVisible()) {
2691 [osview setHidden:NO];
2703 if (!topLevel && initializeWindow)
2720 #ifndef QT_MAC_USE_COCOA 2721 return d_func()->qd_hd;
2748 nativeParent->
update(dirtyRect);
2755 d->aboutToDestroy();
2757 parentWidget()->d_func()->invalidateBuffer(
d->effectiveRectFor(geometry()));
2758 if (!internalWinId())
2760 d->deactivateWidgetCleanup();
2765 for(
int i = 0; i < chldrn.
size(); i++) {
2768 static_cast<QWidget*>(obj)->destroy(destroySubWindows, destroySubWindows);
2770 if(mac_mouse_grabber ==
this)
2772 if(mac_keyboard_grabber ==
this)
2778 qApp->d_func()->closePopup(
this);
2779 if (destroyWindow) {
2782 NSDrawer *drawer = nil;
2783 #ifdef QT_MAC_USE_COCOA 2785 drawer = qt_mac_drawer_for(
this);
2793 #ifndef QT_MAC_USE_COCOA 2806 #ifdef QT_MAC_USE_COCOA 2813 }
QT_CATCH (
const std::bad_alloc &) {
2819 void QWidgetPrivate::transferChildren()
2822 if (!q->internalWinId())
2826 for (
int i = 0; i < chlist.
size(); ++i) {
2835 #ifndef QT_MAC_USE_COCOA 2857 #ifdef QT_MAC_USE_COCOA 2858 void QWidgetPrivate::setSubWindowStacking(
bool set)
2863 static bool use_behaviour_qt473 = !
qgetenv(
"QT_MAC_USE_CHILDWINDOWS").
isEmpty();
2886 if (
set && ![qwin isVisible])
2893 if ([pwin isVisible]
2895 && ![qwin parentWindow]
2897 NSInteger level = [qwin level];
2898 [pwin addChildWindow:qwin ordered:NSWindowAbove];
2899 if ([qwin level] < level)
2900 [qwin setLevel:level];
2903 [pwin removeChildWindow:qwin];
2913 for (
int i=0; i<widgets.
size(); ++i) {
2919 if ([cwin isVisible] && (ctype ==
Qt::Window || ctype ==
Qt::Dialog) && ![cwin parentWindow]) {
2920 NSInteger level = [cwin level];
2921 [qwin addChildWindow:cwin ordered:NSWindowAbove];
2922 if ([cwin level] < level)
2923 [cwin setLevel:level];
2940 #ifdef QT_MAC_USE_COCOA 2941 bool wasWindow = q->isWindow();
2945 if (q->isVisible() && q->parentWidget() && parent != q->
parentWidget())
2946 q->parentWidget()->d_func()->invalidateBuffer(
effectiveRectFor(q->geometry()));
2950 if (glWidgets.isEmpty() ==
false) {
2954 it != glWidgets.constEnd(); ++
it)
2955 current->d_func()->glWidgets.removeAll(*
it);
2963 #ifndef QT_MAC_USE_COCOA 2964 EventHandlerRef old_window_event = 0;
2966 bool oldToolbarVisible =
false;
2967 NSDrawer *oldDrawer = nil;
2968 NSToolbar *oldToolbar = 0;
2970 if (wasCreated && !(q->windowType() ==
Qt::Desktop)) {
2972 #ifndef QT_MAC_USE_COCOA 2973 old_window_event = window_event;
2976 oldDrawer = qt_mac_drawer_for(q);
2980 oldToolbar = [oldWindow
toolbar];
2982 [oldToolbar retain];
2983 oldToolbarVisible = [oldToolbar isVisible];
2984 [oldWindow setToolbar:nil];
3001 q->setWindowOpacity(1.0f);
3016 const bool nativeWidget = q->internalWinId() != 0;
3017 if (wasCreated || (nativeWidget && nonWindowWithCreatedParent)) {
3019 if (q->isWindow()) {
3020 #ifndef QT_MAC_USE_COCOA 3025 mwl->updateHIToolBarStatus();
3032 [newWindow setToolbar:oldToolbar];
3033 [oldToolbar release];
3034 [oldToolbar setVisible:oldToolbarVisible];
3039 if (q->isWindow() || (!parent || parent->
isVisible()) || explicitlyHidden)
3043 #ifdef QT_MAC_USE_COCOA 3045 if (parent && parent->d_func() && parent->d_func()->isInUnifiedToolbar) {
3046 if (parent->d_func()->unifiedSurface) {
3048 parent->d_func()->unifiedSurface->recursiveRedirect(toolbar, toolbar, toolbar->d_func()->toolbar_offset);
3051 #endif // QT_MAC_USE_COCOA 3055 #ifndef QT_MAC_USE_COCOA 3058 if (q->isWindow()) {
3060 mwl->updateHIToolBarStatus();
3071 || (!q->isWindow() && q->parentWidget()
3076 #ifndef QT_MAC_USE_COCOA 3077 if (old_window_event)
3078 RemoveEventHandler(old_window_event);
3084 #ifdef QT_MAC_USE_COCOA 3095 if (glWidgets.isEmpty() ==
false) {
3098 current->d_func()->glWidgets += glWidgets;
3111 if (!internalWinId()) {
3115 #ifndef QT_MAC_USE_COCOA 3117 HIPoint hi_pos = CGPointMake(tmp.
x(), tmp.
y());
3121 return QPoint((
int)hi_pos.x+win_rect.left, (
int)hi_pos.y+win_rect.top);
3124 NSPoint hi_pos = NSMakePoint(tmp.
x(), tmp.
y());
3127 hi_pos.x += win_rect.origin.x;
3128 hi_pos.y += win_rect.origin.y;
3138 if (!internalWinId()) {
3142 #ifndef QT_MAC_USE_COCOA 3145 HIPoint hi_pos = CGPointMake(pos.
x()-win_rect.left, pos.
y()-win_rect.top);
3147 return d->mapFromWS(
QPoint((
int)hi_pos.x, (
int)hi_pos.y));
3152 NSPoint hi_pos = NSMakePoint(pos.
x()-win_rect.origin.x,
3176 if (q->isWindow()) {
3177 #ifndef QT_MAC_USE_COCOA 3186 void QWidgetPrivate::setWindowModified_sys(
bool mod)
3190 #ifndef QT_MAC_USE_COCOA 3198 void QWidgetPrivate::setWindowFilePath_sys(
const QString &filePath)
3201 #ifdef QT_MAC_USE_COCOA 3206 bool validRef =
false;
3208 bzero(&ref,
sizeof(ref));
3212 status = FSPathMakeRef(reinterpret_cast<const UInt8 *>(filePath.
toUtf8().
constData()), &ref, 0);
3213 validRef = (status == noErr);
3222 if (status != noErr)
3223 qWarning(
"QWidget::setWindowFilePath: Error setting proxyicon for path (%s):%ld",
3239 QIcon icon = q->windowIcon();
3250 if (q->isWindow()) {
3251 #ifndef QT_MAC_USE_COCOA 3255 previousIcon = topData->windowIcon;
3256 topData->windowIcon = 0;
3261 if (wclass == kDocumentWindowClass) {
3263 previousIcon = topData->windowIcon;
3264 topData->windowIcon = newIcon;
3270 if (previousIcon != 0)
3271 ReleaseIconRef(previousIcon);
3276 NSButton *iconButton = [
qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
3277 if (iconButton == nil) {
3279 const NSString *tmpString =
reinterpret_cast<const NSString *
>((
CFStringRef)
string);
3280 [
qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:
const_cast<NSString *
>(tmpString)]];
3281 iconButton = [
qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
3284 [iconButton setImage:nil];
3288 [iconButton setImage:image];
3298 if(q->isWindow() && !iconText.
isEmpty()) {
3299 #ifndef QT_MAC_USE_COCOA 3311 if(mac_mouse_grabber)
3313 mac_mouse_grabber=
this;
3318 #ifndef QT_NO_CURSOR 3322 if(mac_mouse_grabber)
3324 mac_mouse_grabber=
this;
3332 if(!
qt_nograb() && mac_mouse_grabber ==
this) {
3333 mac_mouse_grabber = 0;
3341 if(mac_keyboard_grabber)
3343 mac_keyboard_grabber =
this;
3349 if(!
qt_nograb() && mac_keyboard_grabber ==
this)
3350 mac_keyboard_grabber = 0;
3370 QWidget *fullScreenWidget = tlw;
3374 fullScreenWidget = parentW->
window();
3382 qApp->desktop()->screenNumber(
this) == 0);
3387 #ifndef QT_MAC_USE_COCOA 3388 windowActive = IsWindowActive(win);
3391 windowActive = [win isKeyWindow];
3397 #ifndef QT_MAC_USE_COCOA 3398 ActivateWindow(win,
true);
3399 qApp->setActiveWindow(tlw);
3401 [win makeKeyWindow];
3403 }
else if(!isMinimized()) {
3404 #ifndef QT_MAC_USE_COCOA 3407 [win makeKeyAndOrderFront:win];
3417 void QWidgetPrivate::update_sys(
const QRect &r)
3423 macSetNeedsDisplay(r != q->rect() ? r :
QRegion());
3426 void QWidgetPrivate::update_sys(
const QRegion &rgn)
3431 dirtyOnWidget += rgn;
3432 macSetNeedsDisplay(rgn);
3435 bool QWidgetPrivate::isRealWindow()
const 3454 bool realWindow = isRealWindow();
3455 #ifndef QT_MAC_USE_COCOA 3458 recreateMacWindow();
3474 #ifndef QT_MAC_USE_COCOA 3475 SizeWindow(window, q->width(), q->height(),
true);
3478 #ifdef QT_MAC_USE_COCOA 3486 #ifndef QT_MAC_USE_COCOA 3487 OpenDrawer(window, kWindowEdgeDefault,
false);
3489 NSDrawer *drawer = qt_mac_drawer_for(q);
3490 [drawer openOnEdge:[drawer preferredEdge]];
3493 #ifndef QT_MAC_USE_COCOA 3494 ShowHide(window,
true);
3497 [window setAlphaValue:q->windowOpacity()];
3502 [window orderFront:window];
3504 [window makeKeyAndOrderFront:
window];
3513 [window orderFront:
window];
3516 [modalWin orderFront:window];
3519 setSubWindowStacking(
true);
3524 if (q->focusWidget())
3529 toggleDrawers(
true);
3531 if (isCurrentlyMinimized) {
3532 #ifndef QT_MAC_USE_COCOA 3533 CollapseWindow(window,
true);
3535 [window miniaturize:
window];
3538 #ifndef QT_MAC_USE_COCOA 3542 }
else if(
topData()->embedded || !q->parentWidget() || q->parentWidget()->isVisible()) {
3543 #ifndef QT_MAC_USE_COCOA 3548 [view setHidden:NO];
3556 #ifdef QT_MAC_USE_COCOA 3561 QWidget *widgetUnderMouse = 0;
3563 if (q == widgetUnderMouse) {
3565 qt_last_mouse_receiver = widgetUnderMouse;
3566 qt_last_native_mouse_receiver = widgetUnderMouse ?
3572 topLevelAt_cache = 0;
3578 #ifndef QT_MAC_USE_COCOA 3579 CGPoint nativePoint = CGPointMake(pt.
x(), pt.
y());
3585 return QPoint(nativePoint.x, nativePoint.y);
3596 #ifdef QT_MAC_USE_COCOA 3597 setSubWindowStacking(
false);
3601 #ifndef QT_MAC_USE_COCOA 3603 if(GetSheetWindowParent(window, &parent) != noErr || !parent)
3604 ShowHide(window,
false);
3606 HideSheetWindow(window);
3609 [window orderOut:
window];
3612 #ifndef QT_MAC_USE_COCOA 3613 CloseDrawer(window,
false);
3615 [qt_mac_drawer_for(q) close];
3618 #ifndef QT_MAC_USE_COCOA 3619 ShowHide(window,
false);
3622 if ((q->windowType() ==
Qt::Tool) && [window respondsToSelector:
@selector(setAnimationBehavior:)])
3623 [window setAnimationBehavior: 2];
3625 [window orderOut:
window];
3631 if(q->isFullScreen())
3633 bool keepFullScreen =
false;
3635 int windowCount = windowList.
count();
3636 for(
int i = 0; i < windowCount; i++)
3650 keepFullScreen =
true;
3659 toggleDrawers(
false);
3661 #ifndef QT_MAC_USE_COCOA 3664 SetWindowModality(window, kWindowModalityNone,
3669 #ifndef QT_MAC_USE_COCOA 3673 if (q->isActiveWindow() && !(q->windowType() ==
Qt::Popup)) {
3675 if(q->parentWidget())
3678 for (WindowPtr wp = GetFrontWindowOfClass(kMovableModalWindowClass,
true);
3679 wp; wp = GetNextWindowOfClass(wp, kMovableModalWindowClass,
true)) {
3684 for (WindowPtr wp = GetFrontWindowOfClass(kDocumentWindowClass,
true);
3685 wp; wp = GetNextWindowOfClass(wp, kDocumentWindowClass,
true)) {
3691 for(WindowPtr wp = GetFrontWindowOfClass(kSimpleWindowClass,
true);
3692 wp; wp = GetNextWindowOfClass(wp, kSimpleWindowClass,
true)) {
3705 #ifndef QT_MAC_USE_COCOA 3710 [view setHidden:YES];
3718 #ifdef QT_MAC_USE_COCOA 3723 QWidget *widgetUnderMouse = 0;
3725 if (q == widgetUnderMouse) {
3727 qt_last_mouse_receiver = widgetUnderMouse;
3728 qt_last_native_mouse_receiver = widgetUnderMouse ?
3734 topLevelAt_cache = 0;
3743 bool needShow =
false;
3744 Qt::WindowStates
oldstate = windowState();
3745 if (oldstate == newstate)
3748 #ifdef QT_MAC_USE_COCOA 3751 bool needSendStateChange =
true;
3754 if(newstate & Qt::WindowFullScreen) {
3756 if(tlextra->normalGeometry.width() < 0) {
3759 tlextra->normalGeometry = geometry();
3761 tlextra->savedFlags = windowFlags();
3763 needShow = isVisible();
3764 const QRect fullscreen(
qApp->desktop()->screenGeometry(
qApp->desktop()->screenNumber(
this)));
3766 setGeometry(fullscreen);
3767 if(!
qApp->desktop()->screenNumber(
this))
3770 needShow = isVisible();
3771 if(!
qApp->desktop()->screenNumber(
this))
3774 setGeometry(
d->topData()->normalGeometry);
3775 d->topData()->normalGeometry.setRect(0, 0, -1, -1);
3783 if (newstate & Qt::WindowMinimized) {
3784 #ifndef QT_MAC_USE_COCOA 3785 CollapseWindow(window,
true);
3787 [window miniaturize:
window];
3790 #ifndef QT_MAC_USE_COCOA 3791 CollapseWindow(window,
false);
3793 [window deminiaturize:
window];
3796 needSendStateChange = oldstate == windowState();
3801 if(tlextra->normalGeometry.width() < 0) {
3804 tlextra->normalGeometry = geometry();
3807 }
else if(!(newstate & Qt::WindowFullScreen)) {
3811 #ifdef DEBUG_WINDOW_STATE 3812 #define WSTATE(x) qDebug("%s -- %s --> %s", #x, (oldstate & x) ? "true" : "false", (newstate & x) ? "true" : "false") 3813 WSTATE(Qt::WindowMinimized);
3814 WSTATE(Qt::WindowMaximized);
3815 WSTATE(Qt::WindowFullScreen);
3818 if(!(newstate & (Qt::WindowMinimized|Qt::WindowFullScreen)) &&
3819 ((oldstate & Qt::WindowFullScreen) || (oldstate & Qt::WindowMinimized) ||
3820 (oldstate & Qt::WindowMaximized) != (newstate & Qt::WindowMaximized))) {
3821 if(newstate & Qt::WindowMaximized) {
3823 #ifndef QT_MAC_USE_COCOA 3824 HIToolbarRef toolbarRef;
3825 if (GetWindowToolbar(window, &toolbarRef) == noErr && toolbarRef
3826 && !isVisible() && !IsWindowToolbarVisible(window)) {
3830 ShowHideWindowToolbar(window,
true,
false);
3831 d->updateFrameStrut();
3836 SetRect(&bounds, avail.
x(), avail.
y(), avail.
x() + avail.
width(), avail.
y() + avail.
height());
3838 if(bounds.right - bounds.left >
extra->
maxw)
3840 if(bounds.bottom - bounds.top >
extra->
maxh)
3841 bounds.bottom = bounds.top +
extra->
maxh;
3844 QRect fs =
d->frameStrut();
3845 bounds.left += fs.
left();
3846 if(bounds.right < avail.
x()+avail.
width())
3847 bounds.right = qMin<short>((
uint)avail.
x()+avail.
width(), bounds.right+fs.
left());
3848 if(bounds.bottom < avail.
y()+avail.
height())
3849 bounds.bottom = qMin<short>((
uint)avail.
y()+avail.
height(), bounds.bottom+fs.
top());
3850 bounds.top += fs.
top();
3851 bounds.right -= fs.
right();
3852 bounds.bottom -= fs.
bottom();
3854 QRect orect(geometry().x(), geometry().y(), width(), height()),
3855 nrect(bounds.left, bounds.top, bounds.right - bounds.left,
3856 bounds.bottom - bounds.top);
3857 if(orect != nrect) {
3858 Point idealSize = { nrect.
height(), nrect.
width() };
3859 ZoomWindowIdeal(window, inZoomOut, &idealSize);
3862 NSToolbar *toolbarRef = [window
toolbar];
3863 if (toolbarRef && !isVisible() && ![toolbarRef isVisible]) {
3868 [toolbarRef setVisible:
true];
3870 d->updateFrameStrut();
3882 needSendStateChange = oldstate == windowState();
3883 }
else if(oldstate & Qt::WindowMaximized && !(oldstate & Qt::WindowFullScreen)) {
3884 #ifndef QT_MAC_USE_COCOA 3886 ZoomWindowIdeal(window, inZoomIn, &idealSize);
3891 setGeometry(tlextra->normalGeometry);
3892 tlextra->normalGeometry.setRect(0, 0, -1, -1);
3907 if (needSendStateChange) {
3917 #ifdef QT_MAC_USE_COCOA 3920 [[view
window] makeFirstResponder:view];
3929 id topView =
reinterpret_cast<id>(context);
3930 if (view1 == topView)
3931 return NSOrderedDescending;
3932 if (view2 == topView)
3933 return NSOrderedAscending;
3934 return NSOrderedSame;
3943 #if QT_MAC_USE_COCOA 3945 if (isRealWindow()) {
3959 if([window respondsToSelector:
@selector(isOnActiveSpace)]) {
3960 if(![window performSelector:
@selector(isOnActiveSpace)]) {
3964 if(parentWindow && [parentWindow respondsToSelector:
@selector(isOnActiveSpace)]) {
3965 if ([parentWindow performSelector:
@selector(isOnActiveSpace)]) {
3969 recreateMacWindow();
3976 [window orderFront:
window];
3979 ProcessSerialNumber psn;
3980 GetCurrentProcess(&psn);
3981 SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
3985 NSView *parentView = [view superview];
3986 [parentView sortSubviewsUsingFunction:
compareViews2Raise context:
reinterpret_cast<void *
>(view)];
3988 topLevelAt_cache = 0;
3994 ProcessSerialNumber psn;
3995 GetCurrentProcess(&psn);
3996 SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
3998 }
else if(q->parentWidget()) {
4007 id topView =
reinterpret_cast<id>(context);
4008 if (view1 == topView)
4009 return NSOrderedAscending;
4010 if (view2 == topView)
4011 return NSOrderedDescending;
4012 return NSOrderedSame;
4020 #ifdef QT_MAC_USE_COCOA 4021 if (isRealWindow()) {
4023 [window orderBack:
window];
4026 NSView *parentView = [view superview];
4027 [parentView sortSubviewsUsingFunction:
compareViews2Lower context:
reinterpret_cast<void *
>(view)];
4029 topLevelAt_cache = 0;
4033 }
else if(q->parentWidget()) {
4044 if (viewOrder[view1] < viewOrder[view2])
4045 return NSOrderedAscending;
4046 if (viewOrder[view1] > viewOrder[view2])
4047 return NSOrderedDescending;
4048 return NSOrderedSame;
4057 #ifdef QT_MAC_USE_COCOA 4063 NSView *parentView = [myView superview];
4064 NSArray *subviews = [parentView subviews];
4065 NSUInteger
index = 1;
4069 for (NSView *subview in subviews) {
4070 viewOrder.
insert(subview, index * 2);
4073 viewOrder[myView] = viewOrder[wView] - 1;
4086 #ifndef QT_MAC_USE_COCOA 4094 HIRect bounds = CGRectMake(newRect.
x(), newRect.
y(),
4099 const bool isResize = (oldRect.
size() != newRect.
size());
4121 HIViewSetFrame(view, &bounds);
4125 const int dx = newRect.
x() - oldRect.
x();
4126 const int dy = newRect.
y() - oldRect.
y();
4136 HIViewFindByID(HIViewGetRoot(HIViewGetWindow(
HIViewRef(q->
winId()))), kHIViewWindowGrowBoxID, &nativeSizeGrip);
4137 if (nativeSizeGrip) {
4140 const int sizeGripSize = 20;
4147 HIViewSetFrame(view, &bounds);
4154 const HIRect scrollBounds =
4155 CGRectMake(scrollRect.
x(), scrollRect.
y(), scrollRect.
width(), scrollRect.
height());
4160 HIViewMoveBy(view, dx, dy);
4164 OSStatus err = HIViewScrollRect(parentView, &scrollBounds, dx, dy);
4166 HIViewSetNeedsDisplay(view,
true);
4167 qWarning(
"QWidget: Internal error (%s:%d)", __FILE__, __LINE__);
4171 HIViewSetDrawingEnabled(view,
false);
4172 HIViewSetFrame(view, &bounds);
4173 HIViewSetDrawingEnabled(view,
true);
4176 const int startx = oldRect.
width();
4177 const int stopx = newRect.
width();
4178 const int starty = oldRect.
height();
4179 const int stopy = newRect.
height();
4181 const HIRect verticalSlice = CGRectMake(startx, 0, stopx , stopy);
4182 HIViewSetNeedsDisplayInRect(view, &verticalSlice,
true);
4183 const HIRect horizontalSlice = CGRectMake(0, starty, startx, stopy);
4184 HIViewSetNeedsDisplayInRect(view, &horizontalSlice,
true);
4203 void QWidgetPrivate::setWSGeometry(
bool dontShow,
const QRect &oldRect)
4240 #ifdef QT_MAC_USE_COCOA 4243 if (!isEmbeddedWindow) {
4244 parentWRect = q->parentWidget()->data->wrect;
4248 #ifndef QT_MAC_USE_COCOA 4254 #ifndef QT_MAC_USE_COCOA 4256 HIViewGetFrame(parentView, &tmpRect);
4258 NSRect tmpRect = [parentView frame];
4260 parentWRect =
QRect(tmpRect.origin.x, tmpRect.origin.y,
4261 tmpRect.size.width, tmpRect.size.height);
4264 parentWRect = wrectRange;
4271 if (!parentWRect.
contains(wrectInParentCoordSys) && !isEmbeddedWindow) {
4272 wrectInParentCoordSys &= parentWRect;
4273 wrect = wrectInParentCoordSys;
4291 QRect vrect = wrectInParentCoordSys & q->parentWidget()->rect();
4297 #ifndef QT_MAC_USE_COCOA 4298 HIRect bounds = CGRectMake(wrectInParentCoordSys.
x(), wrectInParentCoordSys.
y(),
4299 wrectInParentCoordSys.
width(), wrectInParentCoordSys.
height());
4304 NSRect bounds = NSMakeRect(wrectInParentCoordSys.
x(), wrectInParentCoordSys.
y(),
4305 wrectInParentCoordSys.
width(), wrectInParentCoordSys.
height());
4306 [nsview setFrame:bounds];
4315 nativeParent->
update(dirtyWRect);
4322 #ifndef QT_MAC_USE_COCOA 4326 [nsview setHidden:NO];
4334 #ifndef QT_MAC_USE_COCOA 4336 if (!validRange.
contains(wrectInParentCoordSys)) {
4338 QPoint screenOffset(0, 0);
4340 while (parentWidget && !parentWidget->
isWindow()) {
4349 wrectInParentCoordSys &=cropRect;
4350 wrect = wrectInParentCoordSys;
4353 #endif //QT_MAC_USE_COCOA 4357 bool outsideRange = !wrectInParentCoordSys.
isValid();
4358 bool mapWindow =
false;
4362 #ifndef QT_MAC_USE_COCOA 4366 [nsview setHidden:YES];
4369 }
else if (!q->isHidden()) {
4388 w->d_func()->setWSGeometry();
4392 #ifndef QT_MAC_USE_COCOA 4400 NSRect bounds = NSMakeRect(
4401 wrectInParentCoordSys.
x(), wrectInParentCoordSys.
y(),
4402 wrectInParentCoordSys.
width(), wrectInParentCoordSys.
height());
4403 [nsview setFrame:bounds];
4417 const bool sizeUnchanged = oldRect.
size() == wrectInParentCoordSys.
size();
4418 const bool posUnchanged = oldRect.
topLeft() == wrectInParentCoordSys.
topLeft();
4425 nativeParent->
update(dirtyOldWRect | dirtyNewWRect);
4428 nativeParent->
update(dirtyNewWRect - dirtyOldWRect);
4430 nativeParent->
update(dirtyOldWRect | dirtyNewWRect);
4435 if (mapWindow && !dontShow) {
4437 #ifndef QT_MAC_USE_COCOA 4441 [nsview setHidden:NO];
4446 void QWidgetPrivate::adjustWithinMaxAndMinSize(
int &w,
int &h)
4467 if (isRealWindow()) {
4473 void QWidgetPrivate::applyMaxAndMinSizeOnWindow()
4478 const float max_f(20000);
4479 #ifndef QT_MAC_USE_COCOA 4480 #define SF(x) ((x > max_f) ? max_f : x) 4486 #define SF(x) ((x > max_f) ? max_f : x) 4504 bool realWindow = isRealWindow();
4507 adjustWithinMaxAndMinSize(w, h);
4508 #ifndef QT_MAC_USE_COCOA 4509 if (w != 0 && h != 0) {
4512 Rect r; SetRect(&r, x, y, x + w, y + h);
4516 setGeometry_sys_helper(x, y, w, h, isMove);
4519 if (!isMove && !q->testAttribute(
Qt::WA_Moved) && !q->isVisible()) {
4526 x = p->geometry().center().x() - (w / 2);
4527 y = p->geometry().center().y() - (h / 2);
4530 x = availGeo.
center().
x() - (w / 2);
4531 y = availGeo.
center().
y() - (h / 2);
4535 QSize olds = q->size();
4536 const bool isResize = (olds !=
QSize(w, h));
4549 if (currTopLeft.
x() == x && currTopLeft.
y() == y
4550 && cocoaFrameRect.size.width != 0
4551 && cocoaFrameRect.size.height != 0) {
4552 [window setFrame:cocoaFrameRect
display:realWindow];
4560 cocoaFrameRect.origin.
y += 1;
4561 [window setFrame:cocoaFrameRect
display:realWindow];
4562 cocoaFrameRect.origin.y -= 1;
4563 [window setFrameOrigin:cocoaFrameRect.origin];
4567 setGeometry_sys_helper(x, y, w, h, isMove);
4570 topLevelAt_cache = 0;
4573 void QWidgetPrivate::setGeometry_sys_helper(
int x,
int y,
int w,
int h,
bool isMove)
4576 bool realWindow = isRealWindow();
4579 QSize olds = q->size();
4585 const bool isResize = (olds !=
QSize(w, h));
4587 if (!realWindow && !isResize &&
QPoint(x, y) == oldp)
4593 const bool visible = q->isVisible();
4597 adjustWithinMaxAndMinSize(w, h);
4598 qt_mac_update_sizer(q);
4600 #ifndef QT_MAC_USE_COCOA 4605 ChangeWindowAttributes(window, kWindowNoAttributes, kWindowFullZoomAttribute);
4607 ChangeWindowAttributes(window, kWindowFullZoomAttribute, kWindowNoAttributes);
4610 HIRect bounds = CGRectMake(0, 0, w, h);
4616 const QRect oldRect(oldp, olds);
4618 moveRect(oldRect, x - oldp.
x(), y - oldp.
y());
4620 setWSGeometry(
false, oldRect);
4626 if(isMove || isResize) {
4628 if(isMove && q->pos() != oldp)
4637 if(isMove && q->pos() != oldp) {
4648 updateMaximizeButton_sys();
4649 applyMaxAndMinSizeOnWindow();
4652 void QWidgetPrivate::updateMaximizeButton_sys()
4660 #ifdef QT_MAC_USE_COCOA 4662 NSButton *maximizeButton = [window standardWindowButton:NSWindowZoomButton];
4668 if (!tlwExtra->savedWindowAttributesFromMaximized) {
4669 #ifndef QT_MAC_USE_COCOA 4670 GetWindowAttributes(window,
4671 (WindowAttributes*)&
extra->
topextra->savedWindowAttributesFromMaximized);
4674 tlwExtra->savedWindowAttributesFromMaximized = (![maximizeButton isHidden] && [maximizeButton isEnabled]);
4677 #ifndef QT_MAC_USE_COCOA 4678 ChangeWindowAttributes(window, kWindowNoAttributes, kWindowFullZoomAttribute);
4680 [maximizeButton setEnabled:NO];
4685 if (tlwExtra->savedWindowAttributesFromMaximized) {
4686 #ifndef QT_MAC_USE_COCOA 4687 ChangeWindowAttributes(window,
4689 kWindowNoAttributes);
4691 [maximizeButton setEnabled:YES];
4693 tlwExtra->savedWindowAttributesFromMaximized = 0;
4723 static int accelEnv = -1;
4724 if (accelEnv == -1) {
4729 QRect validScrollRect = qscrollRect.
isValid() ? qscrollRect : q->rect();
4734 const bool accelerateScroll = accelEnv &&
isOpaque && !overlapped;
4735 const bool isAlien = (q->internalWinId() == 0);
4742 if (!q->updatesEnabled()) {
4745 if (!scrollChildren || q->children().isEmpty())
4749 if (!accelerateScroll) {
4751 QRegion region(validScrollRect);
4755 update_sys(qscrollRect);
4759 #ifdef QT_MAC_USE_COCOA 4773 const QPoint scrollDelta(dx, dy);
4774 if (scrollChildren) {
4777 for (
int i=0; i<children.
size(); i++) {
4779 if (
QWidget *w = qobject_cast<QWidget*>(obj)) {
4782 #ifndef QT_MAC_USE_COCOA 4790 HIViewSetDrawingEnabled(hiview,
false);
4791 HIViewSetFrame(hiview, &bounds);
4793 HIViewSetDrawingEnabled(hiview,
true);
4798 [view setFrame:NSMakeRect(
4813 #ifndef QT_MAC_USE_COCOA 4815 HIRect scrollrect = CGRectMake(qscrollRect.
x(), qscrollRect.
y(), qscrollRect.
width(), qscrollRect.
height());
4819 qWarning(
"QWidget::scroll: Your rectangle was too big for the widget, clipping rect");
4820 scrollrect = CGRectMake(
qMax(qscrollRect.
x(), 0),
qMax(qscrollRect.
y(), 0),
4837 deltaXRect.
setY(validScrollRect.
y());
4840 deltaXRect.
setX(validScrollRect.
x());
4843 deltaXRect.
setX(validScrollRect.
x() + validScrollRect.
width() + dx);
4850 deltaYRect.
setX(validScrollRect.
x());
4853 deltaYRect.
setY(validScrollRect.
y());
4856 deltaYRect.
setY(validScrollRect.
y() + validScrollRect.
height() + dy);
4863 QPoint scrollTopLeftInsideNative = nativeWidget->mapFromGlobal(q->mapToGlobal(validScrollRect.
topLeft()));
4864 validScrollRect.
moveTo(scrollTopLeftInsideNative);
4868 NSRect nsscrollRect = NSMakeRect(
4869 validScrollRect.
x() + (dx < 0 ? -dx : 0),
4870 validScrollRect.
y() + (dy < 0 ? -dy : 0),
4871 validScrollRect.
width() + (dx > 0 ? -dx : 0),
4872 validScrollRect.
height() + (dy > 0 ? -dy : 0));
4874 NSSize deltaSize = NSMakeSize(dx, dy);
4884 const QVector<QRect> &dirtyRectsToScroll = dirtyOnWidget.rects();
4885 for (
int i=0; i<dirtyRectsToScroll.
size(); ++i) {
4886 QRect qdirtyRect = dirtyRectsToScroll[i];
4888 update_sys(qdirtyRect);
4894 update_sys(deltaXRect);
4896 update_sys(deltaYRect);
4898 #endif // QT_MAC_USE_COCOA 4901 for (
int i=0; i<movedChildren.
size(); i++) {
4912 return qRound(metric(PdmHeight) * 25.4 /
qreal(metric(PdmDpiY)));
4914 return qRound(metric(PdmWidth) * 25.4 /
qreal(metric(PdmDpiX)));
4917 #ifndef QT_MAC_USE_COCOA 4921 return (
int)rect.size.width;
4922 return (
int)rect.size.height; }
4934 case PdmPhysicalDpiX: {
4936 if (
d->extra &&
d->extra->customDpiX)
4937 return d->extra->customDpiX;
4939 return static_cast<QWidget *
>(
d->parent)->metric(m);
4943 case PdmPhysicalDpiY: {
4945 if (
d->extra &&
d->extra->customDpiY)
4946 return d->extra->customDpiY;
4948 return static_cast<QWidget *
>(
d->parent)->metric(m);
4952 qWarning(
"QWidget::metric: Unhandled parameter %d", m);
4960 #ifdef QT_MAC_USE_COCOA 4961 extra->imageMask = 0;
4967 #ifdef QT_MAC_USE_COCOA 4968 if (
extra->imageMask)
4969 CFRelease(
extra->imageMask);
4987 #ifndef QT_MAC_USE_COCOA 5008 #if QT_MAC_USE_COCOA 5011 NSRect frameW = [oswnd frame];
5013 NSRect frameC = [oswnd contentRectForFrameRect:frameW];
5015 (frameW.origin.y + frameW.size.height) - (frameC.origin.y + frameC.size.height),
5016 (frameW.origin.x + frameW.size.width) - (frameC.origin.x + frameC.size.width),
5017 frameC.origin.y - frameW.origin.y);
5030 #ifndef QT_MAC_USE_COCOA 5043 void QWidgetPrivate::registerTouchWindow(
bool enable)
5046 #ifdef QT_MAC_USE_COCOA 5047 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 5052 if (enable == touchEventsEnabled)
5060 ++view->alienTouchCount;
5061 if (view->alienTouchCount == 1) {
5062 touchEventsEnabled =
true;
5063 [view setAcceptsTouchEvents:YES];
5066 --view->alienTouchCount;
5067 if (view->alienTouchCount == 0) {
5068 touchEventsEnabled =
false;
5069 [view setAcceptsTouchEvents:NO];
5081 #ifndef QT_MAC_USE_COCOA 5087 if (!q->internalWinId())
5092 finishCocoaMaskSetup();
5097 topLevelAt_cache = 0;
5108 level =
qBound(0.0, level, 1.0);
5114 #if QT_MAC_USE_COCOA 5115 [oswindow setAlphaValue:level];
5117 SetWindowAlpha(oswindow, level);
5121 #ifdef QT_MAC_USE_COCOA 5122 void QWidgetPrivate::syncCocoaMask()
5129 if(
extra->maskBits.size() != q->size()) {
5133 extra->maskBits.setNumColors(2);
5141 finishCocoaMaskSetup();
5145 void QWidgetPrivate::finishCocoaMaskSetup()
5155 if (
extra->imageMask) {
5156 CFRelease(
extra->imageMask);
5157 extra->imageMask = 0;
5160 if (!
extra->maskBits.isNull()) {
5162 extra->maskBits.bits(),
5163 extra->maskBits.numBytes(),
5166 extra->imageMask = CGImageMaskCreate(
extra->maskBits.width(),
extra->maskBits.height(),
5167 1, 1,
extra->maskBits.bytesPerLine(), dataProvider,
5170 if (q->isWindow()) {
5173 [window invalidateShadow];
5175 macSetNeedsDisplay(
QRegion());
5207 const QWidget *
const primaryWindow = windowParent ? windowParent->
window() : 0;
5210 #ifdef QT_MAC_USE_COCOA 5212 bool alreadySheet = [windowRef styleMask] & NSDocModalWindowMask;
5216 if (!alreadySheet) {
5218 recreateMacWindow();
5221 if ([windowRef isKindOfClass:[NSPanel
class]]){
5226 bool isDialog = ref ? [ref isKindOfClass:[NSPanel
class]] :
false;
5227 bool worksWhenModal = isDialog ? [
static_cast<NSPanel *
>(ref) worksWhenModal] :
false;
5229 [
static_cast<NSPanel *
>(windowRef) setWorksWhenModal:YES];
5235 recreateMacWindow();
5243 if ([windowRef isKindOfClass:[NSPanel
class]])
5244 [
static_cast<NSPanel *
>(windowRef) setWorksWhenModal:YES];
5252 WindowClass old_wclass;
5253 GetWindowClass(windowRef, &old_wclass);
5255 if (modal || primaryWindowModal) {
5259 if (old_wclass != kSheetWindowClass){
5262 recreateMacWindow();
5267 if (old_wclass == kSheetWindowClass){
5270 recreateMacWindow();
5273 if (old_wclass == kDocumentWindowClass || old_wclass == kFloatingWindowClass || old_wclass == kUtilityWindowClass){
5278 WindowGroupRef group = GetWindowGroup(windowRef);
5279 HIWindowChangeClass(windowRef, kMovableModalWindowClass);
5280 quint32 tmpWattr = kWindowCloseBoxAttribute | kWindowHorizontalZoomAttribute;
5281 ChangeWindowAttributes(windowRef, tmpWattr, kWindowNoAttributes);
5282 ChangeWindowAttributes(windowRef, kWindowNoAttributes, tmpWattr);
5287 SetWindowGroup(windowRef, group);
5292 SetWindowModality(windowRef, kWindowModalityAppModal, 0);
5295 }
else if (windowRef) {
5296 if (old_wclass == kSheetWindowClass){
5298 recreateMacWindow();
5302 SetWindowModality(windowRef, kWindowModalityNone, 0);
5304 if (q->window()->d_func()->topData()->wattr |= kWindowCloseBoxAttribute)
5305 ChangeWindowAttributes(windowRef, kWindowCloseBoxAttribute, kWindowNoAttributes);
5306 if (q->window()->d_func()->topData()->wattr |= kWindowHorizontalZoomAttribute)
5307 ChangeWindowAttributes(windowRef, kWindowHorizontalZoomAttribute, kWindowNoAttributes);
5308 if (q->window()->d_func()->topData()->wattr |= kWindowCollapseBoxAttribute)
5309 ChangeWindowAttributes(windowRef, kWindowCollapseBoxAttribute, kWindowNoAttributes);
5312 WindowClass newClass = q->window()->d_func()->topData()->wclass;
5313 if (old_wclass != newClass && newClass != 0){
5314 WindowGroupRef group = GetWindowGroup(windowRef);
5315 HIWindowChangeClass(windowRef, newClass);
5320 SetWindowGroup(windowRef, group);
5326 SetAutomaticControlDragTrackingEnabledForWindow(windowRef,
true);
5327 macUpdateOpaqueSizeGrip();
5331 void QWidgetPrivate::macUpdateHideOnSuspend()
5336 #ifndef QT_MAC_USE_COCOA 5349 void QWidgetPrivate::macUpdateOpaqueSizeGrip()
5356 #ifndef QT_MAC_USE_COCOA // Growbox is always transparent on Cocoa. Can emulate with setting a QSizeGrip 5358 HIViewFindByID(HIViewGetRoot(
qt_mac_window_for(q)), kHIViewWindowGrowBoxID, &growBox);
5365 void QWidgetPrivate::macUpdateSizeAttribute()
5376 w->d_func()->macUpdateSizeAttribute();
5381 void QWidgetPrivate::macUpdateIgnoreMouseEvents()
5383 #ifndef QT_MAC_USE_COCOA // This is handled inside the mouse handler on Cocoa. 5396 #ifndef kHIViewFeatureIgnoresClicks 5397 #define kHIViewFeatureIgnoresClicks kHIViewIgnoresClicks 5408 void QWidgetPrivate::macUpdateMetalAttribute()
5411 bool realWindow = isRealWindow();
5416 #if QT_MAC_USE_COCOA 5420 if ([cocoaWindow styleMask] & NSTexturedBackgroundWindowMask)
5422 recreateMacWindow();
5429 ChangeWindowAttributes(
qt_mac_window_for(q), kWindowMetalNoContentSeparatorAttribute, 0);
5431 ChangeWindowAttributes(
qt_mac_window_for(q), 0, kWindowMetalNoContentSeparatorAttribute);
5440 void QWidgetPrivate::setEnabled_helper_sys(
bool enable)
5442 #ifdef QT_MAC_USE_COCOA 5445 if ([view isKindOfClass:[NSControl
class]])
5446 [
static_cast<NSControl *
>(view) setEnabled:enable];
T qobject_cast(QObject *object)
The QPainter class performs low-level painting on widgets and other paint devices.
The QColor class provides colors based on RGB, HSV or CMYK values.
static void jump(QtMsgType t, const char *m)
const struct __CFString * CFStringRef
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
void setHeight(int h)
Sets the height of the rectangle to the given height.
virtual void interrupt()=0
Interrupts event dispatching; i.
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
The QCursor class provides a mouse cursor with an arbitrary shape.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
QPointer< QWidget > widget
int flipYCoordinate(int y)
#define it(className, varName)
void qAddPostRoutine(QtCleanUpFunction p)
int count(const T &t) const
Returns the number of occurrences of value in the vector.
struct OpaqueWindowPtr * WindowRef
static QAbstractEventDispatcher * instance(QThread *thread=0)
Returns a pointer to the event dispatcher object for the specified thread.
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
The QPointF class defines a point in the plane using floating point precision.
int left() const
Returns the x-coordinate of the rectangle's left edge.
QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
int width() const
Returns the width of the rectangle.
The QList::const_iterator class provides an STL-style const iterator for QList and QQueue...
static LibLoadStatus status
struct CGImage * CGImageRef
bool exists() const
Returns true if the file exists; otherwise returns false.
static QApplicationPrivate * instance()
void * qt_mac_create_nsimage(const QPixmap &pm)
int count(const T &t) const
Returns the number of occurrences of value in the list.
QRect boundingRect() const
Returns the bounding rectangle of this region.
void moveTo(int x, int t)
Moves the rectangle, leaving the top-left corner at the given position (x, y).
QPointF flipPoint(const NSPoint &p)
int height() const
Returns the height of the rectangle.
void setY(int y)
Sets the top edge of the rectangle to the given y coordinate.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
The QHash class is a template class that provides a hash-table-based dictionary.
void update(const QRectF &rect=QRectF())
Schedules a redraw of the area covered by rect in this item.
The QVector class is a template class that provides a dynamic array.
The QObject class is the base class of all Qt objects.
float qt_mac_defaultDpi_y()
static QSize closestAcceptableSize(const QWidget *w, const QSize &s)
Returns a size that satisfies all size constraints on widget, including heightForWidth() and that is ...
QChar * data()
Returns a pointer to the data stored in the QString.
void setAutoDestruct(bool autoDestr)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool paintingActive() const
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
void macSendToolbarChangeEvent(QWidget *widget)
Q_CORE_EXPORT void qDebug(const char *,...)
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or 0 if there is no Qt widget there...
void setParent_helper(QObject *)
int width() const
Returns the width.
void append(const T &t)
Inserts value at the end of the list.
void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount of the given rectangles using the current pen and brush.
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool isActive() const
Returns true if the paint engine is actively drawing; otherwise returns false.
The QMoveEvent class contains event parameters for move events.
Q_GUI_EXPORT EGLDisplay display()
QPoint bottomRight() const
Returns the position of the rectangle's bottom-right corner.
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
struct OpaqueControlRef * HIViewRef
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
bool isNull() const
Returns true if both the x and y coordinates are set to 0, otherwise returns false.
The QResizeEvent class contains event parameters for resize events.
Q_CORE_EXPORT void qWarning(const char *,...)
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
static void clearColorSpace(QWidget *w)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QRegion class specifies a clip region for a painter.
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle's top-left corner to (x1, y1), and the coordinates of its botto...
void qt_mac_send_posted_gl_updates(QWidget *widget)
The QShowEvent class provides an event that is sent when a widget is shown.
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
void setSystemClip(const QRegion &baseClip)
Sets the system clip for this engine.
struct OpaqueRgnHandle * RgnHandle
void setX(int x)
Sets the left edge of the rectangle to the given x coordinate.
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
The QWindowSurface class provides the drawing area for top-level windows.
struct OpaqueEventRef * EventRef
void moveTopLeft(const QPoint &p)
Moves the rectangle, leaving the top-left corner at the given position.
const T & at(int i) const
Returns the item at index position i in the vector.
static QWidget * parentWidget(const QWidget *w)
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
~QPaintEngineCleanupHandler()
static QDragManager * self()
const char * constData() const
Returns a pointer to the data stored in the byte array.
QPoint center() const
Returns the center point of the rectangle.
bool unifiedTitleAndToolBarOnMac
whether the window uses the unified title and toolbar look on Mac OS X
static bool tryModalHelper(QWidget *widget, QWidget **rettop=0)
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
int top() const
Returns the y-coordinate of the rectangle's top edge.
The QWindowStateChangeEvent class provides the window state before a window state change...
int right() const
Returns the x-coordinate of the rectangle's right edge.
void setAlphaF(qreal alpha)
Sets the alpha of this color to alpha.
void setClipping(bool enable)
Enables clipping if enable is true, or disables clipping if enable is false.
int y() const
Returns the y-coordinate of the rectangle's top edge.
QWidget * currentTarget()
QPaintEngineCleanupHandler()
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)
float qt_mac_defaultDpi_x()
int x() const
Returns the x-coordinate of the rectangle's left edge.
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
bool qt_mac_app_fullscreen
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given widt...
The QPoint class defines a point in the plane using integer precision.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
const UInt32 kEventClassQt
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
The QMainWindow class provides a main application window.
int size() const
Returns the number of items in the list.
void setWidth(int w)
Sets the width of the rectangle to the given width.
void updateHIToolBarStatus()
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
struct OpaqueHIObjectRef * HIObjectRef
QString objectName() const
int height() const
Returns the height.
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
const QObjectList & children() const
Returns a list of child objects.
static void dispatchEnterLeave(QWidget *enter, QWidget *leave)
virtual int metric(PaintDeviceMetric metric) const
int y() const
Returns the y coordinate of this point.
The QPixmap class is an off-screen image representation that can be used as a paint device...
void qt_syncCocoaTitleBarButtons(OSWindowRef window, QWidget *widgetForWindow)
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
static const MacVersion MacintoshVersion
the version of the Macintosh operating system on which the application is run (Mac only)...
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
The QSize class defines the size of a two-dimensional object using integer point precision.
T * data()
Returns a pointer to the data stored in the vector.
struct OpaqueEventHandlerCallRef * EventHandlerCallRef
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
int x() const
Returns the x coordinate of this point.
struct CGContext * CGContextRef
static QGraphicsSystem * graphicsSystem()
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
The QFileInfo class provides system-independent file information.
The QPaintEvent class contains event parameters for paint events.
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
The QIconDragEvent class indicates that a main icon drag has begun.
The QEvent class is the base class of all event classes.
#define qPrintable(string)
static void leaveModal(QWidget *)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
int size() const
Returns the number of items in the vector.
const QBrush & window() const
Returns the window (general background) brush of the current color group.
Q_DECL_CONSTEXPR int qRound(qreal d)
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
static QWidget * dropWidget
qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, 0, &widgetToGetTouch)
struct OpaqueIconRef * IconRef
static Qt::KeyboardModifiers oldstate
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
The QIcon class provides scalable icons in different modes and states.