kmail

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;
35signals:
36 void changed();
37
38 public slots:
39 virtual void setEnabled( bool state );
40
41 protected:
42 void dragEnterEvent( TQDragEnterEvent *e );
43 void dragLeaveEvent( TQDragLeaveEvent *e );
44 void dragMoveEvent( TQDragMoveEvent *e );
45 void dropEvent( TQDropEvent *e );
46
47 private slots:
48 void newColor( int index );
49
50 private:
51 int mCurrentOnDragEnter;
52
53};
54
55
56class ColorListItem : public TQListBoxItem
57{
58 public:
59 ColorListItem( const TQString &text, const TQColor &color=TQt::black );
60 const TQColor &color( void );
61 void setColor( const TQColor &color );
62
63 protected:
64 virtual void paint( TQPainter * );
65 virtual int height( const TQListBox * ) const;
66 virtual int width( const TQListBox * ) const;
67
68 private:
69 TQColor mColor;
70 int mBoxWidth;
71};
72
73#endif
74