Eneboo - Documentación para desarrolladores
src/qt/include/qpopupmenu.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qpopupmenu.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QPopupMenu class
00005 **
00006 ** Created : 941128
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the widgets module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QPOPUPMENU_H
00039 #define QPOPUPMENU_H
00040 
00041 #ifndef QT_H
00042 #include "qframe.h"
00043 #include "qmenudata.h"
00044 #endif // QT_H
00045 
00046 #ifndef QT_NO_POPUPMENU
00047 class QPopupMenuPrivate;
00048 
00049 class Q_EXPORT QPopupMenu : public QFrame, public QMenuData
00050 {
00051     Q_OBJECT
00052     Q_PROPERTY( bool checkable READ isCheckable WRITE setCheckable )
00053 public:
00054     QPopupMenu( QWidget* parent=0, const char* name=0 );
00055     ~QPopupMenu();
00056 
00057     void        popup( const QPoint & pos, int indexAtPoint = -1 ); // open
00058     void        updateItem( int id );
00059 
00060     virtual void        setCheckable( bool );
00061     bool        isCheckable() const;
00062 
00063     void        setFont( const QFont & );
00064     void        show();
00065     void        hide();
00066 
00067     int         exec();
00068     int         exec( const QPoint & pos, int indexAtPoint = 0 ); // modal
00069 
00070     virtual void        setActiveItem( int );
00071     QSize       sizeHint() const;
00072 
00073     int         idAt( int index ) const { return QMenuData::idAt( index ); }
00074     int         idAt( const QPoint& pos ) const;
00075 
00076     bool        customWhatsThis() const;
00077 
00078     int         insertTearOffHandle( int id=-1, int index=-1 );
00079 
00080     void        activateItemAt( int index );
00081     QRect       itemGeometry( int index );
00082 
00083 
00084 signals:
00085     void        activated( int itemId );
00086     void        highlighted( int itemId );
00087     void        activatedRedirect( int itemId ); // to parent menu
00088     void        highlightedRedirect( int itemId );
00089     void        aboutToShow();
00090     void        aboutToHide();
00091 
00092 protected:
00093     int         itemHeight( int ) const;
00094     int         itemHeight( QMenuItem* mi ) const;
00095     void        drawItem( QPainter* p, int tab, QMenuItem* mi,
00096                    bool act, int x, int y, int w, int h);
00097 
00098     void        drawContents( QPainter * );
00099 
00100     void        closeEvent( QCloseEvent *e );
00101     void        paintEvent( QPaintEvent * );
00102     void        mousePressEvent( QMouseEvent * );
00103     void        mouseReleaseEvent( QMouseEvent * );
00104     void        mouseMoveEvent( QMouseEvent * );
00105     void        keyPressEvent( QKeyEvent * );
00106     void        focusInEvent( QFocusEvent * );
00107     void        focusOutEvent( QFocusEvent * );
00108     void        timerEvent( QTimerEvent * );
00109     void        leaveEvent( QEvent * );
00110     void        styleChange( QStyle& );
00111     void        enabledChange( bool );
00112     int         columns() const;
00113 
00114     bool        focusNextPrevChild( bool next );
00115 
00116     int         itemAtPos( const QPoint &, bool ignoreSeparator = TRUE ) const;
00117 
00118 private slots:
00119     void        subActivated( int itemId );
00120     void        subHighlighted( int itemId );
00121 #ifndef QT_NO_ACCEL
00122     void        accelActivated( int itemId );
00123     void        accelDestroyed();
00124 #endif
00125     void        popupDestroyed( QObject* );
00126     void        modalActivation( int );
00127 
00128     void        subMenuTimer();
00129     void        subScrollTimer();
00130     void        allowAnimation();
00131     void     toggleTearOff();
00132 
00133     void        performDelayedChanges();
00134 
00135 private:
00136     void        updateScrollerState();
00137     void        menuContentsChanged();
00138     void        menuStateChanged();
00139     void        performDelayedContentsChanged();
00140     void        performDelayedStateChanged();
00141     void        menuInsPopup( QPopupMenu * );
00142     void        menuDelPopup( QPopupMenu * );
00143     void        frameChanged();
00144 
00145     void        actSig( int, bool = FALSE );
00146     void        hilitSig( int );
00147     virtual void setFirstItemActive();
00148     void        hideAllPopups();
00149     void        hidePopups();
00150     bool        tryMenuBar( QMouseEvent * );
00151     void        byeMenuBar();
00152 
00153     QSize       updateSize(bool force_recalc=FALSE, bool do_resize=TRUE);
00154     void        updateRow( int row );
00155 #ifndef QT_NO_ACCEL
00156     void        updateAccel( QWidget * );
00157     void        enableAccel( bool );
00158 #endif
00159     QPopupMenuPrivate  *d;
00160 #ifndef QT_NO_ACCEL
00161     QAccel     *autoaccel;
00162 #endif
00163 
00164 #if defined(Q_WS_MAC) && !defined(QMAC_QMENUBAR_NO_NATIVE)
00165     bool macPopupMenu(const QPoint &, int);
00166     uint mac_dirty_popup : 1;
00167 #endif
00168 
00169     int popupActive;
00170     int tab;
00171     uint accelDisabled : 1;
00172     uint checkable : 1;
00173     uint connectModalRecursionSafety : 1;
00174     uint tornOff : 1;
00175     uint pendingDelayedContentsChanges : 1;
00176     uint pendingDelayedStateChanges : 1;
00177     int maxPMWidth;
00178     int ncols;
00179     bool        snapToMouse;
00180     bool        tryMouseEvent( QPopupMenu *, QMouseEvent * );
00181 
00182     friend class QMenuData;
00183     friend class QMenuBar;
00184 
00185     void connectModal(QPopupMenu* receiver, bool doConnect);
00186 
00187 private:        // Disabled copy constructor and operator=
00188 #if defined(Q_DISABLE_COPY)
00189     QPopupMenu( const QPopupMenu & );
00190     QPopupMenu &operator=( const QPopupMenu & );
00191 #endif
00192 };
00193 
00194 
00195 #endif // QT_NO_POPUPMENU
00196 
00197 #endif // QPOPUPMENU_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'