lib

koColorChooser.cpp
1/* This file is part of the KDE project
2 Copyright (c) 1999 Matthias Elter (me@kde.org)
3 Copyright (c) 2001-2002 Igor Jansen (rm@kde.org)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#include "koColorChooser.h"
22
23#include <tqcolor.h>
24#include <tqlayout.h>
25#include <tqspinbox.h>
26#include <tqtabwidget.h>
27
28#include <tdelocale.h>
29#include <kiconloader.h>
30#include <kcolordialog.h>
31#include <ktabctl.h>
32#include <koFrameButton.h>
33#include <koColorSlider.h>
34
35KoColorChooser::KoColorChooser(TQWidget *parent, const char *name) : TQWidget(parent, name)
36{
37 m_current = 0;
38 m_tab = new TQTabWidget(this, "KoColorChooser tab");
39 mGrid = new TQGridLayout(this, 3, 5);
40 mRGBWidget = new RGBWidget(m_tab);
41 m_current = mRGBWidget;
42 m_tab -> addTab(mRGBWidget, "RGB");
43 mHSVWidget = new HSVWidget(m_tab);
44 m_tab -> addTab(mHSVWidget, "HSV");
45#if 0
46 mCMYKWidget = new TQWidget(m_tab);
47 m_tab -> addTab(mCMYKWidget, "CMYK");
48 mLABWidget = new LABWidget(m_tab);
49 m_tab -> addTab(mLABWidget, "LAB");
50#endif
51 mGreyWidget = new GreyWidget(m_tab);
52 m_tab -> addTab(mGreyWidget, i18n("Gray"));
53 mColorSelector = new KHSSelector(this);
54 mColorSelector->setFixedHeight(20);
55 mGrid->addMultiCellWidget(m_tab, 0, 1, 0, 4);
56 mGrid->addMultiCellWidget(mColorSelector, 2, 2, 0, 4);
57 connect(mRGBWidget, TQ_SIGNAL(colorChanged(const KoColor &)), this, TQ_SLOT(childColorChanged(const KoColor &)));
58 connect(mHSVWidget, TQ_SIGNAL(colorChanged(const KoColor &)), this, TQ_SLOT(childColorChanged(const KoColor &)));
59// connect(mLABWidget, TQ_SIGNAL(colorChanged(const KoColor &)), this, TQ_SLOT(childColorChanged(const KoColor &)));
60 connect(mGreyWidget, TQ_SIGNAL(colorChanged(const KoColor &)), this, TQ_SLOT(childColorChanged(const KoColor &)));
61 connect(mColorSelector, TQ_SIGNAL(valueChanged(int, int)), this, TQ_SLOT(slotChangeXY(int, int)));
62 connect(m_tab, TQ_SIGNAL(currentChanged(TQWidget*)), this, TQ_SLOT(slotCurrentChanged(TQWidget*)));
63 slotChangeColor(KoColor::black());
64}
65
66void KoColorChooser::slotCurrentChanged(TQWidget *current)
67{
68 m_current = static_cast<ColorWidget*>(current);
69 m_current -> slotChangeColor(mColor);
70}
71
72void KoColorChooser::slotChangeXY(int h, int s)
73{
74 KoColor c(h, s, 192, KoColor::csHSV);
75
76 m_current -> slotChangeColor(c);
77}
78
79void KoColorChooser::slotChangeColor(const TQColor &c)
80{
81 slotChangeColor(KoColor(c));
82}
83
84void KoColorChooser::childColorChanged(const KoColor& c)
85{
86 mColor.setRGB(c.R(), c.G(), c.B());
87 emit colorChanged(mColor);
88}
89
90void KoColorChooser::slotChangeColor(const KoColor &c)
91{
92 mColor = c;
93 m_current -> slotChangeColor(mColor);
94 mColorSelector->setValues(c.H(), c.S());
95}
96
97/* RGBWidget */
98RGBWidget::RGBWidget(TQWidget *parent) : ColorWidget(parent)
99{
100 TQGridLayout *mGrid = new TQGridLayout(this, 4, 5);
101
102 mColorPatch = new KColorPatch(this);
103
104 /* setup color sliders */
105 mRSlider = new KoColorSlider(this);
106 mRSlider->setMaximumHeight(20);
107 mRSlider->slotSetRange(0, 255);
108
109 mGSlider = new KoColorSlider(this);
110 mGSlider->setMaximumHeight(20);
111 mGSlider->slotSetRange(0, 255);
112
113 mBSlider = new KoColorSlider(this);
114 mBSlider->setMaximumHeight(20);
115 mBSlider->slotSetRange(0, 255);
116
117 /* setup slider labels */
118 mRLabel = new TQLabel("R", this);
119 mRLabel->setFixedWidth(16);
120 mRLabel->setFixedHeight(20);
121 mGLabel = new TQLabel("G", this);
122 mGLabel->setFixedWidth(16);
123 mGLabel->setFixedHeight(20);
124 mBLabel = new TQLabel("B", this);
125 mBLabel->setFixedWidth(16);
126 mBLabel->setFixedHeight(20);
127
128 /* setup spin box */
129 mRIn = new TQSpinBox(0, 255, 1, this);
130 mRIn->setFixedWidth(42);
131 mRIn->setFixedHeight(20);
132 mGIn = new TQSpinBox(0, 255, 1, this);
133 mGIn->setFixedWidth(42);
134 mGIn->setFixedHeight(20);
135 mBIn = new TQSpinBox(0, 255, 1, this);
136 mBIn->setFixedWidth(42);
137 mBIn->setFixedHeight(20);
138
139 mGrid->addMultiCellWidget(mColorPatch, 0, 4, 0, 0);
140 mGrid->addWidget(mRLabel, 1, 1);
141 mGrid->addWidget(mGLabel, 2, 1);
142 mGrid->addWidget(mBLabel, 3, 1);
143 mGrid->addMultiCellWidget(mRSlider, 1, 1, 2, 3);
144 mGrid->addMultiCellWidget(mGSlider, 2, 2, 2, 3);
145 mGrid->addMultiCellWidget(mBSlider, 3, 3, 2, 3);
146 mGrid->addWidget(mRIn, 1, 4);
147 mGrid->addWidget(mGIn, 2, 4);
148 mGrid->addWidget(mBIn, 3, 4);
149
150 connect(mColorPatch, TQ_SIGNAL(colorChanged(const TQColor &)), this, TQ_SLOT(slotPatchChanged(const TQColor &)));
151
152 /* connect color sliders */
153 connect(mRSlider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotRSliderChanged(int)));
154 connect(mGSlider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotGSliderChanged(int)));
155 connect(mBSlider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotBSliderChanged(int)));
156
157 /* connect spin box */
158 connect(mRIn, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotRInChanged(int)));
159 connect(mGIn, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotGInChanged(int)));
160 connect(mBIn, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotBInChanged(int)));
161}
162
163ColorWidget::ColorWidget(TQWidget *parent) : TQWidget(parent)
164{
165}
166
167ColorWidget::~ColorWidget()
168{
169}
170
171void ColorWidget::slotChangeColor(const KoColor& c)
172{
173 mColor.setRGB(c.R(), c.G(), c.B());
174 slotRefreshColor();
175}
176
177void ColorWidget::slotChangeColor(const TQColor& c)
178{
179 mColor.setColor(c);
180 slotRefreshColor();
181}
182
183void RGBWidget::slotRefreshColor()
184{
185 int r = mColor.R();
186 int g = mColor.G();
187 int b = mColor.B();
188
189 mRSlider->slotSetColor1(TQColor(0, g, b));
190 mRSlider->slotSetColor2(TQColor(255, g, b));
191 mRSlider->slotSetValue(r);
192 mRIn->setValue(r);
193
194 mGSlider->slotSetColor1(TQColor(r, 0, b));
195 mGSlider->slotSetColor2(TQColor(r, 255, b));
196 mGSlider->slotSetValue(g);
197 mGIn->setValue(g);
198
199 mBSlider->slotSetColor1(TQColor(r, g, 0));
200 mBSlider->slotSetColor2(TQColor(r, g, 255));
201 mBSlider->slotSetValue(b);
202 mBIn->setValue(b);
203 mColorPatch -> setColor(mColor.color());
204}
205
206void RGBWidget::slotRSliderChanged(int r)
207{
208 int g = mColor.G();
209 int b = mColor.B();
210
211 mColor.setRGB(r, g, b);
212 slotRefreshColor();
213 emit colorChanged(KoColor(r, g, b, KoColor::csRGB));
214}
215
216void RGBWidget::slotGSliderChanged(int g)
217{
218 int r = mColor.R();
219 int b = mColor.B();
220
221 mColor.setRGB(r, g, b);
222 slotRefreshColor();
223 emit colorChanged(KoColor( r, g, b, KoColor::csRGB));
224}
225
226void RGBWidget::slotBSliderChanged(int b)
227{
228 int r = mColor.R();
229 int g = mColor.G();
230
231 mColor.setRGB(r, g, b);
232 slotRefreshColor();
233 emit colorChanged(KoColor(r, g, b, KoColor::csRGB));
234}
235
236void RGBWidget::slotRInChanged(int r)
237{
238 int g = mColor.G();
239 int b = mColor.B();
240
241 mColor.setRGB(r, g, b);
242 slotRefreshColor();
243 emit colorChanged(KoColor(r, g, b, KoColor::csRGB));
244}
245
246void RGBWidget::slotGInChanged(int g)
247{
248 int r = mColor.R();
249 int b = mColor.B();
250
251 mColor.setRGB(r, g, b);
252 slotRefreshColor();
253 emit colorChanged(KoColor(r, g, b, KoColor::csRGB));
254}
255
256void RGBWidget::slotBInChanged(int b)
257{
258 int r = mColor.R();
259 int g = mColor.G();
260
261 mColor.setRGB(r, g, b);
262 slotRefreshColor();
263 emit colorChanged(KoColor(r, g, b, KoColor::csRGB));
264}
265
266void RGBWidget::slotPatchChanged(const TQColor& clr)
267{
268 int r = clr.red();
269 int g = clr.green();
270 int b = clr.blue();
271
272 mColor.setRGB(r, g, b);
273 slotRefreshColor();
274 emit colorChanged(KoColor(r, g, b, KoColor::csRGB));
275}
276
277/* HSVWidget */
278
279HSVWidget::HSVWidget(TQWidget *parent): ColorWidget(parent)
280{
281 TQGridLayout *mGrid = new TQGridLayout(this, 3, 3);
282
283 mColorPatch = new KColorPatch(this);
284
285 /* setup color sliders */
286 mHSlider = new KoColorSlider(this);
287 mHSlider->setMaximumHeight(20);
288 mHSlider->slotSetRange(0, 359);
289
290 mSSlider = new KoColorSlider(this);
291 mSSlider->setMaximumHeight(20);
292 mSSlider->slotSetRange(0, 255);
293
294 mVSlider = new KoColorSlider(this);
295 mVSlider->setMaximumHeight(20);
296 mVSlider->slotSetRange(0, 255);
297
298 /* setup slider labels */
299 mHLabel = new TQLabel("H", this);
300 mHLabel->setFixedWidth(16);
301 mHLabel->setFixedHeight(20);
302 mSLabel = new TQLabel("S", this);
303 mSLabel->setFixedWidth(16);
304 mSLabel->setFixedHeight(20);
305 mVLabel = new TQLabel("V", this);
306 mVLabel->setFixedWidth(16);
307 mVLabel->setFixedHeight(20);
308
309 /* setup spin box */
310 mHIn = new TQSpinBox(0, 359, 1, this);
311 mHIn->setFixedWidth(42);
312 mHIn->setFixedHeight(20);
313 mSIn = new TQSpinBox(0, 255, 1, this);
314 mSIn->setFixedWidth(42);
315 mSIn->setFixedHeight(20);
316 mVIn = new TQSpinBox(0, 255, 1, this);
317 mVIn->setFixedWidth(42);
318 mVIn->setFixedHeight(20);
319
320 mGrid->addMultiCellWidget(mColorPatch, 0, 4, 0, 0);
321 mGrid->addWidget(mHLabel, 1, 1);
322 mGrid->addWidget(mSLabel, 2, 1);
323 mGrid->addWidget(mVLabel, 3, 1);
324 mGrid->addMultiCellWidget(mHSlider, 1, 1, 2, 3);
325 mGrid->addMultiCellWidget(mSSlider, 2, 2, 2, 3);
326 mGrid->addMultiCellWidget(mVSlider, 3, 3, 2, 3);
327 mGrid->addWidget(mHIn, 1, 4);
328 mGrid->addWidget(mSIn, 2, 4);
329 mGrid->addWidget(mVIn, 3, 4);
330
331 connect(mColorPatch, TQ_SIGNAL(colorChanged(const TQColor &)), this, TQ_SLOT(slotPatchChanged(const TQColor &)));
332
333 /* connect color sliders */
334 connect(mHSlider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotHSliderChanged(int)));
335 connect(mSSlider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotSSliderChanged(int)));
336 connect(mVSlider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotVSliderChanged(int)));
337
338 /* connect spin box */
339 connect(mHIn, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotHInChanged(int)));
340 connect(mSIn, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotSInChanged(int)));
341 connect(mVIn, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotVInChanged(int)));
342}
343
344void HSVWidget::slotRefreshColor()
345{
346 int h = mColor.H();
347 int s = mColor.S();
348 int v = mColor.V();
349
350 mHSlider->slotSetColor1(KoColor(0, s, v, KoColor::csHSV).color());
351 mHSlider->slotSetColor2(KoColor(359, s, v, KoColor::csHSV).color());
352 mHSlider->slotSetValue(h);
353 mHIn->setValue(h);
354
355 mSSlider->slotSetColor1(KoColor(h, 0, v, KoColor::csHSV).color());
356 mSSlider->slotSetColor2(KoColor(h, 255, v, KoColor::csHSV).color());
357 mSSlider->slotSetValue(s);
358 mSIn->setValue(s);
359
360 mVSlider->slotSetColor1(KoColor(h, s, 0, KoColor::csHSV).color());
361 mVSlider->slotSetColor2(KoColor(h, s, 255, KoColor::csHSV).color());
362 mVSlider->slotSetValue(v);
363 mVIn->setValue(v);
364 mColorPatch -> setColor(mColor.color());
365}
366
367void HSVWidget::slotHSliderChanged(int h)
368{
369 int v = mColor.V();
370 int s = mColor.S();
371
372 mColor.setHSV(h, s, v);
373 slotRefreshColor();
374 emit colorChanged(mColor);
375}
376
377void HSVWidget::slotSSliderChanged(int s)
378{
379 int h = mColor.H();
380 int v = mColor.V();
381
382 mColor.setHSV(h, s, v);
383 slotRefreshColor();
384 emit colorChanged(mColor);
385}
386
387void HSVWidget::slotVSliderChanged(int v)
388{
389 int h = mColor.H();
390 int s = mColor.S();
391
392 mColor.setHSV(h, s, v);
393 slotRefreshColor();
394 emit colorChanged(mColor);
395}
396
397void HSVWidget::slotHInChanged(int h)
398{
399 int s = mColor.S();
400 int v = mColor.V();
401
402 mColor.setHSV(h, s, v);
403 slotRefreshColor();
404 emit colorChanged(mColor);
405}
406
407void HSVWidget::slotSInChanged(int s)
408{
409 int h = mColor.H();
410 int v = mColor.V();
411
412 mColor.setHSV(h, s, v);
413 slotRefreshColor();
414 emit colorChanged(mColor);
415}
416
417void HSVWidget::slotVInChanged(int v)
418{
419 int h = mColor.H();
420 int s = mColor.S();
421
422 mColor.setHSV(h, s, v);
423 slotRefreshColor();
424 emit colorChanged(mColor);
425}
426
427void HSVWidget::slotPatchChanged(const TQColor& clr)
428{
429 int r = clr.red();
430 int g = clr.green();
431 int b = clr.blue();
432
433 mColor.setRGB(r, g, b);
434 slotRefreshColor();
435 emit colorChanged(mColor);
436}
437
438/* GreyWidget */
439
440GreyWidget::GreyWidget(TQWidget *parent): ColorWidget(parent)
441{
442 TQGridLayout *mGrid = new TQGridLayout(this, 3, 3);
443
444 mColorPatch = new KColorPatch(this);
445
446 /* setup slider */
447 mVSlider = new KoColorSlider(this);
448 mVSlider->setMaximumHeight(20);
449 mVSlider->slotSetRange(0, 255);
450 mVSlider->slotSetColor1(TQColor(255, 255, 255));
451 mVSlider->slotSetColor2(TQColor(0, 0, 0));
452
453 /* setup slider label */
454 mVLabel = new TQLabel("K", this);
455 mVLabel->setFixedWidth(18);
456 mVLabel->setFixedHeight(20);
457
458 /* setup spin box */
459 mVIn = new TQSpinBox(0, 255, 1, this);
460 mVIn->setFixedWidth(42);
461 mVIn->setFixedHeight(20);
462
463 mGrid->addMultiCellWidget(mColorPatch, 0, 4, 0, 0);
464 mGrid->addWidget(mVLabel, 1, 1);
465 mGrid->addMultiCellWidget(mVSlider, 1, 1, 2, 3);
466 mGrid->addWidget(mVIn, 1, 4);
467
468 connect(mColorPatch, TQ_SIGNAL(colorChanged(const TQColor &)), this, TQ_SLOT(slotPatchChanged(const TQColor &)));
469
470 /* connect color slider */
471 connect(mVSlider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotVSliderChanged(int)));
472
473 /* connect spin box */
474 connect(mVIn, TQ_SIGNAL(valueChanged(int)), mVSlider, TQ_SLOT(slotSetValue(int)));
475}
476
477void GreyWidget::slotRefreshColor()
478{
479 double v = mColor.R() + mColor.G() + mColor.B();
480 v /= 3.0;
481 v = 255.0 - v;
482 mVIn->setValue(static_cast<int>(v));
483 mVSlider->slotSetValue(static_cast<int>(v));
484 mColorPatch -> setColor(mColor.color());
485}
486
487void GreyWidget::slotVSliderChanged(int v)
488{
489 v = 255 - v;
490
491 mColor.setRGB(v, v, v);
492 slotRefreshColor();
493 emit colorChanged(mColor);
494}
495
496void GreyWidget::slotVInChanged(int v)
497{
498 v = 255 - v;
499
500 mColor.setRGB(v, v, v);
501 slotRefreshColor();
502 emit colorChanged(mColor);
503}
504
505void GreyWidget::slotPatchChanged(const TQColor& clr)
506{
507 int gray = tqGray(clr.red(), clr.green(), clr.blue());
508
509 mColor.setRGB(gray, gray, gray);
510 slotRefreshColor();
511 emit colorChanged(mColor);
512}
513
514LABWidget::LABWidget(TQWidget *parent) : ColorWidget(parent)
515{
516 TQGridLayout *mGrid = new TQGridLayout(this, 4, 5);
517
518 mColorPatch = new KColorPatch(this);
519
520 /* setup color sliders */
521 mLSlider = new KoColorSlider(this);
522 mLSlider->setMaximumHeight(20);
523 mLSlider->slotSetRange(0, 255);
524
525 mASlider = new KoColorSlider(this);
526 mASlider->setMaximumHeight(20);
527 mASlider->slotSetRange(0, 255);
528
529 mBSlider = new KoColorSlider(this);
530 mBSlider->setMaximumHeight(20);
531 mBSlider->slotSetRange(0, 255);
532
533 /* setup slider labels */
534 mLLabel = new TQLabel("L", this);
535 mLLabel->setFixedWidth(16);
536 mLLabel->setFixedHeight(20);
537 mALabel = new TQLabel("A", this);
538 mALabel->setFixedWidth(16);
539 mALabel->setFixedHeight(20);
540 mBLabel = new TQLabel("B", this);
541 mBLabel->setFixedWidth(16);
542 mBLabel->setFixedHeight(20);
543
544 /* setup spin box */
545 mLIn = new TQSpinBox(0, 255, 1, this);
546 mLIn->setFixedWidth(42);
547 mLIn->setFixedHeight(20);
548 mAIn = new TQSpinBox(0, 255, 1, this);
549 mAIn->setFixedWidth(42);
550 mAIn->setFixedHeight(20);
551 mBIn = new TQSpinBox(0, 255, 1, this);
552 mBIn->setFixedWidth(42);
553 mBIn->setFixedHeight(20);
554
555 mGrid->addMultiCellWidget(mColorPatch, 0, 4, 0, 0);
556 mGrid->addWidget(mLLabel, 1, 1);
557 mGrid->addWidget(mALabel, 2, 1);
558 mGrid->addWidget(mBLabel, 3, 1);
559 mGrid->addMultiCellWidget(mLSlider, 1, 1, 2, 3);
560 mGrid->addMultiCellWidget(mASlider, 2, 2, 2, 3);
561 mGrid->addMultiCellWidget(mBSlider, 3, 3, 2, 3);
562 mGrid->addWidget(mLIn, 1, 4);
563 mGrid->addWidget(mAIn, 2, 4);
564 mGrid->addWidget(mBIn, 3, 4);
565
566 connect(mColorPatch, TQ_SIGNAL(colorChanged(const TQColor &)), this, TQ_SLOT(slotPatchChanged(const TQColor &)));
567
568 /* connect color sliders */
569 connect(mLSlider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotLSliderChanged(int)));
570 connect(mASlider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotASliderChanged(int)));
571 connect(mBSlider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotBSliderChanged(int)));
572
573 /* connect spin box */
574 connect(mLIn, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotLInChanged(int)));
575 connect(mAIn, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotAInChanged(int)));
576 connect(mBIn, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(slotBInChanged(int)));
577}
578
579void LABWidget::slotRefreshColor()
580{
581 int l = mColor.L();
582 int a = mColor.a();
583 int b = mColor.b();
584
585 mLSlider->slotSetColor1(KoColor(0, a, b, KoColor::csLab).color());
586 mLSlider->slotSetColor2(KoColor(255, a, b, KoColor::csLab).color());
587 mLSlider->slotSetValue(l);
588 mLIn->setValue(l);
589
590 mASlider->slotSetColor1(KoColor(l, 0, b, KoColor::csLab).color());
591 mASlider->slotSetColor2(KoColor(l, 255, b, KoColor::csLab).color());
592 mASlider->slotSetValue(a);
593 mAIn->setValue(a);
594
595 mBSlider->slotSetColor1(KoColor(l, a, 0, KoColor::csLab).color());
596 mBSlider->slotSetColor2(KoColor(l, a, 255, KoColor::csLab).color());
597 mBSlider->slotSetValue(b);
598 mBIn->setValue(b);
599 mColorPatch -> setColor(mColor.color());
600}
601
602void LABWidget::slotLSliderChanged(int l)
603{
604 int a = mColor.a();
605 int b = mColor.b();
606
607 mColor.setLab(l, a, b);
608 slotRefreshColor();
609 emit colorChanged(mColor);
610
611}
612
613void LABWidget::slotASliderChanged(int a)
614{
615 int l = mColor.L();
616 int b = mColor.b();
617
618 mColor.setLab(l, a, b);
619 slotRefreshColor();
620 emit colorChanged(mColor);
621}
622
623void LABWidget::slotBSliderChanged(int b)
624{
625 int l = mColor.L();
626 int a = mColor.a();
627
628 mColor.setLab(l, a, b);
629 slotRefreshColor();
630 emit colorChanged(mColor);
631}
632
633void LABWidget::slotLInChanged(int l)
634{
635 int a = mColor.a();
636 int b = mColor.b();
637
638 mColor.setLab(l, a, b);
639 slotRefreshColor();
640 emit colorChanged(mColor);
641}
642
643void LABWidget::slotAInChanged(int a)
644{
645 int l = mColor.L();
646 int b = mColor.b();
647
648 mColor.setLab(l, a, b);
649 slotRefreshColor();
650 emit colorChanged(mColor);
651}
652
653void LABWidget::slotBInChanged(int b)
654{
655 int l = mColor.L();
656 int a = mColor.a();
657
658 mColor.setLab(l, a, b);
659 slotRefreshColor();
660 emit colorChanged(mColor);
661}
662
663void LABWidget::slotPatchChanged(const TQColor& clr)
664{
665 int r = clr.red();
666 int g = clr.green();
667 int b = clr.blue();
668
669 mColor.setRGB(r, g, b);
670 slotRefreshColor();
671 emit colorChanged(mColor);
672}
673
674#include "koColorChooser.moc"
675
const char * name(StdAction id)