00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _KGAMEPROGRESS_H
00025 #define _KGAMEPROGRESS_H
00026
00027 #include <QtGui/QFrame>
00028 #include <libkdegames_export.h>
00029
00049 class KDEGAMES_EXPORT KGameProgress : public QFrame
00050 {
00051 Q_OBJECT
00052 Q_ENUMS( BarStyle )
00053 Q_PROPERTY( int value READ value WRITE setValue)
00054 Q_PROPERTY( int mininum READ minimum WRITE setMinimum)
00055 Q_PROPERTY( int maximum READ maximum WRITE setMaximum)
00056 Q_PROPERTY( BarStyle barStyle READ barStyle WRITE setBarStyle )
00057 Q_PROPERTY( QColor barColor READ barColor WRITE setBarColor )
00058 Q_PROPERTY( QPixmap barPixmap READ barPixmap WRITE setBarPixmap )
00059 Q_PROPERTY( Qt::Orientation orientation READ orientation WRITE setOrientation )
00060 Q_PROPERTY( bool textEnabled READ textEnabled WRITE setTextEnabled )
00061
00062 public:
00069 enum BarStyle { Solid, Blocked };
00070
00074 explicit KGameProgress(QWidget *parent=0);
00075
00079 explicit KGameProgress(Qt::Orientation orient, QWidget *parent=0);
00080
00084 ~KGameProgress();
00085
00091 void setBarStyle(BarStyle style);
00092
00096 void setBarColor(const QColor &);
00097
00101 void setBarPixmap(const QPixmap &);
00102
00108 void setOrientation(Qt::Orientation);
00109
00114 void setTextEnabled(bool);
00115
00121 BarStyle barStyle() const;
00122
00127 QColor barColor() const;
00128
00134 const QPixmap *barPixmap() const;
00135
00141 int value() const;
00142
00148 int minimum() const;
00149
00155 int maximum() const;
00156
00162 Qt::Orientation orientation() const;
00163
00170 bool textEnabled() const;
00171
00174 virtual QSize sizeHint() const;
00175
00178 virtual QSize minimumSizeHint() const;
00179
00182 virtual QSizePolicy sizePolicy() const;
00183
00188 QString format() const;
00189
00190 public Q_SLOTS:
00191
00200 void setFormat(const QString & format);
00201
00207 void setValue(int value);
00208
00214 void setMinimum(int value);
00215
00221 void setMaximum(int value);
00222
00230 void advance(int prog);
00231
00234 void valueChange(int newValue);
00235
00236 Q_SIGNALS:
00240 void percentageChanged(int);
00241
00242 protected:
00245 void styleChange( QStyle& );
00248 void paletteChange( const QPalette & );
00251 void paintEvent( QPaintEvent *e );
00252
00253 private Q_SLOTS:
00254 void paletteChange();
00255
00256 private:
00257 class KGameProgressPrivate;
00258 KGameProgressPrivate * const d;
00259 };
00260
00261
00262 #endif