-rwxr-xr-x | microkde/fncolordialog.h | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/microkde/fncolordialog.h b/microkde/fncolordialog.h new file mode 100755 index 0000000..615d2ed --- a/dev/null +++ b/microkde/fncolordialog.h | |||
@@ -0,0 +1,137 @@ | |||
1 | /* this program for Sharp SLA300, B500, C7x0, C860 Linux PDA | ||
2 | Copyright (C) 2003-2005 Joe Kanemori.<kanemori@ymg.urban.ne.jp> | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundatibannwaon; either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software | ||
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | /* | ||
19 | 2005/02/27 FreeNote 1.11.10pre | ||
20 | ・PDFの出力形式を一部変更 | ||
21 | ・インポート時のバグfix | ||
22 | |||
23 | */ | ||
24 | #ifndef FNPALETTEDIALOG_H | ||
25 | #define FNPALETTEDIALOG_H | ||
26 | #include <qwidget.h> | ||
27 | #include <qpixmap.h> | ||
28 | #include <qpainter.h> | ||
29 | #include <qcolor.h> | ||
30 | #include <qdialog.h> | ||
31 | #include <qlayout.h> | ||
32 | #include <qslider.h> | ||
33 | #include <qspinbox.h> | ||
34 | |||
35 | //----------------------------------------------------------------------------- | ||
36 | // FNPaletteBase | ||
37 | //----------------------------------------------------------------------------- | ||
38 | class Q_EXPORT FNPaletteBase : public QWidget | ||
39 | { | ||
40 | Q_OBJECT | ||
41 | public: | ||
42 | |||
43 | FNPaletteBase(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | ||
44 | |||
45 | |||
46 | virtual ~FNPaletteBase(); | ||
47 | |||
48 | |||
49 | void setBGColor(QColor c) { | ||
50 | bgcolor_ = c; | ||
51 | selection_ = c; | ||
52 | redraw(); | ||
53 | }; | ||
54 | QColor color() const { | ||
55 | return selection_; | ||
56 | }; | ||
57 | |||
58 | protected: | ||
59 | virtual void paintEvent(QPaintEvent*); | ||
60 | virtual void resizeEvent(QResizeEvent* evt); | ||
61 | virtual void redraw(bool force=false); | ||
62 | virtual void drawImpl(QPainter& pa); | ||
63 | virtual void mouseReleaseEvent(QMouseEvent* evt); | ||
64 | virtual bool pickColor(int x, int y); | ||
65 | QColor selection_; | ||
66 | private: | ||
67 | QPixmap wbuf_; | ||
68 | QColor bgcolor_; | ||
69 | bool _isblock; | ||
70 | |||
71 | signals: | ||
72 | void clicked(FNPaletteBase* sender); | ||
73 | }; | ||
74 | |||
75 | |||
76 | |||
77 | |||
78 | //----------------------------------------------------------------------------- | ||
79 | // FNColorPalette | ||
80 | //----------------------------------------------------------------------------- | ||
81 | class Q_EXPORT FNColorPalette : public FNPaletteBase | ||
82 | { | ||
83 | Q_OBJECT | ||
84 | public: | ||
85 | FNColorPalette(QColor c, QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | ||
86 | virtual ~FNColorPalette(); | ||
87 | }; | ||
88 | |||
89 | |||
90 | |||
91 | |||
92 | //----------------------------------------------------------------------------- | ||
93 | // FNHSVPalette | ||
94 | //----------------------------------------------------------------------------- | ||
95 | class Q_EXPORT FNHSVPalette : public FNPaletteBase | ||
96 | { | ||
97 | Q_OBJECT | ||
98 | public: | ||
99 | FNHSVPalette(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | ||
100 | virtual ~FNHSVPalette(); | ||
101 | public slots: | ||
102 | void hueChanged(int v); | ||
103 | protected: | ||
104 | virtual void drawImpl(QPainter& pa); | ||
105 | int _hue; | ||
106 | }; | ||
107 | |||
108 | |||
109 | |||
110 | |||
111 | //----------------------------------------------------------------------------- | ||
112 | // FNColorDialog | ||
113 | //----------------------------------------------------------------------------- | ||
114 | class Q_EXPORT FNColorDialog : public QDialog | ||
115 | { | ||
116 | Q_OBJECT | ||
117 | public: | ||
118 | FNColorDialog(QWidget* parent=0, const char* name=0, WFlags f=0); | ||
119 | virtual ~FNColorDialog(); | ||
120 | void setColor(QColor c); | ||
121 | QColor color() const; | ||
122 | public slots: | ||
123 | virtual void basePaletteClicked(FNPaletteBase*); | ||
124 | virtual void hsvPaletteClicked(FNPaletteBase*); | ||
125 | void rgbChanged(int); | ||
126 | private: | ||
127 | FNHSVPalette* _palette; | ||
128 | FNColorPalette* _base[16]; | ||
129 | QSlider* _hue; | ||
130 | FNColorPalette* _select; | ||
131 | QSpinBox* _r; | ||
132 | QSpinBox* _g; | ||
133 | QSpinBox* _b; | ||
134 | bool _isblock; | ||
135 | |||
136 | }; | ||
137 | #endif //FNPALETTEDIALOG_H | ||