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"
32 #include <Q3PopupMenu>
35 * Extended QPushButton that shows a menu with submenu for language selection.
36 * Essentially just a combo box with a 2-D dataset, but using a real
37 * QComboBox will produce ugly results.
39 * Combined version of KTagCombo and KLanguageCombo but using a QPushButton
42 class KLanguageButton
: public QPushButton
47 KLanguageButton(QWidget
*parent
=0, const char *name
=0);
50 void insertItem( const QIcon
& icon
, const QString
&text
,
51 const QString
&tag
, const QString
&submenu
= QString::null
,
53 void insertItem( const QString
&text
, const QString
&tag
,
54 const QString
&submenu
= QString::null
, int index
= -1 );
55 void insertSeparator( const QString
&submenu
= QString::null
,
57 void insertSubmenu( const QString
&text
, const QString
&tag
,
58 const QString
&submenu
= QString::null
, int index
= -1);
63 void insertLanguage( const QString
& path
, const QString
& name
,
64 const QString
& sub
= QString::null
,
65 const QString
&submenu
= QString::null
, int index
= -1);
68 * Tag of the selected item
70 QString
currentTag() const;
71 QString
tag( int i
) const;
72 bool containsTag( const QString
&str
) const;
75 * Set the current item
77 int currentItem() const;
78 void setCurrentItem( int i
);
79 void setCurrentItem( const QString
&code
);
82 void activated( int index
);
83 void highlighted( int index
);
86 void slotActivated( int );
89 // work space for the new class
91 Q3PopupMenu
*m_popup
, *m_oldPopup
;