diff options
author | Morten Sorvig <morten.sorvig@nokia.com> | 2011-09-06 14:10:50 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2011-09-07 11:00:36 +0200 |
commit | cee63e2c17c8e83a4366741da0cbd5fc852e5835 (patch) | |
tree | 75ccc2afe762a51984d6651d6ff6eb875b73cad6 /src/widgets/widgets/qmenu.h | |
parent | e2be53891fe218c9a1a63c2d385d149d2b1f982f (diff) |
Cocoa: QMenu refactor.
This change prepares for enabling native menus
on OS X.
Move code from src/widgets to cocoa:
- qcocoaapplicaiton
- qcocoaapplicaitondelegate
- qcocoamenuloader
- qcocoamenu
- qmenu_mac
- misc helpers to qcocoahelpers
Create a QNSApplication and
QCocoaApplicationDelegate at application startup.
New Lighthouse API:
- class QPlatformMenu
- class QPlatformMenuBar
- QPlatformIntegration::createPlatformMenu()
- QPlatformIntegration::createPlatformMenuBar()
Platforms that wants a native menu integration
subclasses QPlatformMenu[|Bar] and implements the
create function. The default implementation returns
0, which causes QMenu to use the standard Qt
menus.
This API is based on the current native menu
abstraction that Mac, Wince and S60 uses in Qt 4.
The main difference is that the platform classes are
proper standalone classes and not #ifdeffed into
QMenuPrivate.
Change-Id: I3da41f80b0ae903a476937908b1f9b88014b7954
Reviewed-on: http://codereview.qt.nokia.com/4068
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/widgets/widgets/qmenu.h')
-rw-r--r-- | src/widgets/widgets/qmenu.h | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index 84a1f1ef14..8d7e281fd4 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -46,10 +46,7 @@ #include <QtCore/qstring.h> #include <QtWidgets/qicon.h> #include <QtWidgets/qaction.h> -#ifdef Q_OS_MAC -#include "QtWidgets/qmacdefines_mac.h" -#endif - +#include <QtWidgets/qplatformmenu_qpa.h> #ifdef QT3_SUPPORT #include <QtGui/qpixmap.h> @@ -145,9 +142,7 @@ public: void setIcon(const QIcon &icon); void setNoReplayFor(QWidget *widget); -#ifdef Q_OS_MAC - OSMenuRef macMenu(OSMenuRef merge=0); -#endif + QPlatformMenu *platformMenu(); #ifdef Q_WS_WINCE HMENU wceMenu(); @@ -418,15 +413,8 @@ private: friend class QComboBox; friend class QAction; friend class QToolButtonPrivate; - -#ifdef Q_OS_MAC - friend void qt_mac_trayicon_activate_action(QMenu *, QAction *action); - friend bool qt_mac_watchingAboutToShow(QMenu *); - friend OSStatus qt_mac_menu_event(EventHandlerCallRef, EventRef, void *); - friend bool qt_mac_activate_action(OSMenuRef, uint, QAction::ActionEvent, bool); - friend void qt_mac_emit_menuSignals(QMenu *, bool); + friend void qt_mac_emit_menuSignals(QMenu *menu, bool show); friend void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action); -#endif }; #endif // QT_NO_MENU |