author | zecke <zecke> | 2003-04-13 16:25:24 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-04-13 16:25:24 (UTC) |
commit | c27d6327b9be5792fa507557f03997a46f32cc26 (patch) (unidiff) | |
tree | 3332ed2d1c673a898ba1862276d8688918618d7f /libopie2/opieui | |
parent | 3e1f225ed1e515c3425361fdc90ac4d5b6d86941 (diff) | |
download | opie-c27d6327b9be5792fa507557f03997a46f32cc26.zip opie-c27d6327b9be5792fa507557f03997a46f32cc26.tar.gz opie-c27d6327b9be5792fa507557f03997a46f32cc26.tar.bz2 |
Add apie comments
QString -> const QString& fix
-rw-r--r-- | libopie2/opieui/odialog.h | 5 | ||||
-rw-r--r-- | libopie2/opieui/oimageeffect.h | 1 | ||||
-rw-r--r-- | libopie2/opieui/olistview.h | 4 | ||||
-rw-r--r-- | libopie2/opieui/opopupmenu.h | 3 |
4 files changed, 9 insertions, 4 deletions
diff --git a/libopie2/opieui/odialog.h b/libopie2/opieui/odialog.h index 7947dfb..4116ed7 100644 --- a/libopie2/opieui/odialog.h +++ b/libopie2/opieui/odialog.h | |||
@@ -1,88 +1,89 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef ODIALOG_H | 32 | #ifndef ODIALOG_H |
33 | #define ODIALOG_H | 33 | #define ODIALOG_H |
34 | 34 | ||
35 | class QLayoutItem; | 35 | class QLayoutItem; |
36 | 36 | ||
37 | #include <qdialog.h> | 37 | #include <qdialog.h> |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Dialog with extended nonmodal support and methods for OPIE standard | 40 | * Dialog with extended nonmodal support and methods for OPIE standard |
41 | * compliance. | 41 | * compliance. |
42 | * | 42 | * |
43 | * The @ref marginHint() and @ref spacingHint() sizes shall be used | 43 | * The @ref marginHint() and @ref spacingHint() sizes shall be used |
44 | * whenever you layout the interior of a dialog. One special note. If | 44 | * whenever you layout the interior of a dialog. One special note. If |
45 | * you make your own action buttons (OK, Cancel etc), the space | 45 | * you make your own action buttons (OK, Cancel etc), the space |
46 | * beteween the buttons shall be @ref spacingHint(), whereas the space | 46 | * beteween the buttons shall be @ref spacingHint(), whereas the space |
47 | * above, below, to the right and to the left shall be @ref marginHint(). | 47 | * above, below, to the right and to the left shall be @ref marginHint(). |
48 | * If you add a separator line above the buttons, there shall be a | 48 | * If you add a separator line above the buttons, there shall be a |
49 | * @ref marginHint() between the buttons and the separator and a | 49 | * @ref marginHint() between the buttons and the separator and a |
50 | * @ref marginHint() above the separator as well. | 50 | * @ref marginHint() above the separator as well. |
51 | * | 51 | * |
52 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 52 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
53 | */ | 53 | */ |
54 | // lets fix up Qt instead! Size does matter. -zecke | ||
54 | 55 | ||
55 | class ODialog : public QDialog | 56 | class ODialog : public QDialog |
56 | { | 57 | { |
57 | Q_OBJECT | 58 | Q_OBJECT |
58 | 59 | ||
59 | public: | 60 | public: |
60 | 61 | ||
61 | /** | 62 | /** |
62 | * Constructor. | 63 | * Constructor. |
63 | * | 64 | * |
64 | * Takes the same arguments as @ref QDialog. | 65 | * Takes the same arguments as @ref QDialog. |
65 | */ | 66 | */ |
66 | ODialog(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0); | 67 | ODialog(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0); |
67 | 68 | ||
68 | /** | 69 | /** |
69 | * Return the number of pixels you shall use between a | 70 | * Return the number of pixels you shall use between a |
70 | * dialog edge and the outermost widget(s) according to the KDE standard. | 71 | * dialog edge and the outermost widget(s) according to the KDE standard. |
71 | **/ | 72 | **/ |
72 | static int marginHint(); | 73 | static int marginHint(); |
73 | 74 | ||
74 | /** | 75 | /** |
75 | * Return the number of pixels you shall use between | 76 | * Return the number of pixels you shall use between |
76 | * widgets inside a dialog according to the KDE standard. | 77 | * widgets inside a dialog according to the KDE standard. |
77 | */ | 78 | */ |
78 | static int spacingHint(); | 79 | static int spacingHint(); |
79 | 80 | ||
80 | private: | 81 | private: |
81 | static int mMarginSize; | 82 | static int mMarginSize; |
82 | static int mSpacingSize; | 83 | static int mSpacingSize; |
83 | 84 | ||
84 | //class ODialogPrivate; | 85 | class ODialogPrivate; |
85 | //ODialogPrivate *d; | 86 | ODialogPrivate *d; // d pointer always needed! -zecke |
86 | 87 | ||
87 | }; | 88 | }; |
88 | #endif // ODIALOG_H | 89 | #endif // ODIALOG_H |
diff --git a/libopie2/opieui/oimageeffect.h b/libopie2/opieui/oimageeffect.h index 313ea50..fb4d22d 100644 --- a/libopie2/opieui/oimageeffect.h +++ b/libopie2/opieui/oimageeffect.h | |||
@@ -1,514 +1,515 @@ | |||
1 | //FIXME: Revise for Opie - do we really need such fancy stuff on PDA's? | 1 | //FIXME: Revise for Opie - do we really need such fancy stuff on PDA's? |
2 | //FIXME: Maybe not on SL5xxx, but surely on C700 :)) | 2 | //FIXME: Maybe not on SL5xxx, but surely on C700 :)) |
3 | //FIXME: I think we don#t need that -zecke | ||
3 | 4 | ||
4 | /* This file is part of the KDE libraries | 5 | /* This file is part of the KDE libraries |
5 | Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@interaccess.com> | 6 | Copyright (C) 1998, 1999, 2001, 2002 Daniel M. Duley <mosfet@interaccess.com> |
6 | (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> | 7 | (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> |
7 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> | 8 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> |
8 | 9 | ||
9 | Redistribution and use in source and binary forms, with or without | 10 | Redistribution and use in source and binary forms, with or without |
10 | modification, are permitted provided that the following conditions | 11 | modification, are permitted provided that the following conditions |
11 | are met: | 12 | are met: |
12 | 13 | ||
13 | 1. Redistributions of source code must retain the above copyright | 14 | 1. Redistributions of source code must retain the above copyright |
14 | notice, this list of conditions and the following disclaimer. | 15 | notice, this list of conditions and the following disclaimer. |
15 | 2. Redistributions in binary form must reproduce the above copyright | 16 | 2. Redistributions in binary form must reproduce the above copyright |
16 | notice, this list of conditions and the following disclaimer in the | 17 | notice, this list of conditions and the following disclaimer in the |
17 | documentation and/or other materials provided with the distribution. | 18 | documentation and/or other materials provided with the distribution. |
18 | 19 | ||
19 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 20 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
20 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 22 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
22 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 23 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
24 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
28 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 30 | ||
30 | */ | 31 | */ |
31 | 32 | ||
32 | // $Id$ | 33 | // $Id$ |
33 | 34 | ||
34 | #ifndef OIMAGEEFFECT_H | 35 | #ifndef OIMAGEEFFECT_H |
35 | #define OIMAGEEFFECT_H | 36 | #define OIMAGEEFFECT_H |
36 | 37 | ||
37 | class QImage; | 38 | class QImage; |
38 | class QSize; | 39 | class QSize; |
39 | class QColor; | 40 | class QColor; |
40 | 41 | ||
41 | /** | 42 | /** |
42 | * This class includes various @ref QImage based graphical effects. | 43 | * This class includes various @ref QImage based graphical effects. |
43 | * | 44 | * |
44 | * Everything is | 45 | * Everything is |
45 | * static, so there is no need to create an instance of this class. You can | 46 | * static, so there is no need to create an instance of this class. You can |
46 | * just call the static methods. They are encapsulated here merely to provide | 47 | * just call the static methods. They are encapsulated here merely to provide |
47 | * a common namespace. | 48 | * a common namespace. |
48 | */ | 49 | */ |
49 | 50 | ||
50 | class OImageEffect | 51 | class OImageEffect |
51 | { | 52 | { |
52 | public: | 53 | public: |
53 | enum GradientType { VerticalGradient, HorizontalGradient, | 54 | enum GradientType { VerticalGradient, HorizontalGradient, |
54 | DiagonalGradient, CrossDiagonalGradient, | 55 | DiagonalGradient, CrossDiagonalGradient, |
55 | PyramidGradient, RectangleGradient, | 56 | PyramidGradient, RectangleGradient, |
56 | PipeCrossGradient, EllipticGradient }; | 57 | PipeCrossGradient, EllipticGradient }; |
57 | enum RGBComponent { Red, Green, Blue, Gray, All }; | 58 | enum RGBComponent { Red, Green, Blue, Gray, All }; |
58 | 59 | ||
59 | enum Lighting {NorthLite, NWLite, WestLite, SWLite, | 60 | enum Lighting {NorthLite, NWLite, WestLite, SWLite, |
60 | SouthLite, SELite, EastLite, NELite}; | 61 | SouthLite, SELite, EastLite, NELite}; |
61 | 62 | ||
62 | enum ModulationType { Intensity, Saturation, HueShift, Contrast }; | 63 | enum ModulationType { Intensity, Saturation, HueShift, Contrast }; |
63 | 64 | ||
64 | enum NoiseType { UniformNoise=0, GaussianNoise, MultiplicativeGaussianNoise, | 65 | enum NoiseType { UniformNoise=0, GaussianNoise, MultiplicativeGaussianNoise, |
65 | ImpulseNoise, LaplacianNoise, PoissonNoise}; | 66 | ImpulseNoise, LaplacianNoise, PoissonNoise}; |
66 | 67 | ||
67 | enum RotateDirection{ Rotate90, Rotate180, Rotate270 }; | 68 | enum RotateDirection{ Rotate90, Rotate180, Rotate270 }; |
68 | 69 | ||
69 | /** | 70 | /** |
70 | * Create a gradient from color a to color b of the specified type. | 71 | * Create a gradient from color a to color b of the specified type. |
71 | * | 72 | * |
72 | * @param size The desired size of the gradient. | 73 | * @param size The desired size of the gradient. |
73 | * @param ca Color a | 74 | * @param ca Color a |
74 | * @param cb Color b | 75 | * @param cb Color b |
75 | * @param type The type of gradient. | 76 | * @param type The type of gradient. |
76 | * @param ncols The number of colors to use when not running on a | 77 | * @param ncols The number of colors to use when not running on a |
77 | * truecolor display. The gradient will be dithered to this number of | 78 | * truecolor display. The gradient will be dithered to this number of |
78 | * colors. Pass 0 to prevent dithering. | 79 | * colors. Pass 0 to prevent dithering. |
79 | */ | 80 | */ |
80 | static QImage gradient(const QSize &size, const QColor &ca, | 81 | static QImage gradient(const QSize &size, const QColor &ca, |
81 | const QColor &cb, GradientType type, int ncols=3); | 82 | const QColor &cb, GradientType type, int ncols=3); |
82 | 83 | ||
83 | /** | 84 | /** |
84 | * Create an unbalanced gradient. | 85 | * Create an unbalanced gradient. |
85 | 86 | ||
86 | * An unbalanced gradient is a gradient where the transition from | 87 | * An unbalanced gradient is a gradient where the transition from |
87 | * color a to color b is not linear, but in this case, exponential. | 88 | * color a to color b is not linear, but in this case, exponential. |
88 | * | 89 | * |
89 | * @param size The desired size of the gradient. | 90 | * @param size The desired size of the gradient. |
90 | * @param ca Color a | 91 | * @param ca Color a |
91 | * @param cb Color b | 92 | * @param cb Color b |
92 | * @param type The type of gradient. | 93 | * @param type The type of gradient. |
93 | * @param xfactor The x decay length. Use a value between -200 and 200. | 94 | * @param xfactor The x decay length. Use a value between -200 and 200. |
94 | * @param yfactor The y decay length. | 95 | * @param yfactor The y decay length. |
95 | * @param ncols The number of colors. See OPixmapEffect:gradient. | 96 | * @param ncols The number of colors. See OPixmapEffect:gradient. |
96 | */ | 97 | */ |
97 | static QImage unbalancedGradient(const QSize &size, const QColor &ca, | 98 | static QImage unbalancedGradient(const QSize &size, const QColor &ca, |
98 | const QColor &cb, GradientType type, int xfactor = 100, | 99 | const QColor &cb, GradientType type, int xfactor = 100, |
99 | int yfactor = 100, int ncols = 3); | 100 | int yfactor = 100, int ncols = 3); |
100 | 101 | ||
101 | /** | 102 | /** |
102 | * Blends a color into the destination image, using an opacity | 103 | * Blends a color into the destination image, using an opacity |
103 | * value for blending one into another. Very fast direct pixel | 104 | * value for blending one into another. Very fast direct pixel |
104 | * manipulation is used. | 105 | * manipulation is used. |
105 | * | 106 | * |
106 | * @author Karol Szwed (gallium@kde.org) | 107 | * @author Karol Szwed (gallium@kde.org) |
107 | * @param clr source color to be blended into the destination image. | 108 | * @param clr source color to be blended into the destination image. |
108 | * @param dst destination image in which the source will be blended into. | 109 | * @param dst destination image in which the source will be blended into. |
109 | * @param opacity opacity (in percent) which determines how much the source | 110 | * @param opacity opacity (in percent) which determines how much the source |
110 | * color will be blended into the destination image. | 111 | * color will be blended into the destination image. |
111 | * @return The destination image (dst) containing the result. | 112 | * @return The destination image (dst) containing the result. |
112 | */ | 113 | */ |
113 | static QImage& blend(const QColor& clr, QImage& dst, float opacity); | 114 | static QImage& blend(const QColor& clr, QImage& dst, float opacity); |
114 | 115 | ||
115 | /** | 116 | /** |
116 | * Blend the src image into the destination image, using an opacity | 117 | * Blend the src image into the destination image, using an opacity |
117 | * value for blending one into another. Very fast direct pixel | 118 | * value for blending one into another. Very fast direct pixel |
118 | * manipulation is used. | 119 | * manipulation is used. |
119 | * | 120 | * |
120 | * @author Karol Szwed (gallium@kde.org) | 121 | * @author Karol Szwed (gallium@kde.org) |
121 | * @param src source image to be blended into the destination image. | 122 | * @param src source image to be blended into the destination image. |
122 | * @param dst destination image in which the source will be blended into. | 123 | * @param dst destination image in which the source will be blended into. |
123 | * @param opacity opacity (in percent) which determines how much the source | 124 | * @param opacity opacity (in percent) which determines how much the source |
124 | * image will be blended into the destination image. | 125 | * image will be blended into the destination image. |
125 | * @return The destination image (dst) containing the result. | 126 | * @return The destination image (dst) containing the result. |
126 | */ | 127 | */ |
127 | static QImage& blend(QImage& src, QImage& dst, float opacity); | 128 | static QImage& blend(QImage& src, QImage& dst, float opacity); |
128 | 129 | ||
129 | /** | 130 | /** |
130 | * Blend the provided image into a background of the indicated color. | 131 | * Blend the provided image into a background of the indicated color. |
131 | * | 132 | * |
132 | * @param initial_intensity this parameter takes values from -1 to 1: | 133 | * @param initial_intensity this parameter takes values from -1 to 1: |
133 | * a) if positive: how much to fade the image in its | 134 | * a) if positive: how much to fade the image in its |
134 | * less affected spot | 135 | * less affected spot |
135 | * b) if negative: roughly indicates how much of the image | 136 | * b) if negative: roughly indicates how much of the image |
136 | * remains unaffected | 137 | * remains unaffected |
137 | * @param bgnd indicates the color of the background to blend in | 138 | * @param bgnd indicates the color of the background to blend in |
138 | * @param eff lets you choose what kind of blending you like | 139 | * @param eff lets you choose what kind of blending you like |
139 | * @param anti_dir blend in the opposite direction (makes no much sense | 140 | * @param anti_dir blend in the opposite direction (makes no much sense |
140 | * with concentric blending effects) | 141 | * with concentric blending effects) |
141 | * @param image must be 32bpp | 142 | * @param image must be 32bpp |
142 | */ | 143 | */ |
143 | static QImage& blend(QImage &image, float initial_intensity, | 144 | static QImage& blend(QImage &image, float initial_intensity, |
144 | const QColor &bgnd, GradientType eff, | 145 | const QColor &bgnd, GradientType eff, |
145 | bool anti_dir=false); | 146 | bool anti_dir=false); |
146 | 147 | ||
147 | /** | 148 | /** |
148 | * Blend an image into another one, using a gradient type | 149 | * Blend an image into another one, using a gradient type |
149 | * for blending from one to another. | 150 | * for blending from one to another. |
150 | * | 151 | * |
151 | * @param image1 source1 and result of blending | 152 | * @param image1 source1 and result of blending |
152 | * @param image2 source2 of blending | 153 | * @param image2 source2 of blending |
153 | * @param gt gradient type for blending between source1 and source2 | 154 | * @param gt gradient type for blending between source1 and source2 |
154 | * @param xf x decay length for unbalanced gradient tpye | 155 | * @param xf x decay length for unbalanced gradient tpye |
155 | * @param yf y decay length for unbalanced gradient tpye | 156 | * @param yf y decay length for unbalanced gradient tpye |
156 | */ | 157 | */ |
157 | static QImage& blend(QImage &image1,QImage &image2, | 158 | static QImage& blend(QImage &image1,QImage &image2, |
158 | GradientType gt, int xf=100, int yf=100); | 159 | GradientType gt, int xf=100, int yf=100); |
159 | 160 | ||
160 | /** | 161 | /** |
161 | * Blend an image into another one, using a color channel of a | 162 | * Blend an image into another one, using a color channel of a |
162 | * third image for the decision of blending from one to another. | 163 | * third image for the decision of blending from one to another. |
163 | * | 164 | * |
164 | * @param image1 Source 1 and result of blending | 165 | * @param image1 Source 1 and result of blending |
165 | * @param image2 Source 2 of blending | 166 | * @param image2 Source 2 of blending |
166 | * @param blendImage If the gray value of of pixel is 0, the result | 167 | * @param blendImage If the gray value of of pixel is 0, the result |
167 | * for this pixel is that of image1; for a gray value | 168 | * for this pixel is that of image1; for a gray value |
168 | * of 1, the pixel of image2 is used; for a value | 169 | * of 1, the pixel of image2 is used; for a value |
169 | * inbetween, a corresponding blending is used. | 170 | * inbetween, a corresponding blending is used. |
170 | * @param channel The RBG channel to use for the blending decision. | 171 | * @param channel The RBG channel to use for the blending decision. |
171 | */ | 172 | */ |
172 | static QImage& blend(QImage &image1, QImage &image2, | 173 | static QImage& blend(QImage &image1, QImage &image2, |
173 | QImage &blendImage, RGBComponent channel); | 174 | QImage &blendImage, RGBComponent channel); |
174 | 175 | ||
175 | /** | 176 | /** |
176 | * Blend an image into another one, using alpha in the expected way. | 177 | * Blend an image into another one, using alpha in the expected way. |
177 | * @author Rik Hemsley (rikkus) <rik@kde.org> | 178 | * @author Rik Hemsley (rikkus) <rik@kde.org> |
178 | */ | 179 | */ |
179 | static bool blend(const QImage & upper, const QImage & lower, QImage & output); | 180 | static bool blend(const QImage & upper, const QImage & lower, QImage & output); |
180 | // Not yet... static bool blend(const QImage & image1, const QImage & image2, QImage & output, const QRect & destRect); | 181 | // Not yet... static bool blend(const QImage & image1, const QImage & image2, QImage & output, const QRect & destRect); |
181 | 182 | ||
182 | /** | 183 | /** |
183 | * Blend an image into another one, using alpha in the expected way and | 184 | * Blend an image into another one, using alpha in the expected way and |
184 | * over coordinates @p x and @p y with respect to the lower image. | 185 | * over coordinates @p x and @p y with respect to the lower image. |
185 | * The output is a QImage which is the @p upper image already blended | 186 | * The output is a QImage which is the @p upper image already blended |
186 | * with the @p lower one, so its size will be (in general) the same than | 187 | * with the @p lower one, so its size will be (in general) the same than |
187 | * @p upper instead of the same size than @p lower like the method above. | 188 | * @p upper instead of the same size than @p lower like the method above. |
188 | * In fact, the size of @p output is like upper's one only when it can be | 189 | * In fact, the size of @p output is like upper's one only when it can be |
189 | * painted on lower, if there has to be some clipping, output's size will | 190 | * painted on lower, if there has to be some clipping, output's size will |
190 | * be the clipped area and x and y will be set to the correct up-left corner | 191 | * be the clipped area and x and y will be set to the correct up-left corner |
191 | * where the clipped rectangle begins. | 192 | * where the clipped rectangle begins. |
192 | */ | 193 | */ |
193 | static bool blend(int &x, int &y, const QImage & upper, const QImage & lower, QImage & output); | 194 | static bool blend(int &x, int &y, const QImage & upper, const QImage & lower, QImage & output); |
194 | /** | 195 | /** |
195 | * Blend an image into another one, using alpha in the expected way and | 196 | * Blend an image into another one, using alpha in the expected way and |
196 | * over coordinates @p x and @p y with respect to the lower image. | 197 | * over coordinates @p x and @p y with respect to the lower image. |
197 | * The output is painted in the own @p lower image. This is an optimization | 198 | * The output is painted in the own @p lower image. This is an optimization |
198 | * of the blend method above provided by convenience. | 199 | * of the blend method above provided by convenience. |
199 | */ | 200 | */ |
200 | static bool blendOnLower(int x, int y, const QImage & upper, const QImage & lower); | 201 | static bool blendOnLower(int x, int y, const QImage & upper, const QImage & lower); |
201 | 202 | ||
202 | /** | 203 | /** |
203 | * Modifies the intensity of a pixmap's RGB channel component. | 204 | * Modifies the intensity of a pixmap's RGB channel component. |
204 | * | 205 | * |
205 | * @author Daniel M. Duley (mosfet) | 206 | * @author Daniel M. Duley (mosfet) |
206 | * @param image The QImage to process. | 207 | * @param image The QImage to process. |
207 | * @param percent Percent value. Use a negative value to dim. | 208 | * @param percent Percent value. Use a negative value to dim. |
208 | * @param channel Which channel(s) should be modified | 209 | * @param channel Which channel(s) should be modified |
209 | * @return The @p image, provided for convenience. | 210 | * @return The @p image, provided for convenience. |
210 | */ | 211 | */ |
211 | static QImage& channelIntensity(QImage &image, float percent, | 212 | static QImage& channelIntensity(QImage &image, float percent, |
212 | RGBComponent channel); | 213 | RGBComponent channel); |
213 | 214 | ||
214 | /** | 215 | /** |
215 | * Fade an image to a certain background color. | 216 | * Fade an image to a certain background color. |
216 | * | 217 | * |
217 | * The number of colors will not be changed. | 218 | * The number of colors will not be changed. |
218 | * | 219 | * |
219 | * @param image The QImage to process. | 220 | * @param image The QImage to process. |
220 | * @param val The strength of the effect. 0 <= val <= 1. | 221 | * @param val The strength of the effect. 0 <= val <= 1. |
221 | * @param color The background color. | 222 | * @param color The background color. |
222 | * @return Returns the @ref image(), provided for convenience. | 223 | * @return Returns the @ref image(), provided for convenience. |
223 | */ | 224 | */ |
224 | static QImage& fade(QImage &img, float val, const QColor &color); | 225 | static QImage& fade(QImage &img, float val, const QColor &color); |
225 | 226 | ||
226 | 227 | ||
227 | /** | 228 | /** |
228 | * This recolors a pixmap. The most dark color will become color a, | 229 | * This recolors a pixmap. The most dark color will become color a, |
229 | * the most bright one color b, and in between. | 230 | * the most bright one color b, and in between. |
230 | * | 231 | * |
231 | * @param image A QImage to process. | 232 | * @param image A QImage to process. |
232 | * @param ca Color a | 233 | * @param ca Color a |
233 | * @param cb Color b | 234 | * @param cb Color b |
234 | */ | 235 | */ |
235 | static QImage& flatten(QImage &image, const QColor &ca, | 236 | static QImage& flatten(QImage &image, const QColor &ca, |
236 | const QColor &cb, int ncols=0); | 237 | const QColor &cb, int ncols=0); |
237 | 238 | ||
238 | /** | 239 | /** |
239 | * Build a hash on any given @ref QImage | 240 | * Build a hash on any given @ref QImage |
240 | * | 241 | * |
241 | * @param image The QImage to process | 242 | * @param image The QImage to process |
242 | * @param lite The hash faces the indicated lighting (cardinal poles). | 243 | * @param lite The hash faces the indicated lighting (cardinal poles). |
243 | * @param spacing How many unmodified pixels inbetween hashes. | 244 | * @param spacing How many unmodified pixels inbetween hashes. |
244 | * @return Returns the @ref image(), provided for convenience. | 245 | * @return Returns the @ref image(), provided for convenience. |
245 | */ | 246 | */ |
246 | static QImage& hash(QImage &image, Lighting lite=NorthLite, | 247 | static QImage& hash(QImage &image, Lighting lite=NorthLite, |
247 | unsigned int spacing=0); | 248 | unsigned int spacing=0); |
248 | 249 | ||
249 | /** | 250 | /** |
250 | * Either brighten or dim the image by a specified percent. | 251 | * Either brighten or dim the image by a specified percent. |
251 | * For example, .50 will modify the colors by 50%. | 252 | * For example, .50 will modify the colors by 50%. |
252 | * | 253 | * |
253 | * @author Daniel M. Duley (mosfet) | 254 | * @author Daniel M. Duley (mosfet) |
254 | * @param image The QImage to process. | 255 | * @param image The QImage to process. |
255 | * @param percent The percent value. Use a negative value to dim. | 256 | * @param percent The percent value. Use a negative value to dim. |
256 | * @return Returns The @ref image(), provided for convenience. | 257 | * @return Returns The @ref image(), provided for convenience. |
257 | */ | 258 | */ |
258 | static QImage& intensity(QImage &image, float percent); | 259 | static QImage& intensity(QImage &image, float percent); |
259 | 260 | ||
260 | /** | 261 | /** |
261 | * Modulate the image with a color channel of another image. | 262 | * Modulate the image with a color channel of another image. |
262 | * | 263 | * |
263 | * @param image The QImage to modulate and result. | 264 | * @param image The QImage to modulate and result. |
264 | * @param modImage The QImage to use for modulation. | 265 | * @param modImage The QImage to use for modulation. |
265 | * @param reverse Invert the meaning of image/modImage; result is image! | 266 | * @param reverse Invert the meaning of image/modImage; result is image! |
266 | * @param type The modulation Type to use. | 267 | * @param type The modulation Type to use. |
267 | * @param factor The modulation amplitude; with 0 no effect [-200;200]. | 268 | * @param factor The modulation amplitude; with 0 no effect [-200;200]. |
268 | * @param channel The RBG channel of image2 to use for modulation. | 269 | * @param channel The RBG channel of image2 to use for modulation. |
269 | * @return Returns the @ref image(), provided for convenience. | 270 | * @return Returns the @ref image(), provided for convenience. |
270 | */ | 271 | */ |
271 | static QImage& modulate(QImage &image, QImage &modImage, bool reverse, | 272 | static QImage& modulate(QImage &image, QImage &modImage, bool reverse, |
272 | ModulationType type, int factor, RGBComponent channel); | 273 | ModulationType type, int factor, RGBComponent channel); |
273 | 274 | ||
274 | /** | 275 | /** |
275 | * Convert an image to grayscale. | 276 | * Convert an image to grayscale. |
276 | * | 277 | * |
277 | * @author Daniel M. Duley (mosfet) | 278 | * @author Daniel M. Duley (mosfet) |
278 | * @param image The @ref QImage to process. | 279 | * @param image The @ref QImage to process. |
279 | * @param fast Set to @p true in order to use a faster but non-photographic | 280 | * @param fast Set to @p true in order to use a faster but non-photographic |
280 | * quality algorithm. Appropriate for things such as toolbar icons. | 281 | * quality algorithm. Appropriate for things such as toolbar icons. |
281 | * @return Returns the @ref image(), provided for convenience. | 282 | * @return Returns the @ref image(), provided for convenience. |
282 | */ | 283 | */ |
283 | static QImage& toGray(QImage &image, bool fast = false); | 284 | static QImage& toGray(QImage &image, bool fast = false); |
284 | 285 | ||
285 | /** | 286 | /** |
286 | * Desaturate an image evenly. | 287 | * Desaturate an image evenly. |
287 | * | 288 | * |
288 | * @param image The QImage to process. | 289 | * @param image The QImage to process. |
289 | * @param desat A value between 0 and 1 setting the degree of desaturation | 290 | * @param desat A value between 0 and 1 setting the degree of desaturation |
290 | * @return Returns the @ref image(), provided for convenience. | 291 | * @return Returns the @ref image(), provided for convenience. |
291 | */ | 292 | */ |
292 | static QImage& desaturate(QImage &image, float desat = 0.3); | 293 | static QImage& desaturate(QImage &image, float desat = 0.3); |
293 | 294 | ||
294 | /** | 295 | /** |
295 | * Fast, but low quality contrast of an image. Also see contrastHSV. | 296 | * Fast, but low quality contrast of an image. Also see contrastHSV. |
296 | * | 297 | * |
297 | * @author Daniel M. Duley (mosfet) | 298 | * @author Daniel M. Duley (mosfet) |
298 | * @param image The QImage to process. | 299 | * @param image The QImage to process. |
299 | * @param c A contrast value between -255 to 255. | 300 | * @param c A contrast value between -255 to 255. |
300 | * @return The @ref image(), provided for convenience. | 301 | * @return The @ref image(), provided for convenience. |
301 | */ | 302 | */ |
302 | static QImage& contrast(QImage &image, int c); | 303 | static QImage& contrast(QImage &image, int c); |
303 | 304 | ||
304 | /** | 305 | /** |
305 | * Dither an image using Floyd-Steinberg dithering for low-color | 306 | * Dither an image using Floyd-Steinberg dithering for low-color |
306 | * situations. | 307 | * situations. |
307 | * | 308 | * |
308 | * @param image The QImage to process. | 309 | * @param image The QImage to process. |
309 | * @param palette The color palette to use | 310 | * @param palette The color palette to use |
310 | * @param size The size of the palette | 311 | * @param size The size of the palette |
311 | * @return Returns the @ref image(), provided for convenience. | 312 | * @return Returns the @ref image(), provided for convenience. |
312 | */ | 313 | */ |
313 | static QImage& dither(QImage &img, const QColor *palette, int size); | 314 | static QImage& dither(QImage &img, const QColor *palette, int size); |
314 | 315 | ||
315 | /** | 316 | /** |
316 | * Calculate the image for a selected image, for instance a selected icon | 317 | * Calculate the image for a selected image, for instance a selected icon |
317 | * on the desktop. | 318 | * on the desktop. |
318 | * @param img the QImage to select | 319 | * @param img the QImage to select |
319 | * @param col the selected color, usually from QColorGroup::highlight(). | 320 | * @param col the selected color, usually from QColorGroup::highlight(). |
320 | */ | 321 | */ |
321 | static QImage& selectedImage( QImage &img, const QColor &col ); | 322 | static QImage& selectedImage( QImage &img, const QColor &col ); |
322 | 323 | ||
323 | /** | 324 | /** |
324 | * High quality, expensive HSV contrast. You can do a faster one by just | 325 | * High quality, expensive HSV contrast. You can do a faster one by just |
325 | * taking a intensity threshold (ie: 128) and incrementing RGB color | 326 | * taking a intensity threshold (ie: 128) and incrementing RGB color |
326 | * channels above it and decrementing those below it, but this gives much | 327 | * channels above it and decrementing those below it, but this gives much |
327 | * better results. | 328 | * better results. |
328 | * | 329 | * |
329 | * @author Daniel M. Duley (mosfet) | 330 | * @author Daniel M. Duley (mosfet) |
330 | * @param img The QImage to process. | 331 | * @param img The QImage to process. |
331 | * @param sharpen If true sharpness is increase, (spiffed). Otherwise | 332 | * @param sharpen If true sharpness is increase, (spiffed). Otherwise |
332 | * it is decreased, (dulled). | 333 | * it is decreased, (dulled). |
333 | */ | 334 | */ |
334 | static void contrastHSV(QImage &img, bool sharpen=true); | 335 | static void contrastHSV(QImage &img, bool sharpen=true); |
335 | 336 | ||
336 | /** | 337 | /** |
337 | * Normalizes the pixel values to span the full range of color values. | 338 | * Normalizes the pixel values to span the full range of color values. |
338 | * This is a contrast enhancement technique. | 339 | * This is a contrast enhancement technique. |
339 | * @author Daniel M. Duley (mosfet) | 340 | * @author Daniel M. Duley (mosfet) |
340 | */ | 341 | */ |
341 | static void normalize(QImage &img); | 342 | static void normalize(QImage &img); |
342 | 343 | ||
343 | /** | 344 | /** |
344 | * Performs histogram equalization on the reference | 345 | * Performs histogram equalization on the reference |
345 | * image. | 346 | * image. |
346 | * @author Daniel M. Duley (mosfet) | 347 | * @author Daniel M. Duley (mosfet) |
347 | */ | 348 | */ |
348 | static void equalize(QImage &img); | 349 | static void equalize(QImage &img); |
349 | 350 | ||
350 | /** | 351 | /** |
351 | * Thresholds the reference image. You can also threshold images by using | 352 | * Thresholds the reference image. You can also threshold images by using |
352 | * ThresholdDither in the various QPixmap/QImage convert methods, but this | 353 | * ThresholdDither in the various QPixmap/QImage convert methods, but this |
353 | * lets you specify a threshold value. | 354 | * lets you specify a threshold value. |
354 | * | 355 | * |
355 | * @author Daniel M. Duley (mosfet) | 356 | * @author Daniel M. Duley (mosfet) |
356 | * @param img The QImage to process. | 357 | * @param img The QImage to process. |
357 | * @param value The threshold value. | 358 | * @param value The threshold value. |
358 | */ | 359 | */ |
359 | static void threshold(QImage &img, unsigned int value=128); | 360 | static void threshold(QImage &img, unsigned int value=128); |
360 | 361 | ||
361 | /** | 362 | /** |
362 | * Produces a 'solarization' effect seen when exposing a photographic | 363 | * Produces a 'solarization' effect seen when exposing a photographic |
363 | * film to light during the development process. | 364 | * film to light during the development process. |
364 | * | 365 | * |
365 | * @author Daniel M. Duley (mosfet) | 366 | * @author Daniel M. Duley (mosfet) |
366 | * @param img The QImage to process. | 367 | * @param img The QImage to process. |
367 | * @param factor The extent of the solarization (0-99.9) | 368 | * @param factor The extent of the solarization (0-99.9) |
368 | */ | 369 | */ |
369 | static void solarize(QImage &img, double factor=50.0); | 370 | static void solarize(QImage &img, double factor=50.0); |
370 | 371 | ||
371 | /** | 372 | /** |
372 | * Embosses the source image. This involves highlighting the edges | 373 | * Embosses the source image. This involves highlighting the edges |
373 | * and applying various other enhancements in order to get a metal | 374 | * and applying various other enhancements in order to get a metal |
374 | * effect. | 375 | * effect. |
375 | * | 376 | * |
376 | * @author Daniel M. Duley (mosfet) | 377 | * @author Daniel M. Duley (mosfet) |
377 | * @param src The QImage to process. | 378 | * @param src The QImage to process. |
378 | * @return The embossed image. The original is not changed. | 379 | * @return The embossed image. The original is not changed. |
379 | */ | 380 | */ |
380 | static QImage emboss(QImage &src); | 381 | static QImage emboss(QImage &src); |
381 | 382 | ||
382 | /** | 383 | /** |
383 | * Minimizes speckle noise in the source image using the 8 hull | 384 | * Minimizes speckle noise in the source image using the 8 hull |
384 | * algorithm. | 385 | * algorithm. |
385 | * | 386 | * |
386 | * @author Daniel M. Duley (mosfet) | 387 | * @author Daniel M. Duley (mosfet) |
387 | * @param src The QImage to process. | 388 | * @param src The QImage to process. |
388 | * @return The despeckled image. The original is not changed. | 389 | * @return The despeckled image. The original is not changed. |
389 | */ | 390 | */ |
390 | static QImage despeckle(QImage &src); | 391 | static QImage despeckle(QImage &src); |
391 | 392 | ||
392 | /** | 393 | /** |
393 | * Produces a neat little "charcoal" effect. | 394 | * Produces a neat little "charcoal" effect. |
394 | * | 395 | * |
395 | * @author Daniel M. Duley (mosfet) | 396 | * @author Daniel M. Duley (mosfet) |
396 | * @param src The QImage to process. | 397 | * @param src The QImage to process. |
397 | * @param factor The factor for detecting lines (0-99.0). | 398 | * @param factor The factor for detecting lines (0-99.0). |
398 | * @return The charcoal image. The original is not changed. | 399 | * @return The charcoal image. The original is not changed. |
399 | */ | 400 | */ |
400 | static QImage charcoal(QImage &src, double factor=50.0); | 401 | static QImage charcoal(QImage &src, double factor=50.0); |
401 | 402 | ||
402 | /** | 403 | /** |
403 | * Rotates the image by the specified amount | 404 | * Rotates the image by the specified amount |
404 | * | 405 | * |
405 | * @author Daniel M. Duley (mosfet) | 406 | * @author Daniel M. Duley (mosfet) |
406 | * @param src The QImage to process. | 407 | * @param src The QImage to process. |
407 | * @param r The rotate direction. | 408 | * @param r The rotate direction. |
408 | * @return The rotated image. The original is not changed. | 409 | * @return The rotated image. The original is not changed. |
409 | */ | 410 | */ |
410 | static QImage rotate(QImage &src, RotateDirection r); | 411 | static QImage rotate(QImage &src, RotateDirection r); |
411 | 412 | ||
412 | /** | 413 | /** |
413 | * Scales an image using simple pixel sampling. This does not produce | 414 | * Scales an image using simple pixel sampling. This does not produce |
414 | * nearly as nice a result as QImage::smoothScale(), but has the | 415 | * nearly as nice a result as QImage::smoothScale(), but has the |
415 | * advantage of being much faster - only a few milliseconds. | 416 | * advantage of being much faster - only a few milliseconds. |
416 | * | 417 | * |
417 | * @author Daniel M. Duley (mosfet) | 418 | * @author Daniel M. Duley (mosfet) |
418 | * @param src The QImage to process. | 419 | * @param src The QImage to process. |
419 | * @param w The new width. | 420 | * @param w The new width. |
420 | * @param h The new height. | 421 | * @param h The new height. |
421 | * @return The scaled image. The original is not changed. | 422 | * @return The scaled image. The original is not changed. |
422 | */ | 423 | */ |
423 | static QImage sample(QImage &src, int w, int h); | 424 | static QImage sample(QImage &src, int w, int h); |
424 | 425 | ||
425 | /** | 426 | /** |
426 | * Adds noise to an image. | 427 | * Adds noise to an image. |
427 | * | 428 | * |
428 | * @author Daniel M. Duley (mosfet) | 429 | * @author Daniel M. Duley (mosfet) |
429 | * @param src The QImage to process. | 430 | * @param src The QImage to process. |
430 | * @param type The algorithm used to generate the noise. | 431 | * @param type The algorithm used to generate the noise. |
431 | * @return The image with noise added. The original is not changed. | 432 | * @return The image with noise added. The original is not changed. |
432 | */ | 433 | */ |
433 | static QImage addNoise(QImage &src, NoiseType type = GaussianNoise); | 434 | static QImage addNoise(QImage &src, NoiseType type = GaussianNoise); |
434 | 435 | ||
435 | /** | 436 | /** |
436 | * Blurs an image by convolving pixel neighborhoods. | 437 | * Blurs an image by convolving pixel neighborhoods. |
437 | * | 438 | * |
438 | * @author Daniel M. Duley (mosfet) | 439 | * @author Daniel M. Duley (mosfet) |
439 | * @param src The QImage to process. | 440 | * @param src The QImage to process. |
440 | * @param factor The percent weight to give to the center pixel. | 441 | * @param factor The percent weight to give to the center pixel. |
441 | * @return The blurred image. The original is not changed. | 442 | * @return The blurred image. The original is not changed. |
442 | */ | 443 | */ |
443 | static QImage blur(QImage &src, double factor=50.0); | 444 | static QImage blur(QImage &src, double factor=50.0); |
444 | 445 | ||
445 | /** | 446 | /** |
446 | * Detects edges in an image using pixel neighborhoods and an edge | 447 | * Detects edges in an image using pixel neighborhoods and an edge |
447 | * detection mask. | 448 | * detection mask. |
448 | * | 449 | * |
449 | * @author Daniel M. Duley (mosfet) | 450 | * @author Daniel M. Duley (mosfet) |
450 | * @param src The QImage to process. | 451 | * @param src The QImage to process. |
451 | * @param factor The percent weight to give to the center pixel. | 452 | * @param factor The percent weight to give to the center pixel. |
452 | * @return The image with edges detected. The original is not changed. | 453 | * @return The image with edges detected. The original is not changed. |
453 | */ | 454 | */ |
454 | static QImage edge(QImage &src, double factor=50.0); | 455 | static QImage edge(QImage &src, double factor=50.0); |
455 | 456 | ||
456 | /** | 457 | /** |
457 | * Implodes an image by a specified percent. | 458 | * Implodes an image by a specified percent. |
458 | * | 459 | * |
459 | * @author Daniel M. Duley (mosfet) | 460 | * @author Daniel M. Duley (mosfet) |
460 | * @param src The QImage to process. | 461 | * @param src The QImage to process. |
461 | * @param factor The extent of the implosion. | 462 | * @param factor The extent of the implosion. |
462 | * @param background An RGBA value to use for the background. After the | 463 | * @param background An RGBA value to use for the background. After the |
463 | * effect some pixels may be "empty". This value is used for those pixels. | 464 | * effect some pixels may be "empty". This value is used for those pixels. |
464 | * @return The imploded image. The original is not changed. | 465 | * @return The imploded image. The original is not changed. |
465 | */ | 466 | */ |
466 | static QImage implode(QImage &src, double factor=30.0, | 467 | static QImage implode(QImage &src, double factor=30.0, |
467 | unsigned int background = 0xFFFFFFFF); | 468 | unsigned int background = 0xFFFFFFFF); |
468 | /** | 469 | /** |
469 | * Produces an oil painting effect. | 470 | * Produces an oil painting effect. |
470 | * | 471 | * |
471 | * @author Daniel M. Duley (mosfet) | 472 | * @author Daniel M. Duley (mosfet) |
472 | * @param src The QImage to process. | 473 | * @param src The QImage to process. |
473 | * @param radius The radius of the pixel neighborhood used in applying the | 474 | * @param radius The radius of the pixel neighborhood used in applying the |
474 | * effect. | 475 | * effect. |
475 | * @return The new image. The original is not changed. | 476 | * @return The new image. The original is not changed. |
476 | */ | 477 | */ |
477 | static QImage oilPaint(QImage &src, int radius=3); | 478 | static QImage oilPaint(QImage &src, int radius=3); |
478 | 479 | ||
479 | /** | 480 | /** |
480 | * Sharpens the pixels in the image using pixel neighborhoods. | 481 | * Sharpens the pixels in the image using pixel neighborhoods. |
481 | * | 482 | * |
482 | * @author Daniel M. Duley (mosfet) | 483 | * @author Daniel M. Duley (mosfet) |
483 | * @param src The QImage to process. | 484 | * @param src The QImage to process. |
484 | * @param factor The percent weight to give to the center pixel. | 485 | * @param factor The percent weight to give to the center pixel. |
485 | * @return The sharpened image. The original is not changed. | 486 | * @return The sharpened image. The original is not changed. |
486 | */ | 487 | */ |
487 | static QImage sharpen(QImage &src, double factor=30.0); | 488 | static QImage sharpen(QImage &src, double factor=30.0); |
488 | 489 | ||
489 | /** | 490 | /** |
490 | * Randomly displaces pixels. | 491 | * Randomly displaces pixels. |
491 | * | 492 | * |
492 | * @author Daniel M. Duley (mosfet) | 493 | * @author Daniel M. Duley (mosfet) |
493 | * @param src The QImage to process. | 494 | * @param src The QImage to process. |
494 | * @param amount The vicinity for choosing a random pixel to swap. | 495 | * @param amount The vicinity for choosing a random pixel to swap. |
495 | * @return The image with pixels displaced. The original is not changed. | 496 | * @return The image with pixels displaced. The original is not changed. |
496 | */ | 497 | */ |
497 | static QImage spread(QImage &src, unsigned int amount=3); | 498 | static QImage spread(QImage &src, unsigned int amount=3); |
498 | 499 | ||
499 | /** | 500 | /** |
500 | * Shades the image using a distance light source. | 501 | * Shades the image using a distance light source. |
501 | * | 502 | * |
502 | * @author Daniel M. Duley (mosfet) | 503 | * @author Daniel M. Duley (mosfet) |
503 | * @param src The QImage to process. | 504 | * @param src The QImage to process. |
504 | * @param color_shading If true do color shading, otherwise do grayscale. | 505 | * @param color_shading If true do color shading, otherwise do grayscale. |
505 | * @param azimuth Determines the light source and direction. | 506 | * @param azimuth Determines the light source and direction. |
506 | * @param elevation Determines the light source and direction. | 507 | * @param elevation Determines the light source and direction. |
507 | * @return The shaded image. The original is not changed. | 508 | * @return The shaded image. The original is not changed. |
508 | */ | 509 | */ |
509 | static QImage shade(QImage &src, bool color_shading=true, double azimuth=30.0, | 510 | static QImage shade(QImage &src, bool color_shading=true, double azimuth=30.0, |
510 | double elevation=30.0); | 511 | double elevation=30.0); |
511 | /** | 512 | /** |
512 | * Swirls the image by a specified amount | 513 | * Swirls the image by a specified amount |
513 | * | 514 | * |
514 | * @author Daniel M. Duley (mosfet) | 515 | * @author Daniel M. Duley (mosfet) |
diff --git a/libopie2/opieui/olistview.h b/libopie2/opieui/olistview.h index bafc67c..b62e278 100644 --- a/libopie2/opieui/olistview.h +++ b/libopie2/opieui/olistview.h | |||
@@ -1,235 +1,235 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OLISTVIEW_H | 31 | #ifndef OLISTVIEW_H |
32 | #define OLISTVIEW_H | 32 | #define OLISTVIEW_H |
33 | 33 | ||
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <qpen.h> | 36 | #include <qpen.h> |
37 | #include <qdatastream.h> | 37 | #include <qdatastream.h> |
38 | 38 | ||
39 | class OListViewItem; | 39 | class OListViewItem; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * A @ref QListView variant featuring visual and functional enhancements | 42 | * A @ref QListView variant featuring visual and functional enhancements |
43 | * like an alternate background for odd rows, an autostretch mode | 43 | * like an alternate background for odd rows, an autostretch mode |
44 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. | 44 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. |
45 | * | 45 | * |
46 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 46 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
47 | * @short OListView list/tree widget. | 47 | * @short OListView list/tree widget. |
48 | */ | 48 | */ |
49 | class OListView: public QListView | 49 | class OListView: public QListView |
50 | { | 50 | { |
51 | public: | 51 | public: |
52 | /** | 52 | /** |
53 | * Constructor. | 53 | * Constructor. |
54 | * | 54 | * |
55 | * The parameters @p parent and @p name are handled by | 55 | * The parameters @p parent and @p name are handled by |
56 | * @ref QListView, as usual. | 56 | * @ref QListView, as usual. |
57 | */ | 57 | */ |
58 | OListView ( QWidget *parent = 0, const char *name = 0 ); | 58 | OListView ( QWidget *parent = 0, const char *name = 0 ); |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Destructor. | 61 | * Destructor. |
62 | */ | 62 | */ |
63 | virtual ~OListView(); | 63 | virtual ~OListView(); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Let the last column fit exactly all the available width. | 66 | * Let the last column fit exactly all the available width. |
67 | */ | 67 | */ |
68 | void setFullWidth( bool fullWidth ); | 68 | void setFullWidth( bool fullWidth ); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Returns whether the last column is set to fit the available width. | 71 | * Returns whether the last column is set to fit the available width. |
72 | */ | 72 | */ |
73 | bool fullWidth() const; | 73 | bool fullWidth() const; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Reimplemented for full width support | 76 | * Reimplemented for full width support |
77 | */ | 77 | */ |
78 | virtual int addColumn( const QString& label, int width = -1 ); | 78 | virtual int addColumn( const QString& label, int width = -1 ); |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Reimplemented for full width support | 81 | * Reimplemented for full width support |
82 | */ | 82 | */ |
83 | virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); | 83 | virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Reimplemented for full width support | 86 | * Reimplemented for full width support |
87 | */ | 87 | */ |
88 | virtual void removeColumn(int index); | 88 | virtual void removeColumn(int index); |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * sets the alternate background background color. | 91 | * sets the alternate background background color. |
92 | * This only has an effect if the items are OListViewItems | 92 | * This only has an effect if the items are OListViewItems |
93 | * | 93 | * |
94 | * @param c the color to use for every other item. Set to an invalid | 94 | * @param c the color to use for every other item. Set to an invalid |
95 | * color to disable alternate colors. | 95 | * color to disable alternate colors. |
96 | */ | 96 | */ |
97 | void setAlternateBackground( const QColor &c ); | 97 | void setAlternateBackground( const QColor &c ); |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * sets the column separator pen. | 100 | * sets the column separator pen. |
101 | * | 101 | * |
102 | * @param p the pen used to draw the column separator. | 102 | * @param p the pen used to draw the column separator. |
103 | */ | 103 | */ |
104 | void setColumnSeparator( const QPen &p ); | 104 | void setColumnSeparator( const QPen &p ); |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * @return the alternate background color | 107 | * @return the alternate background color |
108 | */ | 108 | */ |
109 | const QColor& alternateBackground() const; | 109 | const QColor& alternateBackground() const; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * @return the column separator pen | 112 | * @return the column separator pen |
113 | */ | 113 | */ |
114 | const QPen& columnSeparator() const; | 114 | const QPen& columnSeparator() const; |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * create a list view item as child of this object | 117 | * create a list view item as child of this object |
118 | * @return the new object | 118 | * @return the new object |
119 | */ | 119 | */ |
120 | virtual OListViewItem* childFactory(); | 120 | virtual OListViewItem* childFactory(); |
121 | 121 | ||
122 | #ifndef QT_NO_DATASTREAM | 122 | #ifndef QT_NO_DATASTREAM |
123 | /** | 123 | /** |
124 | * serialize this object to a @ref QDataStream | 124 | * serialize this object to a @ref QDataStream |
125 | * @param s the stream used to serialize this object. | 125 | * @param s the stream used to serialize this object. |
126 | */ | 126 | */ |
127 | virtual void serializeTo( QDataStream& s ) const; | 127 | virtual void serializeTo( QDataStream& s ) const; |
128 | 128 | ||
129 | /** | 129 | /** |
130 | * serialize this object from a @ref QDataStream | 130 | * serialize this object from a @ref QDataStream |
131 | * @param s the stream used to serialize this object. | 131 | * @param s the stream used to serialize this object. |
132 | */ | 132 | */ |
133 | virtual void serializeFrom( QDataStream& s ); | 133 | virtual void serializeFrom( QDataStream& s ); |
134 | #endif | 134 | #endif |
135 | 135 | ||
136 | private: | 136 | private: |
137 | QColor m_alternateBackground; | 137 | QColor m_alternateBackground; |
138 | bool m_fullWidth; | 138 | bool m_fullWidth; |
139 | QPen m_columnSeparator; | 139 | QPen m_columnSeparator; |
140 | }; | 140 | }; |
141 | 141 | ||
142 | #ifndef QT_NO_DATASTREAM | 142 | #ifndef QT_NO_DATASTREAM |
143 | /** | 143 | /** |
144 | * \relates QListView | 144 | * \relates QListView |
145 | * Writes a listview to the stream and returns a reference to the stream. | 145 | * Writes a listview to the stream and returns a reference to the stream. |
146 | */ | 146 | */ |
147 | QDataStream& operator<<( QDataStream& s, const OListView& lv ); | 147 | QDataStream& operator<<( QDataStream& s, const OListView& lv ); |
148 | /** | 148 | /** |
149 | * \relates QListView | 149 | * \relates QListView |
150 | * Reads a listview from the stream and returns a reference to the stream. | 150 | * Reads a listview from the stream and returns a reference to the stream. |
151 | */ | 151 | */ |
152 | QDataStream& operator>>( QDataStream& s, OListView& lv ); | 152 | QDataStream& operator>>( QDataStream& s, OListView& lv ); |
153 | #endif // QT_NO_DATASTREAM | 153 | #endif // QT_NO_DATASTREAM |
154 | 154 | ||
155 | //****************************** OListViewItem ****************************************************************** | 155 | //****************************** OListViewItem ****************************************************************** |
156 | 156 | ||
157 | class OListViewItem: public QListViewItem | 157 | class OListViewItem: public QListViewItem |
158 | { | 158 | { |
159 | public: | 159 | public: |
160 | OListViewItem( QListView * parent ); | 160 | OListViewItem( QListView * parent ); |
161 | OListViewItem( QListViewItem * parent ); | 161 | OListViewItem( QListViewItem * parent ); |
162 | OListViewItem( QListView * parent, QListViewItem * after ); | 162 | OListViewItem( QListView * parent, QListViewItem * after ); |
163 | OListViewItem( QListViewItem * parent, QListViewItem * after ); | 163 | OListViewItem( QListViewItem * parent, QListViewItem * after ); |
164 | 164 | ||
165 | OListViewItem( QListView * parent, | 165 | OListViewItem( QListView * parent, |
166 | QString, QString = QString::null, | 166 | QString, QString = QString::null, |
167 | QString = QString::null, QString = QString::null, | 167 | QString = QString::null, QString = QString::null, |
168 | QString = QString::null, QString = QString::null, | 168 | QString = QString::null, QString = QString::null, |
169 | QString = QString::null, QString = QString::null ); | 169 | QString = QString::null, QString = QString::null ); |
170 | 170 | ||
171 | OListViewItem( QListViewItem * parent, | 171 | OListViewItem( QListViewItem * parent, |
172 | QString, QString = QString::null, | 172 | QString, QString = QString::null, |
173 | QString = QString::null, QString = QString::null, | 173 | QString = QString::null, QString = QString::null, |
174 | QString = QString::null, QString = QString::null, | 174 | QString = QString::null, QString = QString::null, |
175 | QString = QString::null, QString = QString::null ); | 175 | QString = QString::null, QString = QString::null ); |
176 | 176 | ||
177 | OListViewItem( QListView * parent, QListViewItem * after, | 177 | OListViewItem( QListView * parent, QListViewItem * after, |
178 | QString, QString = QString::null, | 178 | QString, QString = QString::null, |
179 | QString = QString::null, QString = QString::null, | 179 | QString = QString::null, QString = QString::null, |
180 | QString = QString::null, QString = QString::null, | 180 | QString = QString::null, QString = QString::null, |
181 | QString = QString::null, QString = QString::null ); | 181 | QString = QString::null, QString = QString::null ); |
182 | 182 | ||
183 | OListViewItem( QListViewItem * parent, QListViewItem * after, | 183 | OListViewItem( QListViewItem * parent, QListViewItem * after, |
184 | QString, QString = QString::null, | 184 | QString, QString = QString::null, |
185 | QString = QString::null, QString = QString::null, | 185 | QString = QString::null, QString = QString::null, |
186 | QString = QString::null, QString = QString::null, | 186 | QString = QString::null, QString = QString::null, |
187 | QString = QString::null, QString = QString::null ); | 187 | QString = QString::null, QString = QString::null ); |
188 | 188 | ||
189 | virtual ~OListViewItem(); | 189 | virtual ~OListViewItem(); |
190 | 190 | ||
191 | const QColor& backgroundColor(); | 191 | const QColor& backgroundColor(); |
192 | bool isAlternate(); | 192 | bool isAlternate(); |
193 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); | 193 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); |
194 | void init(); | 194 | void init(); |
195 | 195 | ||
196 | /** | 196 | /** |
197 | * create a list view item as child of this object | 197 | * create a list view item as child of this object |
198 | * @return the new object | 198 | * @return the new object |
199 | */ | 199 | */ |
200 | virtual OListViewItem* childFactory(); | 200 | virtual OListViewItem* childFactory(); |
201 | 201 | ||
202 | #ifndef QT_NO_DATASTREAM | 202 | #ifndef QT_NO_DATASTREAM |
203 | /** | 203 | /** |
204 | * serialize this object to or from a @ref QDataStream | 204 | * serialize this object to or from a @ref QDataStream |
205 | * @param s the stream used to serialize this object. | 205 | * @param s the stream used to serialize this object. |
206 | */ | 206 | */ |
207 | virtual void serializeTo( QDataStream& s ) const; | 207 | virtual void serializeTo( QDataStream& s ) const; |
208 | 208 | ||
209 | /** | 209 | /** |
210 | * serialize this object to or from a @ref QDataStream | 210 | * serialize this object to or from a @ref QDataStream |
211 | * @param s the stream used to serialize this object. | 211 | * @param s the stream used to serialize this object. |
212 | */ | 212 | */ |
213 | virtual void serializeFrom( QDataStream& s ); | 213 | virtual void serializeFrom( QDataStream& s ); |
214 | #endif | 214 | #endif |
215 | 215 | ||
216 | private: | 216 | private: |
217 | bool m_known; | 217 | bool m_known; |
218 | bool m_odd; | 218 | bool m_odd; |
219 | }; | 219 | }; |
220 | 220 | ||
221 | #ifndef QT_NO_DATASTREAM | 221 | #ifndef QT_NO_DATASTREAM |
222 | /** | 222 | /** |
223 | * \relates QListViewItem | 223 | * \relates QListViewItem |
224 | * Writes a listview item and all subitems recursively to the stream | 224 | * Writes a listview item and all subitems recursively to the stream |
225 | * and returns a reference to the stream. | 225 | * and returns a reference to the stream. |
226 | */ | 226 | */ |
227 | QDataStream& operator<<( QDataStream &s, const OListViewItem& lvi ); | 227 | QDataStream& operator<<( QDataStream &s, const OListViewItem& lvi ); |
228 | /** | 228 | /** |
229 | * \relates QListViewItem | 229 | * \relates QListViewItem |
230 | * Reads a listview item from the stream and returns a reference to the stream. | 230 | * Reads a listview item from the stream and returns a reference to the stream. |
231 | */ | 231 | */ |
232 | QDataStream& operator>>( QDataStream &s, OListViewItem& lvi ); | 232 | QDataStream& operator>>( QDataStream &s, OListViewItem& lvi ); |
233 | #endif // QT_NO_DATASTREAM | 233 | #endif // QT_NO_DATASTREAM |
234 | 234 | ||
235 | #endif // OLISTVIEW_H | 235 | #endif // OLISTVIEW_H |
diff --git a/libopie2/opieui/opopupmenu.h b/libopie2/opieui/opopupmenu.h index 94f05f4..54e4301 100644 --- a/libopie2/opieui/opopupmenu.h +++ b/libopie2/opieui/opopupmenu.h | |||
@@ -1,256 +1,259 @@ | |||
1 | //FIXME what is ODE? ODE Desktop Environemt? -zecke | ||
2 | //FIXME do we need titles? space is limited that is only eyecandy? -zecke | ||
3 | //FIXME keyboard navigation is also not that popular on a PDA might be with a keyboard (tuxphone) -zecke | ||
1 | /* This file is part of the ODE libraries | 4 | /* This file is part of the ODE libraries |
2 | Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org> | 5 | Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org> |
3 | 6 | ||
4 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. | 9 | License version 2 as published by the Free Software Foundation. |
7 | 10 | ||
8 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 14 | Library General Public License for more details. |
12 | 15 | ||
13 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
17 | */ | 20 | */ |
18 | #ifndef _OPOPUP_H | 21 | #ifndef _OPOPUP_H |
19 | #define _OPOPUP_H | 22 | #define _OPOPUP_H |
20 | 23 | ||
21 | #define INCLUDE_MENUITEM_DEF | 24 | #define INCLUDE_MENUITEM_DEF |
22 | 25 | ||
23 | /* QT */ | 26 | /* QT */ |
24 | 27 | ||
25 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
26 | 29 | ||
27 | /* OPIE */ | 30 | /* OPIE */ |
28 | 31 | ||
29 | #include <opie2/opixmapeffect.h> | 32 | #include <opie2/opixmapeffect.h> |
30 | 33 | ||
31 | /** | 34 | /** |
32 | * Title widget for use in @ref OPopupMenu. | 35 | * Title widget for use in @ref OPopupMenu. |
33 | * | 36 | * |
34 | * You usually don't have to create this manually since | 37 | * You usually don't have to create this manually since |
35 | * @ref OPopupMenu::insertTitle will do it for you, but it is allowed if | 38 | * @ref OPopupMenu::insertTitle will do it for you, but it is allowed if |
36 | * you wish to customize it's look. | 39 | * you wish to customize it's look. |
37 | * | 40 | * |
38 | * @author Daniel M. Duley <mosfet@kde.org> | 41 | * @author Daniel M. Duley <mosfet@kde.org> |
39 | * @short OPopupMenu title widget. | 42 | * @short OPopupMenu title widget. |
40 | */ | 43 | */ |
41 | class OPopupTitle : public QWidget | 44 | class OPopupTitle : public QWidget |
42 | { | 45 | { |
43 | Q_OBJECT | 46 | Q_OBJECT |
44 | 47 | ||
45 | public: | 48 | public: |
46 | /** | 49 | /** |
47 | * Constructs a title widget with the user specified gradient, pixmap, | 50 | * Constructs a title widget with the user specified gradient, pixmap, |
48 | * and colors. | 51 | * and colors. |
49 | */ | 52 | */ |
50 | OPopupTitle(QWidget *parent=0, const char *name=0); | 53 | OPopupTitle(QWidget *parent=0, const char *name=0); |
51 | /** | 54 | /** |
52 | * @deprecated | 55 | * @deprecated |
53 | * Constructs a title widget with the specified gradient and colors. | 56 | * Constructs a title widget with the specified gradient and colors. |
54 | */ | 57 | */ |
55 | OPopupTitle(OPixmapEffect::GradientType gradient, const QColor &color, | 58 | OPopupTitle(OPixmapEffect::GradientType gradient, const QColor &color, |
56 | const QColor &textColor, QWidget *parent=0, | 59 | const QColor &textColor, QWidget *parent=0, |
57 | const char *name=0); | 60 | const char *name=0); |
58 | /** | 61 | /** |
59 | * @deprecated | 62 | * @deprecated |
60 | * Constructs a title widget with the specified pixmap and colors. | 63 | * Constructs a title widget with the specified pixmap and colors. |
61 | */ | 64 | */ |
62 | OPopupTitle(const OPixmap &background, const QColor &color, | 65 | OPopupTitle(const OPixmap &background, const QColor &color, |
63 | const QColor &textColor, QWidget *parent=0, | 66 | const QColor &textColor, QWidget *parent=0, |
64 | const char *name=0); | 67 | const char *name=0); |
65 | /** | 68 | /** |
66 | * Sets the title string and optional icon for the title widget. | 69 | * Sets the title string and optional icon for the title widget. |
67 | * | 70 | * |
68 | * You will want to call this before inserting into a menu. | 71 | * You will want to call this before inserting into a menu. |
69 | */ | 72 | */ |
70 | void setTitle(const QString &text, const QPixmap *icon=NULL); | 73 | void setTitle(const QString &text, const QPixmap *icon=NULL); |
71 | /** | 74 | /** |
72 | * Returns the current title. | 75 | * Returns the current title. |
73 | */ | 76 | */ |
74 | QString title() const { return(titleStr); } | 77 | QString title() const { return(titleStr); } |
75 | /** | 78 | /** |
76 | * Returns the current icon. | 79 | * Returns the current icon. |
77 | */ | 80 | */ |
78 | QPixmap icon() const { return(miniicon); } | 81 | QPixmap icon() const { return(miniicon); } |
79 | 82 | ||
80 | QSize sizeHint() const; | 83 | QSize sizeHint() const; |
81 | 84 | ||
82 | public slots: | 85 | public slots: |
83 | /// @since 3.1 | 86 | /// @since 3.1 |
84 | void setText( const QString &text ); | 87 | void setText( const QString &text ); |
85 | /// @since 3.1 | 88 | /// @since 3.1 |
86 | void setIcon( const QPixmap &pix ); | 89 | void setIcon( const QPixmap &pix ); |
87 | 90 | ||
88 | protected: | 91 | protected: |
89 | void paintEvent(QPaintEvent *ev); | 92 | void paintEvent(QPaintEvent *ev); |
90 | 93 | ||
91 | QString titleStr; | 94 | QString titleStr; |
92 | QPixmap miniicon; | 95 | QPixmap miniicon; |
93 | 96 | ||
94 | // Remove in KDE4 | 97 | // Remove in KDE4 |
95 | OPixmapEffect::GradientType grType; | 98 | OPixmapEffect::GradientType grType; |
96 | QPixmap fill; | 99 | QPixmap fill; |
97 | QColor fgColor, bgColor, grHigh, grLow; | 100 | QColor fgColor, bgColor, grHigh, grLow; |
98 | bool useGradient; | 101 | bool useGradient; |
99 | 102 | ||
100 | protected: | 103 | protected: |
101 | virtual void virtual_hook( int id, void* data ); | 104 | virtual void virtual_hook( int id, void* data ); |
102 | private: | 105 | private: |
103 | class OPopupTitlePrivate; | 106 | class OPopupTitlePrivate; |
104 | OPopupTitlePrivate *d; | 107 | OPopupTitlePrivate *d; |
105 | }; | 108 | }; |
106 | 109 | ||
107 | /** | 110 | /** |
108 | * OPopupMenu is a class for menus with standard title items and keyboard | 111 | * OPopupMenu is a class for menus with standard title items and keyboard |
109 | * accessibility for popups with many options and/or varying options. It acts | 112 | * accessibility for popups with many options and/or varying options. It acts |
110 | * identically to QPopupMenu, with the addition of insertTitle(), | 113 | * identically to QPopupMenu, with the addition of insertTitle(), |
111 | * changeTitle(), setKeyboardShortcutsEnabled() and | 114 | * changeTitle(), setKeyboardShortcutsEnabled() and |
112 | * setKeyboardShortcutsExecute() methods. | 115 | * setKeyboardShortcutsExecute() methods. |
113 | * | 116 | * |
114 | * The titles support a text string, an icon, plus user defined gradients, | 117 | * The titles support a text string, an icon, plus user defined gradients, |
115 | * colors, and background pixmaps. | 118 | * colors, and background pixmaps. |
116 | * | 119 | * |
117 | * The keyboard search algorithm is incremental with additional underlining | 120 | * The keyboard search algorithm is incremental with additional underlining |
118 | * for user feedback. | 121 | * for user feedback. |
119 | * | 122 | * |
120 | * @short A menu with title items. | 123 | * @short A menu with title items. |
121 | * @author Daniel M. Duley <mosfet@kde.org> | 124 | * @author Daniel M. Duley <mosfet@kde.org> |
122 | * @author Hamish Rodda <meddie@yoyo.its.monash.edu.au> | 125 | * @author Hamish Rodda <meddie@yoyo.its.monash.edu.au> |
123 | */ | 126 | */ |
124 | class OPopupMenu : public QPopupMenu { | 127 | class OPopupMenu : public QPopupMenu { |
125 | Q_OBJECT | 128 | Q_OBJECT |
126 | public: | 129 | public: |
127 | /** | 130 | /** |
128 | * Constructs a OPopupMenu. | 131 | * Constructs a OPopupMenu. |
129 | */ | 132 | */ |
130 | OPopupMenu(QWidget *parent=0, const char *name=0); | 133 | OPopupMenu(QWidget *parent=0, const char *name=0); |
131 | 134 | ||
132 | /** | 135 | /** |
133 | * Destructs the object | 136 | * Destructs the object |
134 | */ | 137 | */ |
135 | ~OPopupMenu(); | 138 | ~OPopupMenu(); |
136 | 139 | ||
137 | /** | 140 | /** |
138 | * Inserts a title item with no icon. | 141 | * Inserts a title item with no icon. |
139 | */ | 142 | */ |
140 | int insertTitle(const QString &text, int id=-1, int index=-1); | 143 | int insertTitle(const QString &text, int id=-1, int index=-1); |
141 | /** | 144 | /** |
142 | * Inserts a title item with the given icon and title. | 145 | * Inserts a title item with the given icon and title. |
143 | */ | 146 | */ |
144 | int insertTitle(const QPixmap &icon, const QString &text, int id=-1, | 147 | int insertTitle(const QPixmap &icon, const QString &text, int id=-1, |
145 | int index=-1); | 148 | int index=-1); |
146 | /** | 149 | /** |
147 | * Changes the title of the item at the specified id. If a icon was | 150 | * Changes the title of the item at the specified id. If a icon was |
148 | * previously set it is cleared. | 151 | * previously set it is cleared. |
149 | */ | 152 | */ |
150 | void changeTitle(int id, const QString &text); | 153 | void changeTitle(int id, const QString &text); |
151 | /** | 154 | /** |
152 | * Changes the title and icon of the title item at the specified id. | 155 | * Changes the title and icon of the title item at the specified id. |
153 | */ | 156 | */ |
154 | void changeTitle(int id, const QPixmap &icon, const QString &text); | 157 | void changeTitle(int id, const QPixmap &icon, const QString &text); |
155 | /** | 158 | /** |
156 | * Returns the title of the title item at the specified id. The default | 159 | * Returns the title of the title item at the specified id. The default |
157 | * id of -1 is for backwards compatibility only, you should always specify | 160 | * id of -1 is for backwards compatibility only, you should always specify |
158 | * the id. | 161 | * the id. |
159 | */ | 162 | */ |
160 | QString title(int id=-1) const; | 163 | QString title(int id=-1) const; |
161 | /** | 164 | /** |
162 | * Returns the icon of the title item at the specified id. | 165 | * Returns the icon of the title item at the specified id. |
163 | */ | 166 | */ |
164 | QPixmap titlePixmap(int id) const; | 167 | QPixmap titlePixmap(int id) const; |
165 | 168 | ||
166 | /** | 169 | /** |
167 | * Enables keyboard navigation by searching for the entered key sequence. | 170 | * Enables keyboard navigation by searching for the entered key sequence. |
168 | * Also underlines the currently selected item, providing feedback on the search. | 171 | * Also underlines the currently selected item, providing feedback on the search. |
169 | * | 172 | * |
170 | * Defaults to off. | 173 | * Defaults to off. |
171 | * | 174 | * |
172 | * WARNING: calls to text() of currently keyboard-selected items will | 175 | * WARNING: calls to text() of currently keyboard-selected items will |
173 | * contain additional ampersand characters. | 176 | * contain additional ampersand characters. |
174 | * | 177 | * |
175 | * WARNING: though pre-existing keyboard shortcuts will not interfere with the | 178 | * WARNING: though pre-existing keyboard shortcuts will not interfere with the |
176 | * operation of this feature, they may be confusing to the user as the existing | 179 | * operation of this feature, they may be confusing to the user as the existing |
177 | * shortcuts will not work. | 180 | * shortcuts will not work. |
178 | * @since 3.1 | 181 | * @since 3.1 |
179 | */ | 182 | */ |
180 | void setKeyboardShortcutsEnabled(bool enable); | 183 | void setKeyboardShortcutsEnabled(bool enable); |
181 | 184 | ||
182 | /** | 185 | /** |
183 | * Enables execution of the menu item once it is uniquely specified. | 186 | * Enables execution of the menu item once it is uniquely specified. |
184 | * Defaults to off. | 187 | * Defaults to off. |
185 | * @since 3.1 | 188 | * @since 3.1 |
186 | */ | 189 | */ |
187 | void setKeyboardShortcutsExecute(bool enable); | 190 | void setKeyboardShortcutsExecute(bool enable); |
188 | 191 | ||
189 | /** | 192 | /** |
190 | * Obsolete method provided for backwards compatibility only. Use the | 193 | * Obsolete method provided for backwards compatibility only. Use the |
191 | * normal constructor and insertTitle instead. | 194 | * normal constructor and insertTitle instead. |
192 | */ | 195 | */ |
193 | OPopupMenu(const QString &title, QWidget *parent=0, const char *name=0); | 196 | OPopupMenu(const QString &title, QWidget *parent=0, const char *name=0); |
194 | /** | 197 | /** |
195 | * Obsolete method provided for backwards compatibility only. Use | 198 | * Obsolete method provided for backwards compatibility only. Use |
196 | * insertTitle and changeTitle instead. | 199 | * insertTitle and changeTitle instead. |
197 | */ | 200 | */ |
198 | void setTitle(const QString &title); | 201 | void setTitle(const QString &title); |
199 | 202 | ||
200 | /** | 203 | /** |
201 | * Returns the context menu associated with this menu | 204 | * Returns the context menu associated with this menu |
202 | * @since 3.2 | 205 | * @since 3.2 |
203 | */ | 206 | */ |
204 | QPopupMenu* contextMenu(); | 207 | QPopupMenu* contextMenu(); |
205 | 208 | ||
206 | /** | 209 | /** |
207 | * Hides the context menu if shown | 210 | * Hides the context menu if shown |
208 | * @since 3.2 | 211 | * @since 3.2 |
209 | */ | 212 | */ |
210 | void cancelContextMenuShow(); | 213 | void cancelContextMenuShow(); |
211 | 214 | ||
212 | /** | 215 | /** |
213 | * Returns the OPopupMenu associated with the current context menu | 216 | * Returns the OPopupMenu associated with the current context menu |
214 | * @since 3.2 | 217 | * @since 3.2 |
215 | */ | 218 | */ |
216 | static OPopupMenu* contextMenuFocus(); | 219 | static OPopupMenu* contextMenuFocus(); |
217 | 220 | ||
218 | /** | 221 | /** |
219 | * returns the ID of the menuitem associated with the current context menu | 222 | * returns the ID of the menuitem associated with the current context menu |
220 | * @since 3.2 | 223 | * @since 3.2 |
221 | */ | 224 | */ |
222 | static int contextMenuFocusItem(); | 225 | static int contextMenuFocusItem(); |
223 | 226 | ||
224 | signals: | 227 | signals: |
225 | /** | 228 | /** |
226 | * connect to this signal to be notified when a context menu is about to be shown | 229 | * connect to this signal to be notified when a context menu is about to be shown |
227 | * @param menu The menu that the context menu is about to be shown for | 230 | * @param menu The menu that the context menu is about to be shown for |
228 | * @param menuItem The menu item that the context menu is currently on | 231 | * @param menuItem The menu item that the context menu is currently on |
229 | * @param ctxMenu The context menu itself | 232 | * @param ctxMenu The context menu itself |
230 | * @since 3.2 | 233 | * @since 3.2 |
231 | */ | 234 | */ |
232 | void aboutToShowContextMenu(OPopupMenu* menu, int menuItem, QPopupMenu* ctxMenu); | 235 | void aboutToShowContextMenu(OPopupMenu* menu, int menuItem, QPopupMenu* ctxMenu); |
233 | 236 | ||
234 | protected: | 237 | protected: |
235 | virtual void closeEvent(QCloseEvent *); | 238 | virtual void closeEvent(QCloseEvent *); |
236 | virtual void keyPressEvent(QKeyEvent* e); | 239 | virtual void keyPressEvent(QKeyEvent* e); |
237 | virtual bool eventFilter(QObject* obj, QEvent* event); | 240 | virtual bool eventFilter(QObject* obj, QEvent* event); |
238 | virtual void hideEvent(QHideEvent*); | 241 | virtual void hideEvent(QHideEvent*); |
239 | 242 | ||
240 | virtual void virtual_hook( int id, void* data ); | 243 | virtual void virtual_hook( int id, void* data ); |
241 | 244 | ||
242 | protected slots: | 245 | protected slots: |
243 | /// @since 3.1 | 246 | /// @since 3.1 |
244 | QString underlineText(const QString& text, uint length); | 247 | QString underlineText(const QString& text, uint length); |
245 | /// @since 3.1 | 248 | /// @since 3.1 |
246 | void resetKeyboardVars(bool noMatches = false); | 249 | void resetKeyboardVars(bool noMatches = false); |
247 | void itemHighlighted(int whichItem); | 250 | void itemHighlighted(int whichItem); |
248 | void showCtxMenu(QPoint pos); | 251 | void showCtxMenu(QPoint pos); |
249 | void ctxMenuHiding(); | 252 | void ctxMenuHiding(); |
250 | 253 | ||
251 | private: | 254 | private: |
252 | class OPopupMenuPrivate; | 255 | class OPopupMenuPrivate; |
253 | OPopupMenuPrivate *d; | 256 | OPopupMenuPrivate *d; |
254 | }; | 257 | }; |
255 | 258 | ||
256 | #endif | 259 | #endif |