- Save/load palettes properly
[dashstudio.git] / src / components / colorpalette / private / luminancepicker.h
blobc7682d74ec2e2ce3d64c3d5f2363a33879e96757
1 /***************************************************************************
2 * Copyright (C) 2005 by Jorge Cuadrado *
3 * kuadrosxx@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
22 #ifndef COMPONENTSLUMINACEPICKER_H
23 #define COMPONENTSLUMINACEPICKER_H
26 #include <QPaintEvent>
27 #include <QPixmap>
28 #include <QMouseEvent>
29 #include <QWidget>
31 namespace Component {
33 class LuminancePicker : public QWidget
35 Q_OBJECT
36 public:
37 LuminancePicker(QWidget* parent=0);
38 ~LuminancePicker();
39 int value();
41 public slots:
42 void setCol(int h, int s, int v);
43 void setCol(int h, int s);
44 void setVal(int v);
46 signals:
47 void newHsv(int h, int s, int v);
49 protected:
50 void paintEvent(QPaintEvent*);
51 void mouseMoveEvent(QMouseEvent *);
52 void mousePressEvent(QMouseEvent *);
54 private:
55 enum { foff = 3, coff = 4 }; //frame and contents offset
57 struct Private;
58 Private *const d;
60 int y2val(int y);
61 int val2y(int val);
66 #endif