kaddressbook

colorlistbox.h
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20
21#ifndef _COLOR_LISTBOX_H_
22#define _COLOR_LISTBOX_H_
23
24#include <tdelistbox.h>
25
26class ColorListBox : public TDEListBox
27{
28 TQ_OBJECT
29
30
31 public:
32 ColorListBox( TQWidget *parent=0, const char * name=0, WFlags f=0 );
33 void setColor( uint index, const TQColor &color );
34 TQColor color( uint index ) const;
35
36 public slots:
37 virtual void setEnabled( bool state );
38
39 protected:
40 void dragEnterEvent( TQDragEnterEvent *e );
41 void dragLeaveEvent( TQDragLeaveEvent *e );
42 void dragMoveEvent( TQDragMoveEvent *e );
43 void dropEvent( TQDropEvent *e );
44
45 private slots:
46 void newColor( int index );
47
48 private:
49 int mCurrentOnDragEnter;
50
51};
52
53
54class ColorListItem : public TQListBoxItem
55{
56 public:
57 ColorListItem( const TQString &text, const TQColor &color=TQt::black );
58 const TQColor &color( void );
59 void setColor( const TQColor &color );
60
61 protected:
62 virtual void paint( TQPainter * );
63 virtual int height( const TQListBox * ) const;
64 virtual int width( const TQListBox * ) const;
65
66 private:
67 TQColor mColor;
68 int mBoxWidth;
69};
70
71#endif
72