KDEUI
kcapacitybar.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE project 00003 * Copyright (C) 2008 Rafael Fernández López <ereslibre@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KCAPACITYBAR_H 00022 #define KCAPACITYBAR_H 00023 00024 #include <QtGui/QWidget> 00025 00026 #include <kdeui_export.h> 00027 00028 class QPaintEvent; 00029 00044 class KDEUI_EXPORT KCapacityBar 00045 : public QWidget 00046 { 00047 Q_OBJECT 00048 00049 Q_PROPERTY(int value READ value WRITE setValue) 00050 Q_PROPERTY(QString text READ text WRITE setText) 00051 Q_PROPERTY(DrawTextMode drawTextMode READ drawTextMode WRITE setDrawTextMode) 00052 Q_PROPERTY(bool fillFullBlocks READ fillFullBlocks WRITE setFillFullBlocks) 00053 Q_PROPERTY(bool continuous READ continuous WRITE setContinuous) 00054 Q_PROPERTY(int barHeight READ barHeight WRITE setBarHeight) 00055 Q_PROPERTY(Qt::Alignment horizontalTextAlignment READ horizontalTextAlignment 00056 WRITE setHorizontalTextAlignment) 00057 Q_ENUMS(DrawTextMode) 00058 00059 public: 00060 enum DrawTextMode { 00061 DrawTextInline = 0, 00062 DrawTextOutline 00063 }; 00064 00072 explicit KCapacityBar(DrawTextMode drawTextMode = DrawTextOutline, QWidget *parent = 0); 00073 ~KCapacityBar(); 00074 00082 void setValue(int value); 00083 00087 int value() const; 00088 00096 void setText(const QString &text); 00097 00101 QString text() const; 00102 00118 void setFillFullBlocks(bool fillFullBlocks); 00119 00123 bool fillFullBlocks() const; 00124 00135 void setContinuous(bool continuous); 00136 00141 bool continuous() const; 00142 00160 void setBarHeight(int barHeight); 00161 00165 int barHeight() const; 00166 00183 void setHorizontalTextAlignment(Qt::Alignment textAlignment); 00184 00188 Qt::Alignment horizontalTextAlignment() const; 00189 00196 void setDrawTextMode(DrawTextMode mode); 00197 00201 DrawTextMode drawTextMode() const; 00202 00208 void drawCapacityBar(QPainter *p, const QRect &rect) const; 00209 00210 // Reimplemented from QWidget 00211 virtual QSize minimumSizeHint() const; 00212 00213 protected: 00214 // Reimplemented from QWidget 00215 virtual void paintEvent(QPaintEvent *event); 00216 virtual void changeEvent(QEvent *event); 00217 00218 private: 00222 class Private; 00223 Private *const d; 00224 }; 00225 00226 #endif
KDE 4.6 API Reference