00001
00002
00003
00004 #ifndef _SLCOLORSELECTOR_H_INCLUDED
00005 #define _SLCOLORSELECTOR_H_INCLUDED
00006
00007 #include <opie2/ocolorpopupmenu.h>
00008 using namespace Opie;
00009 #include <qtableview.h>
00010 #include <qpopupmenu.h>
00011 #include <qvbox.h>
00012
00013 #define DEF_COLOR_R (6)
00014 #define DEF_COLOR_C (8)
00015 struct SlColorTablePrivate;
00016 class SlColorTable : public QTableView
00017 {
00018 Q_OBJECT
00019 public:
00020 SlColorTable(QWidget *parent=0,const char *name=NULL,WFlags f=0,
00021 int r=DEF_COLOR_R,int c=DEF_COLOR_C,const QRgb *a=NULL);
00022 ~SlColorTable();
00023 void setCurrentColor(QRgb);
00024
00025 protected:
00026 QSize sizeHint() const;
00027 void paintCell(QPainter*,int,int);
00028 void mousePressEvent(QMouseEvent*);
00029 void mouseMoveEvent(QMouseEvent*);
00030 void mouseReleaseEvent(QMouseEvent*);
00031 void keyPressEvent(QKeyEvent*);
00032
00033 signals:
00034
00035
00036 void selected(QRgb rgb);
00037
00038
00039 void reSelected(QRgb rgb);
00040
00041 private:
00042 SlColorTablePrivate *p;
00043 void setCurrent(int,int);
00044 void setSelected(int,int);
00045 QRgb getRgbInCell(int,int);
00046 };
00047
00048
00049 struct SlColorSelectorPrivate;
00050 class SlColorSelector : public QVBox
00051 {
00052 Q_OBJECT
00053 public:
00054 SlColorSelector(bool isTransparentAccept,
00055 QWidget *parent=0,const char *name=NULL,WFlags f=0);
00056 ~SlColorSelector();
00057 void setCurrentColor(QRgb);
00058 void setCurrentColorTransparent();
00059
00060 signals:
00061
00062
00063 void selected(QRgb rgb);
00064
00065
00066 void reSelected(QRgb rgb);
00067
00068
00069 void transparentSelected();
00070
00071
00072 void transparentReSelected();
00073
00074
00075
00076
00077 private:
00078 SlColorSelectorPrivate *p;
00079 };
00080
00081 struct SlColorSelectorPopupPrivate;
00082 class SlColorSelectorPopup : public OColorPopupMenu
00083 {
00084 Q_OBJECT
00085 public:
00086 SlColorSelectorPopup(bool isTransparentAccept,
00087 QWidget *parent=0,const char *name=NULL,WFlags f=0);
00088 ~SlColorSelectorPopup();
00089 void setCurrentColor(QRgb);
00090 void setCurrentColorTransparent();
00091
00092 signals:
00093
00094
00095 void selected(QRgb rgb);
00096
00097
00098 void transparentSelected();
00099
00100
00101
00102
00103
00104
00105
00106 private:
00107 SlColorSelectorPopupPrivate *p;
00108 };
00109
00110 #endif
00111
00112