2 * Copyright 2003 Martin Fuchs
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 // Martin Fuchs, 23.07.2003
29 /// management of file types
35 struct FileTypeManager
: public map
<String
, FileTypeInfo
>
37 typedef map
<String
, FileTypeInfo
> super
;
39 const FileTypeInfo
& operator[](String ext
);
81 Icon(ICON_ID id
, UINT nid
);
82 Icon(ICON_TYPE itype
, int id
, HICON hIcon
);
88 const Icon
& extract(IExtractIcon
* pExtract
, LPCTSTR path
, int idx
);
89 const Icon
& extract_from_file(LPCTSTR path
, int idx
);
91 const Icon
& add(HICON hIcon
);
92 const Icon
& add_cached(HICON hIcon
, LPCTSTR path
, int idx
);
94 const Icon
& get_icon(int icon_id
);
95 HBITMAP
get_icon_bitmap(int icon_id
, HBRUSH hbrBkgnd
, HDC hdc
);
97 void free_icon(int icon_id
);
100 typedef map
<int, Icon
> IconMap
;
102 typedef pair
<String
, int> CachePair
;
103 typedef map
<CachePair
, ICON_ID
> CacheMap
;
105 static int s_next_id
;
112 /// create a bitmap from an icon
113 extern HBITMAP
create_bitmap_from_icon(HICON hIcon
, HBRUSH hbrush_bkgnd
, HDC hdc_wnd
);
116 /// structure containing global variables of Explorer
117 extern struct ExplorerGlobals
121 void init(HINSTANCE hInstance
);
123 HINSTANCE _hInstance
;
132 #ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
133 DWORD(STDAPICALLTYPE
* _SHRestricted
)(RESTRICTIONS
);
136 FileTypeManager _ftype_mgr
;
137 IconCache _icon_cache
;
141 /// convenient loading of string resources
142 struct ResString
: public String
147 /// convenient loading of standard (32x32) icon resources
152 operator HICON() const {return _hIcon
;}
158 /// convenient loading of small (16x16) icon resources
163 operator HICON() const {return _hIcon
;}
169 /// convenient loading of icon resources with specified sizes
172 ResIconEx(UINT nid
, int w
, int h
);
174 operator HICON() const {return _hIcon
;}
180 /// set big and small icons out of the resources for a window
181 extern void SetWindowIcon(HWND hwnd
, UINT nid
);
183 /// convenient loading of bitmap resources
187 ~ResBitmap() {DeleteObject(_hBmp
);}
189 operator HBITMAP() const {return _hBmp
;}