summaryrefslogtreecommitdiff
path: root/libopie/ocolorbutton.cpp
Unidiff
Diffstat (limited to 'libopie/ocolorbutton.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ocolorbutton.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/ocolorbutton.cpp b/libopie/ocolorbutton.cpp
index 93fe5d0..298dba2 100644
--- a/libopie/ocolorbutton.cpp
+++ b/libopie/ocolorbutton.cpp
@@ -8,97 +8,97 @@
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include <opie/colorpopupmenu.h> 29#include <opie/colorpopupmenu.h>
30#include <opie/ocolorbutton.h> 30#include <opie/ocolorbutton.h>
31 31
32#include <qpe/resource.h> 32#include <qpe/resource.h>
33 33
34struct OColorButtonPrivate { 34struct OColorButtonPrivate {
35 QPopupMenu *m_menu; 35 QPopupMenu *m_menu;
36 QColor m_color; 36 QColor m_color;
37}; 37};
38 38
39 39
40/** 40/**
41 * This concstructs a Color Button with @param color as the start color 41 * This concstructs a Color Button with @param color as the start color
42 * It'll use a OColorPopupMenu internally 42 * It'll use a OColorPopupMenu internally
43 * 43 *
44 * @param parent The parent of the Color Button 44 * @param parent The parent of the Color Button
45 * @param color The color from where to start on 45 * @param color The color from where to start on
46 * @param name @see QObject 46 * @param name @see QObject
47 */ 47 */
48OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) 48OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name )
49 : QPushButton ( parent, name ) 49 : QPushButton ( parent, name )
50{ 50{
51 d = new OColorButtonPrivate; 51 d = new OColorButtonPrivate;
52 52
53 d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); 53 d-> m_menu = new OColorPopupMenu ( color, 0, 0 );
54 setPopup ( d-> m_menu ); 54 setPopup ( d-> m_menu );
55 //setPopupDelay ( 0 ); 55 //setPopupDelay ( 0 );
56 connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); 56 connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&)));
57 57
58 updateColor ( color ); 58 updateColor ( color );
59 59
60 QSize s = sizeHint ( ) + QSize ( 12, 0 ); 60 QSize s = sizeHint ( ) + QSize ( 12, 0 );
61 setMinimumSize ( s ); 61 setMinimumSize ( s );
62 setMaximumSize ( s. width ( ) * 2, s. height ( )); 62 setMaximumSize ( s. width ( ) * 2, s. height ( ));
63} 63}
64 64
65/** 65/**
66 * This destructs the object 66 * This destructs the object
67 */ 67 */
68OColorButton::~OColorButton ( ) 68OColorButton::~OColorButton ( )
69{ 69{
70 delete d; 70 delete d;
71} 71}
72 72
73/** 73/**
74 * @return Returns the current color of the button 74 * @return Returns the current color of the button
75 */ 75 */
76QColor OColorButton::color ( ) const 76QColor OColorButton::color ( ) const
77{ 77{
78 return d-> m_color; 78 return d-> m_color;
79} 79}
80 80
81/** 81/**
82 * This method sets the color of the button 82 * This method sets the color of the button
83 * @param c The color to be set. 83 * @param c The color to be set.
84 */ 84 */
85void OColorButton::setColor ( const QColor &c ) 85void OColorButton::setColor ( const QColor &c )
86{ 86{
87 updateColor ( c ); 87 updateColor ( c );
88} 88}
89 89
90/** 90/**
91 * @internal 91 * @internal
92 */ 92 */
93void OColorButton::updateColor ( const QColor &c ) 93void OColorButton::updateColor ( const QColor &c )
94{ 94{
95 d-> m_color = c; 95 d-> m_color = c;
96 96
97 QImage img ( 16, 16, 32 ); 97 QImage img ( 16, 16, 32 );
98 img. fill ( 0 ); 98 img. fill ( 0 );
99 99
100 int r, g, b; 100 int r, g, b;
101 c. rgb ( &r, &g, &b ); 101 c. rgb ( &r, &g, &b );
102 102
103 int w = img. width ( ); 103 int w = img. width ( );
104 int h = img. height ( ); 104 int h = img. height ( );