TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kreplacedialog.h 4.2KB

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