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

  1. /****************************************************************************
  2. ** $Id:  qt/qprogressbar.h   3.0.0   edited Sep 21 17:17 $
  3. **
  4. ** Definition of QProgressBar class
  5. **
  6. ** Created : 970520
  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 QPROGRESSBAR_H
  39. #define QPROGRESSBAR_H
  40.  
  41. #ifndef QT_H
  42. #include "qframe.h"
  43. #endif // QT_H
  44.  
  45. #ifndef QT_NO_PROGRESSBAR
  46.  
  47.  
  48. class QProgressBarPrivate;
  49.  
  50.  
  51. class Q_EXPORT QProgressBar : public QFrame
  52. {
  53.     Q_OBJECT
  54.     Q_PROPERTY( int totalSteps READ totalSteps WRITE setTotalSteps )
  55.     Q_PROPERTY( int progress READ progress WRITE setProgress )
  56.     Q_PROPERTY( QString progressString READ progressString )
  57.     Q_PROPERTY( bool centerIndicator READ centerIndicator WRITE setCenterIndicator )
  58.     Q_PROPERTY( bool indicatorFollowsStyle READ indicatorFollowsStyle WRITE setIndicatorFollowsStyle )
  59.     Q_PROPERTY( bool percentageVisible READ percentageVisible WRITE setPercentageVisible )
  60.  
  61. public:
  62.     QProgressBar( QWidget* parent=0, const char* name=0, WFlags f=0 );
  63.     QProgressBar( int totalSteps, QWidget* parent=0, const char* name=0, WFlags f=0 );
  64.  
  65.     int        totalSteps() const;
  66.     int        progress()   const;
  67.     const QString &progressString() const;
  68.  
  69.     QSize    sizeHint() const;
  70.     QSize    minimumSizeHint() const;
  71.  
  72.     void    setCenterIndicator( bool on );
  73.     bool    centerIndicator() const;
  74.  
  75.     void        setIndicatorFollowsStyle( bool );
  76.     bool    indicatorFollowsStyle() const;
  77.  
  78.     bool    percentageVisible() const;
  79.     void    setPercentageVisible( bool );
  80.  
  81.     void    show();
  82.  
  83. public slots:
  84.     void    reset();
  85.     virtual void setTotalSteps( int totalSteps );
  86.     virtual void setProgress( int progress );
  87.  
  88. protected:
  89.     void    drawContents( QPainter * );
  90.     virtual bool setIndicator( QString & progress_str, int progress,
  91.                    int totalSteps );
  92.     void styleChange( QStyle& );
  93.  
  94. private:
  95.     int        total_steps;
  96.     int        progress_val;
  97.     int        percentage;
  98.     QString    progress_str;
  99.     bool        center_indicator    : 1;
  100.     bool        auto_indicator        : 1;
  101.     bool    percentage_visible  : 1;
  102.     QProgressBarPrivate * d;
  103.     void         initFrame();
  104.  
  105. private:    // Disabled copy constructor and operator=
  106. #if defined(Q_DISABLE_COPY)
  107.     QProgressBar( const QProgressBar & );
  108.     QProgressBar &operator=( const QProgressBar & );
  109. #endif
  110. };
  111.  
  112.  
  113. inline int QProgressBar::totalSteps() const
  114. {
  115.     return total_steps;
  116. }
  117.  
  118. inline int QProgressBar::progress() const
  119. {
  120.     return progress_val;
  121. }
  122.  
  123. inline const QString &QProgressBar::progressString() const
  124. {
  125.     return progress_str;
  126. }
  127.  
  128. inline bool QProgressBar::centerIndicator() const
  129. {
  130.     return center_indicator;
  131. }
  132.  
  133. inline bool QProgressBar::indicatorFollowsStyle() const
  134. {
  135.     return auto_indicator;
  136. }
  137.  
  138. inline bool QProgressBar::percentageVisible() const
  139. {
  140.     return percentage_visible;
  141. }
  142.  
  143. #endif // QT_NO_PROGRESSBAR
  144.  
  145. #endif // QPROGRESSBAR_H
  146.