Statistics
| Revision:

root / trunk / install / launcher / izpack-launcher-1.3_linux / src / wx / include / wx / fdrepdlg.h @ 6834

History | View | Annotate | Download (6.48 KB)

1
/////////////////////////////////////////////////////////////////////////////
2
// Name:        wx/fdrepdlg.h
3
// Purpose:     wxFindReplaceDialog class
4
// Author:      Markus Greither and Vadim Zeitlin
5
// Modified by:
6
// Created:     23/03/2001
7
// RCS-ID:
8
// Copyright:   (c) Markus Greither
9
// Licence:     wxWindows licence
10
/////////////////////////////////////////////////////////////////////////////
11

    
12
#ifndef _WX_FINDREPLACEDLG_H_
13
#define _WX_FINDREPLACEDLG_H_
14

    
15
#include "wx/defs.h"
16

    
17
#if wxUSE_FINDREPLDLG
18

    
19
#include "wx/dialog.h"
20

    
21
class WXDLLEXPORT wxFindDialogEvent;
22
class WXDLLEXPORT wxFindReplaceDialog;
23
class WXDLLEXPORT wxFindReplaceData;
24
class WXDLLEXPORT wxFindReplaceDialogImpl;
25

    
26
// ----------------------------------------------------------------------------
27
// Flags for wxFindReplaceData.Flags
28
// ----------------------------------------------------------------------------
29

    
30
// flages used by wxFindDialogEvent::GetFlags()
31
enum wxFindReplaceFlags
32
{
33
    // downward search/replace selected (otherwise - upwards)
34
    wxFR_DOWN       = 1,
35

    
36
    // whole word search/replace selected
37
    wxFR_WHOLEWORD  = 2,
38

    
39
    // case sensitive search/replace selected (otherwise - case insensitive)
40
    wxFR_MATCHCASE  = 4
41
};
42

    
43
// these flags can be specified in wxFindReplaceDialog ctor or Create()
44
enum wxFindReplaceDialogStyles
45
{
46
    // replace dialog (otherwise find dialog)
47
    wxFR_REPLACEDIALOG = 1,
48

    
49
    // don't allow changing the search direction
50
    wxFR_NOUPDOWN      = 2,
51

    
52
    // don't allow case sensitive searching
53
    wxFR_NOMATCHCASE   = 4,
54

    
55
    // don't allow whole word searching
56
    wxFR_NOWHOLEWORD   = 8
57
};
58

    
59
// ----------------------------------------------------------------------------
60
// wxFindReplaceData: holds Setup Data/Feedback Data for wxFindReplaceDialog
61
// ----------------------------------------------------------------------------
62

    
63
class WXDLLEXPORT wxFindReplaceData : public wxObject
64
{
65
public:
66
    wxFindReplaceData() { Init(); }
67
    wxFindReplaceData(wxUint32 flags) { Init(); SetFlags(flags); }
68

    
69
    // accessors
70
    const wxString& GetFindString() { return m_FindWhat; }
71
    const wxString& GetReplaceString() { return m_ReplaceWith; }
72

    
73
    int GetFlags() const { return m_Flags; }
74

    
75
    // setters: may only be called before showing the dialog, no effect later
76
    void SetFlags(wxUint32 flags) { m_Flags = flags; }
77

    
78
    void SetFindString(const wxString& str) { m_FindWhat = str; }
79
    void SetReplaceString(const wxString& str) { m_ReplaceWith = str; }
80

    
81
protected:
82
    void Init();
83

    
84
private:
85
    wxUint32 m_Flags;
86
    wxString m_FindWhat,
87
             m_ReplaceWith;
88

    
89
    friend class wxFindReplaceDialogBase;
90
};
91

    
92
// ----------------------------------------------------------------------------
93
// wxFindReplaceDialogBase
94
// ----------------------------------------------------------------------------
95

    
96
class WXDLLEXPORT wxFindReplaceDialogBase : public wxDialog
97
{
98
public:
99
    // ctors and such
100
    wxFindReplaceDialogBase() { m_FindReplaceData = NULL; }
101
    wxFindReplaceDialogBase(wxWindow * WXUNUSED(parent),
102
                            wxFindReplaceData *data,
103
                            const wxString& WXUNUSED(title),
104
                            int WXUNUSED(style) = 0)
105
    {
106
        m_FindReplaceData = data;
107
    }
108

    
109
    virtual ~wxFindReplaceDialogBase();
110

    
111
    // find dialog data access
112
    const wxFindReplaceData *GetData() const { return m_FindReplaceData; }
113
    void SetData(wxFindReplaceData *data) { m_FindReplaceData = data; }
114

    
115
    // implementation only, don't use
116
    void Send(wxFindDialogEvent& event);
117

    
118
protected:
119
    wxFindReplaceData *m_FindReplaceData;
120

    
121
    // the last string we searched for
122
    wxString m_lastSearch;
123
};
124

    
125
// include wxFindReplaceDialog declaration
126
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
127
    #include "wx/msw/fdrepdlg.h"
128
#else
129
    #define wxGenericFindReplaceDialog wxFindReplaceDialog
130
    #define sm_classwxGenericFindReplaceDialog sm_classwxFindReplaceDialog
131

    
132
    #include "wx/generic/fdrepdlg.h"
133
#endif
134

    
135
// ----------------------------------------------------------------------------
136
// wxFindReplaceDialog events
137
// ----------------------------------------------------------------------------
138

    
139
class WXDLLEXPORT wxFindDialogEvent : public wxCommandEvent
140
{
141
public:
142
    wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
143
        : wxCommandEvent(commandType, id) { }
144

    
145
    int GetFlags() const { return GetInt(); }
146
    wxString GetFindString() const { return GetString(); }
147
    const wxString& GetReplaceString() const { return m_strReplace; }
148

    
149
    wxFindReplaceDialog *GetDialog() const
150
        { return wxStaticCast(GetEventObject(), wxFindReplaceDialog); }
151

    
152
    // implementation only
153
    void SetFlags(int flags) { SetInt(flags); }
154
    void SetFindString(const wxString& str) { SetString(str); }
155
    void SetReplaceString(const wxString& str) { m_strReplace = str; }
156

    
157
private:
158
    wxString m_strReplace;
159

    
160
    DECLARE_DYNAMIC_CLASS(wxFindDialogEvent)
161
};
162

    
163
BEGIN_DECLARE_EVENT_TYPES()
164
    DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND, 510)
165
    DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_NEXT, 511)
166
    DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE, 512)
167
    DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE_ALL, 513)
168
    DECLARE_EVENT_TYPE(wxEVT_COMMAND_FIND_CLOSE, 514)
169
END_DECLARE_EVENT_TYPES()
170

    
171
typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&);
172

    
173
#define EVT_FIND(id, fn) \
174
    DECLARE_EVENT_TABLE_ENTRY( \
175
        wxEVT_COMMAND_FIND, id, -1, \
176
        (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
177
        & fn, \
178
        (wxObject *) NULL \
179
    ),
180

    
181
#define EVT_FIND_NEXT(id, fn) \
182
    DECLARE_EVENT_TABLE_ENTRY( \
183
        wxEVT_COMMAND_FIND_NEXT, id, -1, \
184
        (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
185
        & fn, \
186
        (wxObject *) NULL \
187
    ),
188

    
189
#define EVT_FIND_REPLACE(id, fn) \
190
    DECLARE_EVENT_TABLE_ENTRY( \
191
        wxEVT_COMMAND_FIND_REPLACE, id, -1, \
192
        (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
193
        & fn, \
194
        (wxObject *) NULL \
195
    ),
196

    
197
#define EVT_FIND_REPLACE_ALL(id, fn) \
198
    DECLARE_EVENT_TABLE_ENTRY( \
199
        wxEVT_COMMAND_FIND_REPLACE_ALL, id, -1, \
200
        (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
201
        & fn, \
202
        (wxObject *) NULL \
203
    ),
204

    
205
#define EVT_FIND_CLOSE(id, fn) \
206
    DECLARE_EVENT_TABLE_ENTRY( \
207
        wxEVT_COMMAND_FIND_CLOSE, id, -1, \
208
        (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
209
        & fn, \
210
        (wxObject *) NULL \
211
    ),
212

    
213
#endif // wxUSE_FINDREPLDLG
214

    
215
#endif
216
    // _WX_FDREPDLG_H