kdualcolorbutton.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __KDUALCOLORBTN_H
00019 #define __KDUALCOLORBTN_H
00020
00021 class QBitmap;
00022 #include <qbrush.h>
00023 #include <qwidget.h>
00024
00045 class KDualColorButton : public QWidget
00046 {
00047 Q_OBJECT
00048 Q_ENUMS( DualColor )
00049 Q_PROPERTY( QColor foreground READ foreground WRITE setForeground )
00050 Q_PROPERTY( QColor background READ background WRITE setBackground )
00051 Q_PROPERTY( QColor currentColor READ currentColor WRITE setCurrentColor STORED false DESIGNABLE false )
00052 Q_PROPERTY( DualColor current READ current WRITE setCurrent )
00053
00054 public:
00055
00056 enum DualColor { Foreground, Background };
00062 KDualColorButton(QWidget *parent=0, const char *name=0, QWidget* dialogParent=0);
00063
00068 KDualColorButton(const QColor &fgColor, const QColor &bgColor,
00069 QWidget *parent=0, const char *name=0, QWidget* dialogParent=0);
00070
00071 ~KDualColorButton();
00075 QColor foreground() const;
00079 QColor background() const;
00083 DualColor current() const;
00087 QColor currentColor() const;
00092 virtual QSize sizeHint() const;
00093 public slots:
00097 void setForeground(const QColor &c);
00101 void setBackground(const QColor &c);
00105 void setCurrent(DualColor s);
00109 void setCurrentColor(const QColor &c);
00110 signals:
00114 void fgChanged(const QColor &c);
00118 void bgChanged(const QColor &c);
00122 void currentChanged(KDualColorButton::DualColor s);
00123 protected:
00131 virtual void metrics(QRect &fgRect, QRect &bgRect);
00132 virtual void paintEvent(QPaintEvent *ev);
00133 virtual void mousePressEvent(QMouseEvent *ev);
00134 virtual void mouseMoveEvent(QMouseEvent *ev);
00135 virtual void mouseReleaseEvent(QMouseEvent *ev);
00136
00137 virtual void dragEnterEvent(QDragEnterEvent *ev);
00138 virtual void dropEvent(QDropEvent *ev);
00139 private:
00140 QBitmap *arrowBitmap;
00141 QPixmap *resetPixmap;
00142 QBrush fg, bg;
00143 QPoint mPos;
00144 bool dragFlag, miniCtlFlag;
00145 DualColor curColor, tmpColor;
00146
00147 protected:
00148 virtual void virtual_hook( int id, void* data );
00149 private:
00150 class KDualColorPrivate;
00151 KDualColorPrivate *d;
00152 };
00153
00154 #endif
This file is part of the documentation for kdeui Library Version 3.3.1.