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