76 #include <Cocoa/Cocoa.h> 108 #include "private/qmacinputcontext_p.h" 109 #include "private/qpaintengine_mac_p.h" 110 #include "private/qcursor_p.h" 111 #include "private/qapplication_p.h" 112 #include "private/qcolor_p.h" 113 #include "private/qwidget_p.h" 114 #include "private/qkeymapper_p.h" 115 #include "private/qeventdispatcher_mac_p.h" 116 #include "private/qeventdispatcher_unix_p.h" 117 #include <private/qcocoamenuloader_mac_p.h> 118 #include <private/qcocoaapplication_mac_p.h> 119 #include <private/qcocoaapplicationdelegate_mac_p.h> 120 #include <private/qt_cocoa_helpers_mac_p.h> 121 #include <private/qcocoawindow_mac_p.h> 122 #include <private/qpixmap_mac_p.h> 123 #include <private/qdesktopwidget_mac_p.h> 124 #include <private/qeventdispatcher_mac_p.h> 127 #ifndef QT_NO_ACCESSIBILITY 137 #include <sys/time.h> 138 #include <sys/select.h> 149 #define QMAC_SPEAK_TO_ME 150 #ifdef QMAC_SPEAK_TO_ME 154 #ifndef kThemeBrushAlternatePrimaryHighlightColor 155 #define kThemeBrushAlternatePrimaryHighlightColor -5 158 #define kCMDeviceUnregisteredNotification CFSTR("CMDeviceUnregisteredNotification") 159 #define kCMDefaultDeviceNotification CFSTR("CMDefaultDeviceNotification") 160 #define kCMDeviceProfilesNotification CFSTR("CMDeviceProfilesNotification") 161 #define kCMDefaultDeviceProfileNotification CFSTR("CMDefaultDeviceProfileNotification") 190 #ifndef QT_MAC_USE_COCOA 196 #if defined(QT_DEBUG) 199 #ifndef QT_MAC_USE_COCOA 229 #ifdef QT_MAC_USE_COCOA 234 temp.
mkdir(
"qt_menu.nib");
236 if (!
QDir(nibDir).exists()) {
237 qWarning(
"qt_mac_loadMenuNib: could not create nib directory in temp");
242 QDir nibResource(
":/trolltech/mac/qt_menu.nib/");
243 if (!nibResource.exists()) {
244 qWarning(
"qt_mac_loadMenuNib: could not load nib from resources");
247 foreach (
const QFileInfo &file, nibResource.entryInfoList())
251 NSURL *nibUrl = [NSURL fileURLWithPath :
const_cast<NSString *
>(
reinterpret_cast<const NSString *
>(
QCFString::toCFStringRef(nibDir)))];
252 NSNib *nib = [[NSNib alloc] initWithContentsOfURL : nibUrl];
255 qWarning(
"qt_mac_loadMenuNib: could not load nib from temp");
258 bool ok = [nib instantiateNibWithOwner : qtMenuLoader topLevelObjects : nil];
260 qWarning(
"qt_mac_loadMenuNib: could not instantiate nib");
269 image.
fill(0xffffffff);
274 const int *bits = (
const int *) ((
const QImage &) image).bits();
276 for (
int y=0; y<w; ++y) {
277 for (
int x=0; x<h; ++x) {
278 int r =
qRed(bits[x]);
280 int b =
qBlue(bits[x]);
281 if (r != g || r != b) {
293 AEDesc scriptTextDesc;
294 ComponentInstance theComponent = 0;
295 OSAID scriptID = kOSANullScript, resultID = kOSANullScript;
298 AECreateDesc(typeNull, 0, 0, &scriptTextDesc);
299 scriptID = kOSANullScript;
300 resultID = kOSANullScript;
303 theComponent = OpenDefaultComponent(kOSAComponentType, typeAppleScript);
310 err = AECreateDesc(typeUTF8Text, script, script_len, &scriptTextDesc);
315 err = OSACompile(theComponent, &scriptTextDesc, kOSAModeNull, &scriptID);
320 err = OSAExecute(theComponent, scriptID, kOSANullScript, kOSAModeNull, &resultID);
324 AECreateDesc(typeNull, 0, 0, ret);
325 if (err == errOSAScriptError)
326 OSAScriptError(theComponent, kOSAErrorMessage, typeChar, ret);
327 else if (err == noErr && resultID != kOSANullScript)
328 OSADisplay(theComponent, resultID, typeChar, kOSAModeNull, ret);
331 AEDisposeDesc(&scriptTextDesc);
332 if (scriptID != kOSANullScript)
333 OSADispose(theComponent, scriptID);
334 if (resultID != kOSANullScript)
335 OSADispose(theComponent, resultID);
337 CloseComponent(theComponent);
354 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) 355 const bool resized = flags & kCGDisplayDesktopShapeChangedFlag;
358 const bool resized =
true;
360 if (resized &&
qApp) {
369 #ifdef DEBUG_PLATFORM_SETTINGS 372 const char *
const groups[] = {
"Active",
"Disabled",
"Inactive" };
373 const char *
const roles[] = {
"WindowText",
"Button",
"Light",
"Midlight",
"Dark",
"Mid",
374 "Text",
"BrightText",
"ButtonText",
"Base",
"Window",
"Shadow",
375 "Highlight",
"HighlightedText",
"Link",
"LinkVisited" };
382 qDebug(
" %s::%s %d::%d::%d [%p]%s", groups[grp], roles[role], b.
color().
red(),
390 #define qt_mac_debug_palette(x, y, z) 394 #ifndef QT_MAC_USE_COCOA 395 static NMRec
qt_mac_notification = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
399 #ifndef QT_MAC_USE_COCOA 401 qt_mac_notification.nmMark = 1;
402 qt_mac_notification.qType = nmType;
403 NMInstall(&qt_mac_notification);
406 [[NSApplication sharedApplication] requestUserAttention:NSInformationalRequest];
412 #ifndef QT_MAC_USE_COCOA 413 NMRemove(&qt_mac_notification);
416 [[NSApplication sharedApplication] cancelUserAttentionRequest:NSInformationalRequest];
420 #ifndef QT_MAC_USE_COCOA 429 OSStatus err = FindWindowOfClass(&p, kAllWindowClasses, &wp, &wpc);
440 qWarning(
"QApplication: qt_mac_window_at: Couldn't find %d",(
int)wp);
453 #ifndef QT_MAC_USE_COCOA 455 RestoreApplicationDockTileImage();
458 SetApplicationDockTileImage(img);
463 NSImage *image = NULL;
466 image = [[NSImage imageNamed:
@"NSApplicationIcon"] retain];
471 [NSApp setApplicationIconImage:image];
479 qWarning(
"qt_mac_set_press_and_hold_context: This functionality is no longer available");
484 #if defined(QT_DEBUG) 496 static bool needToPolish =
true;
499 needToPolish =
false;
509 appleValue = appleSettings.
value(
QLatin1String(
"AppleScrollerPagingBehavior"),
false);
513 appleValue = appleSettings.
value(
QLatin1String(
"AppleMiniaturizeOnDoubleClick"),
true);
521 #ifdef DEBUG_PLATFORM_SETTINGS 522 qDebug(
"qt_mac_update_os_settings *********************************************************************");
556 #ifdef DEBUG_PLATFORM_SETTINGS 562 #ifdef DEBUG_PLATFORM_SETTINGS 563 qDebug(
"qt-internal: Font for Application [%s::%d::%d::%d]",
571 FontMap(
const char *qc,
short fk) : qt_class(qc), font_key(fk) { }
572 const char *
const qt_class;
574 } mac_widget_fonts[] = {
575 FontMap(
"QPushButton", kThemePushButtonFont),
576 FontMap(
"QListView", kThemeViewsFont),
577 FontMap(
"QListBox", kThemeViewsFont),
578 FontMap(
"QTitleBar", kThemeWindowTitleFont),
579 FontMap(
"QMenuBar", kThemeMenuTitleFont),
580 FontMap(
"QMenu", kThemeMenuItemFont),
581 FontMap(
"QComboMenuItem", kThemeSystemFont),
582 FontMap(
"QHeaderView", kThemeSmallSystemFont),
583 FontMap(
"Q3Header", kThemeSmallSystemFont),
584 FontMap(
"QTipLabel", kThemeSmallSystemFont),
585 FontMap(
"QLabel", kThemeSystemFont),
586 FontMap(
"QToolButton", kThemeSmallSystemFont),
587 FontMap(
"QMenuItem", kThemeMenuItemFont),
588 FontMap(
"QComboLineEdit", kThemeViewsFont),
589 FontMap(
"QSmallFont", kThemeSmallSystemFont),
590 FontMap(
"QMiniFont", kThemeMiniSystemFont),
592 for(
int i = 0; mac_widget_fonts[i].qt_class; i++) {
594 bool set_font =
true;
598 = hash->
constFind(mac_widget_fonts[i].qt_class);
600 set_font = (fnt != *it);
604 #ifdef DEBUG_PLATFORM_SETTINGS 605 qDebug(
"qt-internal: Font for %s [%s::%d::%d::%d]", mac_widget_fonts[i].qt_class,
612 #ifdef DEBUG_PLATFORM_SETTINGS 613 qDebug(
"qt_mac_update_os_settings END !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
621 inline PaletteMap(
const char *qc, ThemeBrush
a, ThemeBrush i) :
622 qt_class(qc), active(a), inactive(i) { }
623 const char *
const qt_class;
624 ThemeBrush active, inactive;
625 } mac_widget_colors[] = {
626 PaletteMap(
"QToolButton", kThemeTextColorBevelButtonActive, kThemeTextColorBevelButtonInactive),
627 PaletteMap(
"QAbstractButton", kThemeTextColorPushButtonActive, kThemeTextColorPushButtonInactive),
628 PaletteMap(
"QHeaderView", kThemeTextColorPushButtonActive, kThemeTextColorPushButtonInactive),
629 PaletteMap(
"Q3Header", kThemeTextColorPushButtonActive, kThemeTextColorPushButtonInactive),
630 PaletteMap(
"QComboBox", kThemeTextColorPopupButtonActive, kThemeTextColorPopupButtonInactive),
631 PaletteMap(
"QAbstractItemView", kThemeTextColorListView, kThemeTextColorDialogInactive),
632 PaletteMap(
"QMessageBoxLabel", kThemeTextColorAlertActive, kThemeTextColorAlertInactive),
633 PaletteMap(
"QTabBar", kThemeTextColorTabFrontActive, kThemeTextColorTabFrontInactive),
634 PaletteMap(
"QLabel", kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive),
635 PaletteMap(
"QGroupBox", kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive),
636 PaletteMap(
"QMenu", kThemeTextColorPopupLabelActive, kThemeTextColorPopupLabelInactive),
637 PaletteMap(
"QTextEdit", 0, 0),
638 PaletteMap(
"QTextControl", 0, 0),
639 PaletteMap(
"QLineEdit", 0, 0),
640 PaletteMap(0, 0, 0) };
642 for(
int i = 0; mac_widget_colors[i].qt_class; i++) {
644 if (mac_widget_colors[i].active != 0) {
657 if (!strcmp(mac_widget_colors[i].qt_class,
"QMenu")) {
664 }
else if (!strcmp(mac_widget_colors[i].qt_class,
"QAbstractButton")
665 || !strcmp(mac_widget_colors[i].qt_class,
"QHeaderView")
666 || !strcmp(mac_widget_colors[i].qt_class,
"Q3Header")) {
673 }
else if (!strcmp(mac_widget_colors[i].qt_class,
"QAbstractItemView")) {
684 }
else if (!strcmp(mac_widget_colors[i].qt_class,
"QTextEdit")
685 || !strcmp(mac_widget_colors[i].qt_class,
"QTextControl")) {
690 }
else if (!strcmp(mac_widget_colors[i].qt_class,
"QLineEdit")) {
695 bool set_palette =
true;
699 = phash->
constFind(mac_widget_colors[i].qt_class);
701 set_palette = (pal != *it);
705 #ifdef DEBUG_PLATFORM_SETTINGS 718 #ifndef QT_MAC_USE_COCOA 725 if (IsEventInQueue(GetMainEventQueue(), event))
726 RemoveEventFromQueue(GetMainEventQueue(), event);
735 if (IsEventInQueue(GetMainEventQueue(), event))
736 RemoveEventFromQueue(GetMainEventQueue(), event);
745 #ifndef QT_MAC_USE_COCOA 751 #ifdef QT_MAC_USE_COCOA 754 modalDelegate:nil didEndSelector:nil contextInfo:0];
758 kEventAttributeUserEvent, &request_showsheet_pending);
760 PostEventToQueue(GetMainEventQueue(), request_showsheet_pending, kEventPriorityStandard);
781 for (;it !=
end; ++
it) {
795 for (;it !=
end; ++
it) {
796 QWidget *glWidget = it->widget;
809 #ifndef QT_MAC_USE_COCOA 823 for (;it !=
end; ++
it){
824 QWidget *glWidget = it->widget;
826 if (globalWidgetRect.
intersects(globalGlWidgetRect)) {
828 it->lastUpdateWidget =
widget;
829 }
else if (it->lastUpdateWidget == widget) {
834 it->lastUpdateWidget = 0;
848 if(request_window_change_pending)
852 kEventAttributeUserEvent, &request_window_change_pending);
853 PostEventToQueue(GetMainEventQueue(), request_window_change_pending, kEventPriorityHigh);
927 #ifndef QT_MAC_USE_COCOA 932 #ifndef QT_MAC_USE_COCOA 933 if (request_menubarupdate_pending) {
934 if (IsEventInQueue(GetMainEventQueue(), request_menubarupdate_pending))
936 #ifdef DEBUG_DROPPED_EVENTS 937 qDebug(
"%s:%d Whoa, we dropped an event on the floor!", __FILE__, __LINE__);
942 kEventAttributeUserEvent, &request_menubarupdate_pending);
943 PostEventToQueue(GetMainEventQueue(), request_menubarupdate_pending, kEventPriorityHigh);
951 #ifndef QT_MAC_USE_COCOA 961 kEventAttributeUserEvent, where);
964 PostEventToQueue(GetMainEventQueue(), *where, kEventPriorityStandard);
980 #ifndef QT_MAC_USE_COCOA 985 AESend(&ae, &reply, kAENoReply, kAENormalPriority, kAEDefaultTimeout, 0, 0);
993 qt_mac_dock_menu = menu;
994 #ifdef QT_MAC_USE_COCOA 995 [NSApp setDockMenu:menu->
macMenu()];
997 SetApplicationDockTileMenu(menu->
macMenu());
1005 #ifndef QT_MAC_USE_COCOA 1009 if (w == qt_mac_dock_menu) {
1010 qt_mac_dock_menu = 0;
1011 #ifndef QT_MAC_USE_COCOA 1012 SetApplicationDockTileMenu(0);
1014 [NSApp setDockMenu:0];
1024 { kCoreEventClass, kAEQuitApplication },
1025 { kCoreEventClass, kAEOpenDocuments },
1026 { kInternetEventClass, kAEGetURL },
1029 #ifndef QT_MAC_USE_COCOA 1031 #if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5) 1048 { kEventClassWindow, kEventWindowActivated },
1049 { kEventClassWindow, kEventWindowDeactivated },
1052 { kEventClassMouse, kEventMouseWheelMoved },
1053 { kEventClassMouse, kEventMouseDown },
1054 { kEventClassMouse, kEventMouseUp },
1055 { kEventClassMouse, kEventMouseDragged },
1056 { kEventClassMouse, kEventMouseMoved },
1058 { kEventClassTablet, kEventTabletProximity },
1060 { kEventClassApplication, kEventAppActivated },
1061 { kEventClassApplication, kEventAppDeactivated },
1062 { kEventClassApplication, kEventAppAvailableWindowBoundsChanged },
1065 { kEventClassKeyboard, kEventRawKeyModifiersChanged },
1066 { kEventClassKeyboard, kEventRawKeyRepeat },
1067 { kEventClassKeyboard, kEventRawKeyUp },
1068 { kEventClassKeyboard, kEventRawKeyDown },
1070 { kEventClassCommand, kEventCommandProcess },
1072 { kEventClassAppleEvent, kEventAppleEvent },
1074 { kAppearanceEventClass, kAEAppearanceChanged }
1080 GetEventTypeCount(app_events), app_events, (
void *)
qApp,
1083 #endif // QT_MAC_USE_COCOA 1087 EventTypeSpec tabletProximityEvent = { kEventClassTablet, kEventTabletProximity };
1102 ProcessSerialNumber psn;
1105 CopyProcessName(&psn, &cfstr);
1114 #ifndef QT_MAC_USE_COCOA 1132 CFNotificationCenterRef
center = CFNotificationCenterGetDistributedCenter();
1135 CFNotificationSuspensionBehaviorDeliverImmediately);
1138 CFNotificationSuspensionBehaviorDeliverImmediately);
1141 CFNotificationSuspensionBehaviorDeliverImmediately);
1144 CFNotificationSuspensionBehaviorDeliverImmediately);
1145 ProcessSerialNumber psn;
1146 if (GetCurrentProcess(&psn) == noErr) {
1154 bool forceTransform =
true;
1155 CFTypeRef value = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(),
1156 CFSTR(
"LSUIElement"));
1158 CFTypeID valueType = CFGetTypeID(value);
1161 if (valueType == CFStringGetTypeID())
1163 else if (valueType == CFBooleanGetTypeID())
1164 forceTransform = !CFBooleanGetValue(static_cast<CFBooleanRef>(value));
1165 else if (valueType == CFNumberGetTypeID()) {
1167 CFNumberGetValue(static_cast<CFNumberRef>(value), kCFNumberIntType, &valueAsInt);
1168 forceTransform = !valueAsInt;
1172 if (forceTransform) {
1173 value = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(),
1174 CFSTR(
"LSBackgroundOnly"));
1176 CFTypeID valueType = CFGetTypeID(value);
1177 if (valueType == CFBooleanGetTypeID())
1178 forceTransform = !CFBooleanGetValue(static_cast<CFBooleanRef>(value));
1179 else if (valueType == CFStringGetTypeID())
1181 else if (valueType == CFNumberGetTypeID()) {
1183 CFNumberGetValue(static_cast<CFNumberRef>(value), kCFNumberIntType, &valueAsInt);
1184 forceTransform = !valueAsInt;
1190 if (forceTransform) {
1191 TransformProcessType(&psn, kProcessTransformToForegroundApplication);
1196 char **argv = priv->
argv;
1199 if (
int argc = priv->
argc) {
1202 for(i=1; i < argc; i++) {
1203 if (argv[i] && *argv[i] !=
'-') {
1204 argv[j++] = argv[i];
1208 #if defined(QT_DEBUG) 1209 if (arg ==
"-nograb")
1213 if (arg.
left(5) ==
"-psn_") {
1216 argv[j++] = argv[i];
1219 if (j < priv->argc) {
1228 kCFURLPOSIXPathStyle));
1242 #ifndef QT_NO_ACCESSIBILITY 1251 #ifndef QT_MAC_USE_COCOA 1264 AEEventHandlerUPP current_handler = NULL;
1266 if (!current_handler)
1281 #ifdef QT_MAC_USE_COCOA 1283 qt_redirectNSApplicationSendEvent();
1286 id oldDelegate = [cocoaApp delegate];
1289 [newDelegate setQtPrivate:
priv];
1292 [newDelegate setReflectionDelegate:oldDelegate];
1293 [cocoaApp setDelegate:newDelegate];
1296 qt_mac_loadMenuNib(qtMenuLoader);
1298 [cocoaApp setMenu:[qtMenuLoader menu]];
1299 [newDelegate setMenuLoader:qtMenuLoader];
1331 CFNotificationCenterRef
center = CFNotificationCenterGetDistributedCenter();
1337 #ifndef QT_MAC_USE_COCOA 1346 #ifdef QT_MAC_USE_COCOA 1347 qt_resetNSApplicationSendEvent();
1356 #ifndef QT_NO_ACCESSIBILITY 1365 if (qt_mac_safe_pdev) {
1367 qt_mac_safe_pdev = 0;
1393 void QApplication::setMainWidget(
QWidget *mainWidget)
1401 #ifndef QT_NO_CURSOR 1409 qApp->d_func()->cursor_list.prepend(cursor);
1411 #ifdef QT_MAC_USE_COCOA 1421 if (
qApp->d_func()->cursor_list.isEmpty())
1423 qApp->d_func()->cursor_list.removeFirst();
1425 #ifdef QT_MAC_USE_COCOA 1428 if (
qApp &&
qApp->activeWindow()) {
1434 #endif // QT_NO_CURSOR 1443 #ifndef QT_MAC_USE_COCOA 1452 return topLevelAt_cache;
1457 NSInteger windowCount;
1458 NSCountWindows(&windowCount);
1459 if (windowCount <= 0)
1463 NSWindowList(windowCount, windowList.
data());
1464 int firstQtWindowFound = -1;
1465 for (
int i = 0; i < windowCount; ++i) {
1466 NSWindow *
window = [NSApp windowWithWindowNumber:windowList[i]];
1469 if (candidateWindow && firstQtWindowFound == -1)
1470 firstQtWindowFound = i;
1472 if (NSPointInRect(cocoaPoint, [window frame])) {
1475 if (candidateWindow && !candidateWindow->
mask().
isEmpty()) {
1480 return candidateWindow;
1482 if (i == firstQtWindowFound) {
1486 topLevelAt_cache = candidateWindow;
1488 return candidateWindow;
1494 topLevelAt_cache = 0;
1508 #ifdef QT_MAC_USE_COCOA 1513 #ifdef DEBUG_MODAL_EVENTS 1516 widget, qt_modal_stack ? (int)qt_modal_stack->
count() : -1);
1518 if (!qt_modal_stack)
1521 dispatchEnterLeave(0, qt_last_mouse_receiver);
1522 qt_last_mouse_receiver = 0;
1524 qt_modal_stack->
insert(0, widget);
1530 #ifdef QT_MAC_USE_COCOA 1532 QEventDispatcherMacPrivate::beginModalSession(widget);
1538 if (qt_modal_stack && qt_modal_stack->
removeAll(widget)) {
1539 #ifdef DEBUG_MODAL_EVENTS 1543 if (qt_modal_stack->
isEmpty()) {
1553 dispatchEnterLeave(w, qt_last_mouse_receiver);
1554 qt_last_mouse_receiver = w;
1556 #ifdef QT_MAC_USE_COCOA 1558 QEventDispatcherMacPrivate::endModalSession(widget);
1561 #ifdef DEBUG_MODAL_EVENTS 1571 #ifndef QT_MAC_USE_COCOA 1573 if(
OSWindowRef wp = GetFrontWindowOfClass(kSheetWindowClass,
true)) {
1582 #ifndef QT_MAC_USE_COCOA 1595 bool block_event =
false;
1598 switch (GetEventClass(event)) {
1599 case kEventClassMouse:
1600 case kEventClassKeyboard:
1611 #ifdef DEBUG_MODAL_EVENTS 1612 qDebug(
"%s:%d -- final decision! (%s)", __FILE__, __LINE__, block_event ?
"false" :
"true");
1614 return !block_event;
1621 OSType eventClass = GetEventClass(carbonEvent);
1622 UInt32 eventKind = GetEventKind(carbonEvent);
1623 if (eventClass != kEventClassTablet || eventKind != kEventTabletProximity)
1624 return eventNotHandledErr;
1627 ::TabletProximityRec proxRec;
1628 GetEventParameter(carbonEvent, kEventParamTabletProximityRec, typeTabletProximityRec, 0,
1629 sizeof(proxRec), 0, &proxRec);
1637 #ifndef QT_MAC_USE_COCOA 1651 bool handled_event=
true;
1652 UInt32 ekind = GetEventKind(event), eclass = GetEventClass(event);
1657 request_showsheet_pending = 0;
1660 sizeof(widget), 0, &widget);
1674 ShowHide(window,
true);
1693 if ((send = (event == request_context_pending)))
1700 sizeof(widget), 0, &widget);
1707 if(widget && !isBlockedByModal(widget)) {
1711 const Qt::KeyboardModifiers keyboardModifiers =
qt_mac_get_modifiers(GetCurrentEventKeyModifiers());
1719 handled_event =
false;
1723 handled_event =
false;
1726 case kEventClassTablet:
1728 case kEventTabletProximity:
1730 ::TabletProximityRec proxRec;
1731 GetEventParameter(event, kEventParamTabletProximityRec, typeTabletProximityRec, 0,
1732 sizeof(proxRec), 0, &proxRec);
1736 case kEventClassMouse:
1738 static const int kEventParamQAppSeenMouseEvent =
'QASM';
1742 if (GetEventParameter(event, kEventParamQAppSeenMouseEvent,
1743 typeBoolean, 0,
sizeof(
bool), 0, &seenEvent) == noErr) {
1745 return eventNotHandledErr;
1748 SetEventParameter(event, kEventParamQAppSeenMouseEvent, typeBoolean,
1749 sizeof(
bool), &seenEvent);
1752 bool inNonClientArea =
false;
1753 GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, 0,
1754 sizeof(where), 0, &where);
1755 #if defined(DEBUG_MOUSE_MAPS) 1756 const char *edesc = 0;
1758 case kEventMouseDown: edesc =
"MouseButtonPress";
break;
1759 case kEventMouseUp: edesc =
"MouseButtonRelease";
break;
1760 case kEventMouseDragged:
case kEventMouseMoved: edesc =
"MouseMove";
break;
1762 case kEventMouseWheelMoved: edesc =
"MouseWheelMove";
break;
1764 if(ekind == kEventMouseDown || ekind == kEventMouseUp)
1765 qDebug(
"Handling mouse: %s", edesc);
1768 Qt::KeyboardModifiers modifiers;
1770 UInt32 mac_modifiers = 0;
1771 GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0,
1772 sizeof(mac_modifiers), 0, &mac_modifiers);
1777 UInt32 mac_buttons = 0;
1778 GetEventParameter(event, kEventParamMouseChord, typeUInt32, 0,
1779 sizeof(mac_buttons), 0, &mac_buttons);
1780 if (ekind != kEventMouseWheelMoved)
1786 int wheel_deltaX = 0;
1787 int wheel_deltaY = 0;
1788 static EventRef compatibilityEvent = 0;
1803 const int pixelsToDegrees = 2;
1806 sizeof(mdelt), 0, &mdelt);
1807 wheel_deltaX = mdelt * pixelsToDegrees;
1810 sizeof(mdelt), 0, &mdelt);
1811 wheel_deltaY = mdelt * pixelsToDegrees;
1812 GetEventParameter(event, kEventParamEventRef, typeEventRef, 0,
1813 sizeof(compatibilityEvent), 0, &compatibilityEvent);
1814 }
else if (ekind == kEventMouseWheelMoved) {
1815 if (event != compatibilityEvent) {
1816 compatibilityEvent = 0;
1818 GetEventParameter(event, kEventParamMouseWheelDelta, typeSInt32, 0,
1819 sizeof(mdelt), 0, &mdelt);
1820 EventMouseWheelAxis axis;
1821 GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, 0,
1822 sizeof(axis), 0, &axis);
1825 if (axis == kEventMouseWheelAxisX)
1826 wheel_deltaX =
qBound(-120,
int(mdelt * 10000), 120);
1828 wheel_deltaY =
qBound(-120,
int(mdelt * 10000), 120);
1833 if(ekind == kEventMouseDown || ekind == kEventMouseUp) {
1834 EventMouseButton mac_button = 0;
1835 GetEventParameter(event, kEventParamMouseButton, typeMouseButton, 0,
1836 sizeof(mac_button), 0, &mac_button);
1841 case kEventMouseDown:
1847 case kEventMouseDragged:
1848 case kEventMouseMoved:
1853 const bool inPopupMode = app->d_func()->inPopupMode();
1862 handled_event =
true;
1863 #if defined(DEBUG_MOUSE_MAPS) 1864 qDebug(
"Bail out early due to qt_mac_previous_press_in_popup_mode");
1872 if (qt_button_down && qt_button_down->
window() == popup) {
1881 if(mac_mouse_grabber) {
1883 }
else if (qt_button_down) {
1888 if(GetEventParameter(event, kEventParamWindowRef, typeWindowRef, 0,
1889 sizeof(window), 0, &window) != noErr)
1890 FindWindowOfClass(&where, kAllWindowClasses, &window, 0);
1893 if(HIViewGetViewForMouseEvent(HIViewGetRoot(window), event, &hiview) == noErr) {
1899 widget = otherWidget;
1906 if(ekind == kEventMouseUp && widget) {
1908 if(part == inDrag) {
1910 GetEventParameter(event, kEventParamClickCount, typeUInt32, NULL,
1911 sizeof(count), NULL, &count);
1925 if (widget && widget->
macEvent(er, event))
1935 if (inPopupMode ==
false 1937 && (wpc != inContent && wpc != inStructure)) {
1938 inNonClientArea =
true;
1942 GetEventParameter(event, kEventParamClickCount, typeUInt32, 0,
1943 sizeof(count), 0, &count);
1944 if(count % 2 || count == 0) {
1964 if(cursor_widget && cursor_widget == qt_button_down && ekind == kEventMouseUp)
1967 if(!
qApp->d_func()->cursor_list.isEmpty()) {
1968 cursor =
qApp->d_func()->cursor_list.first();
1970 for(; cursor_widget; cursor_widget = cursor_widget->
parentWidget()) {
1971 QWExtra *extra = cursor_widget->d_func()->extraData();
1973 cursor = *extra->
curs;
1987 handled_event =
false;
1988 #if defined(DEBUG_MOUSE_MAPS) 1989 qDebug(
"Bail out early due to qt_try_modal");
1994 UInt32 tabletEventType = 0;
1995 GetEventParameter(event, kEventParamTabletEventType, typeUInt32, 0,
1996 sizeof(tabletEventType), 0, &tabletEventType);
1997 if (tabletEventType == kEventTabletPoint) {
1998 TabletPointRec tabletPointRec;
1999 GetEventParameter(event, kEventParamTabletPointRec, typeTabletPointRec, 0,
2000 sizeof(tabletPointRec), 0, &tabletPointRec);
2002 int new_tablet_button_state = tabletPointRec.buttons ? 1 : 0;
2004 if (new_tablet_button_state)
2013 qWarning(
"handleTabletEvent: This tablet device is unknown" 2014 " (received no proximity event for it). Discarding event.");
2017 QTabletDeviceData &deviceData = tabletHash->operator[](tabletPointRec.deviceID);
2026 int tiltX = ((int)tabletPointRec.tiltX)/(32767/64);
2027 int tiltY = ((int)tabletPointRec.tiltY)/(-32767/64);
2029 GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, 0,
sizeof(HIPoint), 0, &hiPoint);
2030 QPointF hiRes(hiPoint.x, hiPoint.y);
2031 QPoint global(where.h, where.v);
2037 qreal rotation = 0.0;
2041 if (deviceData.capabilityMask & 0x0200)
2042 z = tabletPointRec.absZ;
2044 if (deviceData.capabilityMask & 0x0800)
2045 tp = tabletPointRec.tangentialPressure / 32767.0;
2047 if (deviceData.capabilityMask & 0x2000)
2048 rotation =
qreal(tabletPointRec.rotation) / 64.0;
2050 QTabletEvent e(t, local, global, hiRes, deviceData.tabletDeviceType,
2051 deviceData.tabletPointerType,
2052 qreal(tabletPointRec.pressure /
qreal(0xffff)), tiltX, tiltY,
2053 tp, rotation, z, modifiers, deviceData.tabletUniqueID);
2061 #if defined(DEBUG_MOUSE_MAPS) 2062 qDebug(
"Bail out early due to tablet acceptance");
2069 if(ekind == kEventMouseDown) {
2073 if (!inPopupMode && windowPart == inMenuBar) {
2078 if (widget && !(GetCurrentKeyModifiers() & cmdKey)) {
2088 needActivate =
false;
2090 if (genuineQtWidget && needActivate)
2098 handled_event =
false;
2099 #if defined(DEBUG_MOUSE_MAPS) 2112 EventTime now = GetEventTime(event);
2119 GetEventParameter(event, kEventParamClickCount, typeUInt32, 0,
2120 sizeof(count), 0, &count);
2135 if(ekind == kEventMouseUp)
2137 handled_event =
false;
2138 #if defined(DEBUG_MOUSE_MAPS) 2139 qDebug(
"Bail out early due to qt_mac_no_click_through_mode");
2153 case kEventMouseDown: {
2154 if (!qt_button_down)
2163 case kEventMouseDragged:
2164 case kEventMouseMoved:
2166 case kEventMouseDown: {
2170 QWidget *
const enterLeaveWidget = (inPopupMode || ekind == kEventMouseUp) ?
2173 if ((
QWidget *) qt_last_mouse_receiver != enterLeaveWidget || inNonClientArea) {
2174 #ifdef DEBUG_MOUSE_MAPS 2175 qDebug(
"Entering: %p - %s (%s), Leaving %s (%s)", (
QWidget*)enterLeaveWidget,
2185 QWidget *enter = enterLeaveWidget;
2188 QWidget *
const popupWidget =
qApp->activePopupWidget();
2189 if (leave == popupWidget)
2190 enter = mouseGrabber;
2191 if (enter == popupWidget)
2192 leave = mouseGrabber;
2193 if ((enter == mouseGrabber && leave == popupWidget)
2194 || (leave == mouseGrabber && enter == popupWidget)) {
2196 qt_last_mouse_receiver = enter;
2200 qt_last_mouse_receiver = enter;
2202 }
else if ((!qt_button_down || !qt_last_mouse_receiver) && !mouseGrabber && !leaveAfterRelease) {
2204 qt_last_mouse_receiver = enterLeaveWidget;
2211 QPoint p(where.h, where.v);
2220 if (wheel_deltaX || wheel_deltaY) {
2221 #ifndef QT_NO_WHEELEVENT 2230 handled_event =
false;
2241 handled_event =
false;
2244 #endif // QT_NO_WHEELEVENT 2246 #ifdef QMAC_SPEAK_TO_ME 2256 NewSpeechChannel(0, &ch);
2258 DisposeSpeechChannel(ch);
2263 static bool lastButtonTranslated =
false;
2264 if(ekind == kEventMouseDown &&
2267 lastButtonTranslated =
true;
2268 }
else if(ekind == kEventMouseUp && lastButtonTranslated) {
2270 lastButtonTranslated =
false;
2272 QMouseEvent qme(etype, plocal, p, buttonToSend, buttons, modifiers);
2275 handled_event =
false;
2278 if (leaveAfterRelease) {
2281 qt_last_mouse_receiver = enter;
2282 leaveAfterRelease = 0;
2285 if(ekind == kEventMouseDown &&
2290 #ifdef DEBUG_MOUSE_MAPS 2291 const char *event_desc = edesc;
2293 event_desc =
"Double Click";
2295 event_desc =
"NonClientMousePress";
2297 event_desc =
"NonClientMouseRelease";
2299 event_desc =
"NonClientMouseMove";
2301 event_desc =
"NonClientMouseDblClick";
2302 qDebug(
"%d %d (%d %d) - Would send (%s) event to %p %s %s (%d 0x%08x 0x%08x %d)", p.
x(), p.
y(),
2303 plocal.x(), plocal.y(), event_desc, (
QWidget*)widget,
2305 widget ? widget->metaObject()->className() :
"*Unknown*",
2306 button, (int)buttons, (
int)modifiers, wheel_deltaX);
2309 handled_event =
false;
2313 case kEventClassTextInput:
2314 case kEventClassKeyboard: {
2316 if(eclass == kEventClassTextInput) {
2317 Q_ASSERT(ekind == kEventTextInputUnicodeForKeyEvent);
2318 OSStatus err = GetEventParameter(event, kEventParamTextInputSendKeyboardEvent, typeEventRef, 0,
2319 sizeof(key_event), 0, &key_event);
2323 const UInt32 key_ekind = GetEventKind(key_event);
2324 Q_ASSERT(GetEventClass(key_event) == kEventClassKeyboard);
2326 if(key_ekind == kEventRawKeyDown)
2328 if(mac_keyboard_grabber)
2344 if (key_ekind == kEventRawKeyModifiersChanged) {
2345 UInt32 modifiers = 0;
2346 GetEventParameter(key_event, kEventParamKeyModifiers, typeUInt32, 0,
2347 sizeof(modifiers), 0, &modifiers);
2352 handled_event =
false;
2358 if (eclass == kEventClassTextInput) {
2359 handled_event =
false;
2362 widget == mac_keyboard_grabber);
2365 case kEventClassWindow: {
2367 GetEventParameter(event, kEventParamDirectObject, typeWindowRef, 0,
2370 if (widget && widget->
macEvent(er, event))
2372 if(ekind == kEventWindowActivated) {
2387 bool just_send_event =
false;
2389 WindowActivationScope scope;
2390 if(GetWindowActivationScope((
WindowRef)wid, &scope) == noErr &&
2391 scope == kWindowActivationScopeIndependent) {
2392 if(GetFrontWindowOfClass(kAllWindowClasses,
true) != wid)
2393 just_send_event =
true;
2396 if(just_send_event) {
2405 }
else if(ekind == kEventWindowDeactivated) {
2409 handled_event =
false;
2412 case kEventClassApplication:
2413 if(ekind == kEventAppActivated) {
2425 WindowPtr wp = ActiveNonFloatingWindow();
2430 }
else if(ekind == kEventAppDeactivated) {
2432 while(app->d_func()->inPopupMode())
2439 }
else if(ekind == kEventAppAvailableWindowBoundsChanged) {
2442 handled_event =
false;
2445 case kAppearanceEventClass:
2446 if(ekind == kAEAppearanceChanged) {
2454 handled_event =
false;
2457 case kEventClassAppleEvent:
2458 if(ekind == kEventAppleEvent) {
2460 if(!ConvertEventRefToEventRecord(event, &erec))
2461 qDebug(
"Qt: internal: WH0A, unexpected condition reached. %s:%d", __FILE__, __LINE__);
2462 else if(AEProcessAppleEvent(&erec) != noErr)
2463 handled_event =
false;
2465 handled_event =
false;
2468 case kEventClassCommand:
2469 if(ekind == kEventCommandProcess) {
2471 GetEventParameter(event, kEventParamDirectObject, typeHICommand,
2472 0,
sizeof(cmd), 0, &cmd);
2473 handled_event =
false;
2474 if(!cmd.menu.menuRef && GetApplicationDockTileMenu()) {
2477 GetEventParameter(event, kEventParamDirectObject, typeHICommand,
2478 0,
sizeof(copy_cmd), 0, ©_cmd);
2479 copy_cmd.menu.menuRef = GetApplicationDockTileMenu();
2480 SetEventParameter(copy, kEventParamDirectObject, typeHICommand,
sizeof(copy_cmd), ©_cmd);
2481 if(SendEventToMenu(copy, copy_cmd.menu.menuRef) == noErr)
2482 handled_event =
true;
2484 if(!handled_event) {
2485 if(cmd.commandID == kHICommandQuit) {
2490 handled_event =
true;
2492 bool handle_quit =
true;
2496 for(
int i = 0; i < tlws.
size(); ++i) {
2497 if(tlws.
at(i)->isVisible())
2500 handle_quit = (visible <= 1);
2511 }
else if(cmd.commandID == kHICommandSelectWindow) {
2512 if((GetCurrentKeyModifiers() & cmdKey))
2513 handled_event =
true;
2514 }
else if(cmd.commandID == kHICommandAbout) {
2517 handled_event =
true;
2525 qDebug(
"%shandled event %c%c%c%c %d", handled_event ?
"(*) " :
"",
2526 char(eclass >> 24),
char((eclass >> 16) & 255),
char((eclass >> 8) & 255),
2527 char(eclass & 255), (
int)ekind);
2530 return eventNotHandledErr;
2536 return eventNotHandledErr;
2540 #ifdef QT_MAC_USE_COCOA 2541 void QApplicationPrivate::qt_initAfterNSAppStarted()
2547 void QApplicationPrivate::setupAppleEvents()
2561 NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
2562 [eventManager setEventHandler:newDelegate andSelector:
@selector(appleEventQuit:withReplyEvent:)
2563 forEventClass:kCoreEventClass andEventID:kAEQuitApplication];
2564 [eventManager setEventHandler:newDelegate andSelector:
@selector(getUrl:withReplyEvent:)
2565 forEventClass:kInternetEventClass andEventID:kAEGetURL];
2578 bool handled_event=
false;
2579 OSType aeID=typeWildCard, aeClass=typeWildCard;
2580 AEGetAttributePtr(ae, keyEventClassAttr, typeType, 0, &aeClass,
sizeof(aeClass), 0);
2581 AEGetAttributePtr(ae, keyEventIDAttr, typeType, 0, &aeID,
sizeof(aeID), 0);
2582 if(aeClass == kCoreEventClass) {
2584 case kAEQuitApplication: {
2586 if (qt_mac_quit_menu_item_enabled) {
2590 handled_event =
true;
2597 case kAEOpenDocuments: {
2599 if(AEGetParamDesc(ae, keyDirectObject, typeAEList, &docs) == noErr) {
2601 AECountItems(&docs, &cnt);
2602 UInt8 *str_buffer = NULL;
2603 for(
int i = 0; i < cnt; i++) {
2605 if(AEGetNthPtr(&docs, i+1, typeFSRef, 0, 0, &ref,
sizeof(ref), 0) != noErr)
2608 str_buffer = (UInt8 *)malloc(1024);
2609 FSRefMakePath(&ref, str_buffer, 1024);
2620 }
else if (aeClass == kInternetEventClass) {
2625 if (AEGetParamPtr(ae, keyDirectObject, typeChar, 0, urlData,
2626 sizeof(urlData) - 1, &actualSize) == noErr) {
2627 urlData[actualSize] = 0;
2638 qDebug(
"Qt: internal: %shandled Apple event! %c%c%c%c %c%c%c%c", handled_event ?
"(*)" :
"",
2639 char(aeID >> 24),
char((aeID >> 16) & 255),
char((aeID >> 8) & 255),
char(aeID & 255),
2640 char(aeClass >> 24),
char((aeClass >> 16) & 255),
char((aeClass >> 8) & 255),
char(aeClass & 255));
2643 return eventNotHandledErr;
2704 if (popup == qt_button_down)
2721 q->sendEvent(fw, &e);
2752 bool needNotification =
false;
2753 for (
int i = 0; i < windowsToMark.
size(); ++i) {
2756 needNotification =
true;
2757 if (duration != 0) {
2761 if (
QTimer *oldTimer =
qApp->d_func()->alertTimerHash.value(widget)) {
2762 qApp->d_func()->alertTimerHash.remove(widget);
2765 qApp->d_func()->alertTimerHash.insert(widget, timer);
2766 timer->
start(duration);
2770 if (needNotification)
2778 while (it != alertTimerHash.end()) {
2780 alertTimerHash.erase(it);
2781 timer->deleteLater();
2786 if (alertTimerHash.isEmpty()) {
2814 return int(dci * 1000);
2830 #ifndef QT_NO_WHEELEVENT 2933 while(it != pathlist.
end())
3003 #ifndef QT_NO_WHEELEVENT 3052 for (; it != fontsubs.
end(); ++
it) {
3069 #ifndef QT_MAC_USE_COCOA 3073 #ifdef QT_MAC_USE_COCOA 3074 [[NSApp mainMenu] cancelTracking];
3079 bool handle_quit =
true;
3081 menuLoader] quitMenuItem] isEnabled]) {
3084 for(
int i = 0; i < tlws.
size(); ++i) {
3085 if (tlws.
at(i)->isVisible())
3088 handle_quit = (visible <= 1);
3103 #if QT_MAC_USE_COCOA 3112 qApp->setActiveWindow(widget);
3115 qApp->setActiveWindow(0);
3129 #if QT_MAC_USE_COCOA The QVariant class acts like a union for the most common Qt data types.
The QDir class provides access to directory structures and their contents.
static int keyboardInputInterval()
The QPainter class performs low-level painting on widgets and other paint devices.
static void aboutQt(QWidget *parent, const QString &title=QString())
Displays a simple message box about Qt, with the given title and centered over parent (if parent is n...
The QColor class provides colors based on RGB, HSV or CMYK values.
static uint hash(const uchar *p, int n)
void setSingleShot(bool singleShot)
static QWidget * main_widget
QString section(QChar sep, int start, int end=-1, SectionFlags flags=SectionDefault) const
This function returns a section of the string.
bool qt_event_remove_activate()
QPointer< QWidget > qt_last_mouse_receiver
const struct __CFString * CFStringRef
The QApplication class manages the GUI application's control flow and main settings.
static QColormap instance(int screen=-1)
static QWidgetList topLevelWidgets()
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
static void cleanUpMacColorSpaces()
static void qt_init_tablet_proximity_handler()
static bool checkInstance(const char *method)
static void setPalette(const QPalette &, const char *className=0)
Changes the default application palette to palette.
static void beep()
Sounds the bell, using the default volume and sound.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns the value for setting key.
The QCursor class provides a mouse cursor with an arbitrary shape.
void qt_event_request_activate(QWidget *w)
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
QPointer< QWidget > widget
Q_GUI_EXPORT void qt_mac_set_press_and_hold_context(bool b)
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
static void setStyle(QStyle *)
Sets the application's GUI style to style.
Qt::MouseButton qt_mac_get_button(EventMouseButton button)
static EventHandlerRef app_proc_handler
The QRegExp class provides pattern matching using regular expressions.
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
#define it(className, varName)
void qt_mac_send_notification()
bool fromString(const QString &)
Sets this font to match the description descrip.
static short qt_mac_window_at(int x, int y, QWidget **w=0)
QList< QWidget * > QWidgetList
void qt_dispatchTabletProximityEvent(const ::TabletProximityRec &proxRec)
The QWheelEvent class contains parameters that describe a wheel event.
static void postEvent(QObject *receiver, QEvent *event)
Adds the event event, with the object receiver as the receiver of the event, to an event queue and re...
struct OpaqueWindowPtr * WindowRef
The QSettings class provides persistent platform-independent application settings.
bool qt_scrollbar_jump_to_pos
void endGroup()
Resets the group to what it was before the corresponding beginGroup() call.
EventLoopTimerUPP timerUPP
static void initializeWidgetPaletteHash()
#define kCMDefaultDeviceNotification
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
QString & replace(int i, int len, QChar after)
Q_GUI_EXPORT bool qt_applefontsmoothing_enabled
void fill(uint pixel)
Fills the entire image with the given pixelValue.
The QByteArray class provides an array of bytes.
#define kCMDeviceProfilesNotification
static void initialize()
This is an internal function.
int length() const
Returns the number of characters in this string.
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or 0 if no application wi...
The QPointF class defines a point in the plane using floating point precision.
void initializeMultitouch_sys()
void qt_mac_set_cursor(const QCursor *)
static Qt::MouseButtons buttons
static OSStatus tabletProximityCallback(EventHandlerCallRef, EventRef, void *)
QString fileName() const
Returns the name of the file, excluding the path.
static void addLibraryPath(const QString &)
Prepends path to the beginning of the library path list, ensuring that it is searched for libraries f...
static QStyle * create(const QString &)
void beginGroup(const QString &prefix)
Appends prefix to the current group.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
static CFStringRef toCFStringRef(const QString &str)
static int wheel_scroll_lines
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
void createEventDispatcher()
static QString toQString(CFStringRef cfstr)
bool mkdir(const QString &dirName) const
Creates a sub-directory called dirName.
void qt_init(QApplicationPrivate *priv, int)
void insert(int i, const T &t)
Inserts value at index position i in the list.
struct CGImage * CGImageRef
QString absoluteFilePath() const
Returns an absolute path including the file name.
static QWidget * active_window
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
static void cleanup()
Internal function that cleans up the font system.
void * qt_mac_create_nsimage(const QPixmap &pm)
int bytesPerLine() const
Returns the number of bytes per image scanline.
static NMRec qt_mac_notification
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
static QPalette palette()
Returns the application palette.
static QStyle * style()
Returns the application's style object.
void qt_mac_update_cursor()
T & value() const
Returns a modifiable reference to the current item's value.
void closePopup(QWidget *popup)
bool qt_wstate_iconified(WId)
#define qt_mac_debug_palette(x, y, z)
static int cursorFlashTime()
ushort red
Returns the red color component of this color.
QPointF flipPoint(const NSPoint &p)
static QString macMenuBarName()
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
static EventHandlerUPP tablet_proximity_UPP
T * qobject_cast(QObject *object)
static struct @193 request_activate_pending
static QString currentPath()
Returns the absolute path of the application's current directory.
QClipboard * qt_clipboard
The QHash class is a template class that provides a hash-table-based dictionary.
void updateKeyMap(const MSG &msg)
static EventRef request_showsheet_pending
void cleanupMultitouch_sys()
The QObject class is the base class of all Qt objects.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
static OSStatus globalEventProcessor(EventHandlerCallRef, EventRef, void *)
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
void qt_event_activate_timer_callbk(EventLoopTimerRef r, void *)
static int wheelScrollLines()
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
QPointer< QWidget > widgetToGetPress
iterator Iterator
Qt-style synonym for QList::iterator.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
bool qt_mac_can_clickThrough(const QWidget *)
static QWidget * focus_widget
OSWindowRef qt_mac_window_for(const QWidget *)
static QFont font()
Returns the default application font.
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
static int keyboard_input_time
Q_CORE_EXPORT void qDebug(const char *,...)
static void quit()
Tells the application to exit with return code 0 (success).
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or 0 if there is no Qt widget there...
static bool qt_mac_collapse_on_dblclick
static void qt_mac_update_intersected_gl_widgets(QWidget *widget)
static void qt_event_request_context(QWidget *w=0, EventRef *where=0)
static QWidget * activeModalWidget()
Returns the active modal widget.
QStringList toStringList() const
Returns the variant as a QStringList if the variant has type() StringList, String ...
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
void append(const T &t)
Inserts value at the end of the list.
static void qt_mac_event_release(EventRef &event)
static void setSystemFont(const QFont &font)
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool qt_mac_is_macdrawer(const QWidget *)
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette...
static bool isEmpty(const char *str)
static struct @192 qt_mac_dblclick
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
QWidget * mac_mouse_grabber
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void qt_release_app_proc_handler()
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
static void initialize()
Internal function that initializes the font system.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
static bool qt_mac_previous_press_in_popup_mode
void qt_init_app_proc_handler()
static QWidgetList * popupWidgets
static void insertSubstitutions(const QString &, const QStringList &)
Inserts the list of families substituteNames into the substitution list for familyName.
const T & at(int i) const
Returns the item at index position i in the list.
struct OpaqueControlRef * HIViewRef
static EventRef request_context_pending
void onApplicationWindowChangedActivation(QWidget *widget, bool activated)
The QStringList class provides a list of strings.
static bool qt_mac_no_click_through_mode
static void clear()
Removes all pixmaps from the cache.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event)
static int mouse_double_click_time
#define kCMDefaultDeviceProfileNotification
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
The QResizeEvent class contains event parameters for resize events.
QPointer< QWidget > last_widget
Q_CORE_EXPORT void qWarning(const char *,...)
QFont qfontForThemeFont(ThemeFontID themeID)
The QImage class provides a hardware-independent image representation that allows direct access to th...
bool contains(const QPoint &p) const
Returns true if the region contains the point p; otherwise returns false.
static const char * data(const QByteArray &arr)
static void setKeyboardInputInterval(int)
int qt_antialiasing_threshold
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
const_iterator constFind(const Key &key) const
Returns an iterator pointing to the item with the key in the hash.
FontHash * qt_app_fonts_hash()
static QTextCodec * codec(MYSQL *mysql)
static int tablet_button_state
static bool animate_combo
static void alert(QWidget *widget, int duration=0)
void qt_mac_set_app_icon(const QPixmap &pixmap)
static QStyle * app_style
bool translateKeyEvent(QWidget *receiver, const MSG &msg, bool grab)
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
static QPalette * sys_pal
QPointer< QWidget > topLevelAt_cache
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
static QDir temp()
Returns the system's temporary directory.
void qt_updated_rootinfo()
QByteArray left(int len) const
Returns a byte array that contains the leftmost len bytes of this byte array.
QStringList childKeys() const
Returns a list of all top-level keys that can be read using the QSettings object. ...
void qt_mac_send_posted_gl_updates(QWidget *widget)
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
void qt_mac_update_os_settings()
static void setActiveWindow(QWidget *act)
Sets the active window to the active widget in response to a system event.
QByteArray mid(int index, int len=-1) const
Returns a byte array containing len bytes from this byte array, starting at position pos...
static bool qt_button_down_in_content
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
static QWidgetList topLevelWidgets()
Returns a list of the top-level widgets (windows) in the application.
static QWidget * topLevelAt(const QPoint &p)
Returns the top-level widget at the given point; returns 0 if there is no such widget.
QPaintDevice * qt_mac_safe_pdev
Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4)
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...
static EventRef request_menubarupdate_pending
struct OpaqueEventRef * EventRef
The QTabletEvent class contains parameters that describe a Tablet event.
static bool qt_mac_apply_settings()
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
static EventHandlerRef tablet_proximity_handler
static bool startingUp()
Returns true if an application object has not been created yet; otherwise returns false...
static void enterModal_sys(QWidget *)
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
QWidgetList * qt_modal_stack
The QMouseEvent class contains parameters that describe a mouse event.
static EventHandlerUPP app_proc_handlerUPP
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
bool qt_sendSpontaneousEvent(QObject *obj, QEvent *event)
const char * constData() const
Returns a pointer to the data stored in the byte array.
static bool animate_tooltip
The QBrush class defines the fill pattern of shapes drawn by QPainter.
bool isNull() const
Returns true if this string is null; otherwise returns false.
bool bold() const
Returns true if weight() is a value greater than QFont::Normal ; otherwise returns false...
static void setColorSpec(int)
Sets the color specification for the application to spec.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
static bool tryModalHelper(QWidget *widget, QWidget **rettop=0)
#define kThemeBrushAlternatePrimaryHighlightColor
uint qstrlen(const char *str)
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
static Qt::KeyboardModifiers queryKeyboardModifiers()
Queries and returns the state of the modifier keys on the keyboard.
static void setCursorFlashTime(int)
static bool isEffectEnabled(Qt::UIEffect)
Returns true if effect is enabled; otherwise returns false.
static QWidget * activePopupWidget()
Returns the active popup widget.
ushort blue
Returns the blue color component of this color.
Type
This enum type defines the valid event types in Qt.
static bool isBlockedByModal(QWidget *widget)
Returns true if widget is blocked by a modal window.
static QWidget * tryModalHelper_sys(QWidget *top)
static QInputContext * inputContext
QWidget * qt_mac_find_window(OSWindowRef)
#define kCMDeviceUnregisteredNotification
The QFont class specifies a font used for drawing text.
QMacTabletHash * qt_mac_tablet_hash()
void onApplicationChangedActivation(bool activated)
static QList< QMacWindowChangeEvent * > * change_events
static EventTypeSpec app_events[]
#define QT_MANGLE_NAMESPACE(name)
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
QString family() const
Returns the requested font family name, i.e.
QColor qcolorForThemeTextColor(ThemeTextColor themeColor)
void qt_mac_cancel_notification()
Q_GUI_EXPORT void qt_mac_set_dock_menu(QMenu *menu)
static bool animate_toolbox
bool qt_mac_app_fullscreen
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
The QPoint class defines a point in the plane using integer precision.
virtual bool macEventFilter(EventHandlerCallRef, EventRef)
static void setWheelScrollLines(int)
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
T & last()
Returns a reference to the last item in the list.
Qt::MouseButtons qt_mac_get_buttons(int buttons)
const UInt32 kEventClassQt
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
int size() const
Returns the number of items in the list.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
static bool desktopSettingsAware()
Returns true if Qt is set to use the system's standard colors, fonts, etc.
QString objectName() const
QString canonicalPath() const
Returns the canonical path, i.e.
The QRect class defines a rectangle in the plane using integer precision.
QColor qcolorForTheme(ThemeBrush brush)
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
static bool native_modal_dialog_active
OSViewRef qt_mac_nativeview_for(const QWidget *)
static void qt_release_tablet_proximity_handler()
static QTextCodec * codecForName(const QByteArray &name)
Searches all installed QTextCodec objects and returns the one which best matches name; the match is c...
QWidget * mac_keyboard_grabber
bool qt_mac_is_macsheet(const QWidget *)
struct OpaqueMenuRef * MenuRef
static void dispatchEnterLeave(QWidget *enter, QWidget *leave)
int size() const
Returns the number of bytes in this byte array.
static void setSystemPalette(const QPalette &pal)
double toDouble(bool *ok=0) const
Returns the variant as a double if the variant has type() Double , QMetaType::Float ...
bool copy(const QString &newName)
Copies the file currently specified by fileName() to a file called newName.
int y() const
Returns the y coordinate of this point.
QVariant property(const char *name) const
Returns the value of the object's name property.
The QPixmap class is an off-screen image representation that can be used as a paint device...
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
Qt::KeyboardModifiers qt_mac_get_modifiers(int keys)
virtual void polish(QWidget *)
Initializes the appearance of the given widget.
void qt_release_apple_event_handler()
void qt_event_request_showsheet(QWidget *w)
static void setOverrideCursor(const QCursor &)
Use changeOverrideCursor(cursor) (if replace is true) or setOverrideCursor(cursor) (if replace is fal...
static EventRef request_window_change_pending
void qt_mac_display_change_callbk(CGDirectDisplayID, CGDisplayChangeSummaryFlags flags, void *)
QKeyMapperPrivate * qt_keymapper_private()
bool italic() const
Returns true if the style() of the font is not QFont::StyleNormal.
int pointSize() const
Returns the point size of the font.
struct QMacAppleEventTypeSpec app_apple_events[]
The QSize class defines the size of a two-dimensional object using integer point precision.
struct OpaqueEventHandlerCallRef * EventHandlerCallRef
static Qt::MouseButtons mouseButtons()
Returns the current state of the buttons on the mouse.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
static void setDoubleClickInterval(int)
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
void qt_mac_send_modifiers_changed(quint32, QObject *)
int x() const
Returns the x coordinate of this point.
static void qt_post_window_change_event(QWidget *widget)
The QTimer class provides repetitive and single-shot timers.
static void restoreOverrideCursor()
Undoes the last setOverrideCursor().
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
static void qt_mac_read_fontsmoothing_settings()
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
The QTextCodec class provides conversions between text encodings.
static QWidget * activeWidget
void qt_color_profile_changed(CFNotificationCenterRef, void *, CFStringRef, const void *, CFDictionaryRef)
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool filterEvent(void *message, long *result)
Sends message through the event filter that was set by setEventFilter().
void qt_event_send_clipboard_changed()
The QFileInfo class provides system-independent file information.
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
static void leaveModal_sys(QWidget *)
static void setFont(const QFont &, const char *className=0)
Changes the default application font to font.
static const KeyPair *const end
PaletteHash * qt_app_palettes_hash()
The QIconDragEvent class indicates that a main icon drag has begun.
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
The QEvent class is the base class of all event classes.
static AEEventHandlerUPP app_proc_ae_handlerUPP
static int doubleClickInterval()
void qt_mac_command_set_enabled(MenuRef, UInt32, bool)
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
ushort green
Returns the green color component of this color.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
The QCloseEvent class contains parameters that describe a close event.
static QMenu * qt_mac_dock_menu
static bool qt_try_modal(QWidget *widget, EventRef event)
Q_GUI_EXPORT bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret)
The QFocusEvent class contains event parameters for widget focus events.
static void setGlobalStrut(const QSize &)
static void setCodecForTr(QTextCodec *c)
static void setEffectEnabled(Qt::UIEffect, bool enable=true)
Enables the UI effect effect if enable is true, otherwise the effect will not be used.
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
void openPopup(QWidget *popup)
static bool setCurrent(const QString &path)
Sets the application's current working directory to path.
static bool qt_mac_event_remove(EventRef &event)
static bool isNull(const QVariant::Private *d)
void qt_event_request_menubarupdate()
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
static void qt_mac_update_child_gl_widgets(QWidget *widget)
The QList class is a template class that provides lists.
static int cursor_flash_time
The QFileOpenEvent class provides an event that will be sent when there is a request to open a file o...
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Q_GUI_EXPORT void qt_event_request_window_change()
#define QT_VERSION
This macro expands a numeric value of the form 0xMMNNPP (MM = major, NN = minor, PP = patch) that spe...
static OSStatus globalAppleEventProcessor(const AppleEvent *, AppleEvent *, long)
The QPalette class contains color groups for each widget state.