2 * ktagcombobox.h - A combobox with support for submenues, icons and tags
4 * Copyright (c) 1999-2000 Hans Petter Bieker <bieker@kde.org>
6 * Requires the Qt widget libraries, available at no cost at
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifndef __KTAGCOMBOBOX_H__
26 #define __KTAGCOMBOBOX_H__
28 #include <qcombobox.h>
34 * This class should be just like qcombobox, but it should be possible
35 * to have have a QIconSet for each entry, and each entry should have a tag.
37 * It has also support for sub menues.
39 class KTagComboBox
: public QComboBox
44 KTagComboBox(QWidget
*parent
=0, const char *name
=0);
47 void insertItem(const QIconSet
& icon
, const QString
&text
, const QString
&tag
, const QString
&submenu
= QString::null
, int index
=-1 );
48 void insertItem(const QString
&text
, const QString
&tag
, const QString
&submenu
= QString::null
, int index
=-1 );
49 void insertSeparator(const QString
&submenu
= QString::null
, int index
=-1 );
50 void insertSubmenu(const QString
&text
, const QString
&tag
, const QString
&submenu
= QString::null
, int index
=-1);
51 void changeItem( const QString
&text
, int index
);
57 * Tag of the selected item
59 QString
currentTag() const;
60 QString
tag ( int i
) const;
61 bool containsTag (const QString
&str
) const;
64 * Set the current item
66 int currentItem() const;
67 void setCurrentItem(int i
);
68 void setCurrentItem(const QString
&code
);
71 virtual void setFont( const QFont
& );
74 void activated( int index
);
75 void highlighted( int index
);
78 void internalActivate( int );
79 void internalHighlight( int );
82 void paintEvent( QPaintEvent
* );
83 void mousePressEvent( QMouseEvent
* );
84 void keyPressEvent( QKeyEvent
*e
);
88 // work space for the new class