00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef QWWTWOCOLORINDICATOR_H
00013 #define QWWTWOCOLORINDICATOR_H
00014
00015 #ifndef WW_NO_TWOCOLORINDICATOR
00016
00017 #include <QWidget>
00018 #include <wwglobal.h>
00019
00020 class QwwTwoColorIndicatorPrivate;
00021 class Q_GUI_EXPORT QwwTwoColorIndicator : public QWidget, QwwPrivatable
00022 {
00023 Q_OBJECT
00024 Q_PROPERTY(QColor fgColor READ fgColor WRITE setFgColor)
00025 Q_PROPERTY(QColor bgColor READ bgColor WRITE setBgColor)
00026 Q_PROPERTY(bool active READ isActive WRITE setActive)
00027 public:
00028 QwwTwoColorIndicator(QWidget *parent = 0);
00029 ~QwwTwoColorIndicator();
00030 const QColor &fgColor() const;
00031 const QColor &bgColor() const;
00032 QSize sizeHint() const;
00033 QSize minimumSizeHint() const;
00034 bool isActive() const;
00035 public slots:
00036 void setFgColor(const QColor &);
00037 void setBgColor(const QColor &);
00038 void switchColors();
00039 void setActive(bool);
00040 signals:
00041 void fgChanged(const QColor &);
00042 void bgChanged(const QColor &);
00043 void fgClicked();
00044 void bgClicked();
00045 void fgPressed();
00046 void bgPressed();
00047 protected:
00048 void paintEvent(QPaintEvent*);
00049 void mousePressEvent(QMouseEvent*);
00050 void mouseReleaseEvent(QMouseEvent*);
00051 virtual void paintSection(QPainter *p, const QRect &rect, const QColor &color);
00052 private:
00053 WW_DECLARE_PRIVATE(QwwTwoColorIndicator);
00054
00055 };
00056
00057 #endif // WW_NO_TWOCOLORINDICATOR
00058
00059 #endif // QWWTWOCOLORINDICATOR_H