• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

keduca

ktagcombobox.h

Go to the documentation of this file.
00001 /*
00002  * ktagcombobox.h - A combobox with support for submenues, icons and tags
00003  *
00004  * Copyright (c) 1999-2000 Hans Petter Bieker <bieker@kde.org>
00005  *
00006  * Requires the Qt widget libraries, available at no cost at
00007  * http://www.troll.no/
00008  *
00009  *  This program is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with this program; if not, write to the Free Software
00021  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00022  */
00023 
00024 
00025 #ifndef __KTAGCOMBOBOX_H__
00026 #define __KTAGCOMBOBOX_H__
00027 
00028 #include <qcombobox.h>
00029 #include <qiconset.h>
00030 class QPopupMenu;
00031 class QStringList;
00032 
00033 /*
00034  * This class should be just like qcombobox, but it should be possible
00035  * to have have a QIconSet for each entry, and each entry should have a tag.
00036  *
00037  * It has also support for sub menues.
00038  */
00039 class KTagComboBox : public QComboBox
00040 {
00041     Q_OBJECT
00042 
00043 public:
00044     KTagComboBox(QWidget *parent=0, const char *name=0);
00045     ~KTagComboBox();
00046 
00047     void insertItem(const QIconSet& icon, const QString &text, const QString &tag, const QString &submenu = QString::null, int index=-1 );
00048     void insertItem(const QString &text, const QString &tag, const QString &submenu = QString::null, int index=-1 );
00049     void insertSeparator(const QString &submenu = QString::null, int index=-1 );
00050     void insertSubmenu(const QString &text, const QString &tag, const QString &submenu = QString::null, int index=-1);
00051     void changeItem( const QString &text, int index );
00052 
00053     int count() const;
00054     void clear();
00055 
00056     /*
00057      * Tag of the selected item
00058      */
00059     QString currentTag() const;
00060     QString tag ( int i ) const;
00061     bool containsTag (const QString &str ) const;
00062 
00063     /*
00064      * Set the current item
00065      */
00066     int currentItem() const;
00067     void setCurrentItem(int i);
00068     void setCurrentItem(const QString &code);
00069 
00070     // widget stuff
00071     virtual void setFont( const QFont & );
00072 
00073 signals:
00074     void activated( int index );
00075     void highlighted( int index );
00076 
00077 private slots:
00078     void internalActivate( int );
00079     void internalHighlight( int );
00080 
00081 protected:
00082     void paintEvent( QPaintEvent * );
00083     void mousePressEvent( QMouseEvent * );
00084     void keyPressEvent( QKeyEvent *e );
00085     void popupMenu();
00086 
00087 private:
00088     // work space for the new class
00089     QStringList *_tags;
00090     QPopupMenu *_popup;
00091     int _current;
00092 };
00093 
00094 #endif

keduca

Skip menu "keduca"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal