diff options
author | James Turner <james.turner@kdab.com> | 2012-05-04 14:16:05 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-19 10:18:21 +0200 |
commit | b8246f08e49eb672974fd3d3d972a5ff13c1524d (patch) | |
tree | 509ab759670f0b24aa8d44ced0584fc2832f5e76 /src/plugins/platforms/cocoa/qcocoatheme.mm | |
parent | 899f1d35a435fd499c73b29aabb6a609d496e5ed (diff) |
Cocoa implementation of QPA menu interface.
Implement the QPA platform menu interface for Cocoa,
including native menubar support and merging with the
predefined menus created from the bundled .nib. Cleanup
code previously used to maintain the menus, and add
a manual test of the menus code.
Change-Id: Ia99267ddb6485e18e05c540eb32c5aee6cbb85db
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoatheme.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoatheme.mm | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index cfb146ad45..2f630c7763 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -41,12 +41,19 @@ #include "qcocoatheme.h" -#include <QVariant> +#include <QtCore/QVariant> #include "qcocoacolordialoghelper.h" #include "qcocoafiledialoghelper.h" #include "qcocoafontdialoghelper.h" #include "qcocoasystemsettings.h" +#include "qcocoamenuitem.h" +#include "qcocoamenu.h" +#include "qcocoamenubar.h" + +#include <QtGui/private/qguiapplication_p.h> +#include <QtGui/QPlatformIntegration> +#include <QtGui/QPlatformNativeInterface> QT_BEGIN_NAMESPACE @@ -133,4 +140,27 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const return QPlatformTheme::themeHint(hint); } +QPlatformMenuItem *QCocoaTheme::createPlatformMenuItem() const +{ + return new QCocoaMenuItem(); +} + +QPlatformMenu *QCocoaTheme::createPlatformMenu() const +{ + return new QCocoaMenu(); +} + +QPlatformMenuBar *QCocoaTheme::createPlatformMenuBar() const +{ + static bool haveMenubar = false; + if (!haveMenubar) { + haveMenubar = true; + QObject::connect(qGuiApp, SIGNAL(focusWindowChanged(QWindow*)), + QGuiApplicationPrivate::platformIntegration()->nativeInterface(), + SLOT(onAppFocusWindowChanged(QWindow*))); + } + + return new QCocoaMenuBar(); +} + QT_END_NAMESPACE |