OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
editsear.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 class TEditSearch, an edit control that responds to Find,
7/// Replace and FindNext menu commands.
8//----------------------------------------------------------------------------
9
10#if !defined(OWL_EDITSEAR_H)
11#define OWL_EDITSEAR_H
12
13#include <owl/private/defs.h>
14#if defined(BI_HAS_PRAGMA_ONCE)
15# pragma once
16#endif
17
18#include <owl/edit.h>
19#include <owl/findrepl.h>
20#include <owl/editsear.rh>
21
22
23namespace owl {
24
25#include <owl/preclass.h>
26
27/// \addtogroup ctrl
28/// @{
29
30/// \class TEditSearch
31// ~~~~~ ~~~~~~~~~~~
32/// TEditSearch is an edit control that responds to Find, Replace, and FindNext menu
33/// commands. This class is streamable.
34//
35class _OWLCLASS TEditSearch : public TEdit {
36 public:
37 TEditSearch(TWindow* parent = nullptr,
38 int id = 0,
39 LPCTSTR text = nullptr,
40 int x = 0, int y = 0, int w = 0, int h = 0,
41 TModule* module = nullptr);
42
44 TWindow* parent,
45 int id,
46 const tstring& text,
47 int x = 0, int y = 0, int w = 0, int h = 0,
48 TModule* = nullptr);
49
50 TEditSearch(TWindow* parent,
51 int resourceId,
52 TModule& module);
53
54 ~TEditSearch() override;
55
56 void SetupWindow() override;
57 void DoSearch();
58
59 TFindReplaceDialog::TData& GetSearchData();
60 void SetSearchData(const TFindReplaceDialog::TData& searchdata);
61
62 TFindReplaceDialog* GetSearchDialog();
63 void SetSearchDialog(TFindReplaceDialog* searchdialog);
64
65 uint GetSearchCmd();
66 void SetSearchCmd(uint searchcmd);
67
68 protected: // !CQ these command handlers were public
69
70 // Menu command handlers
71 //
72 void CmEditFind(); ///< CM_EDITFIND
73 void CmEditReplace(); ///< CM_EDITREPLACE
74 void CeEditFindReplace(TCommandEnabler& ce);
75 void CmEditFindNext(); ///< CM_EDITFINDNEXT
76 void CeEditFindNext(TCommandEnabler& ce);
77
78 TResult EvFindMsg(TParam1, TParam2); ///< Registered commdlg message
79
81/// The SearchData structure defines the search text string, the replacement text
82/// string, and the size of the text buffer.
84
85/// Contains find or replace dialog-box information (such as the text to find and
86/// replace) and check box settings.
87 TFindReplaceDialog* SearchDialog;
88
89/// Contains the search command identifier that opened the dialog box if one is open.
90 uint SearchCmd;
91
92 private:
93 // Hidden to prevent accidental copying or assignment
94 //
96 TEditSearch& operator=(const TEditSearch&);
97
100};
101
103
104#include <owl/posclass.h>
105
106
107//----------------------------------------------------------------------------
108// Inline implementations
109//
110
111/// This constructor, which aliases an Edit control created from a
112/// dialog resource is 'unconventional' in that it expects a TModule reference
113/// instead of the traditional 'TModule* = 0'. This is, however, to avoid
114/// ambiguities between the two forms of constructor. Since it is traditionally
115/// created as a child of a TDialog-derived class, you can simply use the module of
116/// the parent object.
117/// For example,
118/// \code
119/// TMyDialog::TMyDialog(....)
120/// {
121/// edit = new TEditSearch(this, ID_EDIT1, *GetModule());
122/// }
123/// \endcode
124//
125inline
127 :TEdit(parent, resourceId, 0, &module),SearchData(FR_DOWN)
128{
129 SearchDialog = nullptr;
130 SearchCmd = 0;
131}
132
133//
134/// Returns the search data used for the common dialog.
135//
137 return SearchData;
138}
139
140//
141/// Uses new search data.
142//
146
147//
148/// Returns the common dialog pointer.
149//
151 return SearchDialog;
152}
153
154//
155/// Uses new common dialog pointer.
156//
160
161//
162/// Returns the user selected command that brought up the search dialog.
163//
165 return SearchCmd;
166}
167
168//
169/// Remembers the command the user selected to bring up the search dialog.
170//
172 SearchCmd = searchcmd;
173}
174
175} // OWL namespace
176
177
178#endif // OWL_EDITSEAR_H
179
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
Definition window.h:209
A TEdit is an interface object that represents an edit control interface element.
Definition edit.h:34
TEditSearch is an edit control that responds to Find, Replace, and FindNext menu commands.
Definition editsear.h:35
The TFindReplaceDialog::TData class encapsulates information necessary to initialize a TFindReplace d...
Definition findrepl.h:41
TFindReplaceDialog is an abstract base class for a modeless dialog box that lets you search for and r...
Definition findrepl.h:34
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
Definition of class TEdit.
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
Definition of FindReplace- abstract, Find-, Replace- common Dialog classes.
#define DECLARE_STREAMABLE_OWL(cls, ver)
Definition objstrm.h:1529
#define DECLARE_STREAMABLE_INLINES(cls)
Definition objstrm.h:1538
TEditSearch(TWindow *parent=nullptr, int id=0, LPCTSTR text=nullptr, int x=0, int y=0, int w=0, int h=0, TModule *module=nullptr)
Constructs a TEditSearch object given the parent window, resource ID, and character string (text).
Definition editsear.cpp:35
TFindReplaceDialog::TData & GetSearchData()
Returns the search data used for the common dialog.
Definition editsear.h:136
TFindReplaceDialog * GetSearchDialog()
Returns the common dialog pointer.
Definition editsear.h:150
void SetSearchDialog(TFindReplaceDialog *searchdialog)
Uses new common dialog pointer.
Definition editsear.h:157
void SetSearchData(const TFindReplaceDialog::TData &searchdata)
Uses new search data.
Definition editsear.h:143
uint GetSearchCmd()
Returns the user selected command that brought up the search dialog.
Definition editsear.h:164
void SetSearchCmd(uint searchcmd)
Remembers the command the user selected to bring up the search dialog.
Definition editsear.h:171
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
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
unsigned int uint
Definition number.h:25
#define public_data
Definition defs.h:207
#define _OWLCLASS
Definition defs.h:338