diff options
author | Morten Sorvig <morten.sorvig@nokia.com> | 2011-07-05 15:02:39 +0200 |
---|---|---|
committer | Morten Sorvig <morten.sorvig@nokia.com> | 2011-07-06 09:59:36 +0200 |
commit | 4ed17a650847d4ad129478608e9697c909126263 (patch) | |
tree | bddc9d0107bf05690b8b58a0fe73a337e59eb409 /src/widgets/widgets/qmenu_p.h | |
parent | 14757fedb2e4a92fb37a90a88485107909f4f5e1 (diff) |
Start porting the Mac menu system to QPA.
Global changes:
qglobal.h: remove code that sets Q_WS_MAC and
Q_MAC_USE_COCOA - this is dead code now. Add
qt_widget_helpers_mac_p.h/mm which will contain
helper functions needed for widgets on Qt 5.
Menu-related changes:
Set AA_DontUseNativeMenuBar before creating the
platform plugin. Change Q_WS_MAC to Q_OS_MAC in the
menu code. Remove Q_MAC_USE_COCOA defines and Carbon
code paths. Move some qt_mac helper functions only
used by the menu system to qmenu_mac.mm. #ifdef out
some code paths that require further porting.
Native menus are now disabled by default but can
be enabled by the QPA plugins that want them by
clearing AA_DontUseNativeMenuBar. Since we at compile
time don't know which plugin will be loaded the Mac
menu code is always included when building on OS X.
(The above is currently only relevant for the Cocoa
plugin.)
Diffstat (limited to 'src/widgets/widgets/qmenu_p.h')
-rw-r--r-- | src/widgets/widgets/qmenu_p.h | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 7ce1a58c0a..9cadb596c8 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -55,12 +55,16 @@ #include "QtWidgets/qmenubar.h" #include "QtWidgets/qstyleoption.h" +#ifdef Q_OS_MAC +#include "QtWidgets/qmacdefines_mac.h" +#endif #include "QtCore/qdatetime.h" #include "QtCore/qmap.h" #include "QtCore/qhash.h" #include "QtCore/qbasictimer.h" #include "private/qwidget_p.h" + #ifdef Q_WS_S60 class CEikMenuPane; #define QT_SYMBIAN_FIRST_MENU_ITEM 32000 @@ -79,7 +83,7 @@ void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id); class QTornOffMenu; class QEventLoop; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC # ifdef __OBJC__ QT_END_NAMESPACE @class NSMenuItem; @@ -89,20 +93,12 @@ typedef void NSMenuItem; # endif //__OBJC__ struct QMacMenuAction { QMacMenuAction() -#ifndef QT_MAC_USE_COCOA - : command(0) -#else : menuItem(0) -#endif , ignore_accel(0), merged(0), menu(0) { } ~QMacMenuAction(); -#ifndef QT_MAC_USE_COCOA - uint command; -#else NSMenuItem *menuItem; -#endif uchar ignore_accel : 1; uchar merged : 1; QPointer<QAction> action; @@ -111,17 +107,12 @@ struct QMacMenuAction { struct QMenuMergeItem { -#ifndef QT_MAC_USE_COCOA - inline QMenuMergeItem(MenuCommand c, QMacMenuAction *a) : command(c), action(a) { } - MenuCommand command; -#else inline QMenuMergeItem(NSMenuItem *c, QMacMenuAction *a) : menuItem(c), action(a) { } NSMenuItem *menuItem; -#endif QMacMenuAction *action; }; typedef QList<QMenuMergeItem> QMenuMergeList; -#endif +#endif // Q_OS_MAC #ifdef Q_WS_WINCE struct QWceMenuAction { @@ -154,7 +145,7 @@ public: #endif scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0), hasCheckableItems(0), sloppyAction(0), doChildEffects(false) -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC ,mac_menu(0) #endif #if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR) @@ -170,7 +161,7 @@ public: ~QMenuPrivate() { delete scroll; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC delete mac_menu; #endif #if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR) @@ -302,7 +293,7 @@ public: //menu fading/scrolling effects bool doChildEffects; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC //mac menu binding struct QMacMenuPrivate { QList<QMacMenuAction*> actionItems; |