xref: /aosp_15_r20/external/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1 // SysIconUtils.h
2 
3 #ifndef ZIP7_INC_SYS_ICON_UTILS_H
4 #define ZIP7_INC_SYS_ICON_UTILS_H
5 
6 #include "../../../Common/MyWindows.h"
7 
8 #include <CommCtrl.h>
9 
10 #include "../../../Common/MyString.h"
11 
12 struct CExtIconPair
13 {
14   UString Ext;
15   int IconIndex;
16   // UString TypeName;
17   // int Compare(const CExtIconPair &a) const { return MyStringCompareNoCase(Ext, a.Ext); }
18 };
19 
20 struct CAttribIconPair
21 {
22   DWORD Attrib;
23   int IconIndex;
24   // UString TypeName;
25   // int Compare(const CAttribIconPair &a) const { return Ext.Compare(a.Ext); }
26 };
27 
28 
29 struct CExtToIconMap
30 {
31   CRecordVector<CAttribIconPair> _attribMap;
32   CObjectVector<CExtIconPair> _extMap_Normal;
33   CObjectVector<CExtIconPair> _extMap_Compressed;
34   int SplitIconIndex;
35   int SplitIconIndex_Defined;
36 
CExtToIconMapCExtToIconMap37   CExtToIconMap(): SplitIconIndex_Defined(false) {}
38 
ClearCExtToIconMap39   void Clear()
40   {
41     SplitIconIndex_Defined = false;
42     _extMap_Normal.Clear();
43     _extMap_Compressed.Clear();
44     _attribMap.Clear();
45   }
46   int GetIconIndex_DIR(DWORD attrib = FILE_ATTRIBUTE_DIRECTORY)
47   {
48     return GetIconIndex(attrib, L"__DIR__");
49   }
50   int GetIconIndex(DWORD attrib, const wchar_t *fileName /* , UString *typeName */);
51 };
52 
53 extern CExtToIconMap g_Ext_to_Icon_Map;
54 
55 DWORD_PTR Shell_GetFileInfo_SysIconIndex_for_Path_attrib_iconIndexRef(
56     CFSTR path, DWORD attrib, int &iconIndex);
57 HRESULT Shell_GetFileInfo_SysIconIndex_for_Path_return_HRESULT(
58     CFSTR path, DWORD attrib, Int32 *iconIndex);
59 int Shell_GetFileInfo_SysIconIndex_for_Path(CFSTR path, DWORD attrib);
60 
61 int Shell_GetFileInfo_SysIconIndex_for_CSIDL(int csidl);
62 
63 HIMAGELIST Shell_Get_SysImageList_smallIcons(bool smallIcons);
64 
65 #endif
66