forked from svn2github/FDM
-
Notifications
You must be signed in to change notification settings - Fork 4
/
ComboBoxTreeCtrl.cpp
73 lines (56 loc) · 1.73 KB
/
ComboBoxTreeCtrl.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
Free Download Manager Copyright (c) 2003-2016 FreeDownloadManager.ORG
*/
#include "stdafx.h"
#include "FdmApp.h"
#include "ComboBoxTreeCtrl.h"
#include "DownloadsGroupsComboBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CComboBoxTreeCtrl::CComboBoxTreeCtrl()
{
}
CComboBoxTreeCtrl::~CComboBoxTreeCtrl()
{
}
BEGIN_MESSAGE_MAP(CComboBoxTreeCtrl, CTreeCtrl)
//{{AFX_MSG_MAP(CComboBoxTreeCtrl)
ON_WM_KILLFOCUS()
ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
ON_NOTIFY_REFLECT(TVN_KEYDOWN, OnKeydown)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CComboBoxTreeCtrl::OnKillFocus(CWnd* pNewWnd)
{
CTreeCtrl::OnKillFocus(pNewWnd);
if (pNewWnd == NULL || pNewWnd->m_hWnd != m_pCombo->m_hWnd)
m_pCombo->ShowDropDown (FALSE);
}
void CComboBoxTreeCtrl::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
if (IsWindowVisible ())
{
m_pCombo->Tree_UpdateSelection ();
m_pCombo->ShowDropDown (FALSE);
}
*pResult = 0;
}
void CComboBoxTreeCtrl::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult)
{
TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*)pNMHDR;
if (pTVKeyDown->wVKey == VK_ESCAPE && IsWindowVisible ())
m_pCombo->ShowDropDown (FALSE);
*pResult = 0;
}
BOOL CComboBoxTreeCtrl::CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect,
CWnd* pParentWnd, UINT nID, LPVOID lpParam)
{
return CWnd::CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, lpParam);
}
BOOL CComboBoxTreeCtrl::CreateEx(DWORD dwExStyle, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
{
return CTreeCtrl::CreateEx(dwExStyle, dwStyle, rect, pParentWnd, nID);
}