summaryrefslogtreecommitdiff
path: root/libqtaux
Unidiff
Diffstat (limited to 'libqtaux') (more/less context) (ignore whitespace changes)
-rw-r--r--libqtaux/ocolorbutton.cpp2
-rw-r--r--libqtaux/ocolorpopupmenu.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/libqtaux/ocolorbutton.cpp b/libqtaux/ocolorbutton.cpp
index fd3f963..9e41d93 100644
--- a/libqtaux/ocolorbutton.cpp
+++ b/libqtaux/ocolorbutton.cpp
@@ -14,97 +14,97 @@
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#include "ocolorpopupmenu.h" 30#include "ocolorpopupmenu.h"
31#include "ocolorbutton.h" 31#include "ocolorbutton.h"
32 32
33/* OPIE */ 33/* OPIE */
34 34
35/* QT */ 35/* QT */
36#include <qimage.h> 36#include <qimage.h>
37 37
38using namespace Opie; 38using namespace Opie;
39 39
40struct OColorButtonPrivate 40struct OColorButtonPrivate
41{ 41{
42 QPopupMenu *m_menu; 42 QPopupMenu *m_menu;
43 QColor m_color; 43 QColor m_color;
44}; 44};
45 45
46/** 46/**
47 * This concstructs a Color Button with @param color as the start color 47 * This concstructs a Color Button with @param color as the start color
48 * It'll use a OColorPopupMenu internally 48 * It'll use a OColorPopupMenu internally
49 * 49 *
50 * @param parent The parent of the Color Button 50 * @param parent The parent of the Color Button
51 * @param color The color from where to start on 51 * @param color The color from where to start on
52 * @param name @see QObject 52 * @param name @see QObject
53 */ 53 */
54OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) 54OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name )
55 : QPushButton ( parent, name ) 55 : QPushButton ( parent, name )
56{ 56{
57 d = new OColorButtonPrivate; 57 d = new OColorButtonPrivate;
58 58
59 d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); 59 d-> m_menu = new OColorPopupMenu ( color, 0, 0 );
60 setPopup ( d-> m_menu ); 60 setPopup ( d-> m_menu );
61 //setPopupDelay ( 0 ); 61 //setPopupDelay ( 0 );
62 connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); 62 connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&)));
63 63
64 updateColor ( color ); 64 updateColor ( color );
65 65
66 QSize s = sizeHint ( ) + QSize ( 12, 0 ); 66 QSize s = sizeHint ( ) + QSize ( 12, 0 );
67 setMinimumSize ( s ); 67 setMinimumSize ( s );
68 setMaximumSize ( s. width ( ) * 2, s. height ( )); 68 setMaximumSize ( s. width ( ) * 2, s. height ( ));
69} 69}
70 70
71/** 71/**
72 * This destructs the object 72 * This destructs the object
73 */ 73 */
74OColorButton::~OColorButton ( ) 74OColorButton::~OColorButton ( )
75{ 75{
76 delete d; 76 delete d;
77} 77}
78 78
79/** 79/**
80 * @return Returns the current color of the button 80 * @return Returns the current color of the button
81 */ 81 */
82QColor OColorButton::color ( ) const 82QColor OColorButton::color ( ) const
83{ 83{
84 return d-> m_color; 84 return d-> m_color;
85} 85}
86 86
87/** 87/**
88 * This method sets the color of the button 88 * This method sets the color of the button
89 * @param c The color to be set. 89 * @param c The color to be set.
90 */ 90 */
91void OColorButton::setColor ( const QColor &c ) 91void OColorButton::setColor ( const QColor &c )
92{ 92{
93 updateColor ( c ); 93 updateColor ( c );
94} 94}
95 95
96/** 96/**
97 * @internal 97 * @internal
98 */ 98 */
99void OColorButton::updateColor ( const QColor &c ) 99void OColorButton::updateColor ( const QColor &c )
100{ 100{
101 d-> m_color = c; 101 d-> m_color = c;
102 102
103 QImage img ( 16, 16, 32 ); 103 QImage img ( 16, 16, 32 );
104 img. fill ( 0 ); 104 img. fill ( 0 );
105 105
106 int r, g, b; 106 int r, g, b;
107 c. rgb ( &r, &g, &b ); 107 c. rgb ( &r, &g, &b );
108 108
109 int w = img. width ( ); 109 int w = img. width ( );
110 int h = img. height ( ); 110 int h = img. height ( );
diff --git a/libqtaux/ocolorpopupmenu.cpp b/libqtaux/ocolorpopupmenu.cpp
index c5b2b88..4da2a0e 100644
--- a/libqtaux/ocolorpopupmenu.cpp
+++ b/libqtaux/ocolorpopupmenu.cpp
@@ -110,66 +110,66 @@ OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const ch
110 addColor(QColor(0, 0, 0), 0, 5); 110 addColor(QColor(0, 0, 0), 0, 5);
111 111
112 addColor(QColor(255, 0, 0), 1, 0); 112 addColor(QColor(255, 0, 0), 1, 0);
113 addColor(QColor(255, 128, 0), 1, 1); 113 addColor(QColor(255, 128, 0), 1, 1);
114 addColor(QColor(255, 255, 0), 1, 2); 114 addColor(QColor(255, 255, 0), 1, 2);
115 addColor(QColor(128, 255, 0), 1, 3); 115 addColor(QColor(128, 255, 0), 1, 3);
116 addColor(QColor(0, 255, 0), 1, 4); 116 addColor(QColor(0, 255, 0), 1, 4);
117 addColor(QColor(0, 255, 128), 1, 5); 117 addColor(QColor(0, 255, 128), 1, 5);
118 118
119 addColor(QColor(128, 0, 0), 2, 0); 119 addColor(QColor(128, 0, 0), 2, 0);
120 addColor(QColor(128, 64, 0), 2, 1); 120 addColor(QColor(128, 64, 0), 2, 1);
121 addColor(QColor(128, 128, 0), 2, 2); 121 addColor(QColor(128, 128, 0), 2, 2);
122 addColor(QColor(64, 128, 0), 2, 3); 122 addColor(QColor(64, 128, 0), 2, 3);
123 addColor(QColor(0, 128, 0), 2, 4); 123 addColor(QColor(0, 128, 0), 2, 4);
124 addColor(QColor(0, 128, 64), 2, 5); 124 addColor(QColor(0, 128, 64), 2, 5);
125 125
126 addColor(QColor(0, 255, 255), 3, 0); 126 addColor(QColor(0, 255, 255), 3, 0);
127 addColor(QColor(0, 128, 255), 3, 1); 127 addColor(QColor(0, 128, 255), 3, 1);
128 addColor(QColor(0, 0, 255), 3, 2); 128 addColor(QColor(0, 0, 255), 3, 2);
129 addColor(QColor(128, 0, 255), 3, 3); 129 addColor(QColor(128, 0, 255), 3, 3);
130 addColor(QColor(255, 0, 255), 3, 4); 130 addColor(QColor(255, 0, 255), 3, 4);
131 addColor(QColor(255, 0, 128), 3, 5); 131 addColor(QColor(255, 0, 128), 3, 5);
132 132
133 addColor(QColor(0, 128, 128), 4, 0); 133 addColor(QColor(0, 128, 128), 4, 0);
134 addColor(QColor(0, 64, 128), 4, 1); 134 addColor(QColor(0, 64, 128), 4, 1);
135 addColor(QColor(0, 0, 128), 4, 2); 135 addColor(QColor(0, 0, 128), 4, 2);
136 addColor(QColor(64, 0, 128), 4, 3); 136 addColor(QColor(64, 0, 128), 4, 3);
137 addColor(QColor(128, 0, 128), 4, 4); 137 addColor(QColor(128, 0, 128), 4, 4);
138 addColor(QColor(128, 0, 64), 4, 5); 138 addColor(QColor(128, 0, 64), 4, 5);
139 139
140 insertItem( colorPanel ); 140 insertItem( colorPanel );
141 insertSeparator(); 141 insertSeparator();
142 insertItem(tr("More"),this,SLOT( moreColorClicked())); 142 insertItem(tr("More"),this,SLOT( moreColorClicked()));
143 /* 143 /*
144 QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); 144 QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" );
145 connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); 145 connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) );
146 chooseColorAction->addTo( this ); 146 chooseColorAction->addTo( this );
147 */ 147 */
148 activateItemAt( 0 ); 148 activateItemAt( 0 );
149} 149}
150 150
151OColorPopupMenu::~OColorPopupMenu() 151OColorPopupMenu::~OColorPopupMenu()
152{ 152{
153} 153}
154 154
155void OColorPopupMenu::addColor( const QColor& color, int row, int col ) 155void OColorPopupMenu::addColor( const QColor& color, int row, int col )
156{ 156{
157 OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel ); 157 OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel );
158 connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); 158 connect( panelButton, SIGNAL( selected(const QColor&) ), this, SLOT( buttonSelected(const QColor&) ) );
159 colorLayout->addWidget( panelButton, row, col ); 159 colorLayout->addWidget( panelButton, row, col );
160} 160}
161 161
162void OColorPopupMenu::buttonSelected( const QColor& color ) 162void OColorPopupMenu::buttonSelected( const QColor& color )
163{ 163{
164 m_color = color; 164 m_color = color;
165 emit colorSelected( color ); 165 emit colorSelected( color );
166 hide(); 166 hide();
167} 167}
168 168
169void OColorPopupMenu::moreColorClicked() 169void OColorPopupMenu::moreColorClicked()
170{ 170{
171 QColor color = QColorDialog::getColor( m_color ); 171 QColor color = QColorDialog::getColor( m_color );
172 m_color = color; 172 m_color = color;
173 emit colorSelected( color ); 173 emit colorSelected( color );
174 hide(); 174 hide();
175} 175}