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