]>
git.saurik.com Git - wxWidgets.git/blob - src/common/fddlgcmn.cpp
210d36e6d1739998794ce16984cadcc0b4761ef9
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/fddlgcmn.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 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
32 #include "wx/fdrepdlg.h"
34 // ----------------------------------------------------------------------------
36 // ----------------------------------------------------------------------------
38 IMPLEMENT_DYNAMIC_CLASS(wxFindDialogEvent
, wxCommandEvent
)
40 wxDEFINE_EVENT( wxEVT_FIND
, wxFindDialogEvent
);
41 wxDEFINE_EVENT( wxEVT_FIND_NEXT
, wxFindDialogEvent
);
42 wxDEFINE_EVENT( wxEVT_FIND_REPLACE
, wxFindDialogEvent
);
43 wxDEFINE_EVENT( wxEVT_FIND_REPLACE_ALL
, wxFindDialogEvent
);
44 wxDEFINE_EVENT( wxEVT_FIND_CLOSE
, wxFindDialogEvent
);
46 // ============================================================================
48 // ============================================================================
50 // ----------------------------------------------------------------------------
52 // ----------------------------------------------------------------------------
54 void wxFindReplaceData::Init()
59 // ----------------------------------------------------------------------------
60 // wxFindReplaceDialogBase
61 // ----------------------------------------------------------------------------
63 wxFindReplaceDialogBase::~wxFindReplaceDialogBase()
67 void wxFindReplaceDialogBase::Send(wxFindDialogEvent
& event
)
69 // we copy the data to dialog->GetData() as well
71 m_FindReplaceData
->m_Flags
= event
.GetFlags();
72 m_FindReplaceData
->m_FindWhat
= event
.GetFindString();
73 if ( HasFlag(wxFR_REPLACEDIALOG
) &&
74 (event
.GetEventType() == wxEVT_FIND_REPLACE
||
75 event
.GetEventType() == wxEVT_FIND_REPLACE_ALL
) )
77 m_FindReplaceData
->m_ReplaceWith
= event
.GetReplaceString();
80 // translate wxEVT_FIND_NEXT to wxEVT_FIND if needed
81 if ( event
.GetEventType() == wxEVT_FIND_NEXT
)
83 if ( m_FindReplaceData
->m_FindWhat
!= m_lastSearch
)
85 event
.SetEventType(wxEVT_FIND
);
87 m_lastSearch
= m_FindReplaceData
->m_FindWhat
;
91 if ( !GetEventHandler()->ProcessEvent(event
) )
93 // the event is not propagated upwards to the parent automatically
94 // because the dialog is a top level window, so do it manually as
95 // in 9 cases of 10 the message must be processed by the dialog
96 // owner and not the dialog itself
97 (void)GetParent()->GetEventHandler()->ProcessEvent(event
);
101 #endif // wxUSE_FINDREPLDLG