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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #ifndef __KTAGCOMBOBOX_H__
26 #define __KTAGCOMBOBOX_H__
33 * This class should be just like qcombobox, but it should be possible
34 * to have have a QIcon for each entry, and each entry should have a tag.
36 * It has also support for sub menus.
38 class KTagComboBox
: public QComboBox
43 explicit KTagComboBox(QWidget
*parent
=0, const char *name
=0);
46 void insertItem(const QIcon
& icon
, const QString
&text
, const QString
&tag
, const QString
&submenu
= QString(), int index
=-1 );
47 void insertItem(const QString
&text
, const QString
&tag
, const QString
&submenu
= QString(), int index
=-1 );
48 void insertSeparator(const QString
&submenu
= QString(), int index
=-1 );
49 void insertSubmenu(const QString
&text
, const QString
&tag
, const QString
&submenu
= QString(), int index
=-1);
55 * Tag of the selected item
57 QString
currentTag() const;
58 QString
tag ( int i
) const;
59 bool containsTag (const QString
&str
) const;
62 * Set the current item
64 int currentItem() const;
65 void setCurrentItem(int i
);
66 void setCurrentItem(const QString
&code
);
69 virtual void setFont( const QFont
& );
72 void activated( int index
);
73 void highlighted( int index
);
76 void internalActivate( int );
77 void internalHighlight( int );
80 void paintEvent( QPaintEvent
* );
81 void mousePressEvent( QMouseEvent
* );
82 void keyPressEvent( QKeyEvent
*e
);
86 // work space for the new class
88 QPopupMenu
*popup
, *old_popup
;