summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp
Unidiff
Diffstat (limited to 'noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp b/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp
index 7be5af5..1320cbc 100644
--- a/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp
+++ b/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp
@@ -2,84 +2,83 @@
2 Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 Copyright (C) 1999 Cristian Tibirna (ctibirna@kde.org) 3 Copyright (C) 1999 Cristian Tibirna (ctibirna@kde.org)
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 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 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <qdialog.h> 21#include <qdialog.h>
22#include <qpainter.h> 22#include <qpainter.h>
23#include <qdrawutil.h> 23#include <qdrawutil.h>
24#include <qapplication.h> 24#include <qapplication.h>
25#include <kglobalsettings.h> 25#include <kglobalsettings.h>
26//#include "kcolordialog.h"
27#include "kcolorbtn.h" 26#include "kcolorbtn.h"
28 27
29#include <opie/colordialog.h> 28#include <opie2/qcolordialog.h>
30 29
31KColorButton::KColorButton( QWidget *parent, const char *name ) 30KColorButton::KColorButton( QWidget *parent, const char *name )
32 : QPushButton( parent, name ), dragFlag(false) 31 : QPushButton( parent, name ), dragFlag(false)
33{ 32{
34 // 2000-10-15 (putzer): fixes broken keyboard usage 33 // 2000-10-15 (putzer): fixes broken keyboard usage
35 connect (this, SIGNAL(clicked()), this, SLOT(chooseColor())); 34 connect (this, SIGNAL(clicked()), this, SLOT(chooseColor()));
36} 35}
37 36
38KColorButton::KColorButton( const QColor &c, QWidget *parent, 37KColorButton::KColorButton( const QColor &c, QWidget *parent,
39 const char *name ) 38 const char *name )
40 : QPushButton( parent, name ), col(c), dragFlag(false) 39 : QPushButton( parent, name ), col(c), dragFlag(false)
41{ 40{
42 41
43 // 2000-10-15 (putzer): fixes broken keyboard usage 42 // 2000-10-15 (putzer): fixes broken keyboard usage
44 connect (this, SIGNAL(clicked()), this, SLOT(chooseColor())); 43 connect (this, SIGNAL(clicked()), this, SLOT(chooseColor()));
45} 44}
46 45
47void KColorButton::setColor( const QColor &c ) 46void KColorButton::setColor( const QColor &c )
48{ 47{
49 col = c; 48 col = c;
50 repaint( false ); 49 repaint( false );
51} 50}
52 51
53void KColorButton::drawButtonLabel( QPainter *painter ) 52void KColorButton::drawButtonLabel( QPainter *painter )
54{ 53{
55 QRect r = QApplication::style().buttonRect( 0, 0, width(), height() ); 54 QRect r = QApplication::style().buttonRect( 0, 0, width(), height() );
56 int l = r.x(); 55 int l = r.x();
57 int t = r.y(); 56 int t = r.y();
58 int w = r.width(); 57 int w = r.width();
59 int h = r.height(); 58 int h = r.height();
60 int b = 5; 59 int b = 5;
61 60
62 QColor lnCol = colorGroup().text(); 61 QColor lnCol = colorGroup().text();
63 QColor fillCol = isEnabled() ? col : backgroundColor(); 62 QColor fillCol = isEnabled() ? col : backgroundColor();
64 63
65 if ( isDown() ) { 64 if ( isDown() ) {
66 qDrawPlainRect( painter, l+b+1, t+b+1, w-b*2, h-b*2, lnCol, 1, 0 ); 65 qDrawPlainRect( painter, l+b+1, t+b+1, w-b*2, h-b*2, lnCol, 1, 0 );
67 b++; 66 b++;
68 painter->fillRect( l+b+1, t+b+1, w-b*2, h-b*2, fillCol ); 67 painter->fillRect( l+b+1, t+b+1, w-b*2, h-b*2, fillCol );
69 } else { 68 } else {
70 qDrawPlainRect( painter, l+b, t+b, w-b*2, h-b*2, lnCol, 1, 0 ); 69 qDrawPlainRect( painter, l+b, t+b, w-b*2, h-b*2, lnCol, 1, 0 );
71 b++; 70 b++;
72 painter->fillRect( l+b, t+b, w-b*2, h-b*2, fillCol ); 71 painter->fillRect( l+b, t+b, w-b*2, h-b*2, fillCol );
73 } 72 }
74} 73}
75 74
76void KColorButton::chooseColor() 75void KColorButton::chooseColor()
77{ 76{
78 QColor newCol=OColorDialog::getColor( col); 77 QColor newCol=QColorDialog::getColor( col);
79 if( newCol != QDialog::Rejected ) 78 if( newCol != QDialog::Rejected )
80 { 79 {
81 col=newCol; 80 col=newCol;
82 repaint( false ); 81 repaint( false );
83 emit changed( col ); 82 emit changed( col );
84 } 83 }
85} 84}