klistviewsearchline.h

00001 /* This file is part of the KDE libraries
00002    Copyright (c) 2003 Scott Wheeler <wheeler@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #ifndef KLISTVIEWSEARCHLINE_H
00020 #define KLISTVIEWSEARCHLINE_H
00021 
00022 #include <klineedit.h>
00023 #include <qhbox.h>
00024 
00025 class KListView;
00026 class QListViewItem;
00027 class QToolButton;
00028 
00044 class KDEUI_EXPORT KListViewSearchLine : public KLineEdit
00045 {
00046     Q_OBJECT
00047 
00048 public:
00049 
00057     KListViewSearchLine(QWidget *parent = 0, KListView *listView = 0, const char *name = 0);
00058 
00063     KListViewSearchLine(QWidget *parent, const char *name);
00064 
00068     virtual ~KListViewSearchLine();
00069 
00075     bool caseSensitive() const;
00076 
00083     QValueList<int> searchColumns() const;
00084 
00091     bool keepParentsVisible() const;
00092 
00098     KListView *listView() const;
00099 
00100 public slots:
00105     virtual void updateSearch(const QString &s = QString::null);
00106 
00112     void setCaseSensitive(bool cs);
00113 
00124     void setKeepParentsVisible(bool v);
00125 
00133     void setSearchColumns(const QValueList<int> &columns);
00134 
00141     void setListView(KListView *lv);
00142 
00143 protected:
00144 
00150     virtual bool itemMatches(const QListViewItem *item, const QString &s) const;
00151 
00157     virtual QPopupMenu *createPopupMenu();
00158 
00159 protected slots:
00173     void queueSearch(const QString &search);
00174 
00183     void activateSearch();
00184 
00185 private:
00186 
00191     void checkItemParentsNotVisible();
00192 
00198     bool checkItemParentsVisible(QListViewItem *item, QListViewItem *highestHiddenParent = 0);
00199 
00200 private slots:
00201     void itemAdded(QListViewItem *item) const;
00202     void listViewDeleted();
00203     void searchColumnsMenuActivated(int);
00204 
00205 private:
00206     class KListViewSearchLinePrivate;
00207     KListViewSearchLinePrivate *d;
00208 };
00209 
00216 class KDEUI_EXPORT KListViewSearchLineWidget : public QHBox
00217 {
00218     Q_OBJECT
00219 
00220 public:
00225     KListViewSearchLineWidget(KListView *listView = 0, QWidget *parent = 0,
00226                               const char *name = 0);
00227 
00231     ~KListViewSearchLineWidget();
00232 
00237     virtual KListViewSearchLine *createSearchLine(KListView *listView);
00238 
00242     KListViewSearchLine *searchLine() const;
00243 
00244 protected slots:
00251     virtual void createWidgets();
00252 
00253 private slots:
00254     void positionInToolBar();
00255 
00256 private:
00257     class KListViewSearchLineWidgetPrivate;
00258     KListViewSearchLineWidgetPrivate *d;
00259 };
00260 
00261 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys