Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

QY2BarGraph.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                          contributed Qt widgets                      |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       QY2BarGraph.h
00014 
00015   Author:     Stefan Hundhammer <sh@suse.de>
00016 
00017   This is a pure Qt widget - it can be used independently of YaST2.
00018 
00019 /-*/
00020 
00021 // -*- c++ -*-
00022 
00023 
00024 #ifndef QY2BarGraph_h
00025 #define QY2BarGraph_h
00026 
00027 #include <qframe.h>
00028 #include <qarray.h>
00029 #include <vector>
00030 
00031 using std::vector;
00032 
00033 
00034 class QY2BarGraph : public QFrame
00035 {
00036     Q_OBJECT
00037 
00038 public:
00039 
00040     QY2BarGraph( QWidget * parent=0, const char * name=0 );
00041 
00045     void addSegment( const QString &label=QString(), int value=0 );
00046 
00051     void setSegments( int segmentCount );
00052 
00057     void setValue( int segmentNo, int newValue );
00058 
00064     void setLabel( int segmentNo, const QString &newLabel );
00065 
00069     int segments() const { return _values.size(); }
00070 
00074     int value( int segmentNo ) const;
00075 
00081     const QString label( int segmentNo ) const;
00082 
00086     int sumValues() const;
00087 
00088 
00094     const QColor segmentBackgroundColor( int segmentNo );
00095 
00101     const QColor segmentForegroundColor( int segmentNo );
00102 
00106     virtual QSize sizeHint() const;
00107 
00108 protected:
00109 
00114     virtual void drawContents( QPainter * );
00115 
00116 
00121     bool index_invalid( int i, const char * function_name ) const;
00122 
00123 private:
00124 
00125     vector<int>         _values;
00126     vector<QString>     _labels;
00127 };
00128 
00129 #endif // QY2BarGraph_h

Generated on Wed Nov 12 06:11:15 2008 for yast2-qt by  doxygen 1.3.9.1