]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/common/fdrepdlg.cpp | |
3 | // Purpose: common parts of wxFindReplaceDialog implementations | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 01.08.01 | |
7 | // RCS-ID: | |
8 | // Copyright: (c) 2001 Vadim Zeitlin | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | #ifdef __GNUG__ | |
21 | #pragma implementation "fdrepdlg.h" | |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #if wxUSE_FINDREPLDLG | |
32 | ||
33 | #ifndef WX_PRECOMP | |
34 | #endif | |
35 | ||
36 | #include "wx/fdrepdlg.h" | |
37 | ||
38 | // ---------------------------------------------------------------------------- | |
39 | // wxWin macros | |
40 | // ---------------------------------------------------------------------------- | |
41 | ||
42 | IMPLEMENT_DYNAMIC_CLASS(wxFindDialogEvent, wxCommandEvent) | |
43 | ||
44 | DEFINE_EVENT_TYPE(wxEVT_COMMAND_FIND) | |
45 | DEFINE_EVENT_TYPE(wxEVT_COMMAND_FIND_NEXT) | |
46 | DEFINE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE) | |
47 | DEFINE_EVENT_TYPE(wxEVT_COMMAND_FIND_REPLACE_ALL) | |
48 | DEFINE_EVENT_TYPE(wxEVT_COMMAND_FIND_CLOSE) | |
49 | ||
50 | // ============================================================================ | |
51 | // implementations | |
52 | // ============================================================================ | |
53 | ||
54 | // ---------------------------------------------------------------------------- | |
55 | // wxFindReplaceData | |
56 | // ---------------------------------------------------------------------------- | |
57 | ||
58 | void wxFindReplaceData::Init() | |
59 | { | |
60 | m_Flags = 0; | |
61 | } | |
62 | ||
63 | // ---------------------------------------------------------------------------- | |
64 | // wxFindReplaceDialogBase | |
65 | // ---------------------------------------------------------------------------- | |
66 | ||
67 | wxFindReplaceDialogBase::~wxFindReplaceDialogBase() | |
68 | { | |
69 | } | |
70 | ||
71 | void wxFindReplaceDialogBase::Send(wxFindDialogEvent& event) | |
72 | { | |
73 | // we copy the data to dialog->GetData() as well | |
74 | ||
75 | m_FindReplaceData->m_Flags = event.GetFlags(); | |
76 | m_FindReplaceData->m_FindWhat = event.GetFindString(); | |
77 | if ( HasFlag(wxFR_REPLACEDIALOG) && | |
78 | (event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE || | |
79 | event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL) ) | |
80 | { | |
81 | m_FindReplaceData->m_ReplaceWith = event.GetReplaceString(); | |
82 | } | |
83 | ||
84 | // translate wxEVT_COMMAND_FIND_NEXT to wxEVT_COMMAND_FIND if needed | |
85 | if ( event.GetEventType() == wxEVT_COMMAND_FIND_NEXT ) | |
86 | { | |
87 | if ( m_FindReplaceData->m_FindWhat != m_lastSearch ) | |
88 | { | |
89 | event.SetEventType(wxEVT_COMMAND_FIND); | |
90 | ||
91 | m_lastSearch = m_FindReplaceData->m_FindWhat; | |
92 | } | |
93 | } | |
94 | ||
95 | if ( !GetEventHandler()->ProcessEvent(event) ) | |
96 | { | |
97 | // the event is not propagated upwards to the parent automatically | |
98 | // because the dialog is a top level window, so do it manually as | |
99 | // in 9 cases of 10 the message must be processed by the dialog | |
100 | // owner and not the dialog itself | |
101 | (void)GetParent()->GetEventHandler()->ProcessEvent(event); | |
102 | } | |
103 | } | |
104 | ||
105 | #endif // wxUSE_FINDREPLDLG | |
106 |