00001 /* 00002 This file Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 00003 is part of the Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org> 00004 Opie Project Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de> 00005 00006 =. Originally part of the KDE Project 00007 .=l. 00008 .>+-= 00009 _;:, .> :=|. This program is free software; you can 00010 .> <`_, > . <= redistribute it and/or modify it under 00011 :`=1 )Y*s>-.-- : the terms of the GNU Library General Public 00012 .="- .-=="i, .._ License as published by the Free Software 00013 - . .-<_> .<> Foundation; either version 2 of the License, 00014 ._= =} : or (at your option) any later version. 00015 .%`+i> _;_. 00016 .i_,=:_. -<s. This program is distributed in the hope that 00017 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 00018 : .. .:, . . . without even the implied warranty of 00019 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 00020 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 00021 ..}^=.= = ; Library General Public License for more 00022 ++= -. .` .: details. 00023 : = ...= . :.=- 00024 -. .:....=;==+<; You should have received a copy of the GNU 00025 -_. . . )=. = Library General Public License along with 00026 -- :-=` this library; see the file COPYING.LIB. 00027 If not, write to the Free Software Foundation, 00028 Inc., 59 Temple Place - Suite 330, 00029 Boston, MA 02111-1307, USA. 00030 00031 */ 00032 00033 #ifndef OCOMPLETIONBOX_H 00034 #define OCOMPLETIONBOX_H 00035 00036 class QEvent; 00037 #include <qstringlist.h> 00038 #include <qlistbox.h> 00039 00040 // ML: Until we don't have an own OListBox, we use the QListBox 00041 #define OListBox QListBox 00042 00057 class OCompletionBox : public OListBox 00058 { 00059 Q_OBJECT 00060 Q_PROPERTY( bool isTabHandling READ isTabHandling WRITE setTabHandling ) 00061 Q_PROPERTY(QString cancelledText READ cancelledText WRITE setCancelledText) 00062 00063 public: 00075 OCompletionBox( QWidget *parent, const char *name = 0 ); 00076 00080 ~OCompletionBox(); 00081 00082 virtual QSize sizeHint() const; 00083 00084 public slots: 00088 QStringList items() const; 00089 00095 void insertItems( const QStringList& items, int index = -1 ); 00096 00100 void setItems( const QStringList& items ); 00101 00113 virtual void popup(); 00114 00124 void setTabHandling( bool enable ); 00125 00134 bool isTabHandling() const; 00135 00146 void setCancelledText( const QString& ); 00147 00151 QString cancelledText() const; 00152 00156 void down(); 00157 00161 void up(); 00162 00166 void pageDown(); 00167 00171 void pageUp(); 00172 00176 void home(); 00177 00181 void end(); 00182 00186 virtual void show(); 00187 00191 virtual void hide(); 00192 00193 signals: 00198 void activated( const QString& ); 00199 00204 void userCancelled( const QString& ); 00205 00206 protected: 00211 virtual bool eventFilter( QObject *, QEvent * ); 00212 00213 protected slots: 00218 virtual void slotActivated( QListBoxItem * ); 00219 00220 private slots: 00221 void slotSetCurrentItem( QListBoxItem *i ) { setCurrentItem( i ); } // grrr 00222 void slotCurrentChanged(); 00223 void cancelled(); 00224 void slotItemClicked( QListBoxItem * ); 00225 00226 private: 00227 class OCompletionBoxPrivate; 00228 OCompletionBoxPrivate* d; 00229 }; 00230 00231 00232 #endif // OCOMPLETIONBOX_H
1.4.2