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
00025 #include <kdelibs_export.h>
00026
00048 class KDEUI_EXPORT KDualColorButton : public QWidget
00049 {
00050 Q_OBJECT
00051 Q_ENUMS( DualColor )
00052 Q_PROPERTY( QColor foreground READ foreground WRITE setForeground )
00053 Q_PROPERTY( QColor background READ background WRITE setBackground )
00054 Q_PROPERTY( QColor currentColor READ currentColor WRITE setCurrentColor STORED false DESIGNABLE false )
00055 Q_PROPERTY( DualColor current READ current WRITE setCurrent )
00056
00057 public:
00058
00059 enum DualColor { Foreground, Background };
00065 KDualColorButton(QWidget *parent=0, const char *name=0, QWidget* dialogParent=0);
00066
00071 KDualColorButton(const QColor &fgColor, const QColor &bgColor,
00072 QWidget *parent=0, const char *name=0, QWidget* dialogParent=0);
00073
00074 ~KDualColorButton();
00078 QColor foreground() const;
00082 QColor background() const;
00086 DualColor current() const;
00090 QColor currentColor() const;
00095 virtual QSize sizeHint() const;
00096 public slots:
00100 void setForeground(const QColor &c);
00104 void setBackground(const QColor &c);
00108 void setCurrent(DualColor s);
00112 void setCurrentColor(const QColor &c);
00113 signals:
00117 void fgChanged(const QColor &c);
00121 void bgChanged(const QColor &c);
00125 void currentChanged(KDualColorButton::DualColor s);
00126 protected:
00134 virtual void metrics(QRect &fgRect, QRect &bgRect);
00135 virtual void paintEvent(QPaintEvent *ev);
00136 virtual void mousePressEvent(QMouseEvent *ev);
00137 virtual void mouseMoveEvent(QMouseEvent *ev);
00138 virtual void mouseReleaseEvent(QMouseEvent *ev);
00139
00140 virtual void dragEnterEvent(QDragEnterEvent *ev);
00141 virtual void dropEvent(QDropEvent *ev);
00142 private:
00143 QBitmap *arrowBitmap;
00144 QPixmap *resetPixmap;
00145 QBrush fg, bg;
00146 QPoint mPos;
00147 bool dragFlag, miniCtlFlag;
00148 DualColor curColor, tmpColor;
00149
00150 protected:
00151 virtual void virtual_hook( int id, void* data );
00152 private:
00153 class KDualColorPrivate;
00154 KDualColorPrivate *d;
00155 };
00156
00157 #endif
This file is part of the documentation for kdeui Library Version 3.4.1.