1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This library 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 GNU |
12 | Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef KHUESATURATIONSELECT_H_ |
21 | #define KHUESATURATIONSELECT_H_ |
22 | |
23 | #include <kdeui_export.h> |
24 | #include "kxyselector.h" |
25 | |
26 | #include "kcolorchoosermode.h" |
27 | |
28 | class KDEUI_EXPORT KHueSaturationSelector : public KXYSelector |
29 | { |
30 | Q_OBJECT |
31 | public: |
32 | /** |
33 | * Constructs a hue/saturation selection widget. |
34 | */ |
35 | explicit KHueSaturationSelector( QWidget *parent = 0 ); |
36 | |
37 | /** |
38 | * Destructor. |
39 | */ |
40 | ~KHueSaturationSelector(); |
41 | |
42 | /** |
43 | * Sets the chooser mode. The allowed modes are defined |
44 | * in KColorChooserMode. |
45 | * |
46 | * @param The chooser mode as defined in KColorChooserMode |
47 | */ |
48 | void setChooserMode ( KColorChooserMode chooserMode ); |
49 | |
50 | /** |
51 | * Returns the chooser mode. |
52 | * |
53 | * @return The chooser mode (defined in KColorChooserMode) |
54 | */ |
55 | KColorChooserMode chooserMode () const; |
56 | |
57 | |
58 | /** |
59 | * Returns the hue value |
60 | * |
61 | * @return The hue value (0-360) |
62 | */ |
63 | int hue() const; |
64 | |
65 | /** |
66 | * Sets the hue value (0-360) |
67 | * |
68 | * @param hue The hue value (0-360) |
69 | */ |
70 | void setHue( int hue ); |
71 | |
72 | /** |
73 | * Returns the saturation (0-255) |
74 | * |
75 | * @return The saturation (0-255) |
76 | */ |
77 | int saturation() const; |
78 | |
79 | /** |
80 | * Sets the saturation (0-255) |
81 | * |
82 | * @param saturation The saturation (0-255) |
83 | */ |
84 | void setSaturation( int saturation ); |
85 | |
86 | /** |
87 | * Returns the color value (also known as lumniousity, 0-255) |
88 | * |
89 | * @return The color value (0-255) |
90 | */ |
91 | int colorValue() const; |
92 | |
93 | /** |
94 | * Sets the color value (0-255) |
95 | * |
96 | * @param colorValue The color value (0-255) |
97 | */ |
98 | void setColorValue( int colorValue ); |
99 | |
100 | |
101 | /** |
102 | * Updates the contents |
103 | */ |
104 | void updateContents(); |
105 | |
106 | protected: |
107 | /** |
108 | * Draws the contents of the widget on a pixmap, |
109 | * which is used for buffering. |
110 | */ |
111 | virtual void drawPalette( QPixmap *pixmap ); |
112 | virtual void resizeEvent( QResizeEvent * ); |
113 | |
114 | /** |
115 | * Reimplemented from KXYSelector. This drawing is |
116 | * buffered in a pixmap here. As real drawing |
117 | * routine, drawPalette() is used. |
118 | */ |
119 | virtual void drawContents( QPainter *painter ); |
120 | |
121 | private: |
122 | |
123 | class Private; |
124 | friend class Private; |
125 | Private * const d; |
126 | |
127 | Q_DISABLE_COPY( KHueSaturationSelector ) |
128 | }; |
129 | |
130 | #endif /*KHUESATURATIONSELECT_H_*/ |
131 | |