summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qmenubar_p.h
diff options
context:
space:
mode:
authorMorten Sorvig <morten.sorvig@nokia.com>2011-09-06 14:10:50 +0200
committerMorten Johan Sørvig <morten.sorvig@nokia.com>2011-09-07 11:00:36 +0200
commitcee63e2c17c8e83a4366741da0cbd5fc852e5835 (patch)
tree75ccc2afe762a51984d6651d6ff6eb875b73cad6 /src/widgets/widgets/qmenubar_p.h
parente2be53891fe218c9a1a63c2d385d149d2b1f982f (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/qmenubar_p.h')
-rw-r--r--src/widgets/widgets/qmenubar_p.h38
1 files changed, 3 insertions, 35 deletions
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index e42162a48e..5f482c228e 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -78,13 +78,10 @@ class QMenuBarPrivate : public QWidgetPrivate
public:
QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0),
closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0),
- nativeMenuBar(-1), doChildEffects(false)
+ nativeMenuBar(-1), doChildEffects(false), platformMenuBar(0)
#ifdef QT3_SUPPORT
, doAutoResize(false)
#endif
-#ifdef Q_OS_MAC
- , mac_menubar(0)
-#endif
#ifdef Q_WS_WINCE
, wce_menubar(0), wceClassicMenu(false)
@@ -96,9 +93,7 @@ public:
{ }
~QMenuBarPrivate()
{
-#ifdef Q_OS_MAC
- delete mac_menubar;
-#endif
+ delete platformMenuBar;
#ifdef Q_WS_WINCE
delete wce_menubar;
#endif
@@ -173,35 +168,8 @@ public:
#ifdef QT3_SUPPORT
bool doAutoResize;
#endif
-#ifdef Q_OS_MAC
- //mac menubar binding
- struct QMacMenuBarPrivate {
- QList<QMacMenuAction*> actionItems;
- OSMenuRef menu, apple_menu;
- QMacMenuBarPrivate();
- ~QMacMenuBarPrivate();
+ QPlatformMenuBar *platformMenuBar;
- void addAction(QAction *, QMacMenuAction* =0);
- void addAction(QMacMenuAction *, QMacMenuAction* =0);
- void syncAction(QMacMenuAction *);
- inline void syncAction(QAction *a) { syncAction(findAction(a)); }
- void removeAction(QMacMenuAction *);
- inline void removeAction(QAction *a) { removeAction(findAction(a)); }
- inline QMacMenuAction *findAction(QAction *a) {
- for(int i = 0; i < actionItems.size(); i++) {
- QMacMenuAction *act = actionItems[i];
- if(a == act->action)
- return act;
- }
- return 0;
- }
- } *mac_menubar;
- static bool macUpdateMenuBarImmediatly();
- bool macWidgetHasNativeMenubar(QWidget *widget);
- void macCreateMenuBar(QWidget *);
- void macDestroyMenuBar();
- OSMenuRef macMenu();
-#endif
#ifdef Q_WS_WINCE
void wceCreateMenuBar(QWidget *);
void wceDestroyMenuBar();