kutils Library API Documentation

kfinddialog.h

00001 /*
00002     Copyright (C) 2001, S.R.Haque <srhaque@iee.org>.
00003     Copyright (C) 2002, David Faure <david@mandrakesoft.com>
00004     This file is part of the KDE project
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License version 2, as published by the Free Software Foundation.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef KFINDDIALOG_H
00022 #define KFINDDIALOG_H
00023 
00024 #include <kdialogbase.h>
00025 class KHistoryCombo;
00026 class QPushButton;
00027 class QPopupMenu;
00028 class QGridLayout;
00029 class QLabel;
00030 class QGroupBox;
00031 class QCheckBox;
00032 
00061 class KFindDialog:
00062     public KDialogBase
00063 {
00064     Q_OBJECT
00065 
00066 public:
00067 
00068     // Options.
00069 
00070     enum Options
00071     {
00072         WholeWordsOnly = 1,     // Match whole words only.
00073         FromCursor = 2,         // Start from current cursor position.
00074         SelectedText = 4,       // Only search selected area.
00075         CaseSensitive = 8,      // Consider case when matching.
00076         FindBackwards = 16,     // Go backwards.
00077         RegularExpression = 32, // Interpret the pattern as a regular expression.
00078         // User extensions can use boolean options above this value.
00079         MinimumUserOption = 65536
00080     };
00081 
00091     KFindDialog( QWidget *parent = 0, const char *name = 0, long options = 0,
00092                  const QStringList &findStrings = QStringList(), bool hasSelection = false );
00093 
00097     virtual ~KFindDialog();
00098 
00107     void setFindHistory( const QStringList &strings );
00108 
00114     QStringList findHistory() const;
00115 
00122     void setHasSelection( bool hasSelection );
00123 
00131     void setHasCursor( bool hasCursor );
00132 
00138     void setOptions( long options );
00139 
00146     long options() const;
00147 
00151     QString pattern() const;
00152 
00156     void setPattern ( const QString &pattern );
00157 
00164     QWidget *findExtension();
00165 
00166 signals:
00167 
00172     void okClicked();
00173 
00174 protected slots:
00175 
00176     void slotOk();
00177     void slotSelectedTextToggled(bool);
00178     void showPatterns();
00179     void showPlaceholders();
00180     void textSearchChanged( const QString &);
00181 
00182 protected:
00183     virtual void showEvent ( QShowEvent * );
00184 
00185 private:
00186 
00187     QGroupBox *m_findGrp;
00188     QLabel *m_findLabel;
00189     KHistoryCombo *m_find;
00190     QCheckBox *m_regExp;
00191     QPushButton *m_regExpItem;
00192     QGridLayout *m_findLayout;
00193     QWidget *m_findExtension;
00194 
00195     QGroupBox *m_optionGrp;
00196     QCheckBox *m_wholeWordsOnly;
00197     QCheckBox *m_fromCursor;
00198     QCheckBox *m_selectedText;
00199     QCheckBox *m_caseSensitive;
00200     QCheckBox *m_findBackwards;
00201 
00202     QPopupMenu *m_patterns;
00203 
00204     // Our dirty little secret is that we also implement the "replace" dialog. But we
00205     // keep that fact hidden from all but our friends.
00206 
00207     friend class KReplaceDialog;
00208 
00215     KFindDialog( QWidget *parent, const char *name, bool forReplace );
00216     void init( bool forReplace, const QStringList &findStrings, bool hasSelection );
00217 
00218     QGroupBox *m_replaceGrp;
00219     QLabel *m_replaceLabel;
00220     KHistoryCombo *m_replace;
00221     QCheckBox* m_backRef;
00222     QPushButton* m_backRefItem;
00223     QGridLayout *m_replaceLayout;
00224     QWidget *m_replaceExtension;
00225 
00226     QCheckBox* m_promptOnReplace;
00227 
00228     QPopupMenu *m_placeholders;
00229 
00230     // Binary compatible extensibility.
00231     class KFindDialogPrivate;
00232     KFindDialogPrivate *d;
00233 };
00234 
00235 #endif // KFINDDIALOG_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:55 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001