home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kreplacedialog.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-05-22  |  4.2 KB  |  161 lines

  1. /*
  2.     Copyright (C) 2001, S.R.Haque <srhaque@iee.org>.
  3.     Copyright (C) 2002, David Faure <david@mandrakesoft.com>
  4.     This file is part of the KDE project
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License version 2, as published by the Free Software Foundation.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.     Boston, MA 02110-1301, USA.
  19. */
  20.  
  21. #ifndef KREPLACEDIALOG_H
  22. #define KREPLACEDIALOG_H
  23.  
  24. #include "kfinddialog.h"
  25.  
  26. class KHistoryCombo;
  27. class QCheckBox;
  28. class QGroupBox;
  29. class QLabel;
  30. class QPopupMenu;
  31. class QPushButton;
  32. class QRect;
  33.  
  34. /**
  35.  * @ingroup main
  36.  * @ingroup findreplace
  37.  * @short A generic "replace" dialog.
  38.  *
  39.  * @author S.R.Haque <srhaque@iee.org>
  40.  *
  41.  * \b Detail:
  42.  *
  43.  * This widget inherits from KFindDialog and implements
  44.  * the following additional functionalities:  a replacement string
  45.  * object and an area for a user-defined widget to extend the dialog.
  46.  *
  47.  * \b Example:
  48.  *
  49.  * To use the basic replace dialog:
  50.  *
  51.  * \code
  52.  * \endcode
  53.  *
  54.  * To use your own extensions:
  55.  *
  56.  * \code
  57.  * \endcode
  58.  */
  59. class KUTILS_EXPORT KReplaceDialog:
  60.     public KFindDialog
  61. {
  62.     Q_OBJECT
  63.  
  64. public:
  65.  
  66.     /**
  67.      * Options.
  68.      */
  69.     enum Options
  70.     {
  71.         PromptOnReplace = 256,  ///< Should the user be prompted before the replace operation?
  72.         BackReference = 512
  73.     };
  74.  
  75.     /**
  76.      * Construct a replace dialog.read-only or rather select-only combo box with a
  77.      * parent object and a name.
  78.      *
  79.      * @param parent The parent object of this widget
  80.      * @param name The name of this widget
  81.      * @param options A bitfield of the Options to be enabled.
  82.      * @param findStrings A QStringList to insert in the combo box of text to find
  83.      * @param replaceStrings A QStringList to insert in the combo box of text to
  84.      *        replace with
  85.      * @param hasSelection Whether a selection exists
  86.      */
  87.     KReplaceDialog( QWidget *parent = 0, const char *name = 0, long options = 0,
  88.             const QStringList &findStrings = QStringList(),
  89.             const QStringList &replaceStrings = QStringList(),
  90.             bool hasSelection = true );
  91.  
  92.     /**
  93.      * Destructor.
  94.      */
  95.     virtual ~KReplaceDialog();
  96.  
  97.     /**
  98.      * Provide the list of @p strings to be displayed as the history
  99.      * of replacement strings. @p strings might get truncated if it is
  100.      * too long.
  101.      *
  102.      * @param history The replacement history.
  103.      * @see replacementHistory
  104.      */
  105.     void setReplacementHistory( const QStringList &history );
  106.  
  107.     /**
  108.      * Returns the list of history items.
  109.      *
  110.      * @return The replacement history.
  111.      * @see setReplacementHistory
  112.      */
  113.     QStringList replacementHistory() const;
  114.  
  115.     /**
  116.      * Set the options which are enabled.
  117.      *
  118.      * @param options The setting of the Options.
  119.      * @see Options, KFindDialog::Options
  120.      */
  121.     void setOptions( long options );
  122.  
  123.     /**
  124.      * Returns the state of the options. Disabled options may be returned in
  125.      * an indeterminate state.
  126.      *
  127.      * @return The options.
  128.      * @see setOptions, Options, KFindDialog::Options
  129.      */
  130.     long options() const;
  131.  
  132.     /**
  133.      * Returns the replacement string.
  134.      * @return The replacement string.
  135.      */
  136.     QString replacement() const;
  137.  
  138.     /**
  139.      * Returns an empty widget which the user may fill with additional UI
  140.      * elements as required. The widget occupies the width of the dialog,
  141.      * and is positioned immediately the regular expression support widgets
  142.      * for the replacement string.
  143.      * @return An extensible QWidget.
  144.      */
  145.     QWidget *replaceExtension();
  146.  
  147. protected slots:
  148.  
  149.     void slotOk();
  150.     virtual void showEvent ( QShowEvent * );
  151.  
  152. private:
  153.  
  154.     // Binary compatible extensibility.
  155.     class KReplaceDialogPrivate;
  156.     KReplaceDialogPrivate *d;
  157. };
  158.  
  159.  
  160. #endif // KREPLACEDIALOG_H
  161.