Fix some error
[kdeaccessibility.git] / kmouth / wordcompletion / klanguagebutton.h
blobaf8c79c9ac9e7a8563ebaca170f9c1ffdc61a049
1 /*
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
9 * http://www.troll.no/
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"
31 //Added by qt3to4:
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
40 * instead.
42 class KLanguageButton : public QPushButton
44 Q_OBJECT
46 public:
47 KLanguageButton(QWidget *parent=0, const char *name=0);
48 ~KLanguageButton();
50 void insertItem( const QIcon& icon, const QString &text,
51 const QString &tag, const QString &submenu = QString::null,
52 int index = -1 );
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,
56 int index = -1 );
57 void insertSubmenu( const QString &text, const QString &tag,
58 const QString &submenu = QString::null, int index = -1);
60 int count() const;
61 void clear();
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 );
81 signals:
82 void activated( int index );
83 void highlighted( int index );
85 private slots:
86 void slotActivated( int );
88 private:
89 // work space for the new class
90 QStringList *m_tags;
91 Q3PopupMenu *m_popup, *m_oldPopup;
92 int m_current;
95 #endif