Diffstat (limited to 'kaddressbook/views/colorlistbox.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/colorlistbox.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/kaddressbook/views/colorlistbox.h b/kaddressbook/views/colorlistbox.h new file mode 100644 index 0000000..4a0e705 --- a/dev/null +++ b/kaddressbook/views/colorlistbox.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * kmail: KDE mail client | ||
3 | * This file: Copyright (C) 2000 Espen Sand, espen@kde.org | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program 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 | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | #ifndef _COLOR_LISTBOX_H_ | ||
22 | #define _COLOR_LISTBOX_H_ | ||
23 | |||
24 | #include <klistbox.h> | ||
25 | |||
26 | class QDragEnterEvent; | ||
27 | class QDragLeaveEvent; | ||
28 | class QDragMoveEvent; | ||
29 | class QDropEvent; | ||
30 | |||
31 | class ColorListBox : public KListBox | ||
32 | { | ||
33 | Q_OBJECT | ||
34 | |||
35 | public: | ||
36 | ColorListBox( QWidget *parent=0, const char * name=0, WFlags f=0 ); | ||
37 | void setColor( uint index, const QColor &color ); | ||
38 | QColor color( uint index ) const; | ||
39 | |||
40 | public slots: | ||
41 | virtual void setEnabled( bool state ); | ||
42 | |||
43 | protected: | ||
44 | void dragEnterEvent( QDragEnterEvent *e ); | ||
45 | void dragLeaveEvent( QDragLeaveEvent *e ); | ||
46 | void dragMoveEvent( QDragMoveEvent *e ); | ||
47 | void dropEvent( QDropEvent *e ); | ||
48 | |||
49 | private slots: | ||
50 | void newColor( int index ); | ||
51 | |||
52 | private: | ||
53 | int mCurrentOnDragEnter; | ||
54 | |||
55 | }; | ||
56 | |||
57 | |||
58 | class ColorListItem : public QListBoxItem | ||
59 | { | ||
60 | public: | ||
61 | ColorListItem( const QString &text, const QColor &color=Qt::black ); | ||
62 | const QColor &color( void ); | ||
63 | void setColor( const QColor &color ); | ||
64 | |||
65 | protected: | ||
66 | virtual void paint( QPainter * ); | ||
67 | virtual int height( const QListBox * ) const; | ||
68 | virtual int width( const QListBox * ) const; | ||
69 | |||
70 | private: | ||
71 | QColor mColor; | ||
72 | int mBoxWidth; | ||
73 | }; | ||
74 | |||
75 | #endif | ||
76 | |||