1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/fdrepdlg.h
3 // Purpose: wxFindReplaceDialog class
4 // Author: Markus Greither
5 // Modified by: 31.07.01: VZ: integrated into wxWindows
8 // Copyright: (c) Markus Greither
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_FINDREPLACEDLG_H_
13 #define _WX_FINDREPLACEDLG_H_
16 #pragma interface "fdrepdlg.h"
23 #include "wx/dialog.h"
25 class WXDLLEXPORT wxFindReplaceDialog
;
26 class WXDLLEXPORT wxFindReplaceData
;
27 class WXDLLEXPORT wxFindReplaceDialogImpl
;
29 // ----------------------------------------------------------------------------
30 // Flags for wxFindReplaceData.Flags
31 // ----------------------------------------------------------------------------
33 // flages used by wxFindDialogEvent::GetFlags()
34 enum wxFindReplaceFlags
36 // downward search/replace selected (otherwise - upwards)
39 // whole word search/replace selected
42 // case sensitive search/replace selected (otherwise - case insensitive)
46 // these flags can be specified in wxFindReplaceDialog ctor or Create()
47 enum wxFindReplaceDialogStyles
49 // replace dialog (otherwise find dialog)
50 wxFR_REPLACEDIALOG
= 1,
52 // don't allow changing the search direction
55 // don't allow case sensitive searching
58 // don't allow whole word searching
62 // ----------------------------------------------------------------------------
63 // wxFindReplaceData: holds Setup Data/Feedback Data for wxFindReplaceDialog
64 // ----------------------------------------------------------------------------
66 class WXDLLEXPORT wxFindReplaceData
: public wxObject
69 wxFindReplaceData() { }
70 wxFindReplaceData(wxUint32 flags
) { SetFlags(flags
); }
73 const wxString
& GetFindString() { return m_FindWhat
; }
74 const wxString
& GetReplaceString() { return m_ReplaceWith
; }
76 int GetFlags() const { return m_Flags
; }
78 // setters: may only be called before showing the dialog, no effect later
79 void SetFlags(wxUint32 flags
) { m_Flags
= flags
; }
81 void SetFindString(const wxString
& str
) { m_FindWhat
= str
; }
82 void SetReplaceString(const wxString
& str
) { m_ReplaceWith
= str
; }
89 friend class wxFindReplaceDialog
;
92 // ----------------------------------------------------------------------------
93 // wxFindReplaceDialog: dialog for searching / replacing text
94 // ----------------------------------------------------------------------------
96 class WXDLLEXPORT wxFindReplaceDialog
: public wxDialog
100 wxFindReplaceDialog() { Init(); }
101 wxFindReplaceDialog(wxWindow
*parent
,
102 wxFindReplaceData
*data
,
103 const wxString
&title
);
105 bool Create(wxWindow
*parent
,
106 wxFindReplaceData
*data
,
107 const wxString
&title
);
109 virtual ~wxFindReplaceDialog();
111 // find dialog data access
112 const wxFindReplaceData
*GetData() const { return m_FindReplaceData
; }
113 void SetData(wxFindReplaceData
*data
);
115 // implementation only from now on
117 wxFindReplaceDialogImpl
*GetImpl() const { return m_impl
; }
119 // override some base class virtuals
120 virtual bool Show(bool show
);
121 virtual void SetTitle( const wxString
& title
);
122 virtual wxString
GetTitle() const;
125 virtual void DoGetSize(int *width
, int *height
) const;
126 virtual void DoGetClientSize(int *width
, int *height
) const;
127 virtual void DoSetSize(int x
, int y
,
128 int width
, int height
,
129 int sizeFlags
= wxSIZE_AUTO
);
133 wxFindReplaceData
*m_FindReplaceData
;
136 wxFindReplaceDialogImpl
*m_impl
;
138 DECLARE_DYNAMIC_CLASS(wxFindReplaceDialog
)
141 // ----------------------------------------------------------------------------
142 // wxFindReplaceDialog events
143 // ----------------------------------------------------------------------------
145 class WXDLLEXPORT wxFindDialogEvent
: public wxCommandEvent
148 wxFindDialogEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0)
149 : wxCommandEvent(commandType
, id
) { }
151 int GetFlags() const { return GetInt(); }
152 wxString
GetFindString() const { return GetString(); }
153 const wxString
& GetReplaceString() const { return m_strReplace
; }
155 // implementation only
156 void SetFlags(int flags
) { SetInt(flags
); }
157 void SetFindString(const wxString
& str
) { SetString(str
); }
158 void SetReplaceString(const wxString
& str
) { m_strReplace
= str
; }
161 wxString m_strReplace
;
163 DECLARE_DYNAMIC_CLASS(wxFindDialogEvent
)
166 BEGIN_DECLARE_EVENT_TYPES()
167 DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_NEXT
, 510)
168 DECLARE_EVENT_TYPE(wxEVT_COMMAND_REPLACE
, 511)
169 DECLARE_EVENT_TYPE(wxEVT_COMMAND_REPLACE_ALL
, 512)
170 DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_CLOSE
, 513)
171 END_DECLARE_EVENT_TYPES()
173 typedef void (wxEvtHandler::*wxFindDialogEventFunction
)(wxFindDialogEvent
&);
175 #define EVT_FIND_NEXT(id, fn) \
176 DECLARE_EVENT_TABLE_ENTRY( \
177 wxEVT_COMMAND_FIND_NEXT, id, -1, \
178 (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
183 #define EVT_REPLACE(id, fn) \
184 DECLARE_EVENT_TABLE_ENTRY( \
185 wxEVT_COMMAND_REPLACE, id, -1, \
186 (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
191 #define EVT_FIND_REPLACE_ALL(id, fn) \
192 DECLARE_EVENT_TABLE_ENTRY( \
193 wxEVT_COMMAND_REPLACE_ALL, id, -1, \
194 (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
199 #define EVT_FIND_FIND_CLOSE(id, fn) \
200 DECLARE_EVENT_TABLE_ENTRY( \
201 wxEVT_COMMAND_FIND_CLOSE, id, -1, \
202 (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
207 #endif // wxUSE_FINDREPLDLG