Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / libs / plasma / widgets / progressbar.h
blobbae33bb59aab3b7f90dda754084761b133a73bdc
1 /*
2 * Copyright (C) 2007 Jon de Andres Frias <jondeandres@gmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __PLASMA_PROGRESSBAR__
21 #define __PLASMA_PROGRESSBAR__
23 #include <plasma/widgets/widget.h>
26 namespace Plasma
29 class PLASMA_EXPORT ProgressBar : public Plasma::Widget
31 Q_OBJECT
32 Q_PROPERTY(QString format READ format WRITE setFormat)
33 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
34 Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
35 Q_PROPERTY(bool textVisible READ isTextVisible WRITE setTextVisible)
36 Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
37 Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
38 Q_PROPERTY(int value READ value WRITE setValue)
40 public:
42 /**
43 * Constructor
45 ProgressBar(Widget *parent);
47 /**
48 * Virtual Destructor
50 virtual ~ProgressBar();
52 /**
53 * @return alignment of the progressbar
55 Qt::Alignment alignment() const;
57 /**
58 * @return the format for the shown text
60 QString format() const;
62 /**
63 * @return wether the Plasma::ProgressBar is inverted or not.
65 bool invertedAppearance();
67 /**
68 * @return wether the text is visible or not.
70 bool isTextVisible() const;
72 /**
73 * @return the maximum value in the range of Plasma::ProgressBar
75 int maximum() const;
77 /**
78 * @return the minimum value in the range of Plasma:ProgressBar
80 int minimum() const;
82 /**
83 * Changes the alignment of Plasma::ProgressBar
85 * %p - is replaced by the percentage completed
86 * %v - is replaced by the current value
87 * %m - is replaced by the total number of steps
88 * @param alignment the alignment for the progressbar.
90 void setAlignment(Qt::Alignment alignment);
92 /**
93 * Sets the format for the shown text in Plasma::ProgressBar;
94 * @format the format for the shown text in Plasma:ProgressBar
96 void setFormat(const QString &format);
98 /**
99 * Inverts the appearance of Plasma::ProgressBar
100 * @param invert true inverts the appearance
102 void setInvertedAppearance(bool invert);
105 * Change the text to be visible or not.
106 * @param visible if true then visible
108 void setTextVisible(bool visible);
111 * @return the text to be shown in Plasma::ProgressBar
113 QString text() const;
116 * @return the actual value of the progress
118 int value() const;
120 void paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
122 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
124 public Q_SLOTS:
125 void reset();
126 void setRange(int minimum, int maximum);
127 void setMinimum(int minimum);
128 void setMaximum(int maximum);
129 void setValue(int value);
131 Q_SIGNALS:
132 void valueChanged(int value);
134 private:
135 void init();
137 class Private;
138 Private * const d;
143 #endif /*__PLASMA_PROGRESSBAR__*/