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