summaryrefslogtreecommitdiffstats
path: root/config/colordialog.h
blob: 23c480883831e8cfaef1d5cd350b3d111763c17b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef COLORDIALOG_H
#define COLORDIALOG_H

#include <qdialog.h>
#include <qrect.h>
#include <qimage.h>

class QPushButton;
class QComboBox;
class QGroupBox;
class QPainter;
class ColorDialog;
class QImage;
class QPixmap;

enum Colors { Back = 0, Button, Base, Text, High, HighText, ButText, Alternate, NUMCOLORS };

class DemoWindow : public QWidget
{
   Q_OBJECT
      
public:
   DemoWindow( ColorDialog* parent = 0, const char* name = 0);
   ~DemoWindow();

private slots:
   void smartRepaint();
   
protected:
   void mousePressEvent ( QMouseEvent * e );
   void paintEvent ( QPaintEvent * );
   
private:
   QPainter *p;
   QPainter *pp;
   QPixmap *pm;
   ColorDialog* colorDialog_;
   QRect baseRect;
   QRect buttonRect;
   QRect buttonTextRect;
   QRect highlightRect;
   QRect textRect;
   QRect highTextRect;
   QRect alternateRect;
   QImage baseImage;
   QImage dest;
   
private:
   QImage & tintButton(QImage &src, QColor & c);
   
signals:
   void selected(Colors c);
   
};

class ColorPicker;

class ColorDialog : public QDialog
{
   friend class DemoWindow;
   friend class AppSetter;
    Q_OBJECT

public:
   ColorDialog( QWidget* parent = 0, const char* name = 0);
   ~ColorDialog();
   QPushButton *buttonOk;
   QPushButton *buttonCancel;
   void show();

protected:
   ColorPicker *picker[NUMCOLORS];
   void mouseReleaseEvent(QMouseEvent* me);
   DemoWindow *demo;
   
private:
   QPushButton *buttonCP;
   bool gettingColorFromScreen;
   QComboBox *other;
   
private slots:
   void grabColor();
   void getFromOther( const QString & string );

signals:
    void colorChanged(QColor color);

};

#endif // COLORPICKER_H