libtdegames
kgameprogress.h
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 _KPROGRES_H
00025 #define _KPROGRES_H "$Id$"
00026
00027 #include <tqframe.h>
00028 #include <tqrangecontrol.h>
00029 #include <kdemacros.h>
00050 class KDE_EXPORT KGameProgress : public TQFrame, public TQRangeControl
00051 {
00052 Q_OBJECT
00053
00054 TQ_ENUMS( BarStyle )
00055 TQ_PROPERTY( int value READ value WRITE setValue)
00056 TQ_PROPERTY( BarStyle barStyle READ barStyle WRITE setBarStyle )
00057 TQ_PROPERTY( TQColor barColor READ barColor WRITE setBarColor )
00058 TQ_PROPERTY( TQPixmap barPixmap READ barPixmap WRITE setBarPixmap )
00059 TQ_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
00060 TQ_PROPERTY( bool textEnabled READ textEnabled WRITE setTextEnabled )
00061
00062 public:
00069 enum BarStyle { Solid, Blocked };
00070
00074 KGameProgress(TQWidget *parent=0, const char *name=0);
00075
00079 KGameProgress(Orientation orient, TQWidget *parent=0, const char *name=0);
00080
00084 KGameProgress(int minValue, int maxValue, int value, Orientation,
00085 TQWidget *parent=0, const char *name=0);
00086
00090 ~KGameProgress();
00091
00097 void setBarStyle(BarStyle style);
00098
00102 void setBarColor(const TQColor &);
00103
00107 void setBarPixmap(const TQPixmap &);
00108
00114 void setOrientation(Orientation);
00115
00120 void setTextEnabled(bool);
00121
00127 BarStyle barStyle() const;
00128
00133 const TQColor &barColor() const;
00134
00140 const TQPixmap *barPixmap() const;
00141
00147 int value() const { return TQRangeControl::value(); }
00153 Orientation orientation() const;
00154
00161 bool textEnabled() const;
00162
00165 virtual TQSize sizeHint() const;
00166
00169 virtual TQSize minimumSizeHint() const;
00170
00173 virtual TQSizePolicy sizePolicy() const;
00174
00179 TQString format() const;
00180
00181 public slots:
00182
00191 void setFormat(const TQString & format);
00192
00198 void setValue(int value);
00199
00207 void advance(int prog);
00208
00209 signals:
00213 void percentageChanged(int);
00214
00215 protected:
00218 void valueChange();
00221 void rangeChange();
00224 void styleChange( TQStyle& );
00227 void paletteChange( const TQPalette & );
00230 void drawContents( TQPainter * );
00231
00232 private slots:
00233 void paletteChange();
00234
00235 private:
00236 TQPixmap *bar_pixmap;
00237 bool use_supplied_bar_color;
00238 TQColor bar_color;
00239 TQColor bar_text_color;
00240 TQColor text_color;
00241 TQRect fr;
00242 BarStyle bar_style;
00243 Orientation orient;
00244 bool text_enabled;
00245 TQString format_;
00246 void initialize();
00247 int recalcValue(int);
00248 void drawText(TQPainter *);
00249 void adjustStyle();
00250
00251 class KGameProgressPrivate;
00252 KGameProgressPrivate *d;
00253 };
00254
00255
00256 #endif