forked from hfiggs/WinDV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDropFilesEdit.h
More file actions
89 lines (76 loc) · 3.27 KB
/
Copy pathDropFilesEdit.h
File metadata and controls
89 lines (76 loc) · 3.27 KB
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
81
82
83
84
85
86
87
88
89
#if !defined(AFX_DROPFILESEDIT_H__B0489045_2D71_4D76_B7DC_EE835A73F6F0__INCLUDED_)
#define AFX_DROPFILESEDIT_H__B0489045_2D71_4D76_B7DC_EE835A73F6F0__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DropFilesEdit.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDropFilesEdit
//
// A CEdit subclass that accepts file drag-and-drop (WM_DROPFILES).
//
// When the user drops one or more files onto the control:
// - If m_separator is non-empty, all dropped paths are accepted and joined
// with m_separator into a single string (multi-file mode). This is used
// for the record source file list, where " | " separates paths.
// - If m_separator is empty (NULL was passed to the constructor), only the
// first dropped file is accepted (single-file mode). This is used for the
// capture destination file, where only one output path makes sense.
//
// Each accepted path is optionally passed through the m_filter callback before
// being added to the result. If the callback returns false the file is silently
// skipped. If no filter is provided the built-in NoFilter() stub accepts every
// path unconditionally.
//
// Usage in DVToolsDlg.cpp:
// m_FSRC is constructed with separator " | " and no filter => multi-file
// m_FDST is constructed with no separator and CaptureFilenameExtractBase
// => single-file, strips extension
//
// The parent window must have WS_EX_ACCEPTFILES set (or call DragAcceptFiles(TRUE))
// for WM_DROPFILES to be delivered.
//
class CDropFilesEdit : public CEdit
{
// Construction
public:
/* Constructor.
* multidrop_separator String inserted between paths when multiple files are
* dropped at once. Pass NULL (or omit) to accept only
* the first dropped file.
* filter Optional callback invoked for each dropped path before
* it is appended to the result. The callback receives the
* path by reference and may modify it (e.g. strip the
* extension). Return true to accept, false to skip.
* Defaults to an internal no-op that always returns true.
*/
CDropFilesEdit(LPCSTR multidrop_separator=NULL, bool (*filter)(CString &) = NULL);
// Attributes
public:
// String inserted between multiple dropped file paths.
// Empty when the control is in single-file mode.
CString m_separator;
// Per-file filter/transform callback. Never NULL after construction
// (falls back to the internal NoFilter stub).
bool (*m_filter)(CString &);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDropFilesEdit)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CDropFilesEdit();
// Generated message map functions
protected:
//{{AFX_MSG(CDropFilesEdit)
afx_msg void OnDropFiles(HDROP hDropInfo);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DROPFILESEDIT_H__B0489045_2D71_4D76_B7DC_EE835A73F6F0__INCLUDED_)