Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qprogressbar.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QProgressBar class 00005 ** 00006 ** Created : 970520 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 QPROGRESSBAR_H 00039 #define QPROGRESSBAR_H 00040 00041 #ifndef QT_H 00042 #include "qframe.h" 00043 #endif // QT_H 00044 00045 #ifndef QT_NO_PROGRESSBAR 00046 00047 00048 class QProgressBarPrivate; 00049 00050 00051 class Q_EXPORT QProgressBar : public QFrame 00052 { 00053 Q_OBJECT 00054 Q_PROPERTY( int totalSteps READ totalSteps WRITE setTotalSteps ) 00055 Q_PROPERTY( int progress READ progress WRITE setProgress ) 00056 Q_PROPERTY( QString progressString READ progressString ) 00057 Q_PROPERTY( bool centerIndicator READ centerIndicator WRITE setCenterIndicator ) 00058 Q_PROPERTY( bool indicatorFollowsStyle READ indicatorFollowsStyle WRITE setIndicatorFollowsStyle ) 00059 Q_PROPERTY( bool percentageVisible READ percentageVisible WRITE setPercentageVisible ) 00060 00061 public: 00062 QProgressBar( QWidget* parent=0, const char* name=0, WFlags f=0 ); 00063 QProgressBar( int totalSteps, QWidget* parent=0, const char* name=0, WFlags f=0 ); 00064 00065 int totalSteps() const; 00066 int progress() const; 00067 const QString &progressString() const; 00068 00069 QSize sizeHint() const; 00070 QSize minimumSizeHint() const; 00071 00072 void setCenterIndicator( bool on ); 00073 bool centerIndicator() const; 00074 00075 void setIndicatorFollowsStyle( bool ); 00076 bool indicatorFollowsStyle() const; 00077 00078 bool percentageVisible() const; 00079 void setPercentageVisible( bool ); 00080 00081 void show(); 00082 00083 public slots: 00084 void reset(); 00085 virtual void setTotalSteps( int totalSteps ); 00086 virtual void setProgress( int progress ); 00087 void setProgress( int progress, int totalSteps ); 00088 00089 protected: 00090 void drawContents( QPainter * ); 00091 virtual bool setIndicator( QString & progress_str, int progress, 00092 int totalSteps ); 00093 void styleChange( QStyle& ); 00094 00095 private: 00096 int total_steps; 00097 int progress_val; 00098 int percentage; 00099 QString progress_str; 00100 bool center_indicator : 1; 00101 bool auto_indicator : 1; 00102 bool percentage_visible : 1; 00103 QProgressBarPrivate * d; 00104 void initFrame(); 00105 00106 private: // Disabled copy constructor and operator= 00107 #if defined(Q_DISABLE_COPY) 00108 QProgressBar( const QProgressBar & ); 00109 QProgressBar &operator=( const QProgressBar & ); 00110 #endif 00111 }; 00112 00113 00114 inline int QProgressBar::totalSteps() const 00115 { 00116 return total_steps; 00117 } 00118 00119 inline int QProgressBar::progress() const 00120 { 00121 return progress_val; 00122 } 00123 00124 inline const QString &QProgressBar::progressString() const 00125 { 00126 return progress_str; 00127 } 00128 00129 inline bool QProgressBar::centerIndicator() const 00130 { 00131 return center_indicator; 00132 } 00133 00134 inline bool QProgressBar::indicatorFollowsStyle() const 00135 { 00136 return auto_indicator; 00137 } 00138 00139 inline bool QProgressBar::percentageVisible() const 00140 { 00141 return percentage_visible; 00142 } 00143 00144 #endif // QT_NO_PROGRESSBAR 00145 00146 #endif // QPROGRESSBAR_H