Eneboo - Documentación para desarrolladores
src/qt/src/widgets/qpushbutton.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qpushbutton.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QPushButton class
00005 **
00006 ** Created : 940221
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 QPUSHBUTTON_H
00039 #define QPUSHBUTTON_H
00040 
00041 #ifndef QT_H
00042 #include "qbutton.h"
00043 #include "qiconset.h"
00044 #endif // QT_H
00045 
00046 #ifndef QT_NO_PUSHBUTTON
00047 class QPushButtonPrivate;
00048 class QPopupMenu;
00049 
00050 class Q_EXPORT QPushButton : public QButton
00051 {
00052     Q_OBJECT
00053 
00054     Q_PROPERTY( bool autoDefault READ autoDefault WRITE setAutoDefault )
00055     Q_PROPERTY( bool default READ isDefault WRITE setDefault )
00056     Q_PROPERTY( bool menuButton READ isMenuButton DESIGNABLE false )
00057     Q_PROPERTY( QIconSet iconSet READ iconSet WRITE setIconSet )
00058     Q_OVERRIDE( bool toggleButton WRITE setToggleButton )
00059     Q_OVERRIDE( bool on WRITE setOn )
00060     Q_PROPERTY( bool flat READ isFlat WRITE setFlat )
00061     Q_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true )
00062 
00063 public:
00064     QPushButton( QWidget *parent, const char* name=0 );
00065     QPushButton( const QString &text, QWidget *parent, const char* name=0 );
00066 #ifndef QT_NO_ICONSET
00067     QPushButton( const QIconSet& icon, const QString &text, QWidget *parent, const char* name=0 );
00068 #endif
00069     ~QPushButton();
00070 
00071     QSize       sizeHint() const;
00072 
00073     void        move( int x, int y );
00074     void        move( const QPoint &p );
00075     void        resize( int w, int h );
00076     void        resize( const QSize & );
00077     void        setGeometry( int x, int y, int w, int h );
00078 
00079     void        setGeometry( const QRect & );
00080 
00081     void setToggleButton( bool );
00082 
00083     bool        autoDefault()   const   { return autoDefButton; }
00084     virtual void setAutoDefault( bool autoDef );
00085     bool        isDefault()     const   { return defButton; }
00086     virtual void setDefault( bool def );
00087 
00088     virtual void setIsMenuButton( bool enable ) {  // obsolete functions
00089         if ( (bool)hasMenuArrow == enable )
00090             return;
00091         hasMenuArrow = enable ? 1 : 0;
00092         update();
00093         updateGeometry();
00094     }
00095     bool        isMenuButton() const { return hasMenuArrow; }
00096 
00097 #ifndef QT_NO_POPUPMENU
00098     void setPopup( QPopupMenu* popup );
00099     QPopupMenu* popup() const;
00100 #endif
00101 #ifndef QT_NO_ICONSET
00102     void setIconSet( const QIconSet& );
00103     QIconSet* iconSet() const;
00104 #endif
00105     void setFlat( bool );
00106     bool isFlat() const;
00107 
00108 public slots:
00109     virtual void setOn( bool );
00110 
00111 protected:
00112     void        drawButton( QPainter * );
00113     void        drawButtonLabel( QPainter * );
00114     void        focusInEvent( QFocusEvent * );
00115     void        focusOutEvent( QFocusEvent * );
00116     void        resizeEvent( QResizeEvent * );
00117     void        updateMask();
00118 private slots:
00119 #ifndef QT_NO_POPUPMENU
00120     void popupPressed();
00121 #endif
00122 private:
00123     void        init();
00124 
00125     uint        autoDefButton   : 1;
00126     uint        defButton       : 1;
00127     uint        flt             : 1;
00128     uint        reserved                : 1; // UNUSED
00129     uint        lastEnabled     : 1; // UNUSED
00130     uint        hasMenuArrow    : 1;
00131 
00132     QPushButtonPrivate* d;
00133 
00134     friend class QDialog;
00135 
00136 private:        // Disabled copy constructor and operator=
00137 #if defined(Q_DISABLE_COPY)
00138     QPushButton( const QPushButton & );
00139     QPushButton &operator=( const QPushButton & );
00140 #endif
00141 };
00142 
00143 
00144 #endif // QT_NO_PUSHBUTTON
00145 
00146 #endif // QPUSHBUTTON_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'