Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qmenubar_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5858#include <private/qmenu_p.h> // Mac needs what in this file!
    5959
    60 #ifdef Q_OS_WINCE
     60#ifdef Q_WS_WINCE
    6161#include "qguifunctions_wince.h"
     62#endif
     63
     64#ifndef QT_NO_MENUBAR
     65#ifdef Q_WS_S60
     66class CCoeControl;
     67class CEikMenuBar;
     68#endif
    6269#endif
    6370
     
    7077    Q_DECLARE_PUBLIC(QMenuBar)
    7178public:
    72     QMenuBarPrivate() : itemsDirty(0), itemsWidth(0), itemsStart(-1), currentAction(0), mouseDown(0),
    73                          closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0)
     79    QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0),
     80                         closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0),
     81                         nativeMenuBar(-1), doChildEffects(false)
     82#ifdef QT3_SUPPORT
     83                         , doAutoResize(false)
     84#endif
    7485#ifdef Q_WS_MAC
    7586                         , mac_menubar(0)
    7687#endif
    7788
    78 #ifdef Q_OS_WINCE
     89#ifdef Q_WS_WINCE
    7990                         , wce_menubar(0), wceClassicMenu(false)
    8091#endif
    81     { }
     92#ifdef Q_WS_S60
     93                         , symbian_menubar(0)
     94#endif
     95
     96        { }
    8297    ~QMenuBarPrivate()
    8398        {
     
    85100            delete mac_menubar;
    86101#endif
    87 #ifdef Q_OS_WINCE
     102#ifdef Q_WS_WINCE
    88103            delete wce_menubar;
    89104#endif
     105#ifdef Q_WS_S60
     106            delete symbian_menubar;
     107#endif
    90108        }
    91109
    92110    void init();
    93     QStyleOptionMenuItem getStyleOption(const QAction *action) const;
     111    QAction *getNextAction(const int start, const int increment) const;
    94112
    95113    //item calculations
    96114    uint itemsDirty : 1;
    97     int itemsWidth, itemsStart;
    98115
    99116    QVector<int> shortcutIndexMap;
    100     mutable QMap<QAction*, QRect> actionRects;
    101     mutable QList<QAction*> actionList;
    102     void calcActionRects(int max_width, int start, QMap<QAction*, QRect> &actionRects, QList<QAction*> &actionList) const;
     117    mutable QVector<QRect> actionRects;
     118    void calcActionRects(int max_width, int start) const;
    103119    QRect actionRect(QAction *) const;
    104120    void updateGeometries();
     
    116132
    117133    //keyboard mode for keyboard navigation
     134    void focusFirstAction();
    118135    void setKeyboardMode(bool);
    119136    uint keyboardState : 1, altPressed : 1;
    120137    QPointer<QWidget> keyboardFocusWidget;
    121138
     139
     140    int nativeMenuBar : 3;  // Only has values -1, 0, and 1
    122141    //firing of events
    123142    void activateAction(QAction *, QAction::ActionEvent);
     
    128147    void _q_updateLayout();
    129148
    130 #ifdef Q_OS_WINCE
     149#ifdef Q_WS_WINCE
    131150    void _q_updateDefaultAction();
    132151#endif
     
    178197        }
    179198    } *mac_menubar;
     199    bool macWidgetHasNativeMenubar(QWidget *widget);
    180200    void macCreateMenuBar(QWidget *);
    181201    void macDestroyMenuBar();
    182202    OSMenuRef macMenu();
    183203#endif
    184 #ifdef Q_OS_WINCE
     204#ifdef Q_WS_WINCE
    185205    void wceCreateMenuBar(QWidget *);
    186206    void wceDestroyMenuBar();
     
    221241    bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command);
    222242#endif
     243#ifdef Q_WS_S60
     244    void symbianCreateMenuBar(QWidget *);
     245    void symbianDestroyMenuBar();
     246    struct QSymbianMenuBarPrivate {
     247        QList<QSymbianMenuAction*> actionItems;
     248        QMenuBarPrivate *d;
     249        QSymbianMenuBarPrivate(QMenuBarPrivate *menubar);
     250        ~QSymbianMenuBarPrivate();
     251        void addAction(QAction *, QSymbianMenuAction* =0);
     252        void addAction(QSymbianMenuAction *, QSymbianMenuAction* =0);
     253        void syncAction(QSymbianMenuAction *);
     254        inline void syncAction(QAction *a) { syncAction(findAction(a)); }
     255        void removeAction(QSymbianMenuAction *);
     256        void rebuild();
     257        inline void removeAction(QAction *a) { removeAction(findAction(a)); }
     258        inline QSymbianMenuAction *findAction(QAction *a) {
     259            for(int i = 0; i < actionItems.size(); i++) {
     260                QSymbianMenuAction *act = actionItems[i];
     261                if(a == act->action)
     262                    return act;
     263            }
     264            return 0;
     265        }
     266        void insertNativeMenuItems(const QList<QAction*> &actions);
     267
     268    } *symbian_menubar;
     269    static int symbianCommands(int command);
     270
     271#endif
    223272};
    224273#endif
Note: See TracChangeset for help on using the changeset viewer.