]>
git.saurik.com Git - wxWidgets.git/blob - src/common/fddlgcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/fddlgcmn.cpp
3 // Purpose: common parts of wxFindReplaceDialog implementations
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2001 Vadim Zeitlin
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
31 #include "wx/fdrepdlg.h"
33 // ----------------------------------------------------------------------------
35 // ----------------------------------------------------------------------------
37 IMPLEMENT_DYNAMIC_CLASS(wxFindDialogEvent
, wxCommandEvent
)
39 wxDEFINE_EVENT( wxEVT_FIND
, wxFindDialogEvent
);
40 wxDEFINE_EVENT( wxEVT_FIND_NEXT
, wxFindDialogEvent
);
41 wxDEFINE_EVENT( wxEVT_FIND_REPLACE
, wxFindDialogEvent
);
42 wxDEFINE_EVENT( wxEVT_FIND_REPLACE_ALL
, wxFindDialogEvent
);
43 wxDEFINE_EVENT( wxEVT_FIND_CLOSE
, wxFindDialogEvent
);
45 // ============================================================================
47 // ============================================================================
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
53 void wxFindReplaceData::Init()
58 // ----------------------------------------------------------------------------
59 // wxFindReplaceDialogBase
60 // ----------------------------------------------------------------------------
62 wxFindReplaceDialogBase::~wxFindReplaceDialogBase()
66 void wxFindReplaceDialogBase::Send(wxFindDialogEvent
& event
)
68 // we copy the data to dialog->GetData() as well
70 m_FindReplaceData
->m_Flags
= event
.GetFlags();
71 m_FindReplaceData
->m_FindWhat
= event
.GetFindString();
72 if ( HasFlag(wxFR_REPLACEDIALOG
) &&
73 (event
.GetEventType() == wxEVT_FIND_REPLACE
||
74 event
.GetEventType() == wxEVT_FIND_REPLACE_ALL
) )
76 m_FindReplaceData
->m_ReplaceWith
= event
.GetReplaceString();
79 // translate wxEVT_FIND_NEXT to wxEVT_FIND if needed
80 if ( event
.GetEventType() == wxEVT_FIND_NEXT
)
82 if ( m_FindReplaceData
->m_FindWhat
!= m_lastSearch
)
84 event
.SetEventType(wxEVT_FIND
);
86 m_lastSearch
= m_FindReplaceData
->m_FindWhat
;
90 if ( !GetEventHandler()->ProcessEvent(event
) )
92 // the event is not propagated upwards to the parent automatically
93 // because the dialog is a top level window, so do it manually as
94 // in 9 cases of 10 the message must be processed by the dialog
95 // owner and not the dialog itself
96 (void)GetParent()->GetEventHandler()->ProcessEvent(event
);
100 #endif // wxUSE_FINDREPLDLG