summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-01-20 12:08:49 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-10 12:49:06 +0100
commit3d08681169b5194cdc9e61fbf6fac9c4346147d8 (patch)
treeed8d0c83e7171b94f8ddb75df41df9288633b0bd /src/plugins/platforms/cocoa/qcocoanativeinterface.mm
parentdf86721bb4028ae09c5ce7d71a89808b8f2ccdcd (diff)
Cocoa: Add setNSToolbar(QWindow *, NSToolBar *)
Calling this function associates the given native toolbar with the QWindow. QWindow will then set it on the native NSWindow at the appropriate time during window creation. Change-Id: I2a50f79b2a0453cc739f8d68e965e37b95998083 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoanativeinterface.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index eb520b97c9..85ce96a8b6 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -47,6 +47,7 @@
#include "qmacmime.h"
#include "qcocoahelpers.h"
#include "qcocoaapplication.h"
+#include "qcocoaintegration.h"
#include <qbytearray.h>
#include <qwindow.h>
@@ -125,6 +126,8 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setEmbeddedInForeignView);
if (resource.toLower() == "setcontentborderthickness")
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setContentBorderThickness);
+ if (resource.toLower() == "setnstoolbar")
+ return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setNSToolbar);
return 0;
}
@@ -285,4 +288,16 @@ void QCocoaNativeInterface::setContentBorderThickness(QWindow *window, int topTh
cocoaWindow->setContentBorderThickness(topThickness, bottomThickness);
}
+void QCocoaNativeInterface::setNSToolbar(QWindow *window, void *nsToolbar)
+{
+ if (!window)
+ return;
+
+ QCocoaIntegration::instance()->setToolbar(window, static_cast<NSToolbar *>(nsToolbar));
+
+ QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
+ if (cocoaWindow)
+ cocoaWindow->updateNSToolbar();
+}
+
QT_END_NAMESPACE