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 
00072 class KUTILS_EXPORT KFindDialog:
00073     public KDialogBase
00074 {
00075     Q_OBJECT
00076 
00077 public:
00078 
00079     // Options.
00080 
00081     // KDE4: move to KFind
00082     enum Options
00083     {
00084         WholeWordsOnly = 1,     // Match whole words only.
00085         FromCursor = 2,         // Start from current cursor position.
00086         SelectedText = 4,       // Only search selected area.
00087         CaseSensitive = 8,      // Consider case when matching.
00088         FindBackwards = 16,     // Go backwards.
00089         RegularExpression = 32, // Interpret the pattern as a regular expression.
00090         FindIncremental = 64,   // Find incremental.
00091         // Note that KReplaceDialog uses 256 and 512
00092         // User extensions can use boolean options above this value.
00093         MinimumUserOption = 65536
00094     };
00095 
00105     KFindDialog( QWidget *parent = 0, const char *name = 0, long options = 0,
00106                  const QStringList &findStrings = QStringList(), bool hasSelection = false );
00107     // KDE4: fix ambiguity with private constructor
00108     // Maybe remove options (there's setOptions) and findStrings (setFindHistory) and hasSelection (setHasSelection)
00109 
00120     KFindDialog( bool modal, QWidget *parent = 0, const char *name = 0, long options = 0,
00121                  const QStringList &findStrings = QStringList(), bool hasSelection = false );
00122     // KDE4: consider simplifying
00123 
00127     virtual ~KFindDialog();
00128 
00137     void setFindHistory( const QStringList &history );
00138 
00144     QStringList findHistory() const;
00145 
00152     void setHasSelection( bool hasSelection );
00153 
00161     void setHasCursor( bool hasCursor );
00162 
00171     void setSupportsBackwardsFind( bool supports );
00172 
00181     void setSupportsCaseSensitiveFind( bool supports );
00182 
00191     void setSupportsWholeWordsFind( bool supports );
00192 
00201     void setSupportsRegularExpressionFind( bool supports );
00202 
00208     void setOptions( long options );
00209 
00216     long options() const;
00217 
00221     QString pattern() const;
00222 
00226     void setPattern ( const QString &pattern );
00227 
00234     QWidget *findExtension();
00235 
00236 protected slots:
00237 
00238     void slotOk();
00239     void slotSelectedTextToggled(bool);
00240     void showPatterns();
00241     void showPlaceholders();
00242     void textSearchChanged( const QString &);
00243 
00244 protected:
00245     virtual void showEvent ( QShowEvent * );
00246 
00247 private slots:
00252     void slotPlaceholdersAboutToShow();
00253 
00254 private:
00255 
00256     QGroupBox *m_findGrp;
00257     QLabel *m_findLabel;
00258     KHistoryCombo *m_find;
00259     QCheckBox *m_regExp;
00260     QPushButton *m_regExpItem;
00261     QGridLayout *m_findLayout;
00262     QWidget *m_findExtension;
00263 
00264     QGroupBox *m_optionGrp;
00265     QCheckBox *m_wholeWordsOnly;
00266     QCheckBox *m_fromCursor;
00267     QCheckBox *m_selectedText;
00268     QCheckBox *m_caseSensitive;
00269     QCheckBox *m_findBackwards;
00270 
00271     QPopupMenu *m_patterns;
00272 
00273     // Our dirty little secret is that we also implement the "replace" dialog. But we
00274     // keep that fact hidden from all but our friends.
00275 
00276     friend class KReplaceDialog;
00277 
00284     KFindDialog( QWidget *parent, const char *name, bool forReplace );
00285     void init( bool forReplace, const QStringList &findStrings, bool hasSelection );
00286 
00287     QGroupBox *m_replaceGrp;
00288     QLabel *m_replaceLabel;
00289     KHistoryCombo *m_replace;
00290     QCheckBox* m_backRef;
00291     QPushButton* m_backRefItem;
00292     QGridLayout *m_replaceLayout;
00293     QWidget *m_replaceExtension;
00294 
00295     QCheckBox* m_promptOnReplace;
00296 
00297     QPopupMenu *m_placeholders;
00298 
00299     // Binary compatible extensibility.
00300     class KFindDialogPrivate;
00301     KFindDialogPrivate *d;
00302 };
00303 
00304 #endif // KFINDDIALOG_H
KDE Logo
This file is part of the documentation for kutils Library Version 3.4.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 9 08:04:02 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003