1cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky// SysIconUtils.h
2cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
3cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky#ifndef __SYS_ICON_UTILS_H
4cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky#define __SYS_ICON_UTILS_H
5cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
6f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka#include "../../../Common/MyWindows.h"
7f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka
8f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka#include <commctrl.h>
9f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka
10cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky#include "../../../Common/MyString.h"
11cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
12cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbeckystruct CExtIconPair
13cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky{
14cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  UString Ext;
15cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int IconIndex;
16cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  // UString TypeName;
17cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
18cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  // int Compare(const CExtIconPair &a) const { return MyStringCompareNoCase(Ext, a.Ext); }
19cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky};
20cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
21cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbeckystruct CAttribIconPair
22cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky{
23cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  DWORD Attrib;
24cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int IconIndex;
25cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  // UString TypeName;
26cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
27cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  // int Compare(const CAttribIconPair &a) const { return Ext.Compare(a.Ext); }
28cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky};
29cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
30cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbeckyclass CExtToIconMap
31cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky{
32cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbeckypublic:
33cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  CRecordVector<CAttribIconPair> _attribMap;
34cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  CObjectVector<CExtIconPair> _extMap;
35cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int SplitIconIndex;
36cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int SplitIconIndex_Defined;
37cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
38cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  CExtToIconMap(): SplitIconIndex_Defined(false) {}
39cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
40cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  void Clear()
41cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  {
42cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky    SplitIconIndex_Defined = false;
43cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky    _extMap.Clear();
44cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky    _attribMap.Clear();
45cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  }
46cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  int GetIconIndex(DWORD attrib, const wchar_t *fileName /* , UString *typeName */);
47cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  // int GetIconIndex(DWORD attrib, const UString &fileName);
48cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky};
49cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
50cd66d540cead3f8200b0c73bad9c276d67896c3dDavid SrbeckyDWORD_PTR GetRealIconIndex(CFSTR path, DWORD attrib, int &iconIndex);
51cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbeckyint GetIconIndexForCSIDL(int csidl);
52cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
53cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbeckyinline HIMAGELIST GetSysImageList(bool smallIcons)
54cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky{
55cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  SHFILEINFO shellInfo;
56cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  return (HIMAGELIST)SHGetFileInfo(TEXT(""),
57cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky      FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY,
58cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky      &shellInfo, sizeof(shellInfo),
59cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky      SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | (smallIcons ? SHGFI_SMALLICON : SHGFI_ICON));
60cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky}
61cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
62cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky#endif
63