]> git.saurik.com Git - wxWidgets.git/blame - src/common/fddlgcmn.cpp
Return NULL from wxWindow::GetCapture() when the capture is being lost.
[wxWidgets.git] / src / common / fddlgcmn.cpp
CommitLineData
8db37e06 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/common/fddlgcmn.cpp
8db37e06
VZ
3// Purpose: common parts of wxFindReplaceDialog implementations
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 01.08.01
8db37e06 7// Copyright: (c) 2001 Vadim Zeitlin
65571936 8// Licence: wxWindows licence
8db37e06
VZ
9/////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
8db37e06
VZ
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
37IMPLEMENT_DYNAMIC_CLASS(wxFindDialogEvent, wxCommandEvent)
38
ce7fe42e
VZ
39wxDEFINE_EVENT( wxEVT_FIND, wxFindDialogEvent );
40wxDEFINE_EVENT( wxEVT_FIND_NEXT, wxFindDialogEvent );
41wxDEFINE_EVENT( wxEVT_FIND_REPLACE, wxFindDialogEvent );
42wxDEFINE_EVENT( wxEVT_FIND_REPLACE_ALL, wxFindDialogEvent );
43wxDEFINE_EVENT( wxEVT_FIND_CLOSE, wxFindDialogEvent );
8db37e06
VZ
44
45// ============================================================================
46// implementations
47// ============================================================================
48
49// ----------------------------------------------------------------------------
50// wxFindReplaceData
51// ----------------------------------------------------------------------------
52
53void wxFindReplaceData::Init()
54{
55 m_Flags = 0;
56}
57
58// ----------------------------------------------------------------------------
59// wxFindReplaceDialogBase
60// ----------------------------------------------------------------------------
61
62wxFindReplaceDialogBase::~wxFindReplaceDialogBase()
63{
64}
65
66void 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();
a62848fd 72 if ( HasFlag(wxFR_REPLACEDIALOG) &&
ce7fe42e
VZ
73 (event.GetEventType() == wxEVT_FIND_REPLACE ||
74 event.GetEventType() == wxEVT_FIND_REPLACE_ALL) )
8db37e06
VZ
75 {
76 m_FindReplaceData->m_ReplaceWith = event.GetReplaceString();
77 }
78
ce7fe42e
VZ
79 // translate wxEVT_FIND_NEXT to wxEVT_FIND if needed
80 if ( event.GetEventType() == wxEVT_FIND_NEXT )
8db37e06
VZ
81 {
82 if ( m_FindReplaceData->m_FindWhat != m_lastSearch )
83 {
ce7fe42e 84 event.SetEventType(wxEVT_FIND);
8db37e06
VZ
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