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>
29 class PLASMA_EXPORT ProgressBar
: public Plasma::Widget
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
)
45 ProgressBar(Widget
*parent
);
50 virtual ~ProgressBar();
53 * @return alignment of the progressbar
55 Qt::Alignment
alignment() const;
58 * @return the format for the shown text
60 QString
format() const;
63 * @return wether the Plasma::ProgressBar is inverted or not.
65 bool invertedAppearance();
68 * @return wether the text is visible or not.
70 bool isTextVisible() const;
73 * @return the maximum value in the range of Plasma::ProgressBar
78 * @return the minimum value in the range of Plasma:ProgressBar
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
);
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
);
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
120 void paintWidget(QPainter
*painter
, const QStyleOptionGraphicsItem
*option
, QWidget
*widget
= 0);
122 QSizeF
sizeHint(Qt::SizeHint which
, const QSizeF
&constraint
= QSizeF()) const;
126 void setRange(int minimum
, int maximum
);
127 void setMinimum(int minimum
);
128 void setMaximum(int maximum
);
129 void setValue(int value
);
132 void valueChanged(int value
);
143 #endif /*__PLASMA_PROGRESSBAR__*/