]> git.saurik.com Git - wxWidgets.git/blob - src/common/fddlgcmn.cpp
Misc validity fixes to samples/xrc/rc/*.xrc.
[wxWidgets.git] / src / common / fddlgcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/fddlgcmn.cpp
3 // Purpose: common parts of wxFindReplaceDialog implementations
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 01.08.01
7 // Copyright: (c) 2001 Vadim Zeitlin
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #if wxUSE_FINDREPLDLG
27
28 #ifndef WX_PRECOMP
29 #endif
30
31 #include "wx/fdrepdlg.h"
32
33 // ----------------------------------------------------------------------------
34 // wxWin macros
35 // ----------------------------------------------------------------------------
36
37 IMPLEMENT_DYNAMIC_CLASS(wxFindDialogEvent, wxCommandEvent)
38
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 );
44
45 // ============================================================================
46 // implementations
47 // ============================================================================
48
49 // ----------------------------------------------------------------------------
50 // wxFindReplaceData
51 // ----------------------------------------------------------------------------
52
53 void wxFindReplaceData::Init()
54 {
55 m_Flags = 0;
56 }
57
58 // ----------------------------------------------------------------------------
59 // wxFindReplaceDialogBase
60 // ----------------------------------------------------------------------------
61
62 wxFindReplaceDialogBase::~wxFindReplaceDialogBase()
63 {
64 }
65
66 void wxFindReplaceDialogBase::Send(wxFindDialogEvent& event)
67 {
68 // we copy the data to dialog->GetData() as well
69
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) )
75 {
76 m_FindReplaceData->m_ReplaceWith = event.GetReplaceString();
77 }
78
79 // translate wxEVT_FIND_NEXT to wxEVT_FIND if needed
80 if ( event.GetEventType() == wxEVT_FIND_NEXT )
81 {
82 if ( m_FindReplaceData->m_FindWhat != m_lastSearch )
83 {
84 event.SetEventType(wxEVT_FIND);
85
86 m_lastSearch = m_FindReplaceData->m_FindWhat;
87 }
88 }
89
90 if ( !GetEventHandler()->ProcessEvent(event) )
91 {
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);
97 }
98 }
99
100 #endif // wxUSE_FINDREPLDLG
101