klanguagebutton.h
00001 /* 00002 * klangbutton.h - Button with language selection drop down menu. 00003 * Derived from the KLangCombo class by Hans Petter Bieker. 00004 * 00005 * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org> 00006 * (c) 2001 Martijn Klingens <klingens@kde.org> 00007 * 00008 * Requires the Qt widget libraries, available at no cost at 00009 * http://www.troll.no/ 00010 * 00011 * This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00024 */ 00025 00026 00027 #ifndef __KLANGBUTTON_H__ 00028 #define __KLANGBUTTON_H__ 00029 00030 #include <tqwidget.h> 00031 00032 #include <tdelibs_export.h> 00033 00034 class KLanguageButtonPrivate; 00035 class TQIconSet; 00036 class TQPopupMenu; 00037 00047 class TDEUI_EXPORT KLanguageButton : public TQWidget 00048 { 00049 Q_OBJECT 00050 00051 public: 00058 KLanguageButton(TQWidget * parent = 0, const char * name = 0); 00059 00067 KLanguageButton(const TQString & text, TQWidget * parent = 0, const char * name = 0); 00068 00072 virtual ~KLanguageButton(); 00073 00083 void insertItem( const TQIconSet& icon, const TQString &text, 00084 const TQString & id, const TQString &submenu = TQString::null, 00085 int index = -1 ); 00094 void insertItem( const TQString &text, const TQString & id, 00095 const TQString &submenu = TQString::null, int index = -1 ); 00102 void insertSeparator( const TQString &submenu = TQString::null, 00103 int index = -1 ); 00113 void insertSubmenu( const TQIconSet & icon, const TQString &text, 00114 const TQString & id, const TQString &submenu = TQString::null, 00115 int index = -1); 00124 void insertSubmenu( const TQString &text, const TQString & id, 00125 const TQString &submenu = TQString::null, int index = -1); 00126 00127 00128 void insertLanguage( const TQString& path, const TQString& name, 00129 const TQString& sub = TQString::null, 00130 const TQString &submenu = TQString::null, int index = -1); 00131 00132 00133 int count() const; 00137 void clear(); 00141 void setText(const TQString & text); 00145 TQString current() const; 00149 bool contains( const TQString & id ) const; 00153 void setCurrentItem( const TQString & id ); 00154 00155 TQString id( int i ) const; 00156 00157 signals: 00162 void activated( const TQString & id ); 00163 void highlighted( const TQString & id ); 00164 00165 private slots: 00166 void slotActivated( int ); 00167 void slotHighlighted( int ); 00168 00169 private: 00170 int currentItem() const; 00171 void setCurrentItem( int ); 00172 void init(const char * name); 00173 00174 // work space for the new class 00175 TQStringList *m_ids; 00176 TQPopupMenu *m_popup, *m_oldPopup; 00177 int m_current; 00178 00179 KLanguageButtonPrivate * d; 00180 }; 00181 00182 #endif