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., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KFINDDIALOG_H 00022 #define KFINDDIALOG_H 00023 00024 #include <kdialogbase.h> 00025 class KHistoryCombo; 00026 class TQPushButton; 00027 class TQPopupMenu; 00028 class TQGridLayout; 00029 class TQLabel; 00030 class TQGroupBox; 00031 class TQCheckBox; 00032 00074 class TDEUTILS_EXPORT KFindDialog: 00075 public KDialogBase 00076 { 00077 Q_OBJECT 00078 00079 public: 00080 00081 // Options. 00082 00083 // KDE4: move to KFind 00087 enum Options 00088 { 00089 WholeWordsOnly = 1, 00090 FromCursor = 2, 00091 SelectedText = 4, 00092 CaseSensitive = 8, 00093 FindBackwards = 16, 00094 RegularExpression = 32, 00095 FindIncremental = 64, 00096 // Note that KReplaceDialog uses 256 and 512 00097 // User extensions can use boolean options above this value. 00098 MinimumUserOption = 65536 00099 }; 00100 00110 KFindDialog( TQWidget *parent = 0, const char *name = 0, long options = 0, 00111 const TQStringList &findStrings = TQStringList(), bool hasSelection = false ); 00112 // KDE4: fix ambiguity with private constructor 00113 // Maybe remove options (there's setOptions) and findStrings (setFindHistory) and hasSelection (setHasSelection) 00114 00125 KFindDialog( bool modal, TQWidget *parent = 0, const char *name = 0, long options = 0, 00126 const TQStringList &findStrings = TQStringList(), bool hasSelection = false ); 00127 // KDE4: consider simplifying 00128 00132 virtual ~KFindDialog(); 00133 00142 void setFindHistory( const TQStringList &history ); 00143 00150 TQStringList findHistory() const; 00151 00158 void setHasSelection( bool hasSelection ); 00159 00167 void setHasCursor( bool hasCursor ); 00168 00177 void setSupportsBackwardsFind( bool supports ); 00178 00187 void setSupportsCaseSensitiveFind( bool supports ); 00188 00197 void setSupportsWholeWordsFind( bool supports ); 00198 00207 void setSupportsRegularExpressionFind( bool supports ); 00208 00215 void setOptions( long options ); 00216 00224 long options() const; 00225 00230 TQString pattern() const; 00231 00236 void setPattern ( const TQString &pattern ); 00237 00245 TQWidget *findExtension(); 00246 00247 protected slots: 00248 00249 void slotOk(); 00250 void slotSelectedTextToggled(bool); 00251 void showPatterns(); 00252 void showPlaceholders(); 00253 void textSearchChanged(const TQString &); 00254 void slotRegexCheckBoxToggled(bool checked); 00255 void slotPlaceholdersCheckBoxToggled(bool checked); 00256 00257 protected: 00258 virtual void showEvent ( TQShowEvent * ); 00259 00260 private slots: 00265 void slotPlaceholdersAboutToShow(); 00266 00267 private: 00268 00269 TQGroupBox *m_findGrp; 00270 TQLabel *m_findLabel; 00271 KHistoryCombo *m_find; 00272 TQCheckBox *m_regExp; 00273 TQPushButton *m_regExpItem; 00274 TQGridLayout *m_findLayout; 00275 TQWidget *m_findExtension; 00276 00277 TQGroupBox *m_optionGrp; 00278 TQCheckBox *m_wholeWordsOnly; 00279 TQCheckBox *m_fromCursor; 00280 TQCheckBox *m_selectedText; 00281 TQCheckBox *m_caseSensitive; 00282 TQCheckBox *m_findBackwards; 00283 00284 TQPopupMenu *m_patterns; 00285 00286 // Our dirty little secret is that we also implement the "replace" dialog. But we 00287 // keep that fact hidden from all but our friends. 00288 00289 friend class KReplaceDialog; 00290 00297 KFindDialog( TQWidget *parent, const char *name, bool forReplace ); 00298 void init( bool forReplace, const TQStringList &findStrings, bool hasSelection ); 00299 00300 TQGroupBox *m_replaceGrp; 00301 TQLabel *m_replaceLabel; 00302 KHistoryCombo *m_replace; 00303 TQCheckBox* m_backRef; 00304 TQPushButton* m_backRefItem; 00305 TQGridLayout *m_replaceLayout; 00306 TQWidget *m_replaceExtension; 00307 00308 TQCheckBox* m_promptOnReplace; 00309 00310 TQPopupMenu *m_placeholders; 00311 00312 // Binary compatible extensibility. 00313 class KFindDialogPrivate; 00314 KFindDialogPrivate *d; 00315 }; 00316 00317 #endif // KFINDDIALOG_H