OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
findrepl.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of FindReplace- abstract, Find-, Replace- common Dialog classes
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_FINDREPL_H)
10#define OWL_FINDREPL_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/commdial.h>
18
19namespace owl {
20
21#include <owl/preclass.h>
22
23/// \addtogroup commdlg
24/// @{
25
26/// \class TFindReplaceDialog
27// ~~~~~ ~~~~~~~~~~~~~~~~~~
28/// TFindReplaceDialog is an abstract base class for a modeless dialog box that lets
29/// you search for and replace text. This base class contains functionality common
30/// to both derived classes, TFindDialog (lets you specify text to find) and
31/// TReplaceDialog (lets you specify replacement text). TFindReplaceDialog
32/// communicates with the owner window using a registered message.
33//
35 public:
36
37 /// The TFindReplaceDialog::TData class encapsulates information necessary to
38 /// initialize a TFindReplace dialog box. The TFindDialog and TReplaceDialog classes
39 /// use the TFindReplaceDialog::TData class to initialize the dialog box and to
40 /// accept user-entered options such as the search and replacement text strings.
42 public:
43 /// Flags, which indicates the state of the control buttons and the action that
44 /// occurred in the dialog box, can be a combination of the following constants that
45 /// indicate which command the user wants to select:
46 /// - \c \b FR_DOWN The Down button in the Direction group of the Find dialog box is
47 /// selected.
48 /// - \c \b FR_HIDEMATCHCASE The Match Case check box is hidden.
49 /// - \c \b FR_HIDEWHOLEWORD The Whole Word check box is hidden.
50 /// - \c \b FR_HIDEUPDOWN. The Up and Down buttons are hidden.
51 /// - \c \b FR_MATCHCASE The Match Case check box is checked.
52 /// - \c \b FR_NOMATCHCASE The Match Case check box is disabled. This occurs when the
53 /// dialog box is first initialized.
54 /// - \c \b FR_NOUPDOWN The Up and Down buttons are disabled. This occurs when the dialog
55 /// box is first initialized.
56 /// - \c \b FR_NOWHOLEWORD The Whole Word check box is disabled. This occurs when the
57 /// dialog box is first initialized.
58 /// - \c \b FR_REPLACE The Replace button was pressed in the Replace dialog box.
59 /// - \c \b FR_REPLACEALL The Replace All button was pressed in the Replace dialog box.
60 /// - \c \b FR_WHOLEWORD The Whole Word check box is checked.
62
63 /// BuffSize contains the size of the text buffer.
65
66 /// If the dialog box is successfully created, Error is 0. Otherwise, it contains
67 /// one or more of the following error codes:
68 /// - \c \b CDERR_LOCKRESOURCEFAILURE Failed to lock a specified resource.
69 /// - \c \b CDERR_LOADRESFAILURE Failed to load a specified resource.
70 /// - \c \b CDERR_LOADSTRFAILURE Failed to load a specified string.
71 /// - \c \b CDERR_REGISTERMSGFAIL The window message (a value used to communicate between
72 /// applications) cannot be registered. This message value is used when sending or
73 /// posting window messages.
75
76 /// Contains the search string.
78
79 /// ReplaceWith contains the replacement string.
81
82 TData(uint32 flags = 0, int buffSize = 81);
83 TData(const TData& src);
84 ~TData();
85
86 TData& operator =(const TData& src);
87
88 void Write(opstream& os);
89 void Read(ipstream& is);
90 };
91
93 TData& data,
95 LPCTSTR title = nullptr,
96 TModule* module = nullptr);
97
99 TWindow* parent,
100 TData& data,
102 const tstring& title,
103 TModule* = nullptr);
104
105 void UpdateData(TParam2 param = 0);
106
107 protected:
108
109 virtual void Init(TResId templateId);
110 auto PerformCreate() -> THandle override;
111 auto DialogFunction(TMsgId, TParam1, TParam2) -> INT_PTR override;
112
113 TData& GetData();
114 void SetData(TData& data);
115
116 FINDREPLACE& GetFR();
117 void SetFR(const FINDREPLACE& _fr);
118
119 // Default behavior inline for message response functions
120 //
121 void CmFindNext(); ///< EV_COMMAND(IDOK,
122 void CmReplace(); ///< EV_COMMAND(psh1,
123 void CmReplaceAll(); ///< EV_COMMAND(psh2,
124 void CmCancel(); ///< EV_COMMAND(IDCANCEL,
125
126 void EvNCDestroy();
127
129/// A struct that contains find-and-replace attributes, such as the size of the find
130/// buffer and pointers to search and replace strings, used for find-and-replace
131/// operations.
132 FINDREPLACE fr;
133
134/// Data is a reference to the TData object passed in the constructor.
135 TData& Data;
136
139};
140
141//
142/// \class TFindDialog
143// ~~~~~ ~~~~~~~~~~~
144/// TFindDialog objects represents modeless dialog box interface elements that let
145/// you specify text to find. TFindDialog communicates with the owner window using a
146/// registered message. Derived from TFindReplaceDialog , TFindDialog uses the
147/// TFindReplaceDialog::TData structure to initialize the dialog box with
148/// user-entered values (such as the text string to find).
149//
151 public:
152 TFindDialog(TWindow* parent,
153 TData& data,
154 TResId templateId = 0,
155 LPCTSTR title = nullptr,
156 TModule* module = nullptr);
157
158 TFindDialog(TWindow* parent, TData& data, TResId templateId, const tstring& title, TModule* = nullptr);
159
160 protected:
161 virtual THandle PerformCreate() override;
162
163 private:
164 TFindDialog();
165 TFindDialog(const TFindDialog&);
166
168};
169
170//
171/// \class TReplaceDialog
172// ~~~~~ ~~~~~~~~~~~~~~
173/// TReplaceDialog creates a modeless dialog box that lets the user enter a
174/// selection of text to replace. Because these are model dialog boxes, you can
175/// search for text, edit the text in the window, and return to the dialog box to
176/// enter another selection. TReplaceDialog uses the TFindReplaceDialog::TData class
177/// to set the user-defined values for the dialog box, such as the text strings to
178/// search for and replace.
179//
181 public:
182 TReplaceDialog(TWindow* parent,
183 TData& data,
184 TResId templateId = 0,
185 LPCTSTR title = nullptr,
186 TModule* module = nullptr);
187
188 TReplaceDialog(TWindow* parent, TData& data, TResId templateId, const tstring& title, TModule* = nullptr);
189
190 protected:
191 virtual THandle PerformCreate() override;
192
193 private:
195 TReplaceDialog& operator=(const TReplaceDialog&);
196
198};
199
200/// @}
201
202#include <owl/posclass.h>
203
204//----------------------------------------------------------------------------
205// Inline implementations
206//
207
208//
209/// Returns the transfer data for the find and replace dialog.
210//
214
215//
216/// Sets the transfer data for the dialog.
217//
219 Data = data;
220}
221
222//
223/// Returns the underlying system structure for the find and replace dialog.
224//
226 return fr;
227}
228
229//
230/// Sets the underlying system structure for the dialog.
231//
233 fr = _fr;
234}
235
236//
237/// Responds to a click of the Find Next button.
238///
239/// Default behavior inline for message response functions
240//
244
245//
246/// Responds to a click of the Replace button.
247///
248/// Default behavior inline for message response functions
249//
253
254//
255/// Default behavior inline for message response functions
256///
257/// Responds to a click of the Replace All button.
258//
262
263//
264/// Responds to a click of the Cancel button.
265///
266/// Default behavior inline for message response functions
267//
271
272} // OWL namespace
273
274#endif // OWL_FINDREPL_H
Derived from TDialog, TCommonDialog is the abstract base class for TCommonDialog objects.
Definition commdial.h:62
TFindDialog objects represents modeless dialog box interface elements that let you specify text to fi...
Definition findrepl.h:150
The TFindReplaceDialog::TData class encapsulates information necessary to initialize a TFindReplace d...
Definition findrepl.h:41
uint32 Error
If the dialog box is successfully created, Error is 0.
Definition findrepl.h:74
int BuffSize
BuffSize contains the size of the text buffer.
Definition findrepl.h:64
TCHAR * ReplaceWith
ReplaceWith contains the replacement string.
Definition findrepl.h:80
TCHAR * FindWhat
Contains the search string.
Definition findrepl.h:77
uint32 Flags
Flags, which indicates the state of the control buttons and the action that occurred in the dialog bo...
Definition findrepl.h:61
TFindReplaceDialog is an abstract base class for a modeless dialog box that lets you search for and r...
Definition findrepl.h:34
void CmCancel()
EV_COMMAND(IDCANCEL,.
Definition findrepl.h:268
void SetFR(const FINDREPLACE &_fr)
Sets the underlying system structure for the dialog.
Definition findrepl.h:232
void SetData(TData &data)
Sets the transfer data for the dialog.
Definition findrepl.h:218
void CmReplaceAll()
EV_COMMAND(psh2,.
Definition findrepl.h:259
FINDREPLACE & GetFR()
Returns the underlying system structure for the find and replace dialog.
Definition findrepl.h:225
void CmFindNext()
EV_COMMAND(IDOK,.
Definition findrepl.h:241
TData & GetData()
Returns the transfer data for the find and replace dialog.
Definition findrepl.h:211
void CmReplace()
EV_COMMAND(psh1,.
Definition findrepl.h:250
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TReplaceDialog creates a modeless dialog box that lets the user enter a selection of text to replace.
Definition findrepl.h:180
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
TResult DefaultProcessing()
Handles default processing of events, which includes continued processing of menu/accelerators comman...
Definition window.cpp:852
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Definition objstrm.h:391
Base class for writing streamable objects.
Definition objstrm.h:480
Definition of Common Dialog abstract base class.
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
#define DECLARE_CASTABLE
Definition objstrm.h:1440
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
UINT TMsgId
Message ID type.
Definition dispatch.h:53
unsigned long uint32
Definition number.h:34
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
WPARAM TParam1
First parameter type.
Definition dispatch.h:54
std::string tstring
Definition defs.h:79
#define protected_data
Definition defs.h:208
#define _OWLCLASS
Definition defs.h:338