From 3d08681169b5194cdc9e61fbf6fac9c4346147d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 20 Jan 2014 12:08:49 +0100 Subject: Cocoa: Add setNSToolbar(QWindow *, NSToolBar *) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/plugins/platforms/cocoa/qcocoanativeinterface.mm') 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 #include @@ -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)); + + QCocoaWindow *cocoaWindow = static_cast(window->handle()); + if (cocoaWindow) + cocoaWindow->updateNSToolbar(); +} + QT_END_NAMESPACE -- cgit v1.2.3