home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qpushbutton.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  4KB  |  143 lines

  1. /****************************************************************************
  2. ** $Id:  qt/qpushbutton.h   3.0.0   edited Sep 21 17:17 $
  3. **
  4. ** Definition of QPushButton class
  5. **
  6. ** Created : 940221
  7. **
  8. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the widgets module of the Qt GUI Toolkit.
  11. **
  12. ** This file may be distributed under the terms of the Q Public License
  13. ** as defined by Trolltech AS of Norway and appearing in the file
  14. ** LICENSE.QPL included in the packaging of this file.
  15. **
  16. ** This file may be distributed and/or modified under the terms of the
  17. ** GNU General Public License version 2 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.GPL included in the
  19. ** packaging of this file.
  20. **
  21. ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  22. ** licenses may use this file in accordance with the Qt Commercial License
  23. ** Agreement provided with the Software.
  24. **
  25. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  26. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  27. **
  28. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  29. **   information about Qt Commercial License Agreements.
  30. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  31. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  32. **
  33. ** Contact info@trolltech.com if any conditions of this licensing are
  34. ** not clear to you.
  35. **
  36. **********************************************************************/
  37.  
  38. #ifndef QPUSHBUTTON_H
  39. #define QPUSHBUTTON_H
  40.  
  41. #ifndef QT_H
  42. #include "qbutton.h"
  43. #include "qiconset.h"
  44. #endif // QT_H
  45.  
  46. #ifndef QT_NO_PUSHBUTTON
  47. class QPushButtonPrivate;
  48. class QPopupMenu;
  49.  
  50. class Q_EXPORT QPushButton : public QButton
  51. {
  52.     Q_OBJECT
  53.  
  54.     Q_PROPERTY( bool autoDefault READ autoDefault WRITE setAutoDefault )
  55.     Q_PROPERTY( bool default READ isDefault WRITE setDefault )
  56.     Q_PROPERTY( bool menuButton READ isMenuButton DESIGNABLE false )
  57.     Q_PROPERTY( QIconSet iconSet READ iconSet WRITE setIconSet )
  58.     Q_OVERRIDE( bool toggleButton WRITE setToggleButton )
  59.     Q_OVERRIDE( bool on WRITE setOn )
  60.     Q_PROPERTY( bool flat READ isFlat WRITE setFlat )
  61.     Q_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true )
  62.  
  63. public:
  64.     QPushButton( QWidget *parent, const char* name=0 );
  65.     QPushButton( const QString &text, QWidget *parent, const char* name=0 );
  66.     QPushButton( const QIconSet& icon, const QString &text, QWidget *parent, const char* name=0 );
  67.     ~QPushButton();
  68.  
  69.     QSize    sizeHint() const;
  70.  
  71.     void    move( int x, int y );
  72.     void    move( const QPoint &p );
  73.     void    resize( int w, int h );
  74.     void    resize( const QSize & );
  75.     void    setGeometry( int x, int y, int w, int h );
  76.  
  77.     void    setGeometry( const QRect & );
  78.  
  79.     void setToggleButton( bool );
  80.  
  81.     bool    autoDefault()    const    { return autoDefButton; }
  82.     virtual void setAutoDefault( bool autoDef );
  83.     bool    isDefault()    const    { return defButton; }
  84.     virtual void setDefault( bool def );
  85.  
  86.     virtual void setIsMenuButton( bool enable ) {  // obsolete functions
  87.     if ( (bool)hasMenuArrow == enable )
  88.         return;
  89.     hasMenuArrow = enable ? 1 : 0;
  90.     update();
  91.     updateGeometry();
  92.     }
  93.     bool    isMenuButton() const { return hasMenuArrow; }
  94.  
  95.     void setPopup( QPopupMenu* popup );
  96.     QPopupMenu* popup() const;
  97.  
  98.     void setIconSet( const QIconSet& );
  99.     QIconSet* iconSet() const;
  100.  
  101.     void setFlat( bool );
  102.     bool isFlat() const;
  103.  
  104. public slots:
  105.     virtual void setOn( bool );
  106.  
  107. protected:
  108.     void    drawButton( QPainter * );
  109.     void    drawButtonLabel( QPainter * );
  110.     void    focusInEvent( QFocusEvent * );
  111.     void    focusOutEvent( QFocusEvent * );
  112.     void    resizeEvent( QResizeEvent * );
  113.     void    updateMask();
  114.  
  115. private slots:
  116.     void popupPressed();
  117.  
  118. private:
  119.     void    init();
  120.  
  121.     uint    autoDefButton    : 1;
  122.     uint    defButton    : 1;
  123.     uint    flt        : 1;
  124.     uint    reserved        : 1; // UNUSED
  125.     uint    lastEnabled    : 1; // UNUSED
  126.     uint    hasMenuArrow    : 1;
  127.  
  128.     QPushButtonPrivate* d;
  129.  
  130.     friend class QDialog;
  131.  
  132. private:    // Disabled copy constructor and operator=
  133. #if defined(Q_DISABLE_COPY)
  134.     QPushButton( const QPushButton & );
  135.     QPushButton &operator=( const QPushButton & );
  136. #endif
  137. };
  138.  
  139.  
  140. #endif // QT_NO_PUSHBUTTON
  141.  
  142. #endif // QPUSHBUTTON_H
  143.