1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/fdrepdlg.cpp
3 // Purpose: common parts of wxFindReplaceDialog implementations
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2001 Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "fdrepdlg.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
36 #include "wx/fdrepdlg.h"
38 // ----------------------------------------------------------------------------
40 // ----------------------------------------------------------------------------
42 IMPLEMENT_DYNAMIC_CLASS(wxFindDialogEvent
, wxCommandEvent
)
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
)
50 // ============================================================================
52 // ============================================================================
54 // ----------------------------------------------------------------------------
56 // ----------------------------------------------------------------------------
58 void wxFindReplaceData::Init()
63 // ----------------------------------------------------------------------------
64 // wxFindReplaceDialogBase
65 // ----------------------------------------------------------------------------
67 wxFindReplaceDialogBase::~wxFindReplaceDialogBase()
71 void wxFindReplaceDialogBase::Send(wxFindDialogEvent
& event
)
73 // we copy the data to dialog->GetData() as well
75 m_FindReplaceData
->m_Flags
= event
.GetFlags();
76 m_FindReplaceData
->m_FindWhat
= event
.GetFindString();
77 if ( HasFlag(wxFR_REPLACEDIALOG
) )
79 m_FindReplaceData
->m_ReplaceWith
= event
.GetReplaceString();
82 // translate wxEVT_COMMAND_FIND_NEXT to wxEVT_COMMAND_FIND if needed
83 if ( event
.GetEventType() == wxEVT_COMMAND_FIND_NEXT
)
85 if ( m_FindReplaceData
->m_FindWhat
!= m_lastSearch
)
87 event
.SetEventType(wxEVT_COMMAND_FIND
);
89 m_lastSearch
= m_FindReplaceData
->m_FindWhat
;
93 if ( !GetEventHandler()->ProcessEvent(event
) )
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
);
103 #endif // wxUSE_FINDREPLDLG