]> git.saurik.com Git - wxWidgets.git/blob - src/common/fddlgcmn.cpp
use wxWindows zlib.h instead of Mac OS X system zlib.h directly
[wxWidgets.git] / src / common / fddlgcmn.cpp
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 {
79 m_FindReplaceData->m_ReplaceWith = event.GetReplaceString();
80 }
81
82 // translate wxEVT_COMMAND_FIND_NEXT to wxEVT_COMMAND_FIND if needed
83 if ( event.GetEventType() == wxEVT_COMMAND_FIND_NEXT )
84 {
85 if ( m_FindReplaceData->m_FindWhat != m_lastSearch )
86 {
87 event.SetEventType(wxEVT_COMMAND_FIND);
88
89 m_lastSearch = m_FindReplaceData->m_FindWhat;
90 }
91 }
92
93 if ( !GetEventHandler()->ProcessEvent(event) )
94 {
95 // the event is not propagated upwards to the parent automatically
96 // because the dialog is a top level window, so do it manually as
97 // in 9 cases of 10 the message must be processed by the dialog
98 // owner and not the dialog itself
99 (void)GetParent()->GetEventHandler()->ProcessEvent(event);
100 }
101 }
102
103 #endif // wxUSE_FINDREPLDLG
104