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 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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
) &&
78 (event
.GetEventType() == wxEVT_COMMAND_FIND_REPLACE
||
79 event
.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL
) )
81 m_FindReplaceData
->m_ReplaceWith
= event
.GetReplaceString();
84 // translate wxEVT_COMMAND_FIND_NEXT to wxEVT_COMMAND_FIND if needed
85 if ( event
.GetEventType() == wxEVT_COMMAND_FIND_NEXT
)
87 if ( m_FindReplaceData
->m_FindWhat
!= m_lastSearch
)
89 event
.SetEventType(wxEVT_COMMAND_FIND
);
91 m_lastSearch
= m_FindReplaceData
->m_FindWhat
;
95 if ( !GetEventHandler()->ProcessEvent(event
) )
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
);
105 #endif // wxUSE_FINDREPLDLG