summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget/tst_qwidget_mac_helpers.mm
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:18:55 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:18:55 (GMT)
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /tests/auto/qwidget/tst_qwidget_mac_helpers.mm
downloadQt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2
Long live Qt 4.5!
Diffstat (limited to 'tests/auto/qwidget/tst_qwidget_mac_helpers.mm')
-rw-r--r--tests/auto/qwidget/tst_qwidget_mac_helpers.mm33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qwidget/tst_qwidget_mac_helpers.mm b/tests/auto/qwidget/tst_qwidget_mac_helpers.mm
new file mode 100644
index 0000000..8a437df
--- /dev/null
+++ b/tests/auto/qwidget/tst_qwidget_mac_helpers.mm
@@ -0,0 +1,33 @@
+#include "tst_qwidget_mac_helpers.h"
+#include <private/qt_mac_p.h>
+#include <private/qt_cocoa_helpers_mac_p.h>
+
+
+QString nativeWindowTitle(QWidget *window, Qt::WindowState state)
+{
+ OSWindowRef windowRef = qt_mac_window_for(window);
+ QCFString macTitle;
+ if (state == Qt::WindowMinimized) {
+#ifndef QT_MAC_USE_COCOA
+ CopyWindowAlternateTitle(windowRef, &macTitle);
+#else
+ macTitle = reinterpret_cast<CFStringRef>([[windowRef miniwindowTitle] retain]);
+#endif
+ } else {
+#ifndef QT_MAC_USE_COCOA
+ CopyWindowTitleAsCFString(windowRef, &macTitle);
+#else
+ macTitle = reinterpret_cast<CFStringRef>([[windowRef title] retain]);
+#endif
+ }
+ return macTitle;
+}
+
+bool nativeWindowModified(QWidget *widget)
+{
+#ifndef QT_MAC_USE_COCOA
+ return IsWindowModified(qt_mac_window_for(widget));
+#else
+ return [qt_mac_window_for(widget) isDocumentEdited];
+#endif
+}