2 * klangbutton.h - Button with language selection drop down menu.
3 * Derived from the KLangCombo class by Hans Petter Bieker.
5 * Copyright (c) 1999-2000 Hans Petter Bieker <bieker@kde.org>
6 * (c) 2001 Martijn Klingens <mklingens@yahoo.com>
8 * Requires the Qt widget libraries, available at no cost at
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #ifndef __KLANGBUTTON_H__
28 #define __KLANGBUTTON_H__
30 #include "kpushbutton.h"
33 * Extended QPushButton that shows a menu with submenu for language selection.
34 * Essentially just a combo box with a 2-D dataset, but using a real
35 * QComboBox will produce ugly results.
37 * Combined version of KTagCombo and KLanguageCombo but using a QPushButton
40 class KLanguageButton
: public QPushButton
45 KLanguageButton(QWidget
*parent
=0, const char *name
=0);
48 void insertItem( const QIconSet
& icon
, const QString
&text
,
49 const QString
&tag
, const QString
&submenu
= QString::null
,
51 void insertItem( const QString
&text
, const QString
&tag
,
52 const QString
&submenu
= QString::null
, int index
= -1 );
53 void insertSeparator( const QString
&submenu
= QString::null
,
55 void insertSubmenu( const QString
&text
, const QString
&tag
,
56 const QString
&submenu
= QString::null
, int index
= -1);
61 void insertLanguage( const QString
& path
, const QString
& name
,
62 const QString
& sub
= QString::null
,
63 const QString
&submenu
= QString::null
, int index
= -1);
66 * Tag of the selected item
68 QString
currentTag() const;
69 QString
tag( int i
) const;
70 bool containsTag( const QString
&str
) const;
73 * Set the current item
75 int currentItem() const;
76 void setCurrentItem( int i
);
77 void setCurrentItem( const QString
&code
);
80 void activated( int index
);
81 void highlighted( int index
);
84 void slotActivated( int );
87 // work space for the new class
89 QPopupMenu
*m_popup
, *m_oldPopup
;