libkdegames Library API Documentation

kgameprogress.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1996 Martynas Kunigelis 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 /***************************************************************************** 00019 * * 00020 * KGameProgress -- progress indicator widget for KDE by Martynas Kunigelis * 00021 * * 00022 *****************************************************************************/ 00023 00024 #ifndef _KPROGRES_H 00025 #define _KPROGRES_H "$Id: kgameprogress.h,v 1.2 2003/10/12 13:32:56 bhards Exp $" 00026 00027 #include <qframe.h> 00028 #include <qrangecontrol.h> 00029 00050 class KGameProgress : public QFrame, public QRangeControl 00051 { 00052 Q_OBJECT 00053 Q_ENUMS( BarStyle ) 00054 Q_PROPERTY( int value READ value WRITE setValue) 00055 Q_PROPERTY( BarStyle barStyle READ barStyle WRITE setBarStyle ) 00056 Q_PROPERTY( QColor barColor READ barColor WRITE setBarColor ) 00057 Q_PROPERTY( QPixmap barPixmap READ barPixmap WRITE setBarPixmap ) 00058 Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) 00059 Q_PROPERTY( bool textEnabled READ textEnabled WRITE setTextEnabled ) 00060 00061 public: 00068 enum BarStyle { Solid, Blocked }; 00069 00073 KGameProgress(QWidget *parent=0, const char *name=0); 00074 00078 KGameProgress(Orientation orient, QWidget *parent=0, const char *name=0); 00079 00083 KGameProgress(int minValue, int maxValue, int value, Orientation, 00084 QWidget *parent=0, const char *name=0); 00085 00089 ~KGameProgress(); 00090 00096 void setBarStyle(BarStyle style); 00097 00101 void setBarColor(const QColor &); 00102 00106 void setBarPixmap(const QPixmap &); 00107 00113 void setOrientation(Orientation); 00114 00119 void setTextEnabled(bool); 00120 00126 BarStyle barStyle() const; 00127 00132 const QColor &barColor() const; 00133 00139 const QPixmap *barPixmap() const; 00140 00146 int value() const { return QRangeControl::value(); } 00152 Orientation orientation() const; 00153 00160 bool textEnabled() const; 00161 00164 virtual QSize sizeHint() const; 00165 00168 virtual QSize minimumSizeHint() const; 00169 00172 virtual QSizePolicy sizePolicy() const; 00173 00178 QString format() const; 00179 00180 public slots: 00181 00190 void setFormat(const QString & format); 00191 00197 void setValue(int value); 00198 00206 void advance(int prog); 00207 00208 signals: 00212 void percentageChanged(int); 00213 00214 protected: 00217 void valueChange(); 00220 void rangeChange(); 00223 void styleChange( QStyle& ); 00226 void paletteChange( const QPalette & ); 00229 void drawContents( QPainter * ); 00230 00231 private slots: 00232 void paletteChange(); 00233 00234 private: 00235 QPixmap *bar_pixmap; 00236 bool use_supplied_bar_color; 00237 QColor bar_color; 00238 QColor bar_text_color; 00239 QColor text_color; 00240 QRect fr; 00241 BarStyle bar_style; 00242 Orientation orient; 00243 bool text_enabled; 00244 QString format_; 00245 void initialize(); 00246 int recalcValue(int); 00247 void drawText(QPainter *); 00248 void adjustStyle(); 00249 00250 class KGameProgressPrivate; 00251 KGameProgressPrivate *d; 00252 }; 00253 00254 00255 #endif
KDE Logo
This file is part of the documentation for libkdegames Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 13 12:48:55 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003