fdrepdlg.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: fdrepdlg.h
  3. // Purpose: interface of wxFindDialogEvent, wxFindReplaceDialog
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. See wxFindDialogEvent::GetFlags().
  9. */
  10. enum wxFindReplaceFlags
  11. {
  12. /** downward search/replace selected (otherwise - upwards) */
  13. wxFR_DOWN = 1,
  14. /** whole word search/replace selected */
  15. wxFR_WHOLEWORD = 2,
  16. /** case sensitive search/replace selected (otherwise - case insensitive) */
  17. wxFR_MATCHCASE = 4
  18. };
  19. /**
  20. These flags can be specified in wxFindReplaceDialog ctor or Create():
  21. */
  22. enum wxFindReplaceDialogStyles
  23. {
  24. /** replace dialog (otherwise find dialog) */
  25. wxFR_REPLACEDIALOG = 1,
  26. /** don't allow changing the search direction */
  27. wxFR_NOUPDOWN = 2,
  28. /** don't allow case sensitive searching */
  29. wxFR_NOMATCHCASE = 4,
  30. /** don't allow whole word searching */
  31. wxFR_NOWHOLEWORD = 8
  32. };
  33. /**
  34. @class wxFindDialogEvent
  35. wxFindReplaceDialog events.
  36. @beginEventTable{wxFindDialogEvent}
  37. @event{EVT_FIND(id, func)}
  38. Find button was pressed in the dialog.
  39. @event{EVT_FIND_NEXT(id, func)}
  40. Find next button was pressed in the dialog.
  41. @event{EVT_FIND_REPLACE(id, func)}
  42. Replace button was pressed in the dialog.
  43. @event{EVT_FIND_REPLACE_ALL(id, func)}
  44. Replace all button was pressed in the dialog.
  45. @event{EVT_FIND_CLOSE(id, func)}
  46. The dialog is being destroyed, any pointers to it cannot be used any longer.
  47. @endEventTable
  48. @library{wxcore}
  49. @category{events}
  50. */
  51. class wxFindDialogEvent : public wxCommandEvent
  52. {
  53. public:
  54. /**
  55. Constructor used by wxWidgets only.
  56. */
  57. wxFindDialogEvent(wxEventType commandType = wxEVT_NULL,
  58. int id = 0);
  59. /**
  60. Return the pointer to the dialog which generated this event.
  61. */
  62. wxFindReplaceDialog* GetDialog() const;
  63. /**
  64. Return the string to find (never empty).
  65. */
  66. wxString GetFindString() const;
  67. /**
  68. Get the currently selected flags: this is the combination of
  69. the ::wxFindReplaceFlags enumeration values.
  70. */
  71. int GetFlags() const;
  72. /**
  73. Return the string to replace the search string with (only for replace and
  74. replace all events).
  75. */
  76. const wxString& GetReplaceString() const;
  77. };
  78. wxEventType wxEVT_FIND;
  79. wxEventType wxEVT_FIND_NEXT;
  80. wxEventType wxEVT_FIND_REPLACE;
  81. wxEventType wxEVT_FIND_REPLACE_ALL;
  82. wxEventType wxEVT_FIND_CLOSE;
  83. /**
  84. @class wxFindReplaceData
  85. wxFindReplaceData holds the data for wxFindReplaceDialog.
  86. It is used to initialize the dialog with the default values and will keep the
  87. last values from the dialog when it is closed. It is also updated each time a
  88. wxFindDialogEvent is generated so instead of using the wxFindDialogEvent
  89. methods you can also directly query this object.
  90. Note that all @c SetXXX() methods may only be called before showing the
  91. dialog and calling them has no effect later.
  92. @library{wxcore}
  93. @category{cmndlg,data}
  94. */
  95. class wxFindReplaceData : public wxObject
  96. {
  97. public:
  98. /**
  99. Constructor initializes the flags to default value (0).
  100. */
  101. wxFindReplaceData(wxUint32 flags = 0);
  102. /**
  103. Get the string to find.
  104. */
  105. const wxString& GetFindString() const;
  106. /**
  107. Get the combination of @c wxFindReplaceFlags values.
  108. */
  109. int GetFlags() const;
  110. /**
  111. Get the replacement string.
  112. */
  113. const wxString& GetReplaceString() const;
  114. /**
  115. Set the string to find (used as initial value by the dialog).
  116. */
  117. void SetFindString(const wxString& str);
  118. /**
  119. Set the flags to use to initialize the controls of the dialog.
  120. */
  121. void SetFlags(wxUint32 flags);
  122. /**
  123. Set the replacement string (used as initial value by the dialog).
  124. */
  125. void SetReplaceString(const wxString& str);
  126. };
  127. /**
  128. @class wxFindReplaceDialog
  129. wxFindReplaceDialog is a standard modeless dialog which is used to allow the
  130. user to search for some text (and possibly replace it with something else).
  131. The actual searching is supposed to be done in the owner window which is the
  132. parent of this dialog. Note that it means that unlike for the other standard
  133. dialogs this one @b must have a parent window. Also note that there is no
  134. way to use this dialog in a modal way; it is always, by design and
  135. implementation, modeless.
  136. Please see the @ref page_samples_dialogs sample for an example of using it.
  137. @library{wxcore}
  138. @category{cmndlg}
  139. */
  140. class wxFindReplaceDialog : public wxDialog
  141. {
  142. public:
  143. wxFindReplaceDialog();
  144. /**
  145. After using default constructor Create() must be called.
  146. The @a parent and @a data parameters must be non-@NULL.
  147. */
  148. wxFindReplaceDialog(wxWindow* parent,
  149. wxFindReplaceData* data,
  150. const wxString& title,
  151. int style = 0);
  152. /**
  153. Destructor.
  154. */
  155. virtual ~wxFindReplaceDialog();
  156. /**
  157. Creates the dialog; use wxWindow::Show to show it on screen.
  158. The @a parent and @a data parameters must be non-@NULL.
  159. */
  160. bool Create(wxWindow* parent, wxFindReplaceData* data,
  161. const wxString& title, int style = 0);
  162. /**
  163. Get the wxFindReplaceData object used by this dialog.
  164. */
  165. const wxFindReplaceData* GetData() const;
  166. };