diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2021-12-27 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2022-03-18 15:35:13 +0500 |
commit | f19f813537c7aea1c20749c914e756b54a9c3cf5 (patch) | |
tree | 816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /CPP/Windows/Shell.h | |
parent | 98e06a519b63b81986abe76d28887f6984a7732b (diff) | |
download | 7zip-21.07.tar.gz 7zip-21.07.tar.bz2 7zip-21.07.zip |
'21.07'21.07
Diffstat (limited to 'CPP/Windows/Shell.h')
-rw-r--r-- | CPP/Windows/Shell.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/CPP/Windows/Shell.h b/CPP/Windows/Shell.h new file mode 100644 index 0000000..de91d3f --- /dev/null +++ b/CPP/Windows/Shell.h | |||
@@ -0,0 +1,94 @@ | |||
1 | // Windows/Shell.h | ||
2 | |||
3 | #ifndef __WINDOWS_SHELL_H | ||
4 | #define __WINDOWS_SHELL_H | ||
5 | |||
6 | #include "../Common/MyWindows.h" | ||
7 | #include <ShlObj.h> | ||
8 | |||
9 | #include "../Common/MyString.h" | ||
10 | |||
11 | #include "Defs.h" | ||
12 | |||
13 | namespace NWindows{ | ||
14 | namespace NShell{ | ||
15 | |||
16 | ///////////////////////// | ||
17 | // CItemIDList | ||
18 | #ifndef UNDER_CE | ||
19 | |||
20 | class CItemIDList | ||
21 | { | ||
22 | LPITEMIDLIST m_Object; | ||
23 | public: | ||
24 | CItemIDList(): m_Object(NULL) {} | ||
25 | // CItemIDList(LPCITEMIDLIST itemIDList); | ||
26 | // CItemIDList(const CItemIDList& itemIDList); | ||
27 | ~CItemIDList() { Free(); } | ||
28 | void Free(); | ||
29 | void Attach(LPITEMIDLIST object) | ||
30 | { | ||
31 | Free(); | ||
32 | m_Object = object; | ||
33 | } | ||
34 | LPITEMIDLIST Detach() | ||
35 | { | ||
36 | LPITEMIDLIST object = m_Object; | ||
37 | m_Object = NULL; | ||
38 | return object; | ||
39 | } | ||
40 | operator LPITEMIDLIST() { return m_Object;} | ||
41 | operator LPCITEMIDLIST() const { return m_Object;} | ||
42 | LPITEMIDLIST* operator&() { return &m_Object; } | ||
43 | LPITEMIDLIST operator->() { return m_Object; } | ||
44 | |||
45 | // CItemIDList& operator=(LPCITEMIDLIST object); | ||
46 | // CItemIDList& operator=(const CItemIDList &object); | ||
47 | }; | ||
48 | |||
49 | ///////////////////////////// | ||
50 | // CDrop | ||
51 | |||
52 | class CDrop | ||
53 | { | ||
54 | HDROP m_Object; | ||
55 | bool m_MustBeFinished; | ||
56 | bool m_Assigned; | ||
57 | void Free(); | ||
58 | public: | ||
59 | CDrop(bool mustBeFinished) : m_MustBeFinished(mustBeFinished), m_Assigned(false) {} | ||
60 | ~CDrop() { Free(); } | ||
61 | |||
62 | void Attach(HDROP object); | ||
63 | operator HDROP() { return m_Object;} | ||
64 | bool QueryPoint(LPPOINT point) | ||
65 | { return BOOLToBool(::DragQueryPoint(m_Object, point)); } | ||
66 | void Finish() { ::DragFinish(m_Object); } | ||
67 | UINT QueryFile(UINT fileIndex, LPTSTR fileName, UINT fileNameSize) | ||
68 | { return ::DragQueryFile(m_Object, fileIndex, fileName, fileNameSize); } | ||
69 | #ifndef _UNICODE | ||
70 | UINT QueryFile(UINT fileIndex, LPWSTR fileName, UINT fileNameSize) | ||
71 | { return ::DragQueryFileW(m_Object, fileIndex, fileName, fileNameSize); } | ||
72 | #endif | ||
73 | UINT QueryCountOfFiles(); | ||
74 | UString QueryFileName(UINT fileIndex); | ||
75 | void QueryFileNames(UStringVector &fileNames); | ||
76 | }; | ||
77 | |||
78 | #endif | ||
79 | |||
80 | ///////////////////////////// | ||
81 | // Functions | ||
82 | |||
83 | bool GetPathFromIDList(LPCITEMIDLIST itemIDList, CSysString &path); | ||
84 | bool BrowseForFolder(LPBROWSEINFO lpbi, CSysString &resultPath); | ||
85 | bool BrowseForFolder(HWND owner, LPCTSTR title, LPCTSTR initialFolder, CSysString &resultPath); | ||
86 | |||
87 | #ifndef _UNICODE | ||
88 | bool GetPathFromIDList(LPCITEMIDLIST itemIDList, UString &path); | ||
89 | bool BrowseForFolder(LPBROWSEINFO lpbi, UString &resultPath); | ||
90 | bool BrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR initialFolder, UString &resultPath); | ||
91 | #endif | ||
92 | }} | ||
93 | |||
94 | #endif | ||