diff options
Diffstat (limited to 'src/gui/widgets/qmenubar_p.h')
-rw-r--r-- | src/gui/widgets/qmenubar_p.h | 82 |
1 files changed, 65 insertions, 17 deletions
diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h index 7bb7bf6..71205ae 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -21,9 +20,10 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. @@ -57,10 +57,17 @@ #include "QtGui/qstyleoption.h" #include <private/qmenu_p.h> // Mac needs what in this file! -#ifdef Q_OS_WINCE +#ifdef Q_WS_WINCE #include "qguifunctions_wince.h" #endif +#ifndef QT_NO_MENUBAR +#ifdef Q_WS_S60 +class CCoeControl; +class CEikMenuBar; +#endif +#endif + QT_BEGIN_NAMESPACE #ifndef QT_NO_MENUBAR @@ -69,37 +76,46 @@ class QMenuBarPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QMenuBar) public: - QMenuBarPrivate() : itemsDirty(0), itemsWidth(0), itemsStart(-1), currentAction(0), mouseDown(0), - closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0) + QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0), + closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0), + nativeMenuBar(-1), doChildEffects(false) +#ifdef QT3_SUPPORT + , doAutoResize(false) +#endif #ifdef Q_WS_MAC , mac_menubar(0) #endif -#ifdef Q_OS_WINCE +#ifdef Q_WS_WINCE , wce_menubar(0), wceClassicMenu(false) #endif - { } +#ifdef Q_WS_S60 + , symbian_menubar(0) +#endif + + { } ~QMenuBarPrivate() { #ifdef Q_WS_MAC delete mac_menubar; #endif -#ifdef Q_OS_WINCE +#ifdef Q_WS_WINCE delete wce_menubar; #endif +#ifdef Q_WS_S60 + delete symbian_menubar; +#endif } void init(); - QStyleOptionMenuItem getStyleOption(const QAction *action) const; + QAction *getNextAction(const int start, const int increment) const; //item calculations uint itemsDirty : 1; - int itemsWidth, itemsStart; QVector<int> shortcutIndexMap; - mutable QMap<QAction*, QRect> actionRects; - mutable QList<QAction*> actionList; - void calcActionRects(int max_width, int start, QMap<QAction*, QRect> &actionRects, QList<QAction*> &actionList) const; + mutable QVector<QRect> actionRects; + void calcActionRects(int max_width, int start) const; QRect actionRect(QAction *) const; void updateGeometries(); @@ -115,10 +131,13 @@ public: QPointer<QMenu> activeMenu; //keyboard mode for keyboard navigation + void focusFirstAction(); void setKeyboardMode(bool); uint keyboardState : 1, altPressed : 1; QPointer<QWidget> keyboardFocusWidget; + + int nativeMenuBar : 3; // Only has values -1, 0, and 1 //firing of events void activateAction(QAction *, QAction::ActionEvent); @@ -127,7 +146,7 @@ public: void _q_internalShortcutActivated(int); void _q_updateLayout(); -#ifdef Q_OS_WINCE +#ifdef Q_WS_WINCE void _q_updateDefaultAction(); #endif @@ -181,7 +200,7 @@ public: void macDestroyMenuBar(); OSMenuRef macMenu(); #endif -#ifdef Q_OS_WINCE +#ifdef Q_WS_WINCE void wceCreateMenuBar(QWidget *); void wceDestroyMenuBar(); struct QWceMenuBarPrivate { @@ -220,6 +239,35 @@ public: void wceRefresh(); bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command); #endif +#ifdef Q_WS_S60 + void symbianCreateMenuBar(QWidget *); + void symbianDestroyMenuBar(); + struct QSymbianMenuBarPrivate { + QList<QSymbianMenuAction*> actionItems; + QMenuBarPrivate *d; + QSymbianMenuBarPrivate(QMenuBarPrivate *menubar); + ~QSymbianMenuBarPrivate(); + void addAction(QAction *, QSymbianMenuAction* =0); + void addAction(QSymbianMenuAction *, QSymbianMenuAction* =0); + void syncAction(QSymbianMenuAction *); + inline void syncAction(QAction *a) { syncAction(findAction(a)); } + void removeAction(QSymbianMenuAction *); + void rebuild(); + inline void removeAction(QAction *a) { removeAction(findAction(a)); } + inline QSymbianMenuAction *findAction(QAction *a) { + for(int i = 0; i < actionItems.size(); i++) { + QSymbianMenuAction *act = actionItems[i]; + if(a == act->action) + return act; + } + return 0; + } + void insertNativeMenuItems(const QList<QAction*> &actions); + + } *symbian_menubar; + static void symbianCommands(int command); + +#endif }; #endif |