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/qmenu_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6262#include "private/qwidget_p.h"
    6363
     64
     65
     66
     67
     68
    6469QT_BEGIN_NAMESPACE
    6570
    6671#ifndef QT_NO_MENU
     72
     73
     74
     75
     76
    6777
    6878class QTornOffMenu;
     
    113123#endif
    114124
    115 #ifdef Q_OS_WINCE
     125#ifdef Q_S_WINCE
    116126struct QWceMenuAction {
    117127    uint command;   
     
    121131};
    122132#endif
     133
     134
     135
     136
     137
     138
     139
     140
     141
    123142
    124143class QMenuPrivate : public QWidgetPrivate
     
    127146public:
    128147    QMenuPrivate() : itemsDirty(0), maxIconWidth(0), tabWidth(0), ncols(0),
    129                       collapsibleSeparators(true), hasHadMouse(0), aboutToHide(0), motions(0),
    130                       currentAction(0), scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
    131                       hasCheckableItems(0), sloppyAction(0)
     148                      collapsibleSeparators(true), activationRecursionGuard(false), hasHadMouse(0), aboutToHide(0), motions(0),
     149                      currentAction(0),
     150#ifdef QT_KEYPAD_NAVIGATION
     151                      selectAction(0),
     152                      cancelAction(0),
     153#endif
     154                      scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
     155                      hasCheckableItems(0), sloppyAction(0), doChildEffects(false)
    132156#ifdef Q_WS_MAC
    133157                      ,mac_menu(0)
    134158#endif
    135 #if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
     159#if defined(Q_S_WINCE) && !defined(QT_NO_MENUBAR)
    136160                      ,wce_menu(0)
     161
     162
     163
    137164#endif
    138165#ifdef QT3_SUPPORT
     
    146173        delete mac_menu;
    147174#endif
    148 #if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
     175#if defined(Q_S_WINCE) && !defined(QT_NO_MENUBAR)
    149176        delete wce_menu;
    150177#endif
     178
     179
     180
     181
    151182    }
    152183    void init();
     184
     185
     186
    153187
    154188    //item calculations
     
    156190    mutable uint maxIconWidth, tabWidth;
    157191    QRect actionRect(QAction *) const;
    158     mutable QMap<QAction*, QRect> actionRects;
    159     mutable QList<QAction*> actionList;
     192
     193    mutable Q;
    160194    mutable QHash<QAction *, QWidget *> widgetItems;
    161     void calcActionRects(QMap<QAction*, QRect> &actionRects, QList<QAction*> &actionList) const;
    162     void updateActions();
    163     QRect popupGeometry(int screen=-1) const;
    164     QList<QAction *> filterActions(const QList<QAction *> &actions) const;
    165     uint ncols : 4; //4 bits is probably plenty
     195    void updateActionRects() const;
     196    QRect popupGeometry(const QWidget *widget) const;
     197    QRect popupGeometry(int screen = -1) const;
     198    mutable uint ncols : 4; //4 bits is probably plenty
    166199    uint collapsibleSeparators : 1;
    167200
    168     uint activationRecursionGuard : 1;
     201    ;
    169202
    170203    //selection
     
    175208    int motions;
    176209    QAction *currentAction;
     210
     211
     212
     213
    177214    static QBasicTimer menuDelayTimer;
    178215    enum SelectionReason {
     
    180217        SelectedFromElsewhere
    181218    };
     219
    182220    QAction *actionAt(QPoint p) const;
    183221    void setFirstActionActive();
     
    192230        uint scrollFlags : 2, scrollDirection : 2;
    193231        int scrollOffset;
    194         QBasicTimer *scrollTimer;
    195 
    196         QMenuScroller() : scrollFlags(ScrollNone), scrollDirection(ScrollNone), scrollOffset(0), scrollTimer(0) { }
    197         ~QMenuScroller() { delete scrollTimer; }
     232        QBasicTimer scrollTimer;
     233
     234        QMenuScroller() : scrollFlags(ScrollNone), scrollDirection(ScrollNone), scrollOffset(0) { }
     235        ~QMenuScroller() { }
    198236    } *scroll;
    199237    void scrollMenu(QMenuScroller::ScrollLocation location, bool active=false);
     
    209247    QBasicTimer searchBufferTimer;
    210248
    211     //passing of mouse events up the parent heirarchy
     249    //passing of mouse events up the parent hrarchy
    212250    QPointer<QMenu> activeMenu;
    213251    bool mouseEventTaken(QMouseEvent *);
     
    221259    QMenuCaused causedPopup;
    222260    void hideUpToMenuBar();
    223     void hideMenu(QMenu *menu);
     261    void hideMenu(QMenu *menu);
    224262
    225263    //index mappings
     
    235273    //sloppy selection
    236274    static QBasicTimer sloppyDelayTimer;
    237     QAction *sloppyAction;
     275    QAction *sloppyAction;
    238276    QRegion sloppyRegion;
    239277
     
    255293
    256294    bool hasMouseMoved(const QPoint &globalPos);
     295
     296
     297
    257298
    258299    //menu fading/scrolling effects
     
    285326    OSMenuRef macMenu(OSMenuRef merge);
    286327    void setMacMenuEnabled(bool enable = true);
     328
    287329    static QHash<OSMenuRef, OSMenuRef> mergeMenuHash;
    288330    static QHash<OSMenuRef, QMenuMergeList*> mergeMenuItemsHash;
     
    294336#endif
    295337
    296 #if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
     338#if defined(Q_S_WINCE) && !defined(QT_NO_MENUBAR)
    297339    struct QWceMenuPrivate {
    298340        QList<QWceMenuAction*> actionItems;
     
    319361    QAction* wceCommands(uint command);
    320362#endif
    321 
     363#if defined(Q_WS_S60)
     364    struct QSymbianMenuPrivate {
     365        QList<QSymbianMenuAction*> actionItems;
     366        QSymbianMenuPrivate();
     367        ~QSymbianMenuPrivate();
     368        void addAction(QAction *, QSymbianMenuAction* =0);
     369        void addAction(QSymbianMenuAction *, QSymbianMenuAction* =0);
     370        void syncAction(QSymbianMenuAction *);
     371        inline void syncAction(QAction *a) { syncAction(findAction(a)); }
     372        void removeAction(QSymbianMenuAction *);
     373        void rebuild(bool reCreate = false);
     374        inline void removeAction(QAction *a) { removeAction(findAction(a)); }
     375        inline QSymbianMenuAction *findAction(QAction *a) {
     376            for(int i = 0; i < actionItems.size(); i++) {
     377                QSymbianMenuAction *act = actionItems[i];
     378                if(a == act->action)
     379                    return act;
     380            }
     381            return 0;
     382        }
     383    } *symbian_menu;
     384#endif
    322385    QPointer<QWidget> noReplayFor;
    323386};
Note: See TracChangeset for help on using the changeset viewer.