[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qmenudata.h:1 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>qmenudata.h Include File</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qmenudata.h</h1>
|
---|
| 33 |
|
---|
| 34 | <p>This is the verbatim text of the qmenudata.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
| 35 | <hr>
|
---|
| 36 | <pre>
|
---|
| 37 | /****************************************************************************
|
---|
| 38 | ** $Id: qmenudata-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
| 39 | **
|
---|
| 40 | ** Definition of QMenuData class
|
---|
| 41 | **
|
---|
| 42 | ** Created : 941128
|
---|
| 43 | **
|
---|
| 44 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
---|
| 45 | **
|
---|
| 46 | ** This file is part of the widgets module of the Qt GUI Toolkit.
|
---|
| 47 | **
|
---|
| 48 | ** This file may be distributed under the terms of the Q Public License
|
---|
| 49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
| 50 | ** LICENSE.QPL included in the packaging of this file.
|
---|
| 51 | **
|
---|
| 52 | ** This file may be distributed and/or modified under the terms of the
|
---|
| 53 | ** GNU General Public License version 2 as published by the Free Software
|
---|
| 54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 55 | ** packaging of this file.
|
---|
| 56 | **
|
---|
| 57 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
| 58 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
| 59 | ** Agreement provided with the Software.
|
---|
| 60 | **
|
---|
| 61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
| 62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 63 | **
|
---|
| 64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
| 65 | ** information about Qt Commercial License Agreements.
|
---|
| 66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
| 67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
| 68 | **
|
---|
| 69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
| 70 | ** not clear to you.
|
---|
| 71 | **
|
---|
| 72 | **********************************************************************/
|
---|
| 73 |
|
---|
| 74 | #ifndef QMENUDATA_H
|
---|
| 75 | #define QMENUDATA_H
|
---|
| 76 |
|
---|
| 77 | #ifndef QT_H
|
---|
| 78 | #include "qglobal.h"
|
---|
| 79 | #include "qiconset.h" // conversion QPixmap->QIconset
|
---|
| 80 | #include "qkeysequence.h"
|
---|
| 81 | #include "qstring.h"
|
---|
| 82 | #include "qsignal.h"
|
---|
| 83 | #include "qfont.h"
|
---|
| 84 | #endif // QT_H
|
---|
| 85 |
|
---|
| 86 | #ifndef QT_NO_MENUDATA
|
---|
| 87 |
|
---|
| 88 | class QPopupMenu;
|
---|
| 89 | class QMenuDataData;
|
---|
| 90 | class QObject;
|
---|
| 91 |
|
---|
| 92 | class QCustomMenuItem;
|
---|
| 93 | class QMenuItemData;
|
---|
| 94 |
|
---|
| 95 | class Q_EXPORT QMenuItem // internal menu item class
|
---|
| 96 | {
|
---|
| 97 | friend class QMenuData;
|
---|
| 98 | public:
|
---|
| 99 | QMenuItem();
|
---|
| 100 | ~QMenuItem();
|
---|
| 101 |
|
---|
| 102 | int id() const { return ident; }
|
---|
| 103 | QIconSet *iconSet() const { return iconset_data; }
|
---|
| 104 | QString text() const { return text_data; }
|
---|
| 105 | QString whatsThis() const { return whatsthis_data; }
|
---|
| 106 | QPixmap *pixmap() const { return pixmap_data; }
|
---|
| 107 | QPopupMenu *popup() const { return popup_menu; }
|
---|
| 108 | QWidget *widget() const { return widget_item; }
|
---|
| 109 | QCustomMenuItem *custom() const;
|
---|
| 110 | #ifndef QT_NO_ACCEL
|
---|
| 111 | QKeySequence key() const { return accel_key; }
|
---|
| 112 | #endif
|
---|
| 113 | QSignal *signal() const { return signal_data; }
|
---|
| 114 | bool isSeparator() const { return is_separator; }
|
---|
| 115 | bool isEnabled() const { return is_enabled; }
|
---|
| 116 | bool isChecked() const { return is_checked; }
|
---|
| 117 | bool isDirty() const { return is_dirty; }
|
---|
| 118 | bool isVisible() const { return is_visible; }
|
---|
| 119 | bool isEnabledAndVisible() const { return is_enabled && is_visible; }
|
---|
| 120 |
|
---|
| 121 | void setText( const QString &text ) { text_data = text; }
|
---|
| 122 | void setDirty( bool dirty ) { is_dirty = dirty; }
|
---|
| 123 | void setVisible( bool visible ) { is_visible = visible; }
|
---|
| 124 | void setWhatsThis( const QString &text ) { whatsthis_data = text; }
|
---|
| 125 |
|
---|
| 126 | private:
|
---|
| 127 | int ident; // item identifier
|
---|
| 128 | QIconSet *iconset_data; // icons
|
---|
| 129 | QString text_data; // item text
|
---|
| 130 | QString whatsthis_data; // item Whats This help text
|
---|
| 131 | QPixmap *pixmap_data; // item pixmap
|
---|
| 132 | QPopupMenu *popup_menu; // item popup menu
|
---|
| 133 | QWidget *widget_item; // widget menu item
|
---|
| 134 | #ifndef QT_NO_ACCEL
|
---|
| 135 | QKeySequence accel_key; // accelerator key (state|ascii)
|
---|
| 136 | #endif
|
---|
| 137 | QSignal *signal_data; // connection
|
---|
| 138 | uint is_separator : 1; // separator flag
|
---|
| 139 | uint is_enabled : 1; // disabled flag
|
---|
| 140 | uint is_checked : 1; // checked flag
|
---|
| 141 | uint is_dirty : 1; // dirty (update) flag
|
---|
| 142 | uint is_visible : 1; // visibility flag
|
---|
| 143 | QMenuItemData* d;
|
---|
| 144 |
|
---|
| 145 | QMenuItemData* extra();
|
---|
| 146 |
|
---|
| 147 | private: // Disabled copy constructor and operator=
|
---|
| 148 | #if defined(Q_DISABLE_COPY)
|
---|
| 149 | QMenuItem( const QMenuItem & );
|
---|
| 150 | QMenuItem &operator=( const QMenuItem & );
|
---|
| 151 | #endif
|
---|
| 152 | };
|
---|
| 153 |
|
---|
| 154 | #include "qptrlist.h"
|
---|
| 155 | typedef QPtrList<QMenuItem> QMenuItemList;
|
---|
| 156 | typedef QPtrListIterator<QMenuItem> QMenuItemListIt;
|
---|
| 157 |
|
---|
| 158 |
|
---|
| 159 | class Q_EXPORT QCustomMenuItem : public Qt
|
---|
| 160 | {
|
---|
| 161 | public:
|
---|
| 162 | QCustomMenuItem();
|
---|
| 163 | virtual ~QCustomMenuItem();
|
---|
| 164 | virtual bool fullSpan() const;
|
---|
| 165 | virtual bool isSeparator() const;
|
---|
| 166 | virtual void setFont( const QFont& font );
|
---|
| 167 | virtual void paint( QPainter* p, const QColorGroup& cg, bool act,
|
---|
| 168 | bool enabled, int x, int y, int w, int h ) = 0;
|
---|
| 169 | virtual QSize sizeHint() = 0;
|
---|
| 170 | };
|
---|
| 171 |
|
---|
| 172 |
|
---|
| 173 | class Q_EXPORT QMenuData // menu data class
|
---|
| 174 | {
|
---|
| 175 | friend class QMenuBar;
|
---|
| 176 | friend class QPopupMenu;
|
---|
| 177 | public:
|
---|
| 178 | QMenuData();
|
---|
| 179 | virtual ~QMenuData();
|
---|
| 180 |
|
---|
| 181 | uint count() const;
|
---|
| 182 |
|
---|
| 183 |
|
---|
| 184 | int insertItem( const QString &text,
|
---|
| 185 | const QObject *receiver, const char* member,
|
---|
| 186 | const QKeySequence& accel = 0, int id = -1, int index = -1 );
|
---|
| 187 | int insertItem( const QIconSet& icon,
|
---|
| 188 | const QString &text,
|
---|
| 189 | const QObject *receiver, const char* member,
|
---|
| 190 | const QKeySequence& accel = 0, int id = -1, int index = -1 );
|
---|
| 191 | int insertItem( const QPixmap &pixmap,
|
---|
| 192 | const QObject *receiver, const char* member,
|
---|
| 193 | const QKeySequence& accel = 0, int id = -1, int index = -1 );
|
---|
| 194 | int insertItem( const QIconSet& icon,
|
---|
| 195 | const QPixmap &pixmap,
|
---|
| 196 | const QObject *receiver, const char* member,
|
---|
| 197 | const QKeySequence& accel = 0, int id = -1, int index = -1 );
|
---|
| 198 |
|
---|
| 199 | int insertItem( const QString &text, int id=-1, int index=-1 );
|
---|
| 200 | int insertItem( const QIconSet& icon,
|
---|
| 201 | const QString &text, int id=-1, int index=-1 );
|
---|
| 202 |
|
---|
| 203 | int insertItem( const QString &text, QPopupMenu *popup,
|
---|
| 204 | int id=-1, int index=-1 );
|
---|
| 205 | int insertItem( const QIconSet& icon,
|
---|
| 206 | const QString &text, QPopupMenu *popup,
|
---|
| 207 | int id=-1, int index=-1 );
|
---|
| 208 |
|
---|
| 209 |
|
---|
| 210 | int insertItem( const QPixmap &pixmap, int id=-1, int index=-1 );
|
---|
| 211 | int insertItem( const QIconSet& icon,
|
---|
| 212 | const QPixmap &pixmap, int id=-1, int index=-1 );
|
---|
| 213 | int insertItem( const QPixmap &pixmap, QPopupMenu *popup,
|
---|
| 214 | int id=-1, int index=-1 );
|
---|
| 215 | int insertItem( const QIconSet& icon,
|
---|
| 216 | const QPixmap &pixmap, QPopupMenu *popup,
|
---|
| 217 | int id=-1, int index=-1 );
|
---|
| 218 |
|
---|
| 219 | int insertItem( QWidget* widget, int id=-1, int index=-1 );
|
---|
| 220 |
|
---|
| 221 | int insertItem( const QIconSet& icon, QCustomMenuItem* custom, int id=-1, int index=-1 );
|
---|
| 222 | int insertItem( QCustomMenuItem* custom, int id=-1, int index=-1 );
|
---|
| 223 |
|
---|
| 224 |
|
---|
| 225 | int insertSeparator( int index=-1 );
|
---|
| 226 |
|
---|
| 227 | void removeItem( int id );
|
---|
| 228 | void removeItemAt( int index );
|
---|
| 229 | void clear();
|
---|
| 230 |
|
---|
| 231 | #ifndef QT_NO_ACCEL
|
---|
| 232 | QKeySequence accel( int id ) const;
|
---|
| 233 | void setAccel( const QKeySequence& key, int id );
|
---|
| 234 | #endif
|
---|
| 235 |
|
---|
| 236 | QIconSet *iconSet( int id ) const;
|
---|
| 237 | QString text( int id ) const;
|
---|
| 238 | QPixmap *pixmap( int id ) const;
|
---|
| 239 |
|
---|
| 240 | void setWhatsThis( int id, const QString& );
|
---|
| 241 | QString whatsThis( int id ) const;
|
---|
| 242 |
|
---|
| 243 |
|
---|
| 244 | void changeItem( int id, const QString &text );
|
---|
| 245 | void changeItem( int id, const QPixmap &pixmap );
|
---|
| 246 | void changeItem( int id, const QIconSet &icon, const QString &text );
|
---|
| 247 | void changeItem( int id, const QIconSet &icon, const QPixmap &pixmap );
|
---|
| 248 |
|
---|
| 249 | void changeItem( const QString &text, int id ) { changeItem( id, text); } // obsolete
|
---|
| 250 | void changeItem( const QPixmap &pixmap, int id ) { changeItem( id, pixmap ); } // obsolete
|
---|
| 251 | void changeItem( const QIconSet &icon, const QString &text, int id ) { // obsolete
|
---|
| 252 | changeItem( id, icon, text );
|
---|
| 253 | }
|
---|
| 254 |
|
---|
| 255 | bool isItemActive( int id ) const;
|
---|
| 256 |
|
---|
| 257 | bool isItemEnabled( int id ) const;
|
---|
| 258 | void setItemEnabled( int id, bool enable );
|
---|
| 259 |
|
---|
| 260 | bool isItemChecked( int id ) const;
|
---|
| 261 | void setItemChecked( int id, bool check );
|
---|
| 262 |
|
---|
| 263 | bool isItemVisible( int id ) const;
|
---|
| 264 | void setItemVisible( int id, bool visible );
|
---|
| 265 |
|
---|
| 266 | virtual void updateItem( int id );
|
---|
| 267 |
|
---|
| 268 | int indexOf( int id ) const;
|
---|
| 269 | int idAt( int index ) const;
|
---|
| 270 | virtual void setId( int index, int id );
|
---|
| 271 |
|
---|
| 272 | bool connectItem( int id,
|
---|
| 273 | const QObject *receiver, const char* member );
|
---|
| 274 | bool disconnectItem( int id,
|
---|
| 275 | const QObject *receiver, const char* member );
|
---|
| 276 |
|
---|
| 277 | bool setItemParameter( int id, int param );
|
---|
| 278 | int itemParameter( int id ) const;
|
---|
| 279 |
|
---|
| 280 | QMenuItem *findItem( int id ) const;
|
---|
| 281 | QMenuItem *findItem( int id, QMenuData ** parent ) const;
|
---|
| 282 | QMenuItem * findPopup( QPopupMenu *, int *index = 0 );
|
---|
| 283 |
|
---|
| 284 | virtual void activateItemAt( int index );
|
---|
| 285 |
|
---|
| 286 | protected:
|
---|
| 287 | int actItem;
|
---|
| 288 | QMenuItemList *mitems;
|
---|
| 289 | QMenuData *parentMenu;
|
---|
| 290 | uint isPopupMenu : 1;
|
---|
| 291 | uint isMenuBar : 1;
|
---|
| 292 | uint badSize : 1;
|
---|
| 293 | uint mouseBtDn : 1;
|
---|
| 294 | uint avoid_circularity : 1;
|
---|
| 295 | uint actItemDown : 1;
|
---|
| 296 | virtual void menuContentsChanged();
|
---|
| 297 | virtual void menuStateChanged();
|
---|
| 298 | virtual void menuInsPopup( QPopupMenu * );
|
---|
| 299 | virtual void menuDelPopup( QPopupMenu * );
|
---|
| 300 |
|
---|
| 301 | private:
|
---|
| 302 | int insertAny( const QString *, const QPixmap *, QPopupMenu *,
|
---|
| 303 | const QIconSet*, int, int, QWidget* = 0, QCustomMenuItem* = 0);
|
---|
| 304 | void removePopup( QPopupMenu * );
|
---|
| 305 | void changeItemIconSet( int id, const QIconSet &icon );
|
---|
| 306 |
|
---|
| 307 | QMenuDataData *d;
|
---|
| 308 |
|
---|
| 309 | private: // Disabled copy constructor and operator=
|
---|
| 310 | #if defined(Q_DISABLE_COPY)
|
---|
| 311 | QMenuData( const QMenuData & );
|
---|
| 312 | QMenuData &operator=( const QMenuData & );
|
---|
| 313 | #endif
|
---|
| 314 | };
|
---|
| 315 |
|
---|
| 316 |
|
---|
| 317 | #endif // QT_NO_MENUDATA
|
---|
| 318 |
|
---|
| 319 | #endif // QMENUDATA_H
|
---|
| 320 | </pre>
|
---|
| 321 | <!-- eof -->
|
---|
| 322 | <p><address><hr><div align=center>
|
---|
| 323 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 324 | <td>Copyright © 2007
|
---|
| 325 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 326 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 327 | </table></div></address></body>
|
---|
| 328 | </html>
|
---|