kdeui Library API Documentation

kprogress.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 *  KProgress -- progress indicator widget for KDE                            *
00021 *  Original QRangeControl-based version written by Martynas Kunigelis        *
00022 *  Current QProgressBar based version by Aaron Seigo                         *
00023 *                                                                            *
00024 *****************************************************************************/
00025 
00026 #ifndef _KPROGRESS_H
00027 #define _KPROGRESS_H "$Id: kprogress.h,v 1.31 2002/05/21 16:55:30 tjansen Exp $"
00028 
00029 #include <qprogressbar.h>
00030 #include <kdialogbase.h>
00031 
00046 class KProgress : public QProgressBar
00047 {
00048   Q_OBJECT
00049 
00050 public:
00054   KProgress(QWidget *parent=0, const char *name=0, WFlags f = 0);
00055 
00062   KProgress(int totalSteps, QWidget *parent=0, const char *name=0, WFlags f = 0);
00063 
00067   ~KProgress();
00068 
00073   void setTextEnabled(bool);
00074 
00080   int value() const;
00081 
00088   bool textEnabled() const;
00089 
00094   QString format() const;
00095 
00100   void setRange(int min, int max);
00101 
00105   int maxValue();
00106 
00107 public slots:
00108 
00117   void setFormat(const QString & format);
00118 
00123   void setTotalSteps(int totalSteps);
00124 
00129   virtual void setProgress(int progress);
00130 
00134   void setValue(int progress);
00135 
00143   virtual void advance(int offset);
00144 
00145 signals:
00149   void percentageChanged(int);
00150 
00151 protected:
00155   virtual bool setIndicator(QString & indicator, int progress, int totalSteps);
00156 
00157 private:
00158   QString   mFormat;
00159 
00160 protected:
00161   virtual void virtual_hook( int id, void* data );
00162 private:
00163   class KProgressPrivate;
00164   KProgressPrivate *d;
00165 };
00166 
00183 class KProgressDialog : public KDialogBase
00184 {
00185     Q_OBJECT
00186 
00187     public:
00197         KProgressDialog(QWidget* parent = 0, const char* name = 0,
00198                         const QString& caption = QString::null,
00199                         const QString& text = QString::null,
00200                         bool modal = false);
00201 
00205         ~KProgressDialog();
00206 
00212         KProgress* progressBar();
00213 
00219         void    setLabel(const QString&);
00220         
00224         QString labelText();
00225 
00235         void setAllowCancel(bool allowCancel);
00236 
00240         bool allowCancel();
00241 
00248         void showCancelButton(bool show);
00249 
00254         void setAutoClose(bool close);
00255 
00260         bool autoClose();
00261 
00267         void setAutoReset(bool autoReset);
00268 
00273         bool autoReset();
00274 
00280         bool wasCancelled();
00281 
00285         void setButtonText(const QString&);
00286 
00290         QString buttonText();
00291 
00296         void setMinimumDuration(int ms);
00297 
00301         int  minimumDuration();
00302 
00303     protected slots:
00304         void slotAutoShow();
00305         void slotAutoActions(int percentage);
00306         void slotCancel();
00307 
00308     private:
00309         bool       mAutoClose;
00310         bool       mAutoReset;
00311         bool       mCancelled;
00312         bool       mAllowCancel;
00313         bool       mShown;
00314         QString    mCancelText;
00315         QLabel*    mLabel;
00316         KProgress* mProgressBar;
00317         QTimer*    mShowTimer;
00318         int        mMinDuration;
00319     protected:
00320     virtual void virtual_hook( int id, void* data );
00321     private:
00322         class KProgressDialogPrivate;
00323         KProgressDialogPrivate *d;
00324 };
00325 
00326 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:04 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001