forked from soui3-demo/SlogViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindDlg.cpp
57 lines (46 loc) · 1.08 KB
/
FindDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "stdafx.h"
#include "FindDlg.h"
namespace SOUI
{
CFindDlg::CFindDlg(IFindListener *pFindListener)
:SHostWnd(UIRES.LAYOUT.dlg_find)
,m_pFindListener(pFindListener)
{
}
CFindDlg::~CFindDlg(void)
{
}
void CFindDlg::OnFinalMessage(HWND hWnd)
{
__super::OnFinalMessage(hWnd);
delete this;
}
void CFindDlg::OnClose()
{
SNativeWnd::ShowWindow(SW_HIDE);
}
void CFindDlg::OnFindNext()
{
OnFind(true);
}
void CFindDlg::OnFindPrev()
{
OnFind(false);
}
void CFindDlg::OnFind(bool bNext)
{
if(!m_pFindListener) return;
SStringT strText = m_pEditTarget->GetWindowText();
if(strText.IsEmpty()) return;
bool bMatchCase = !!m_pMatchCase->IsChecked();
bool bMatchWholeWord = !!m_pMatchWholeWord->IsChecked();
m_pFindListener->OnFind(strText,bNext,bMatchCase,bMatchWholeWord);
}
void CFindDlg::OnInit(EventArgs *e)
{
m_pEditTarget = FindChildByID2<SEdit>(R.id.edit_search);
m_pMatchCase = FindChildByID2<SCheckBox>(R.id.chk_match_case);
m_pMatchWholeWord = FindChildByID2<SCheckBox>(R.id.chk_match_whole_word);
m_pEditTarget->SetFocus();
}
}