Diffstat (limited to 'noncore/graphics/drawpad/colorpanel.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/colorpanel.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/noncore/graphics/drawpad/colorpanel.h b/noncore/graphics/drawpad/colorpanel.h new file mode 100644 index 0000000..05364c1 --- a/dev/null +++ b/noncore/graphics/drawpad/colorpanel.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * DrawPad - a drawing program for Opie Environment * | ||
4 | * * | ||
5 | * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * | ||
6 | * * | ||
7 | * This program is free software; you can redistribute it and/or modify * | ||
8 | * it under the terms of the GNU General Public License as published by * | ||
9 | * the Free Software Foundation; either version 2 of the License, or * | ||
10 | * (at your option) any later version. * | ||
11 | * * | ||
12 | ***************************************************************************/ | ||
13 | |||
14 | #ifndef COLORPANEL_H | ||
15 | #define COLORPANEL_H | ||
16 | |||
17 | #include <qframe.h> | ||
18 | #include <qwidget.h> | ||
19 | |||
20 | class QGridLayout; | ||
21 | |||
22 | class ColorPanelButton : public QFrame | ||
23 | { | ||
24 | Q_OBJECT | ||
25 | |||
26 | public: | ||
27 | ColorPanelButton(const QColor& color, QWidget* parent = 0, const char* name = 0); | ||
28 | ~ColorPanelButton(); | ||
29 | |||
30 | void setActive(bool active); | ||
31 | |||
32 | void enterEvent(QEvent* e); | ||
33 | void leaveEvent(QEvent* e); | ||
34 | void paintEvent(QPaintEvent* e); | ||
35 | void mouseReleaseEvent(QMouseEvent* e); | ||
36 | |||
37 | signals: | ||
38 | void selected(const QColor&); | ||
39 | |||
40 | private: | ||
41 | QColor m_color; | ||
42 | bool m_active; | ||
43 | }; | ||
44 | |||
45 | class ColorPanel : public QWidget | ||
46 | { | ||
47 | Q_OBJECT | ||
48 | |||
49 | public: | ||
50 | ColorPanel(QWidget* parent = 0, const char* name = 0); | ||
51 | ~ColorPanel(); | ||
52 | |||
53 | void addColor(const QColor& color, int row, int col); | ||
54 | |||
55 | public slots: | ||
56 | void buttonSelected(const QColor& color); | ||
57 | |||
58 | signals: | ||
59 | void colorSelected(const QColor&); | ||
60 | |||
61 | private: | ||
62 | QGridLayout* m_pGridLayout; | ||
63 | }; | ||
64 | |||
65 | #endif // COLORPANEL_H | ||