summaryrefslogtreecommitdiff
path: root/NSCmpts/SourceProp.h
blob: 9e3aa46df4c673e9a6e57b21aa9ee9591dc096ff (plain)
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
74
75
76
77
78
79
80
// SourceProp.h : Declaration of the CSourceProp

#ifndef __SOURCEPROP_H_
#define __SOURCEPROP_H_

#include "resource.h"       // main symbols

#include "../common/cmptdata.h"

#include <atlctrls.h>
#include <mystring.h>
#include <sysimglist.h>
#include <shlobj.h>
#include <atlextra.h>


/////////////////////////////////////////////////////////////////////////////
// CSourceProp: Base functionality for Night Sec File List Property Pages
// With dragdrop, browse etc...

class ATL_NO_VTABLE CSourceProp :
//	public CDialogImpl<CSourceProp>,
	public CDialogImplEx,
	public IDropTarget
{
public:
	CSourceProp() : CDialogImplEx(IDD_SOURCE) {}

	enum { IDD = IDD_SOURCE };

BEGIN_MSG_MAP(CSourceProp)
	MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
	MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
	MESSAGE_HANDLER(WM_SHOWWINDOW, OnShowWindow)
	NOTIFY_HANDLER(IDC_SOURCE_LIST, LVN_ENDLABELEDIT, OnEndLabelEdit)
	NOTIFY_HANDLER(IDC_SOURCE_LIST, NM_SETFOCUS, OnListSetFocus)
	NOTIFY_HANDLER(IDC_SOURCE_LIST, LVN_KEYDOWN, OnKeyDown)
	NOTIFY_HANDLER(IDC_SOURCE_LIST, LVN_ITEMCHANGED, OnChange)
	NOTIFY_HANDLER(IDC_SOURCE_LIST, LVN_INSERTITEM, OnChange)
	NOTIFY_HANDLER(IDC_SOURCE_LIST, LVN_DELETEITEM, OnChange)
	COMMAND_ID_HANDLER(IDC_ADD, OnAdd)
	COMMAND_ID_HANDLER(IDC_REMOVE, OnRemove)
END_MSG_MAP()

// Handler prototypes:
//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnEndLabelEdit(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnListSetFocus(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnKeyDown(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);


	bool AddFile(string sFileName);

protected:
	CSysImageList	m_imgList;
	CListViewCtrl	m_ctlList;
	string_array m_aPaths;

	void UpdateData(bool bSave = true);

// IDropTarget
public:
	STDMETHOD(DragEnter)(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
	STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
		{ return S_OK; }
	STDMETHOD(DragLeave)(void)
		{ return S_OK; }
	STDMETHOD(Drop)(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
};

#endif //__SOURCEPROP_H_