Changeset 561 for trunk/src/gui/widgets/qmenu_p.h
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/widgets/qmenu_p.h
r2 r561 2 2 ** 3 3 ** 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]) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 62 62 #include "private/qwidget_p.h" 63 63 64 65 66 67 68 64 69 QT_BEGIN_NAMESPACE 65 70 66 71 #ifndef QT_NO_MENU 72 73 74 75 76 67 77 68 78 class QTornOffMenu; … … 113 123 #endif 114 124 115 #ifdef Q_ OS_WINCE125 #ifdef Q_S_WINCE 116 126 struct QWceMenuAction { 117 127 uint command; … … 121 131 }; 122 132 #endif 133 134 135 136 137 138 139 140 141 123 142 124 143 class QMenuPrivate : public QWidgetPrivate … … 127 146 public: 128 147 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) 132 156 #ifdef Q_WS_MAC 133 157 ,mac_menu(0) 134 158 #endif 135 #if defined(Q_ OS_WINCE) && !defined(QT_NO_MENUBAR)159 #if defined(Q_S_WINCE) && !defined(QT_NO_MENUBAR) 136 160 ,wce_menu(0) 161 162 163 137 164 #endif 138 165 #ifdef QT3_SUPPORT … … 146 173 delete mac_menu; 147 174 #endif 148 #if defined(Q_ OS_WINCE) && !defined(QT_NO_MENUBAR)175 #if defined(Q_S_WINCE) && !defined(QT_NO_MENUBAR) 149 176 delete wce_menu; 150 177 #endif 178 179 180 181 151 182 } 152 183 void init(); 184 185 186 153 187 154 188 //item calculations … … 156 190 mutable uint maxIconWidth, tabWidth; 157 191 QRect actionRect(QAction *) const; 158 mutable QMap<QAction*, QRect> actionRects; 159 mutable Q List<QAction*> actionList;192 193 mutable Q; 160 194 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 166 199 uint collapsibleSeparators : 1; 167 200 168 uint activationRecursionGuard : 1;201 ; 169 202 170 203 //selection … … 175 208 int motions; 176 209 QAction *currentAction; 210 211 212 213 177 214 static QBasicTimer menuDelayTimer; 178 215 enum SelectionReason { … … 180 217 SelectedFromElsewhere 181 218 }; 219 182 220 QAction *actionAt(QPoint p) const; 183 221 void setFirstActionActive(); … … 192 230 uint scrollFlags : 2, scrollDirection : 2; 193 231 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() { } 198 236 } *scroll; 199 237 void scrollMenu(QMenuScroller::ScrollLocation location, bool active=false); … … 209 247 QBasicTimer searchBufferTimer; 210 248 211 //passing of mouse events up the parent h eirarchy249 //passing of mouse events up the parent hrarchy 212 250 QPointer<QMenu> activeMenu; 213 251 bool mouseEventTaken(QMouseEvent *); … … 221 259 QMenuCaused causedPopup; 222 260 void hideUpToMenuBar(); 223 void hideMenu(QMenu *menu );261 void hideMenu(QMenu *menu); 224 262 225 263 //index mappings … … 235 273 //sloppy selection 236 274 static QBasicTimer sloppyDelayTimer; 237 QAction *sloppyAction;275 QAction *sloppyAction; 238 276 QRegion sloppyRegion; 239 277 … … 255 293 256 294 bool hasMouseMoved(const QPoint &globalPos); 295 296 297 257 298 258 299 //menu fading/scrolling effects … … 285 326 OSMenuRef macMenu(OSMenuRef merge); 286 327 void setMacMenuEnabled(bool enable = true); 328 287 329 static QHash<OSMenuRef, OSMenuRef> mergeMenuHash; 288 330 static QHash<OSMenuRef, QMenuMergeList*> mergeMenuItemsHash; … … 294 336 #endif 295 337 296 #if defined(Q_ OS_WINCE) && !defined(QT_NO_MENUBAR)338 #if defined(Q_S_WINCE) && !defined(QT_NO_MENUBAR) 297 339 struct QWceMenuPrivate { 298 340 QList<QWceMenuAction*> actionItems; … … 319 361 QAction* wceCommands(uint command); 320 362 #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 322 385 QPointer<QWidget> noReplayFor; 323 386 };
Note:
See TracChangeset
for help on using the changeset viewer.